Search in sources :

Example 6 with ParameterDefinitionImpl

use of org.alfresco.repo.action.ParameterDefinitionImpl in project records-management by Alfresco.

the class ApplyCustomTypeAction method getParameterDefintions.

@Override
protected synchronized List<ParameterDefinition> getParameterDefintions() {
    // We can take these parameter definitions from the properties defined in the dod model.
    if (this.parameterDefinitions == null) {
        AspectDefinition aspectDefinition = getDictionaryService().getAspect(customTypeAspect);
        if (aspectDefinition == null) {
            throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect));
        }
        Map<QName, PropertyDefinition> props = aspectDefinition.getProperties();
        this.parameterDefinitions = new ArrayList<ParameterDefinition>(props.size());
        for (Map.Entry<QName, PropertyDefinition> entry : props.entrySet()) {
            String paramName = entry.getKey().toPrefixString(getNamespaceService());
            PropertyDefinition value = entry.getValue();
            QName paramType = value.getDataType().getName();
            boolean paramIsMandatory = value.isMandatory();
            parameterDefinitions.add(new ParameterDefinitionImpl(paramName, paramType, paramIsMandatory, null));
        }
    }
    return parameterDefinitions;
}
Also used : QName(org.alfresco.service.namespace.QName) AspectDefinition(org.alfresco.service.cmr.dictionary.AspectDefinition) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException) PropertyDefinition(org.alfresco.service.cmr.dictionary.PropertyDefinition) HashMap(java.util.HashMap) Map(java.util.Map) ParameterDefinitionImpl(org.alfresco.repo.action.ParameterDefinitionImpl) ParameterDefinition(org.alfresco.service.cmr.action.ParameterDefinition)

Aggregations

ParameterDefinitionImpl (org.alfresco.repo.action.ParameterDefinitionImpl)6 AspectDefinition (org.alfresco.service.cmr.dictionary.AspectDefinition)2 PropertyDefinition (org.alfresco.service.cmr.dictionary.PropertyDefinition)2 QName (org.alfresco.service.namespace.QName)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 ParameterDefinition (org.alfresco.service.cmr.action.ParameterDefinition)1