Search in sources :

Example 6 with FilePlanComponentKind

use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind 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;
}
Also used : RecordsManagementActionDefinition(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition) RecordsManagementActionDefinition(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition) FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 7 with FilePlanComponentKind

use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.

the class IsTransferAccessionCapabilityCondition method evaluateImpl.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
public boolean evaluateImpl(NodeRef nodeRef) {
    boolean result = false;
    FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
    if (FilePlanComponentKind.TRANSFER.equals(kind)) {
        Boolean value = (Boolean) nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR);
        if (value != null) {
            result = value.booleanValue();
        }
    }
    return result;
}
Also used : FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 8 with FilePlanComponentKind

use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.

the class RecordsManagementNodeFormFilter method afterGenerate.

/**
 * @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map)
 */
@Override
public void afterGenerate(NodeRef nodeRef, List<String> fields, List<String> forcedFields, Form form, Map<String, Object> context) {
    if (getFilePlanService().isFilePlanComponent(nodeRef)) {
        // add all the custom properties
        addCustomPropertyFieldsToGroup(form, nodeRef);
        FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef);
        if (FilePlanComponentKind.RECORD.equals(kind)) {
            // add all the record meta-data aspect properties
            addRecordMetadataPropertyFieldsToGroup(form, nodeRef);
            // add required transient properties
            addTransientProperties(form, nodeRef);
            // add the supplemental marking list property
            forceSupplementalMarkingListProperty(form, nodeRef);
            // protect uneditable properties
            protectRecordProperties(form, nodeRef);
            // if the record is the result of an email we need to 'protect' some fields
            if (this.nodeService.hasAspect(nodeRef, ImapModel.ASPECT_IMAP_CONTENT)) {
                protectEmailExtractedFields(form, nodeRef);
            }
        } else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind)) {
            // add the supplemental marking list property
            forceSupplementalMarkingListProperty(form, nodeRef);
            // add required transient properties
            addTransientProperties(form, nodeRef);
        } else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind)) {
            // use the same mechanism used to determine whether steps can be removed from the
            // schedule to determine whether the disposition level can be changed i.e. record
            // level or folder level.
            DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef);
            if (getDispositionService().hasDisposableItems(schedule)) {
                protectRecordLevelDispositionPropertyField(form);
            }
        }
    }
}
Also used : DispositionScheduleImpl(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl) DispositionSchedule(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 9 with FilePlanComponentKind

use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.

the class JSONConversionComponent method getUIType.

/**
 * Gets the rm 'type' used as a UI convenience and compatibility flag.
 */
private String getUIType(NodeRef nodeRef) {
    String result = "unknown";
    FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
    if (kind != null) {
        switch(kind) {
            case FILE_PLAN:
                {
                    result = "fileplan";
                    break;
                }
            case RECORD_CATEGORY:
                {
                    result = "record-category";
                    break;
                }
            case RECORD_FOLDER:
                {
                    if (recordService.isMetadataStub(nodeRef)) {
                        result = "metadata-stub-folder";
                    } else {
                        result = "record-folder";
                    }
                    break;
                }
            case RECORD:
                {
                    if (recordService.isMetadataStub(nodeRef)) {
                        result = "metadata-stub";
                    } else {
                        if (recordService.isDeclared(nodeRef)) {
                            result = "record";
                        } else {
                            result = "undeclared-record";
                        }
                    }
                    break;
                }
            case HOLD:
                {
                    result = "hold";
                    break;
                }
            case TRANSFER:
                {
                    result = "transfer-container";
                    break;
                }
            case UNFILED_RECORD_FOLDER:
                {
                    result = "unfiled-record-folder";
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
    return result;
}
Also used : FilePlanComponentKind(org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)

Example 10 with FilePlanComponentKind

use of org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind in project records-management by Alfresco.

the class ServiceBaseImpl method getFilePlanComponentKind.

/**
 * Gets the file plan component kind from the given node reference
 *
 * @see FilePlanService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef)
 */
public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) {
    FilePlanComponentKind result = null;
    Map<NodeRef, FilePlanComponentKind> map = transactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef");
    if (map.containsKey(nodeRef)) {
        result = map.get(nodeRef);
    } else {
        if (isFilePlanComponent(nodeRef)) {
            result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
            if (isFilePlan(nodeRef)) {
                result = FilePlanComponentKind.FILE_PLAN;
            } else if (isRecordCategory(nodeRef)) {
                result = FilePlanComponentKind.RECORD_CATEGORY;
            } else if (isRecordFolder(nodeRef)) {
                result = FilePlanComponentKind.RECORD_FOLDER;
            } else if (isRecord(nodeRef)) {
                result = FilePlanComponentKind.RECORD;
            } else if (instanceOf(nodeRef, TYPE_HOLD_CONTAINER)) {
                result = FilePlanComponentKind.HOLD_CONTAINER;
            } else if (isHold(nodeRef)) {
                result = FilePlanComponentKind.HOLD;
            } else if (instanceOf(nodeRef, TYPE_TRANSFER_CONTAINER)) {
                result = FilePlanComponentKind.TRANSFER_CONTAINER;
            } else if (isTransfer(nodeRef)) {
                result = FilePlanComponentKind.TRANSFER;
            } else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION)) {
                result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
            } else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER)) {
                result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER;
            } else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_FOLDER)) {
                result = FilePlanComponentKind.UNFILED_RECORD_FOLDER;
            }
        }
        if (result != null) {
            map.put(nodeRef, result);
        }
    }
    return result;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) 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