Search in sources :

Example 76 with PropertyDefinition

use of org.alfresco.service.cmr.dictionary.PropertyDefinition in project records-management by Alfresco.

the class ListOfValuesGet method createPeriodPropertiesModel.

/**
 * Creates the model for the list of period properties.
 *
 * @param baseUrl The base URL of the service
 * @return model of period properties list
 */
protected Map<String, Object> createPeriodPropertiesModel(String baseUrl) {
    // iterate over all period properties and get the label from their type definition
    Collection<DispositionProperty> dispositionProperties = dispositionService.getDispositionProperties();
    List<Map<String, String>> items = new ArrayList<Map<String, String>>(dispositionProperties.size());
    for (DispositionProperty dispositionProperty : dispositionProperties) {
        PropertyDefinition propDef = dispositionProperty.getPropertyDefinition();
        QName propName = dispositionProperty.getQName();
        if (propDef != null) {
            Map<String, String> item = new HashMap<String, String>(2);
            String propTitle = propDef.getTitle(ddService);
            if (propTitle == null || propTitle.length() == 0) {
                propTitle = StringUtils.capitalize(propName.getLocalName());
            }
            item.put("label", propTitle);
            item.put("value", propName.toPrefixString(this.namespaceService));
            items.add(item);
        }
    }
    // create the model
    Map<String, Object> model = new HashMap<String, Object>(2);
    model.put("url", baseUrl + "/periodproperties");
    model.put("items", items);
    return model;
}
Also used : DispositionProperty(org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) PropertyDefinition(org.alfresco.service.cmr.dictionary.PropertyDefinition)

Example 77 with PropertyDefinition

use of org.alfresco.service.cmr.dictionary.PropertyDefinition 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

PropertyDefinition (org.alfresco.service.cmr.dictionary.PropertyDefinition)77 QName (org.alfresco.service.namespace.QName)51 HashMap (java.util.HashMap)25 ArrayList (java.util.ArrayList)24 NodeRef (org.alfresco.service.cmr.repository.NodeRef)16 Map (java.util.Map)15 Serializable (java.io.Serializable)14 AssociationDefinition (org.alfresco.service.cmr.dictionary.AssociationDefinition)11 ClassDefinition (org.alfresco.service.cmr.dictionary.ClassDefinition)11 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)9 DataTypeDefinition (org.alfresco.service.cmr.dictionary.DataTypeDefinition)9 Collection (java.util.Collection)7 List (java.util.List)7 AspectDefinition (org.alfresco.service.cmr.dictionary.AspectDefinition)7 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)7 BooleanQuery (org.apache.lucene.search.BooleanQuery)7 Builder (org.apache.lucene.search.BooleanQuery.Builder)7 Constraint (org.alfresco.service.cmr.dictionary.Constraint)6 ConstantScoreQuery (org.apache.lucene.search.ConstantScoreQuery)6 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)6