Package org.apache.chemistry.opencmis.commons.definitions

Examples of org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer


            }

            result.setHasMoreItems((result.getList().size() + skip) < 2);
            result.setNumItems(BigInteger.valueOf(2));
        } else {
            TypeDefinitionContainer tc = fTypes.get(typeId);
            if ((tc == null) || (tc.getChildren() == null)) {
                return result;
            }

            for (TypeDefinitionContainer child : tc.getChildren()) {
                if (skip > 0) {
                    skip--;
                    continue;
                }

                result.getList().add(copyTypeDefintion(child.getTypeDefinition()));

                max--;
                if (max == 0) {
                    break;
                }
            }

            result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
            result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
        }

        if (!includePropertyDefinitions) {
            for (TypeDefinition type : result.getList()) {
                type.getPropertyDefinitions().clear();
View Full Code Here


            // result.add(getTypesDescendants(depth,
            // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions));
            // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID),
            // includePropertyDefinitions));
        } else {
            TypeDefinitionContainer tc = fTypes.get(typeId);
            if (tc != null) {
                result.add(getTypesDescendants(d, tc, ipd));
            }
        }
View Full Code Here

    /**
     * For internal use.
     */
    public TypeDefinition getType(String typeId) {
        TypeDefinitionContainer tc = fTypes.get(typeId);
        if (tc == null) {
            return null;
        }

        return tc.getTypeDefinition();
    }
View Full Code Here

    /**
     * CMIS getTypeDefinition.
     */
    public TypeDefinition getTypeDefinition(CallContext context, String typeId) {
        TypeDefinitionContainer tc = fTypes.get(typeId);
        if (tc == null) {
            throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
        }

        return copyTypeDefintion(tc.getTypeDefinition());
    }
View Full Code Here

        getRepositoryInfoFromStoreManager(repositoryId); // just to check if
        // repository
        // exists

        TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId);
        if (tc != null) {
            return tc.getTypeDefinition();
        } else
            throw new CmisObjectNotFoundException("unknown type id: " + typeId);
    }
View Full Code Here

            // spec says that depth must be ignored in this case
            Collection<TypeDefinitionContainer> tmp = fStoreManager.getTypeDefinitionList(repositoryId,
                    includePropertyDefinitions);
            result = new ArrayList<TypeDefinitionContainer>(tmp);
        } else {
            TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId, includePropertyDefinitions,
                    depth == null ? -1 : depth.intValue());
            if (tc == null)
                throw new CmisInvalidArgumentException("unknown type id: " + typeId);
            else
                result = tc.getChildren();
        }

        return result;
    }
View Full Code Here

            int depth) {
        TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
        if (null == typeManager)
            throw new RuntimeException("Unknown repository " + repositoryId);

        TypeDefinitionContainer tc = typeManager.getTypeById(typeId);
        List<TypeDefinitionContainer> result = null;

        if (tc != null) {
            if (depth == -1) {
                result = tc.getChildren();
                if (!includePropertyDefinitions)
                    cloneTypeList(depth - 1, false, result);
            } else if (depth == 0 || depth < -1)
                throw new CmisInvalidArgumentException("illegal depth value: " + depth);
            else {
                result = tc.getChildren();
                cloneTypeList(depth - 1, includePropertyDefinitions, result);
            }
        }
        return tc;
    }
View Full Code Here

     */
    private void cloneTypeList(int depth, boolean includePropertyDefinitions, List<TypeDefinitionContainer> types) {

        ListIterator<TypeDefinitionContainer> it = types.listIterator();
        while (it.hasNext()) {
            TypeDefinitionContainer tdc = it.next();
            AbstractTypeDefinition td = ((AbstractTypeDefinition) tdc.getTypeDefinition()).clone();
            if (!includePropertyDefinitions)
                td.setPropertyDefinitions(null);
            TypeDefinitionContainerImpl tdcClone = new TypeDefinitionContainerImpl(td);
            if (depth > 0) {
                ArrayList<TypeDefinitionContainer> children = new ArrayList<TypeDefinitionContainer>(tdc.getChildren()
                        .size());
                children.addAll(tdc.getChildren());
                tdcClone.setChildren(children);
                cloneTypeList(depth - 1, includePropertyDefinitions, children);
            }
            it.set(tdcClone);
        }
View Full Code Here

            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
    }

    protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
        String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
        if (typeDefC == null)
            throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");

        return typeDefC.getTypeDefinition();
    }
View Full Code Here

        return typeDefC.getTypeDefinition();
    }

    protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {

        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
        return typeDefC.getTypeDefinition();
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.