Search in sources :

Example 11 with BaseTypeId

use of org.apache.chemistry.opencmis.commons.enums.BaseTypeId in project structr by structr.

the class CMISRepositoryService method getTypeDefinitionContainer.

private TypeDefinitionContainer getTypeDefinitionContainer(final TypeDefinition typeDefinition, final Boolean includePropertyDefinitions) {
    final TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();
    final List<TypeDefinitionContainer> list = new LinkedList<>();
    result.setTypeDefinition(typeDefinition);
    result.setChildren(list);
    final String typeId = typeDefinition.getId();
    final BaseTypeId baseTypeId = getBaseTypeId(typeId);
    if (baseTypeId != null) {
        for (final TypeDefinition child : getBaseTypeChildren(baseTypeId, includePropertyDefinitions)) {
            list.add(getTypeDefinitionContainer(child, includePropertyDefinitions));
        }
    } else {
        for (final TypeDefinition child : getTypeChildren(typeDefinition.getId(), includePropertyDefinitions)) {
            list.add(getTypeDefinitionContainer(child, includePropertyDefinitions));
        }
    }
    return result;
}
Also used : TypeDefinitionContainerImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl) BaseTypeId(org.apache.chemistry.opencmis.commons.enums.BaseTypeId) TypeDefinitionContainer(org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer) LinkedList(java.util.LinkedList) MutableTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableTypeDefinition) MutablePolicyTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutablePolicyTypeDefinition) MutableRelationshipTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableRelationshipTypeDefinition) MutableFolderTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableFolderTypeDefinition) TypeDefinition(org.apache.chemistry.opencmis.commons.definitions.TypeDefinition) MutableDocumentTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition) MutableSecondaryTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableSecondaryTypeDefinition) MutableItemTypeDefinition(org.apache.chemistry.opencmis.commons.definitions.MutableItemTypeDefinition)

Example 12 with BaseTypeId

use of org.apache.chemistry.opencmis.commons.enums.BaseTypeId 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)12 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)5 MutableTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableTypeDefinition)3 CmisConstraintException (org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException)3 CmisRuntimeException (org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException)3 BaseMessage (com.pogeyan.cmis.api.BaseMessage)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 ObjectData (org.apache.chemistry.opencmis.commons.data.ObjectData)2 PermissionMapping (org.apache.chemistry.opencmis.commons.data.PermissionMapping)2 MutableDocumentTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition)2 MutableFolderTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableFolderTypeDefinition)2 MutableItemTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableItemTypeDefinition)2 MutablePolicyTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutablePolicyTypeDefinition)2 MutableRelationshipTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableRelationshipTypeDefinition)2 MutableSecondaryTypeDefinition (org.apache.chemistry.opencmis.commons.definitions.MutableSecondaryTypeDefinition)2 PermissionDefinition (org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition)2 TypeDefinition (org.apache.chemistry.opencmis.commons.definitions.TypeDefinition)2