Class RMCaveatConfigComponentImpl
- java.lang.Object
-
- org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponentImpl
-
- All Implemented Interfaces:
RMCaveatConfigComponent
,org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy
,org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
,org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
,org.alfresco.repo.policy.ClassPolicy
,org.alfresco.repo.policy.Policy
public class RMCaveatConfigComponentImpl extends Object implements org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, RMCaveatConfigComponent
RM Caveat Config component impl- Author:
- janv
-
-
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(org.alfresco.service.cmr.repository.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<org.alfresco.service.namespace.QName>
getRMCaveatModels()
Get custom caveat modelsRMConstraintInfo
getRMConstraint(String listName)
Get RM Constraint detail.RMConstraintInfo
getRMConstraint(org.alfresco.service.namespace.QName listQName)
Get an RMConstraintInfoCollection<String>
getRMConstraintNames()
boolean
hasAccess(org.alfresco.service.cmr.repository.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(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)
void
onCreateNode(org.alfresco.service.cmr.repository.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(org.alfresco.service.cmr.security.AuthorityService authorityService)
void
setCaveatAspects(List<String> caveatAspectNames)
void
setCaveatConfig(org.alfresco.repo.cache.SimpleCache<String,Map<String,List<String>>> caveatConfig)
void
setCaveatModels(List<String> caveatModelNames)
void
setContentService(org.alfresco.service.cmr.repository.ContentService contentService)
void
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
void
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
void
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
void
setPersonService(org.alfresco.service.cmr.security.PersonService personService)
void
setStoreRef(String storeRef)
org.alfresco.service.cmr.repository.NodeRef
updateOrCreateCaveatConfig(File jsonFile)
org.alfresco.service.cmr.repository.NodeRef
updateOrCreateCaveatConfig(InputStream is)
org.alfresco.service.cmr.repository.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(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Validate the caveat config and optionally update the cache.
-
-
-
Method Detail
-
setCaveatConfig
public void setCaveatConfig(org.alfresco.repo.cache.SimpleCache<String,Map<String,List<String>>> caveatConfig)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setContentService
public void setContentService(org.alfresco.service.cmr.repository.ContentService contentService)
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
-
setAuthorityService
public void setAuthorityService(org.alfresco.service.cmr.security.AuthorityService authorityService)
-
setPersonService
public void setPersonService(org.alfresco.service.cmr.security.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(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)
- Specified by:
onContentUpdate
in interfaceorg.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy
- See Also:
RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted
-
beforeDeleteNode
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
- Specified by:
beforeDeleteNode
in interfaceorg.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
- See Also:
NodeServicePolicies.BeforeDeleteNodePolicy.beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
-
onCreateNode
public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
- Specified by:
onCreateNode
in interfaceorg.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
- See Also:
NodeServicePolicies.OnCreateNodePolicy.onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
-
validateAndReset
protected void validateAndReset(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Validate the caveat config and optionally update the cache.- Parameters:
nodeRef
- The nodeRef of the config
-
updateOrCreateCaveatConfig
public org.alfresco.service.cmr.repository.NodeRef updateOrCreateCaveatConfig(InputStream is)
- Specified by:
updateOrCreateCaveatConfig
in interfaceRMCaveatConfigComponent
-
updateOrCreateCaveatConfig
public org.alfresco.service.cmr.repository.NodeRef updateOrCreateCaveatConfig(File jsonFile)
- Specified by:
updateOrCreateCaveatConfig
in interfaceRMCaveatConfigComponent
-
updateOrCreateCaveatConfig
public org.alfresco.service.cmr.repository.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(org.alfresco.service.cmr.repository.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<org.alfresco.service.namespace.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(org.alfresco.service.namespace.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
-
-