Search in sources :

Example 1 with FilePlanComponentKind

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));
            }
        }
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) Period(org.alfresco.service.cmr.repository.Period) FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 2 with FilePlanComponentKind

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;
}
Also used : FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 3 with FilePlanComponentKind

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;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) JSONObject(org.json.simple.JSONObject) QName(org.alfresco.service.namespace.QName) JSONObject(org.json.simple.JSONObject) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) HashMap(java.util.HashMap) Map(java.util.Map) FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 4 with FilePlanComponentKind

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;
}
Also used : FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 5 with FilePlanComponentKind

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;
}
Also used : FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Aggregations

FilePlanComponentKind (org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)13 NodeRef (org.alfresco.service.cmr.repository.NodeRef)5 QName (org.alfresco.service.namespace.QName)4 HashMap (java.util.HashMap)2 Period (org.alfresco.service.cmr.repository.Period)2 Serializable (java.io.Serializable)1 Map (java.util.Map)1 Matcher (java.util.regex.Matcher)1 RecordsManagementActionDefinition (org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition)1 DispositionSchedule (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule)1 DispositionScheduleImpl (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl)1 Role (org.alfresco.module.org_alfresco_module_rm.role.Role)1 ActionDefinition (org.alfresco.service.cmr.action.ActionDefinition)1 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)1 JSONObject (org.json.simple.JSONObject)1