use of org.alfresco.service.cmr.dictionary.ClassDefinition in project records-management by Alfresco.
the class CustomisableGet method executeImpl.
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
*/
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
Set<QName> qnames = rmAdminService.getCustomisable();
ArrayList<Item> items = new ArrayList<Item>(qnames.size());
for (QName qname : qnames) {
ClassDefinition definition = dictionaryService.getClass(qname);
if (definition != null) {
String name = qname.toPrefixString(namespaceService);
String title = definition.getTitle(dictionaryService);
if (title == null || title.length() == 0) {
title = qname.getLocalName();
}
boolean isAspect = definition.isAspect();
items.add(new Item(name, isAspect, title));
}
}
// Sort the customisable types and aspects by title
Collections.sort(items, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o1.title.compareToIgnoreCase(o2.title);
}
});
model.put("items", items);
return model;
}
use of org.alfresco.service.cmr.dictionary.ClassDefinition in project records-management by Alfresco.
the class IdentifierServiceImpl method lookupGenerator.
/**
* @param type content type (could be aspect or type)
* @return
*/
private IdentifierGenerator lookupGenerator(QName type) {
ParameterCheck.mandatory("type", type);
if (logger.isDebugEnabled()) {
logger.debug("Looking for idGenerator for type " + type.toString());
}
// Look for the generator related to the type
IdentifierGenerator result = register.get(type);
if (result == null) {
// Check the parent type
ClassDefinition typeDef = dictionaryService.getClass(type);
if (typeDef != null) {
QName parentType = typeDef.getParentName();
if (parentType != null) {
// Recurse to find parent type generator
result = lookupGenerator(parentType);
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("Unable to find type definition for " + type.toString() + " when generating identifier.");
}
}
}
return result;
}
Aggregations