use of org.apache.chemistry.opencmis.commons.definitions.MutableTypeDefinition in project structr by structr.
the class CMISRepositoryService method extendTypeDefinition.
private MutableTypeDefinition extendTypeDefinition(final Class<? extends GraphObject> type, final Boolean includePropertyDefinitions) {
final String typeName = type.getSimpleName();
MutableTypeDefinition result = null;
try {
// instantiate class to obtain runtime CMIS information
final GraphObject obj = type.newInstance();
if (obj != null) {
final CMISInfo info = obj.getCMISInfo();
if (info != null) {
final BaseTypeId baseTypeId = info.getBaseTypeId();
if (baseTypeId != null) {
switch(baseTypeId) {
case CMIS_DOCUMENT:
result = getDocumentTypeDefinition(typeName, includePropertyDefinitions, false);
break;
case CMIS_FOLDER:
result = getFolderTypeDefinition(typeName, includePropertyDefinitions, false);
break;
case CMIS_ITEM:
result = getItemTypeDefinition(typeName, includePropertyDefinitions, false);
break;
case CMIS_POLICY:
result = getPolicyTypeDefinition(typeName, includePropertyDefinitions, false);
break;
case CMIS_RELATIONSHIP:
result = getRelationshipTypeDefinition(typeName, includePropertyDefinitions, false);
break;
case CMIS_SECONDARY:
result = getSecondaryTypeDefinition(typeName, includePropertyDefinitions, false);
break;
}
if (result != null) {
// initialize..
for (final PropertyKey key : StructrApp.getConfiguration().getPropertySet(type, PropertyView.All)) {
final MutablePropertyDefinition property = createProperty(type, key);
if (property != null) {
result.addPropertyDefinition(property);
}
}
}
}
}
}
} catch (final IllegalAccessException | InstantiationException iex) {
logger.warn("", iex);
}
return result;
}
Aggregations