Class DefaultPolicyAspectProcessor
java.lang.Object
com.broadleafcommerce.data.tracking.core.policy.DefaultPolicyAspectProcessor
- All Implemented Interfaces:
PolicyAspectProcessor
- Author:
- Jeff Fischer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PolicyInformationbuildPolicyInformation(IdentityType[] identityTypes, String[] permissionRoots, OperationType[] operationTypes, PermissionMatchingStrategy multipleRootsMatchingStrategy, String ownerIdentifier, int param, int ownerIdentifierParam) protected OperationTypenarrowType(PolicyInformation policy, ContextInfo contextInfo) Figure out the OperationType to use, given the policy and contextInfo.protected voidnotify(PolicyResponse policyResponse) Raise an exception for a failedPolicyResponsevoidsetOverrides(List<PolicyOverride> injected) Validate thePolicyannotated method call
-
Constructor Details
-
DefaultPolicyAspectProcessor
-
-
Method Details
-
setOverrides
-
validate
public Object validate(org.aspectj.lang.ProceedingJoinPoint joinPoint, Object aspect) throws Throwable Description copied from interface:PolicyAspectProcessorValidate thePolicyannotated method call- Specified by:
validatein interfacePolicyAspectProcessor- Parameters:
joinPoint- metadata about the method callaspect- the instance of theAspectannotate class driving this call- Returns:
- the result of the call
- Throws:
Throwable- any exception
-
buildPolicyInformation
protected PolicyInformation buildPolicyInformation(IdentityType[] identityTypes, String[] permissionRoots, OperationType[] operationTypes, PermissionMatchingStrategy multipleRootsMatchingStrategy, String ownerIdentifier, int param, int ownerIdentifierParam) - Parameters:
identityTypes- seePolicy.identityTypes()permissionRoots- seePolicy.permissionRoots()operationTypes- seePolicy.operationTypes()multipleRootsMatchingStrategy- seePolicy.permissionMatchingStrategy()ownerIdentifier- seePolicy.ownerIdentifier()param- seePolicy.param()ownerIdentifierParam-- Returns:
- The constructed, generic policy information at a particular pointcut
-
narrowType
Figure out the OperationType to use, given the policy and contextInfo.- If there is only one operationType described in Policy:
- If it's not UNKNOWN, use it
- If there's not contextInfo, return UNKNOWN
- Otherwise, return the operation type on the contextInfo
- Otherwise, find and use the first match of contextInfo operationType in those defined by Policy, or the first OperationType in the policy defined list if no match is found
- Parameters:
policy- The policy annotation on the method that optionally defines one or more OperationTypescontextInfo- The optional contextInfo that describes an overall operationType for the context of the request- Returns:
- The final OperationType to use for the policy validation
-
notify
Raise an exception for a failedPolicyResponse- Parameters:
policyResponse- Failed response
-