Interface PolicyService
- All Superinterfaces:
Service
public interface PolicyService extends Service
Service used to read policy values. Policies are defined in the MPT, and can have values at
many different levels, depending on their associated Policy Hierarchy. This service
automatically evaluates the policies, navigating up through the parents of the given model
until it finds a parent which has a value for the policy.
-
Method Summary
Modifier and Type Method Description <T> Pair<T,ModelId>
getFullyQualifiedPolicyValue(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.lang.Long sysId, T defaultValue, PlatformUserContext context)
LikegetPolicyValue(String, ModelLevelType, Long, Object, PlatformUserContext)
, but also returns model information for which policy is defined.<T> T
getPolicyValue(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.lang.Long sysId, T defaultValue, PlatformUserContext context)
Return the policy defined at the given level, if defined.<T> java.util.Map<java.lang.Long,T>
getPolicyValues(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.util.Collection<java.lang.Long> sysIds, T defaultValue, PlatformUserContext context)
LikegetPolicyValue(String, ModelLevelType, Long, Object, PlatformUserContext)
, but for multiple models at once instead of just one.<T> java.util.Map<java.lang.Long,T>
getValidatedPolicyValues(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.util.Collection<java.lang.Long> sysIds, T defaultValue, PlatformUserContext context)
Like#getPolicyValues(String, ModelLevelType, Long, Object, PlatformUserContext)
, but additionally validates all model link values in case they are "orphaned" (i.e.
-
Method Details
-
getPolicyValue
<T> T getPolicyValue(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.lang.Long sysId, T defaultValue, PlatformUserContext context)Return the policy defined at the given level, if defined. If not, navigates through the level's parents (using the Policy's Hiearchy) until it finds a non-null value. If no value is found, returns the defaultValue provided.- Parameters:
fullyQualifiedPolicyName
- full-qualified name of the Policy to fetchmodelLevelType
- level of the given sysIdsysId
- sysId of the entity whose policy value is desireddefaultValue
- value to be returned if no value found on the given entity or its parents
-
getPolicyValues
<T> java.util.Map<java.lang.Long,T> getPolicyValues(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.util.Collection<java.lang.Long> sysIds, T defaultValue, PlatformUserContext context)LikegetPolicyValue(String, ModelLevelType, Long, Object, PlatformUserContext)
, but for multiple models at once instead of just one. -
getValidatedPolicyValues
<T> java.util.Map<java.lang.Long,T> getValidatedPolicyValues(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.util.Collection<java.lang.Long> sysIds, T defaultValue, PlatformUserContext context)Like#getPolicyValues(String, ModelLevelType, Long, Object, PlatformUserContext)
, but additionally validates all model link values in case they are "orphaned" (i.e. references a deleted record). When that occurs, it treats it like a "null" value and continues up the hierarchy, looking for a valid value. -
getFullyQualifiedPolicyValue
<T> Pair<T,ModelId> getFullyQualifiedPolicyValue(java.lang.String fullyQualifiedPolicyName, com.onenetwork.platform.data.model.impl.ModelLevelType modelLevelType, java.lang.Long sysId, T defaultValue, PlatformUserContext context)LikegetPolicyValue(String, ModelLevelType, Long, Object, PlatformUserContext)
, but also returns model information for which policy is defined. In other words, if the existing policy is defined on a parent model, it will return not only the value, but also the details of that specific parent model.
-