use of org.alfresco.service.cmr.dictionary.AspectDefinition in project records-management by Alfresco.
the class RecordMetaDataAspectsGet method executeImpl.
/*
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
// Get the nodeRef and confirm it is valid
NodeRef nodeRef = null;
String nodeRefValue = req.getParameter(PARAM_NODEREF);
if (nodeRefValue == null || nodeRefValue.trim().length() == 0) {
// get the file plan if a node ref hasn't been specified
// TODO will need to remove when multi file plans supported
nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
} else {
nodeRef = new NodeRef(nodeRefValue);
}
// Get the details of all the aspects
Set<QName> aspectQNames = recordService.getRecordMetadataAspects(nodeRef);
List<Map<String, Object>> aspects = new ArrayList<Map<String, Object>>(aspectQNames.size() + 1);
for (QName aspectQName : aspectQNames) {
// Get the prefix aspect and default the label to the localname
String prefixString = aspectQName.toPrefixString(namespaceService);
String label = aspectQName.getLocalName();
Map<String, Object> aspect = new HashMap<String, Object>(2);
aspect.put("id", prefixString);
// Try and get the aspect definition
AspectDefinition aspectDefinition = dictionaryService.getAspect(aspectQName);
if (aspectDefinition != null) {
// Fet the label from the aspect definition
label = aspectDefinition.getTitle(dictionaryService);
}
aspect.put("value", label);
// Add the aspect details to the aspects list
aspects.add(aspect);
}
// create model object with the lists model
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("aspects", aspects);
return model;
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project records-management by Alfresco.
the class RMSearchPropertiesGet method executeImpl.
/**
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>(13);
List<Group> groups = new ArrayList<Group>(5);
// get the file plan
// TODO the file plan should be passed to this web script
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
// get the record metadata aspects
Set<QName> aspects = recordService.getRecordMetadataAspects(filePlan);
for (QName aspect : aspects) {
Map<QName, PropertyDefinition> properties = dictionaryService.getPropertyDefs(aspect);
Property[] propObjs = new Property[properties.size()];
int index = 0;
for (PropertyDefinition propertyDefinition : properties.values()) {
Property propObj = new Property(propertyDefinition);
propObjs[index] = propObj;
index++;
}
AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect);
Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(dictionaryService), propObjs);
groups.add(group);
}
Map<QName, PropertyDefinition> customProps = adminService.getCustomPropertyDefinitions();
Property[] propObjs = new Property[customProps.size()];
int index = 0;
for (PropertyDefinition propertyDefinition : customProps.values()) {
Property propObj = new Property(propertyDefinition);
propObjs[index] = propObj;
index++;
}
Group group = new Group("rmcustom", "Custom", propObjs);
groups.add(group);
model.put("groups", groups);
return model;
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project records-management by Alfresco.
the class ApplyCustomTypeAction method addParameterDefinitions.
/**
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
*/
@Override
protected final void addParameterDefinitions(List<ParameterDefinition> paramList) {
AspectDefinition aspectDef = getDictionaryService().getAspect(customTypeAspect);
for (PropertyDefinition propDef : aspectDef.getProperties().values()) {
QName propName = propDef.getName();
QName propType = propDef.getDataType().getName();
paramList.add(new ParameterDefinitionImpl(propName.toPrefixString(), propType, propDef.isMandatory(), null));
}
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project records-management by Alfresco.
the class RecordsManagementAdminServiceImpl method getCustomPropertyDefinitions.
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(org.alfresco.module.org_alfresco_module_rm.CustomisableRmElement)
*/
public Map<QName, PropertyDefinition> getCustomPropertyDefinitions(QName customisableType) {
mandatory("customisableType", customisableType);
Map<QName, PropertyDefinition> propDefns = null;
QName relevantAspectQName = getCustomAspect(customisableType);
AspectDefinition aspectDefn = getDictionaryService().getAspect(relevantAspectQName);
if (aspectDefn != null) {
propDefns = aspectDefn.getProperties();
}
return propDefns;
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project records-management by Alfresco.
the class DodCustomTypesGet method executeImpl.
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
List<AspectDefinition> customTypeAspectDefinitions = new ArrayList<AspectDefinition>(4);
for (QName aspectQName : CUSTOM_TYPE_ASPECTS) {
AspectDefinition nextAspectDef = dictionaryService.getAspect(aspectQName);
customTypeAspectDefinitions.add(nextAspectDef);
}
model.put("dodCustomTypes", customTypeAspectDefinitions);
return model;
}
Aggregations