Search in sources :

Example 1 with CMISTypeDefinitionListWrapper

use of org.structr.files.cmis.wrapper.CMISTypeDefinitionListWrapper in project structr by structr.

the class CMISRepositoryService method getTypeChildren.

@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    // important: children are the direct children of a type, as opposed to the descendants
    final CMISTypeDefinitionListWrapper results = new CMISTypeDefinitionListWrapper(maxItems, skipCount);
    if (typeId != null) {
        final BaseTypeId baseTypeId = getBaseTypeId(typeId);
        if (baseTypeId != null) {
            results.addAll(getBaseTypeChildren(baseTypeId, includePropertyDefinitions));
        } else {
            final Class type = StructrApp.getConfiguration().getNodeEntityClass(typeId);
            if (type != null) {
                results.addAll(getTypeChildren(typeId, includePropertyDefinitions));
            } else {
                throw new CmisObjectNotFoundException("Type with ID " + typeId + " does not exist");
            }
        }
    } else {
        results.add(getDocumentTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value(), includePropertyDefinitions, true));
        results.add(getFolderTypeDefinition(BaseTypeId.CMIS_FOLDER.value(), includePropertyDefinitions, true));
        results.add(getItemTypeDefinition(BaseTypeId.CMIS_ITEM.value(), includePropertyDefinitions, true));
        results.add(getPolicyTypeDefinition(BaseTypeId.CMIS_POLICY.value(), includePropertyDefinitions, true));
        results.add(getRelationshipTypeDefinition(BaseTypeId.CMIS_RELATIONSHIP.value(), includePropertyDefinitions, true));
        results.add(getSecondaryTypeDefinition(BaseTypeId.CMIS_SECONDARY.value(), includePropertyDefinitions, true));
    }
    return results;
}
Also used : CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) CMISTypeDefinitionListWrapper(org.structr.files.cmis.wrapper.CMISTypeDefinitionListWrapper) BaseTypeId(org.apache.chemistry.opencmis.commons.enums.BaseTypeId)

Aggregations

BaseTypeId (org.apache.chemistry.opencmis.commons.enums.BaseTypeId)1 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)1 CMISTypeDefinitionListWrapper (org.structr.files.cmis.wrapper.CMISTypeDefinitionListWrapper)1