use of org.alfresco.service.cmr.dictionary.AspectDefinition in project alfresco-remote-api by Alfresco.
the class CustomModelsImpl method getCustomAspects.
@Override
public CollectionWithPagingInfo<CustomAspect> getCustomAspects(String modelName, Parameters parameters) {
CustomModelDefinition modelDef = getCustomModelImpl(modelName);
Collection<AspectDefinition> aspectDefinitions = modelDef.getAspectDefinitions();
// TODO Should we support paging?
Paging paging = Paging.DEFAULT;
List<CustomAspect> customAspects = convertToCustomAspects(aspectDefinitions, false);
return CollectionWithPagingInfo.asPaged(paging, customAspects, false, aspectDefinitions.size());
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project alfresco-remote-api by Alfresco.
the class CustomModelsImpl method getCustomAspect.
@Override
public CustomAspect getCustomAspect(String modelName, String aspectName, Parameters parameters) {
if (aspectName == null) {
throw new InvalidArgumentException(ASPECT_NAME_NULL_ERR);
}
final CustomModelDefinition modelDef = getCustomModelImpl(modelName);
QName aspectQname = QName.createQName(modelDef.getName().getNamespaceURI(), aspectName);
AspectDefinition customAspectDef = customModelService.getCustomAspect(aspectQname);
if (customAspectDef == null) {
throw new EntityNotFoundException(aspectName);
}
// Check if inherited properties have been requested
boolean includeInheritedProps = hasSelectProperty(parameters, SELECT_ALL_PROPS);
return convertToCustomAspect(customAspectDef, includeInheritedProps);
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project alfresco-remote-api by Alfresco.
the class NodesImpl method mapToNodeAspects.
public Set<QName> mapToNodeAspects(List<String> aspectNames) {
Set<QName> nodeAspects = new HashSet<>(aspectNames.size());
for (String aspectName : aspectNames) {
QName aspectQName = createQName(aspectName);
AspectDefinition ad = dictionaryService.getAspect(aspectQName);
if (ad != null) {
nodeAspects.add(aspectQName);
} else {
throw new InvalidArgumentException("Unknown aspect: " + aspectName);
}
}
return nodeAspects;
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project acs-community-packaging by Alfresco.
the class BaseActionWizard method readAspectsConfig.
protected List<SelectItem> readAspectsConfig(FacesContext context, ConfigElement aspectsCfg) {
List<SelectItem> aspects = new ArrayList<SelectItem>();
for (ConfigElement child : aspectsCfg.getChildren()) {
QName idQName = Repository.resolveToQName(child.getAttribute("name"));
if (idQName != null) {
// try and get the display label from config
String label = Utils.getDisplayLabel(context, child);
// if there wasn't a client based label try and get it from the dictionary
if (label == null) {
AspectDefinition aspectDef = this.getDictionaryService().getAspect(idQName);
if (aspectDef != null) {
label = aspectDef.getTitle(this.getDictionaryService());
} else {
label = idQName.getLocalName();
}
}
aspects.add(new SelectItem(idQName.toString(), label));
} else {
logger.warn("Failed to resolve aspect '" + child.getAttribute("name") + "'");
}
}
return aspects;
}
use of org.alfresco.service.cmr.dictionary.AspectDefinition in project acs-community-packaging by Alfresco.
the class AdvancedSearchDialog method getCustomPropertyLookup.
/**
* Helper map to lookup custom property QName strings against a DataTypeDefinition
*
* @return custom property lookup Map
*/
private Map<String, DataTypeDefinition> getCustomPropertyLookup() {
if ((properties.getCustomPropertyLookup() == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
properties.setCustomPropertyLookup(new HashMap<String, DataTypeDefinition>(7, 1.0f));
List<CustomProperty> customProps = getSearchConfig().getCustomProperties();
if (customProps != null) {
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
for (CustomProperty customProp : customProps) {
PropertyDefinition propDef = null;
QName propQName = Repository.resolveToQName(customProp.Property);
if (customProp.Type != null) {
QName type = Repository.resolveToQName(customProp.Type);
TypeDefinition typeDef = dd.getType(type);
propDef = typeDef.getProperties().get(propQName);
} else if (customProp.Aspect != null) {
QName aspect = Repository.resolveToQName(customProp.Aspect);
AspectDefinition aspectDef = dd.getAspect(aspect);
propDef = aspectDef.getProperties().get(propQName);
}
if (propQName != null && propDef != null) {
properties.getCustomPropertyLookup().put(propQName.toString(), propDef.getDataType());
}
}
}
}
return properties.getCustomPropertyLookup();
}
Aggregations