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;
}
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;
}
Aggregations