use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition in project records-management by Alfresco.
the class ExtendedActionServiceImpl method getActionDefinitions.
/**
* @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public List<ActionDefinition> getActionDefinitions(NodeRef nodeRef) {
List<ActionDefinition> result = null;
// first use the base implementation to get the list of action definitions
List<ActionDefinition> actionDefinitions = super.getActionDefinitions(nodeRef);
if (nodeRef == null) {
// nothing to filter
result = actionDefinitions;
} else {
// get the file component kind of the node reference
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
result = new ArrayList<ActionDefinition>(actionDefinitions.size());
// check each action definition
for (ActionDefinition actionDefinition : actionDefinitions) {
if (actionDefinition instanceof RecordsManagementActionDefinition) {
if (kind != null) {
Set<FilePlanComponentKind> applicableKinds = ((RecordsManagementActionDefinition) actionDefinition).getApplicableKinds();
if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind)) {
// an RM action can only act on a RM artifact
result.add(actionDefinition);
}
}
} else {
if (kind == null) {
// a non-RM action can only act on a non-RM artifact
result.add(actionDefinition);
}
}
}
}
return result;
}
Aggregations