Class RMCaveatConfigComponentImpl
- java.lang.Object
-
- org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponentImpl
-
- All Implemented Interfaces:
RMCaveatConfigComponent
,ContentServicePolicies.OnContentUpdatePolicy
,NodeServicePolicies.BeforeDeleteNodePolicy
,NodeServicePolicies.OnCreateNodePolicy
,ClassPolicy
,Policy
public class RMCaveatConfigComponentImpl extends Object implements ContentServicePolicies.OnContentUpdatePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnCreateNodePolicy, RMCaveatConfigComponent
RM Caveat Config component impl- Author:
- janv
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
-
-
Field Summary
-
Fields inherited from interface org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
QNAME
-
-
Constructor Summary
Constructors Constructor Description RMCaveatConfigComponentImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRMConstraint(String listName)
Add RM constraintvoid
addRMConstraintListValue(String listName, String authorityName, String value)
Add a single value to an authority in a list.void
beforeDeleteNode(NodeRef nodeRef)
void
deleteRMConstraint(String listName)
Delete RM ConstraintMap<String,List<String>>
getListDetails(String listName)
Get the member details of the specified listList<String>
getRMAllowedValues(String constraintName)
Get allowed values for given caveat list (for current user)List<QName>
getRMCaveatModels()
Get custom caveat modelsRMConstraintInfo
getRMConstraint(String listName)
Get RM Constraint detail.RMConstraintInfo
getRMConstraint(QName listQName)
Get an RMConstraintInfoCollection<String>
getRMConstraintNames()
boolean
hasAccess(NodeRef nodeRef)
Check whether access to 'record component' node is vetoed for current user due to caveat(s)void
init()
Initialise behaviours and caveat config cachevoid
onContentUpdate(NodeRef nodeRef, boolean newContent)
void
onCreateNode(ChildAssociationRef childAssocRef)
void
removeRMConstraintListAuthority(String listName, String authorityName)
Remove an authority from a listvoid
removeRMConstraintListValue(String listName, String valueName)
Remove RM constraint value (all authorities)void
setAuthorityService(AuthorityService authorityService)
void
setCaveatAspects(List<String> caveatAspectNames)
void
setCaveatConfig(SimpleCache<String,Map<String,List<String>>> caveatConfig)
void
setCaveatModels(List<String> caveatModelNames)
void
setContentService(ContentService contentService)
void
setDictionaryService(DictionaryService dictionaryService)
void
setNamespaceService(NamespaceService namespaceService)
void
setNodeService(NodeService nodeService)
void
setPersonService(PersonService personService)
void
setStoreRef(String storeRef)
NodeRef
updateOrCreateCaveatConfig(File jsonFile)
NodeRef
updateOrCreateCaveatConfig(InputStream is)
NodeRef
updateOrCreateCaveatConfig(String jsonString)
void
updateRMConstraintListAuthority(String listName, String authorityName, List<String> values)
Replace the values for an authority in a list.void
updateRMConstraintListValue(String listName, String valueName, List<String> authorities)
Replace the authorities for a value in a listprotected void
validateAndReset(NodeRef nodeRef)
Validate the caveat config and optionally update the cache.
-
-
-
Method Detail
-
setCaveatConfig
public void setCaveatConfig(SimpleCache<String,Map<String,List<String>>> caveatConfig)
-
setNodeService
public void setNodeService(NodeService nodeService)
-
setContentService
public void setContentService(ContentService contentService)
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
-
setNamespaceService
public void setNamespaceService(NamespaceService namespaceService)
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
-
setPersonService
public void setPersonService(PersonService personService)
-
setStoreRef
public void setStoreRef(String storeRef)
-
init
public void init()
Initialise behaviours and caveat config cache- Specified by:
init
in interfaceRMCaveatConfigComponent
-
onContentUpdate
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
-
beforeDeleteNode
public void beforeDeleteNode(NodeRef nodeRef)
-
onCreateNode
public void onCreateNode(ChildAssociationRef childAssocRef)
-
validateAndReset
protected void validateAndReset(NodeRef nodeRef)
Validate the caveat config and optionally update the cache.- Parameters:
nodeRef
- The nodeRef of the config
-
updateOrCreateCaveatConfig
public NodeRef updateOrCreateCaveatConfig(InputStream is)
- Specified by:
updateOrCreateCaveatConfig
in interfaceRMCaveatConfigComponent
-
updateOrCreateCaveatConfig
public NodeRef updateOrCreateCaveatConfig(File jsonFile)
- Specified by:
updateOrCreateCaveatConfig
in interfaceRMCaveatConfigComponent
-
updateOrCreateCaveatConfig
public NodeRef updateOrCreateCaveatConfig(String jsonString)
- Specified by:
updateOrCreateCaveatConfig
in interfaceRMCaveatConfigComponent
-
getRMConstraintNames
public Collection<String> getRMConstraintNames()
-
getRMAllowedValues
public List<String> getRMAllowedValues(String constraintName)
Description copied from interface:RMCaveatConfigComponent
Get allowed values for given caveat list (for current user)- Specified by:
getRMAllowedValues
in interfaceRMCaveatConfigComponent
- Returns:
-
hasAccess
public boolean hasAccess(NodeRef nodeRef)
Check whether access to 'record component' node is vetoed for current user due to caveat(s)- Specified by:
hasAccess
in interfaceRMCaveatConfigComponent
- Parameters:
nodeRef
-- Returns:
- false, if caveat(s) veto access otherwise return true
-
addRMConstraintListValue
public void addRMConstraintListValue(String listName, String authorityName, String value)
Add a single value to an authority in a list. The existing values of the list remain.- Specified by:
addRMConstraintListValue
in interfaceRMCaveatConfigComponent
- Parameters:
listName
- the name of the RMConstraintListauthorityName
-value
-- Throws:
org.alfresco.error.AlfrescoRuntimeException
- if either the list or the authority do not already exist.
-
getListDetails
public Map<String,List<String>> getListDetails(String listName)
Get the member details of the specified list- Specified by:
getListDetails
in interfaceRMCaveatConfigComponent
- Parameters:
listName
-- Returns:
- the details of the specified list
-
getRMCaveatModels
public List<QName> getRMCaveatModels()
Description copied from interface:RMCaveatConfigComponent
Get custom caveat models- Specified by:
getRMCaveatModels
in interfaceRMCaveatConfigComponent
- Returns:
-
updateRMConstraintListAuthority
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values)
Replace the values for an authority in a list. The existing values are removed. If the authority does not already exist in the list, it will be added- Specified by:
updateRMConstraintListAuthority
in interfaceRMCaveatConfigComponent
- Parameters:
listName
- the name of the RMConstraintListauthorityName
-values
-
-
updateRMConstraintListValue
public void updateRMConstraintListValue(String listName, String valueName, List<String> authorities)
Replace the authorities for a value in a list- Specified by:
updateRMConstraintListValue
in interfaceRMCaveatConfigComponent
- Parameters:
listName
-valueName
-authorities
-
-
removeRMConstraintListValue
public void removeRMConstraintListValue(String listName, String valueName)
Description copied from interface:RMCaveatConfigComponent
Remove RM constraint value (all authorities)- Specified by:
removeRMConstraintListValue
in interfaceRMCaveatConfigComponent
-
removeRMConstraintListAuthority
public void removeRMConstraintListAuthority(String listName, String authorityName)
Remove an authority from a list- Specified by:
removeRMConstraintListAuthority
in interfaceRMCaveatConfigComponent
- Parameters:
listName
- the name of the RMConstraintListauthorityName
-
-
getRMConstraint
public RMConstraintInfo getRMConstraint(QName listQName)
Get an RMConstraintInfo- Parameters:
listQName
-- Returns:
- the constraint or null if it does not exist
-
getRMConstraint
public RMConstraintInfo getRMConstraint(String listName)
Get RM Constraint detail.- Specified by:
getRMConstraint
in interfaceRMCaveatConfigComponent
- Parameters:
listName
- the name of the RMConstraintList- Returns:
- the constraintInfo or null
-
deleteRMConstraint
public void deleteRMConstraint(String listName)
Description copied from interface:RMCaveatConfigComponent
Delete RM Constraint- Specified by:
deleteRMConstraint
in interfaceRMCaveatConfigComponent
- Parameters:
listName
- the name of the RMConstraintList
-
addRMConstraint
public void addRMConstraint(String listName)
Description copied from interface:RMCaveatConfigComponent
Add RM constraint- Specified by:
addRMConstraint
in interfaceRMCaveatConfigComponent
-
-