use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.
the class VitalRecordServiceImpl method setupVitalRecordDefinition.
/**
* @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setupVitalRecordDefinition(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public void setupVitalRecordDefinition(NodeRef nodeRef) {
// get the current review period value
Period currentReviewPeriod = (Period) nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD);
if (currentReviewPeriod == null || PERIOD_NONE.equals(currentReviewPeriod)) {
// get the immediate parent
NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
// is the parent a record category
if (parentRef != null && FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef))) {
// is the child a record category or folder
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) || kind.equals(FilePlanComponentKind.RECORD_FOLDER)) {
// set the vital record definition values to match that of the parent
nodeService.setProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR, nodeService.getProperty(parentRef, PROP_VITAL_RECORD_INDICATOR));
nodeService.setProperty(nodeRef, PROP_REVIEW_PERIOD, nodeService.getProperty(parentRef, PROP_REVIEW_PERIOD));
}
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.
the class VitalRecordServiceImpl method getVitalRecordDefinition.
/**
* @see VitalRecordService#getVitalRecordDefinition(NodeRef)
*/
public VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef) {
VitalRecordDefinition result = null;
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind)) {
result = resolveVitalRecordDefinition(nodeRef);
} else {
if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)) {
result = VitalRecordDefinitionImpl.create(nodeService, nodeRef);
}
}
return result;
}
use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.
the class JSONConversionComponent method setRmNodeValues.
/**
* Helper method to set the RM node values
*
* @param nodeRef node reference
* @param useShortQName indicates whether the short QName are used or not
* @return {@link JSONObject} JSON object containing values
*/
@SuppressWarnings("unchecked")
private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName) {
JSONObject rmNodeValues = new JSONObject();
// UI convenience type
rmNodeValues.put("uiType", getUIType(nodeRef));
// Get the 'kind' of the file plan component
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
rmNodeValues.put("kind", kind.toString());
// set the primary parent node reference
ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef);
if (assoc != null) {
rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().toString());
}
Map<String, Object> values = AuthenticationUtil.runAsSystem(new RunAsWork<Map<String, Object>>() {
public Map<String, Object> doWork() throws Exception {
Map<String, Object> result = new HashMap<String, Object>();
// File plan node reference
NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
if (filePlan != null) {
result.put("filePlan", filePlan.toString());
// Unfiled container node reference
NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan);
if (unfiledRecordContainer != null) {
result.put("unfiledRecordContainer", unfiledRecordContainer.toString());
result.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName));
QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType();
result.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString());
}
}
return result;
}
});
rmNodeValues.putAll(values);
// Set the indicators array
setIndicators(rmNodeValues, nodeRef);
// Set the actions array
setActions(rmNodeValues, nodeRef);
return rmNodeValues;
}
use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.
the class DeclarativeCapability method getAvailableKinds.
/**
* Get list of available kinds
*
* @return list of available kinds
*/
private Set<FilePlanComponentKind> getAvailableKinds() {
if (kinds != null && availableKinds == null) {
availableKinds = new HashSet<FilePlanComponentKind>(kinds.size());
for (String kindString : kinds) {
FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString);
availableKinds.add(kind);
}
}
return availableKinds;
}
use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.
the class DeclarativeCapability method checkKinds.
/**
* Checks that the node ref is of the expected kind
*
* @param nodeRef
* @return
*/
protected boolean checkKinds(NodeRef nodeRef) {
boolean result = false;
FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef);
if (actualKind != null) {
Set<FilePlanComponentKind> availableKinds = getAvailableKinds();
if (availableKinds == null || availableKinds.contains(actualKind)) {
result = true;
}
}
return result;
}
Aggregations