Class RecordsManagementAdminServiceImpl
java.lang.Object
org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase
org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl
- All Implemented Interfaces:
EventListener
,RecordsManagementAdminService
,RecordsManagementCustomModel
,NodeServicePolicies.OnAddAspectPolicy
,NodeServicePolicies.OnCreateNodePolicy
,NodeServicePolicies.OnRemoveAspectPolicy
,ClassPolicy
,Policy
,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
,org.springframework.core.Ordered
public class RecordsManagementAdminServiceImpl
extends RecordsManagementAdminBase
implements RecordsManagementAdminService, RecordsManagementCustomModel, NodeServicePolicies.OnAddAspectPolicy, NodeServicePolicies.OnRemoveAspectPolicy, NodeServicePolicies.OnCreateNodePolicy, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.core.Ordered
Records Management AdminService Implementation.
- Author:
- Neil McErlean, janv
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
-
Field Summary
Fields inherited from class org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase
logger
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy
QNAME
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
QNAME
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy
QNAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Fields inherited from interface org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel
ASPECT_CUSTOM_ASSOCIATIONS, ASPECT_SUPPLEMENTAL_MARKING_LIST, CONSTRAINT_CUSTOM_SMLIST, CUSTOM_REF_CROSSREFERENCE, CUSTOM_REF_OBSOLETES, CUSTOM_REF_RENDITION, CUSTOM_REF_SUPERSEDES, CUSTOM_REF_SUPPORTS, CUSTOM_REF_VERSIONS, PROP_SUPPLEMENTAL_MARKING_LIST, RM_CUSTOM_MODEL, RM_CUSTOM_PREFIX, RM_CUSTOM_URI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCustomAssocDefinition
(String label) This method creates a new custom association, using the given label as the title.addCustomChildAssocDefinition
(String source, String target) This method creates a new custom child association, combining the given source and target and using the combined String as the title.void
addCustomConstraintDefinition
(QName constraintName, String title, boolean caseSensitive, List<String> allowedValues, RMListOfValuesConstraint.MatchLogic matchLogic) This method adds a Constraint definition to the custom model.addCustomPropertyDefinition
(QName propId, QName aspectName, String label, QName dataType, String title, String description) Add custom property definition Note: no default value, single valued, optional, not system protected, no constraintsaddCustomPropertyDefinition
(QName propId, QName aspectName, String label, QName dataType, String title, String description, String defaultValue, boolean multiValued, boolean mandatory, boolean isProtected, QName lovConstraint) Add custom property definition with one optional constraint referencevoid
addCustomReference
(NodeRef fromNode, NodeRef toNode, QName refId) This method adds the specified custom reference instance between the specified nodes.void
changeCustomConstraintTitle
(QName constraintName, String title) void
changeCustomConstraintValues
(QName constraintName, List<String> newAllowedValues) Update custom constraint definition with new list of values (replaces existing list, if any)boolean
existsCustomProperty
(QName propertyName) Indicates whether the custom property exists.getCompoundIdFor
(String sourceId, String targetId) This method retrieves a compound ID (client-side) for the specified sourceId and targetId.Fetches all child associations of the given source.getCustomConstraintDefinitions
(QName modelQName) This method returns ConstraintDefinition objects defined in the given model (note: not property references or in-line defs) The custom constraint definitions are retrieved from the dictionaryService which is notified of any newly created definitions on transaction commit.Get a list of all registered customisable types and aspects.getCustomisable
(NodeRef nodeRef) Get a list of all the registered customisable types and aspects present on a given node reference.Fetches all child associations where the given node is the child.This method returns the custom properties that have been defined for all of the specified customisable RM elements.getCustomPropertyDefinitions
(QName customisableType) This method returns the custom properties that have been defined for the specified customisable RM element.This method returns the custom references that have been defined in the custom model.Fetches all associations from the given source.getCustomReferencesTo
(NodeRef node) Returns a List of all associations to the given node.int
getOrder()
Indicate that this application content listener must be executed with the lowest precedence.getQNameForClientId
(String localName) This method iterates over the custom properties, references looking for one whose id exactly matches that specified.protected RelationshipService
Gets the relationship service instanceboolean
isCustomisable
(QName type) Indicates whether a type (or aspect) is customisable.boolean
Helper method to indicate whether the custom map is initialised or not.void
makeCustomisable
(QName type) Makes a type customisable.void
onAddAspect
(NodeRef nodeRef, QName aspectTypeQName) void
onApplicationEvent
(org.springframework.context.event.ContextRefreshedEvent event) Load the custom properties mapvoid
onCreateNode
(ChildAssociationRef childAssocRef) Make sure any custom property aspects are applied to newly created nodes.void
onRemoveAspect
(NodeRef nodeRef, QName aspectTypeQName) void
removeCustomConstraintDefinition
(QName constraintName) Remove custom constraint definition - if not referenced (by any properties)void
removeCustomPropertyDefinition
(QName propQName) Remove custom property definitionremoveCustomPropertyDefinitionConstraints
(QName propQName) Removes all list of values constraints from the custom property definition.void
removeCustomReference
(NodeRef fromNode, NodeRef toNode, QName assocId) This method removes the specified custom reference instance from the specified node.void
setCustomisableTypes
(List<String> customisableTypes) setCustomPropertyDefinitionConstraint
(QName propQName, QName newLovConstraint) Sets a new list of values constraint on the custom property definition.setCustomPropertyDefinitionLabel
(QName propQName, String newLabel) Update the custom property definition's label (title).void
setJobLockService
(JobLockService jobLockService) void
setRelationshipService
(RelationshipService relationshipService) void
setTransactionService
(TransactionService transactionService) String[]
splitSourceTargetId
(String sourceTargetId) Given a compound id for source and target strings (as used with parent/child custom references), this method splits the String and returns an array containing the source and target IDs separately.void
unmakeCustomisable
(QName type) Assuming the custom properties are not in use, makes a type no longer customisable.updateCustomAssocDefinition
(QName refQName, String newLabel) This method updates the label value for the specified association.updateCustomChildAssocDefinition
(QName refQName, String newSource, String newTarget) This method updates the source and target values for the specified child association.updateCustomPropertyDefinitionName
(QName propQName, String newName) Update the name and label of the custom property definition.Methods inherited from class org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase
composeAssociationDefinitionTitle, existsTitle, getContentService, getCustomAssociations, getCustomModelRef, getDictionaryRepositoryBootstrap, getDictionaryService, getNamespaceService, getNodeService, readCustomContentModel, setContentService, setDictionaryRepositoryBootstrap, setDictionaryService, setNamespaceService, setNodeService, splitAssociationDefinitionTitle, writeCustomContentModel
-
Constructor Details
-
RecordsManagementAdminServiceImpl
public RecordsManagementAdminServiceImpl()
-
-
Method Details
-
setTransactionService
- Parameters:
transactionService
- transaction service
-
setRelationshipService
- Parameters:
relationshipService
- The relationship service instance
-
getRelationshipService
Gets the relationship service instance- Returns:
- The relationship service instance
-
setJobLockService
- Parameters:
jobLockService
- The Job Lock service
-
getOrder
public int getOrder()Indicate that this application content listener must be executed with the lowest precedence. (ie last)- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
- See Also:
-
Ordered.getOrder()
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) Load the custom properties map- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
- See Also:
-
ApplicationListener.onApplicationEvent(org.springframework.context.ApplicationEvent)
-
isCustomMapInit
public boolean isCustomMapInit()Helper method to indicate whether the custom map is initialised or not.- Returns:
- boolean true if initialised, false otherwise
-
onAddAspect
-
onRemoveAspect
-
onCreateNode
Make sure any custom property aspects are applied to newly created nodes. -
setCustomisableTypes
- Parameters:
customisableTypes
- list of string representations of the type qnames that are customisable
-
getCustomisable
Description copied from interface:RecordsManagementAdminService
Get a list of all registered customisable types and aspects.- Specified by:
getCustomisable
in interfaceRecordsManagementAdminService
- Returns:
- Set of <
QName
>s of customisable types and aspects - See Also:
-
getCustomisable
Description copied from interface:RecordsManagementAdminService
Get a list of all the registered customisable types and aspects present on a given node reference.- Specified by:
getCustomisable
in interfaceRecordsManagementAdminService
- Parameters:
nodeRef
- node reference- Returns:
- Set of <
QName
>s of customisable types and aspects, empty if none - See Also:
-
isCustomisable
Description copied from interface:RecordsManagementAdminService
Indicates whether a type (or aspect) is customisable.- Specified by:
isCustomisable
in interfaceRecordsManagementAdminService
- Parameters:
type
- customisable typeQName
- Returns:
- boolean true if type customisable, false otherwise
- See Also:
-
makeCustomisable
Description copied from interface:RecordsManagementAdminService
Makes a type customisable.- Specified by:
makeCustomisable
in interfaceRecordsManagementAdminService
- Parameters:
type
- typeQName
to make customisable- See Also:
-
unmakeCustomisable
Description copied from interface:RecordsManagementAdminService
Assuming the custom properties are not in use, makes a type no longer customisable.- Specified by:
unmakeCustomisable
in interfaceRecordsManagementAdminService
- Parameters:
type
- typeQName
to make customisable- See Also:
-
existsCustomProperty
Description copied from interface:RecordsManagementAdminService
Indicates whether the custom property exists.- Specified by:
existsCustomProperty
in interfaceRecordsManagementAdminService
- Parameters:
propertyName
- propertiesQName
- Returns:
- boolean true if property exists, false otherwise
- See Also:
-
getCustomPropertyDefinitions
Description copied from interface:RecordsManagementAdminService
This method returns the custom properties that have been defined for all of the specified customisable RM elements.Note: the custom property definitions are retrieved from the dictionaryService which is notified of any newly created definitions on transaction commit. Therefore custom properties created in the current transaction will not appear in the result of this method.
- Specified by:
getCustomPropertyDefinitions
in interfaceRecordsManagementAdminService
- Returns:
- Map of <
QName
,PropertyDefinition
>s of custom properties definitions - See Also:
-
getCustomPropertyDefinitions
Description copied from interface:RecordsManagementAdminService
This method returns the custom properties that have been defined for the specified customisable RM element.Note: the custom property definitions are retrieved from the dictionaryService which is notified of any newly created definitions on transaction commit. Therefore custom properties created in the current transaction will not appear in the result of this method.
- Specified by:
getCustomPropertyDefinitions
in interfaceRecordsManagementAdminService
- Returns:
- Map of <
QName
,PropertyDefinition
>s of custom properties definitions - See Also:
-
addCustomPropertyDefinition
public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description) throws CustomMetadataException Description copied from interface:RecordsManagementAdminService
Add custom property definition Note: no default value, single valued, optional, not system protected, no constraints- Specified by:
addCustomPropertyDefinition
in interfaceRecordsManagementAdminService
- Parameters:
propId
- - If a value for propId is provided it will be used to identify property definitions within URLs and in QNames. Therefore it must contain URL/QName-valid characters only. It must also be unique. If a null value is passed, an id will be generated.aspectName
- - mandatory. The aspect within which the property is to be defined. This must be one of the CustomisableRmElements.label
- - mandatorydataType
- - mandatorytitle
- - optionaldescription
- - optional- Returns:
- the propId, whether supplied as a parameter or generated.
- Throws:
CustomMetadataException
- See Also:
-
addCustomPropertyDefinition
public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description, String defaultValue, boolean multiValued, boolean mandatory, boolean isProtected, QName lovConstraint) throws CustomMetadataException Description copied from interface:RecordsManagementAdminService
Add custom property definition with one optional constraint reference- Specified by:
addCustomPropertyDefinition
in interfaceRecordsManagementAdminService
- Parameters:
propId
- - If a value for propId is provided it will be used to identify property definitions within URLs and in QNames. Therefore it must contain URL/QName-valid characters only. It must also be unique. If a null value is passed, an id will be generated.aspectName
- - mandatory. The aspect within which the property is to be defined. This must be one of the CustomisableRmElements.label
- - mandatorydataType
- - mandatorytitle
- - optionaldescription
- - optionaldefaultValue
- - optionalmultiValued
- - TRUE if multi-valued propertymandatory
- - TRUE if mandatory propertyisProtected
- - TRUE if protected propertylovConstraint
- - optional custom constraint- Returns:
- the propId, whether supplied as a parameter or generated.
- Throws:
CustomMetadataException
- See Also:
-
updateCustomPropertyDefinitionName
public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException Description copied from interface:RecordsManagementAdminService
Update the name and label of the custom property definition.- Specified by:
updateCustomPropertyDefinitionName
in interfaceRecordsManagementAdminService
- Parameters:
propQName
- The qname of the existing property definitionnewName
- THe new name for both the custom property and its label.- Returns:
- Throws:
CustomMetadataException
- See Also:
-
setCustomPropertyDefinitionLabel
Description copied from interface:RecordsManagementAdminService
Update the custom property definition's label (title).- Specified by:
setCustomPropertyDefinitionLabel
in interfaceRecordsManagementAdminService
- Parameters:
propQName
- the qname of the property definitionnewLabel
- the new value for the label.- Returns:
- the propId.
- See Also:
-
setCustomPropertyDefinitionConstraint
Description copied from interface:RecordsManagementAdminService
Sets a new list of values constraint on the custom property definition.- Specified by:
setCustomPropertyDefinitionConstraint
in interfaceRecordsManagementAdminService
- Parameters:
propQName
- the qname of the property definitionnewLovConstraint
- the List-Of-Values constraintRef.- Returns:
- the propId.
- See Also:
-
removeCustomPropertyDefinitionConstraints
Description copied from interface:RecordsManagementAdminService
Removes all list of values constraints from the custom property definition.- Specified by:
removeCustomPropertyDefinitionConstraints
in interfaceRecordsManagementAdminService
- Parameters:
propQName
- the qname of the property definition- Returns:
- the propId.
- See Also:
-
removeCustomPropertyDefinition
Description copied from interface:RecordsManagementAdminService
Remove custom property definition -
getCustomReferenceDefinitions
Description copied from interface:RecordsManagementAdminService
This method returns the custom references that have been defined in the custom model. Note: the custom reference definitions are retrieved from the dictionaryService which is notified of any newly created definitions on transaction commit. Therefore custom references created in the current transaction will not appear in the results.- Specified by:
getCustomReferenceDefinitions
in interfaceRecordsManagementAdminService
- Returns:
- The Map of custom references (both parent-child and standard).
- See Also:
-
addCustomReference
Description copied from interface:RecordsManagementAdminService
This method adds the specified custom reference instance between the specified nodes. Only one instance of any custom reference type is allowed in a given direction between two given records.- Specified by:
addCustomReference
in interfaceRecordsManagementAdminService
refId
- the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567- See Also:
-
removeCustomReference
Description copied from interface:RecordsManagementAdminService
This method removes the specified custom reference instance from the specified node.- Specified by:
removeCustomReference
in interfaceRecordsManagementAdminService
assocId
- the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567- See Also:
-
getCustomReferencesFrom
Description copied from interface:RecordsManagementAdminService
Fetches all associations from the given source.- Specified by:
getCustomReferencesFrom
in interfaceRecordsManagementAdminService
- Parameters:
node
- the node from which the associations start.- Returns:
- a List of associations.
- See Also:
-
getCustomChildReferences
Description copied from interface:RecordsManagementAdminService
Fetches all child associations of the given source. i.e. all associations where the given node is the parent.- Specified by:
getCustomChildReferences
in interfaceRecordsManagementAdminService
- Returns:
- See Also:
-
getCustomReferencesTo
Description copied from interface:RecordsManagementAdminService
Returns a List of all associations to the given node.- Specified by:
getCustomReferencesTo
in interfaceRecordsManagementAdminService
- Parameters:
node
- the node to which the associations point.- Returns:
- a List of associations.
- See Also:
-
getCustomParentReferences
Description copied from interface:RecordsManagementAdminService
Fetches all child associations where the given node is the child.- Specified by:
getCustomParentReferences
in interfaceRecordsManagementAdminService
- Returns:
- See Also:
-
addCustomAssocDefinition
Description copied from interface:RecordsManagementAdminService
This method creates a new custom association, using the given label as the title.- Specified by:
addCustomAssocDefinition
in interfaceRecordsManagementAdminService
- Parameters:
label
- the title of the association definition- Returns:
- the QName of the newly-created association.
- See Also:
-
addCustomChildAssocDefinition
Description copied from interface:RecordsManagementAdminService
This method creates a new custom child association, combining the given source and target and using the combined String as the title.- Specified by:
addCustomChildAssocDefinition
in interfaceRecordsManagementAdminService
- Returns:
- the QName of the newly-created association.
- See Also:
-
updateCustomChildAssocDefinition
Description copied from interface:RecordsManagementAdminService
This method updates the source and target values for the specified child association. The source and target will be combined into a single string and stored in the title property. Source and target are String metadata for RM parent/child custom references.- Specified by:
updateCustomChildAssocDefinition
in interfaceRecordsManagementAdminService
- Parameters:
refQName
- qname of the child association.newSource
- the new value for the source field.newTarget
- the new value for the target field.- See Also:
-
updateCustomAssocDefinition
Description copied from interface:RecordsManagementAdminService
This method updates the label value for the specified association. The label will be stored in the title property. Label is String metadata for bidirectional custom references.- Specified by:
updateCustomAssocDefinition
in interfaceRecordsManagementAdminService
- Parameters:
refQName
- qname of the child association.newLabel
- the new value for the label field.- See Also:
-
addCustomConstraintDefinition
public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List<String> allowedValues, RMListOfValuesConstraint.MatchLogic matchLogic) Description copied from interface:RecordsManagementAdminService
This method adds a Constraint definition to the custom model. The implementation of this method would have to go into the M2Model and insert the relevant M2Objects for this new constraint. param type not included as it would always be RMListOfValuesConstraint for RM.- Specified by:
addCustomConstraintDefinition
in interfaceRecordsManagementAdminService
- Parameters:
constraintName
- the name e.g. rmc:footitle
- the human-readable title e.g. My foo listallowedValues
- the allowed values listmatchLogic
- AND (all values must match), OR (at least one values must match)- See Also:
-
changeCustomConstraintValues
Description copied from interface:RecordsManagementAdminService
Update custom constraint definition with new list of values (replaces existing list, if any)- Specified by:
changeCustomConstraintValues
in interfaceRecordsManagementAdminService
- Parameters:
constraintName
- the name e.g. rmc:foo- See Also:
-
changeCustomConstraintTitle
-
getCustomConstraintDefinitions
Description copied from interface:RecordsManagementAdminService
This method returns ConstraintDefinition objects defined in the given model (note: not property references or in-line defs) The custom constraint definitions are retrieved from the dictionaryService which is notified of any newly created definitions on transaction commit. Therefore custom constraints created in the current transaction will not appear in the results. -
removeCustomConstraintDefinition
Description copied from interface:RecordsManagementAdminService
Remove custom constraint definition - if not referenced (by any properties)- Specified by:
removeCustomConstraintDefinition
in interfaceRecordsManagementAdminService
- Parameters:
constraintName
- the name e.g. rmc:foo- See Also:
-
getQNameForClientId
Description copied from interface:RecordsManagementAdminService
This method iterates over the custom properties, references looking for one whose id exactly matches that specified.- Specified by:
getQNameForClientId
in interfaceRecordsManagementAdminService
- Parameters:
localName
- the localName part of the qname of the property or reference definition.- Returns:
- the QName of the property, association definition which matches, or null.
- See Also:
-
splitSourceTargetId
Description copied from interface:RecordsManagementAdminService
Given a compound id for source and target strings (as used with parent/child custom references), this method splits the String and returns an array containing the source and target IDs separately.- Specified by:
splitSourceTargetId
in interfaceRecordsManagementAdminService
- Parameters:
sourceTargetId
- the compound ID.- Returns:
- a String array, where result[0] == sourceId and result[1] == targetId.
- See Also:
-
getCompoundIdFor
Description copied from interface:RecordsManagementAdminService
This method retrieves a compound ID (client-side) for the specified sourceId and targetId.- Specified by:
getCompoundIdFor
in interfaceRecordsManagementAdminService
- Returns:
- See Also:
-