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

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


    private TypeDefinition getSecondaryTypeDefinition(String repositoryId, Set<String> secondaryTypeIds, String propertyId) {
        if (null == secondaryTypeIds || secondaryTypeIds.isEmpty())
            return null;
       
        for (String typeId : secondaryTypeIds) {
            TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
            TypeDefinition typeDef = typeDefC.getTypeDefinition();

            if (TypeValidator.typeContainsProperty(typeDef, propertyId)) {
                return typeDef;
            }
        }
View Full Code Here


        // calculate delta to be removed
        List<String> existingSecondaryTypeIds = so.getSecondaryTypeIds();
        List<String> delta = new ArrayList<String>(existingSecondaryTypeIds);
        delta.removeAll(newSecondaryTypeIds);
        for (String typeDefId : delta) {
            TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeDefId);
            TypeDefinition typeDef = typeDefC.getTypeDefinition();
            propertiesToDelete.addAll(typeDef.getPropertyDefinitions().keySet());
        }

        // TODO: the list may contain too many properties, if the same property is also in a type not to be removed
        return propertiesToDelete;
View Full Code Here

    protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
        if (null == properties)
            return null;
       
        String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
        if (typeDefC == null) {
            throw new CmisInvalidArgumentException("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 == null ? null : typeDefC.getTypeDefinition();
    }
View Full Code Here

    public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
            ExtensionsData extension) {

        validator.getTypeDefinition(context, repositoryId, typeId, extension);

        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,
                    inclPropDefs);
            result = new ArrayList<TypeDefinitionContainer>(tmp);
        } else {
            TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId, inclPropDefs,
                    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

        String typeId = type.getId();
        TypeManagerCreatable typeManager = fStoreManager.getTypeManager(repositoryId);
        if (null == typeManager)
            throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
       
        TypeDefinitionContainer typeDefC = typeManager.getTypeById(typeId);
        if (null == typeDefC)
            throw new CmisInvalidArgumentException("Cannot update type unknown type id: " + typeId);

        typeManager.updateTypeDefinition(type);
        return type;
View Full Code Here

       
        TypeManagerCreatable typeManager = fStoreManager.getTypeManager(repositoryId);
        if (null == typeManager)
            throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
       
        TypeDefinitionContainer typeDefC = typeManager.getTypeById(typeId);
        if (null == typeDefC)
            throw new CmisInvalidArgumentException("Cannot delete type unknown type id: " + typeId);

        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
        if (objectStore.isTypeInUse(typeId)) {
View Full Code Here

    public void addTypeDefinition(TypeDefinition cmisType) {
       
        TypeDefinitionContainerImpl typeContainer = new TypeDefinitionContainerImpl(cmisType);

        // add new type to children of parent types
        TypeDefinitionContainer parentTypeContainer = fTypesMap.get(cmisType.getParentTypeId());
        parentTypeContainer.getChildren().add(typeContainer);

        // recursively add inherited properties
        Map<String, PropertyDefinition<?>> propDefs = typeContainer.getTypeDefinition().getPropertyDefinitions();
        addInheritedProperties(propDefs, parentTypeContainer.getTypeDefinition());

        LOG.info("Adding type definition with name " + cmisType.getLocalName() + " and id "
                + cmisType.getId() + " to repository.");
        // add type to type map
        fTypesMap.put(cmisType.getId(), typeContainer);
View Full Code Here

         {
            addInheritedPropertyDefinitions(propDefs, typeDefinition.getPropertyDefinitions());
        // propDefs.putAll(typeDefinition.getPropertyDefinitions());
        }

        TypeDefinitionContainer parentTypeContainer = fTypesMap.get(typeDefinition.getParentTypeId());
        TypeDefinition parentType = (null == parentTypeContainer ? null : parentTypeContainer.getTypeDefinition());
        addInheritedProperties(propDefs, parentType);
    }
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.