Class DeclarativeCapability

    • Field Detail

      • LOGGER

        protected static final org.apache.commons.logging.Log LOGGER
        Logger
      • permissions

        protected List<String> permissions
        Required permissions
      • conditions

        protected Map<String,​Boolean> conditions
        Map of conditions and expected evaluation result
      • kinds

        protected List<String> kinds
        List of file plan component kinds one of which must be satisfied
      • targetCapability

        protected Capability targetCapability
        Capability to be evaluated against the target node reference
      • isUndetermined

        protected boolean isUndetermined
        Indicates whether to return an undetermined result
    • Constructor Detail

      • DeclarativeCapability

        public DeclarativeCapability()
    • Method Detail

      • setPermissions

        public void setPermissions​(List<String> permissions)
        Parameters:
        permissions - permissions
      • setConditions

        public void setConditions​(Map<String,​Boolean> conditions)
        Parameters:
        conditions - conditions and expected values
      • getConditions

        public Map<String,​Boolean> getConditions()
        Returns:
        Map <String, Boolean > conditions and expected values
      • setKinds

        public void setKinds​(List<String> kinds)
        Parameters:
        kinds - list of file plan component kinds
      • getKinds

        public List<String> getKinds()
        Returns:
        List <@link String > list of expected file plan component kinds
      • setKind

        public void setKind​(String kind)
        Helper method to set a single kind.
        Parameters:
        kind - file plan component kind
      • setUndetermined

        public void setUndetermined​(boolean isUndetermined)
        Sets whether the capability will return an undetermined result when evaluating permissions for a single node reference or not. The default is to return grant.
        Parameters:
        isUndetermined - true if undetermined result, false otherwise
      • isUndetermined

        public boolean isUndetermined()
        Returns:
      • setPermission

        public void setPermission​(String permission)
        Helper @see #setPermissions(List)
        Parameters:
        permission - permission
      • setTargetCapability

        public void setTargetCapability​(Capability targetCapability)
        Parameters:
        targetCapability - target capability
      • checkPermissionsImpl

        protected boolean checkPermissionsImpl​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                               String... permissions)
        Check the permissions passed.
        Parameters:
        nodeRef - node reference
        Returns:
        boolean true if the permissions are present, false otherwise
      • checkPermissions

        protected boolean checkPermissions​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Checks the permissions required for the capability.
        Parameters:
        nodeRef -
        Returns:
      • checkConditions

        protected boolean checkConditions​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                          Map<String,​Boolean> conditions)
        Checks the passed conditions.
        Parameters:
        nodeRef -
        Returns:
      • checkConditions

        protected boolean checkConditions​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Checks the set conditions.
        Parameters:
        nodeRef - node reference
        Returns:
        boolean true if conditions satisfied, false otherwise
      • checkKinds

        protected boolean checkKinds​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Checks that the node ref is of the expected kind
        Parameters:
        nodeRef -
        Returns:
      • evaluateImpl

        protected int evaluateImpl​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Default implementation. Given extending classes a hook point for further checks.
        Parameters:
        nodeRef - node reference
        Returns:
      • onEvaluate

        protected int onEvaluate​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                 int result)
        Default implementation. Called before evaluate completes. The result returned overwrites the already discovered result. Provides a hook point for child implementations that wish to veto the result.
        Parameters:
        nodeRef -
        result -
        Returns: