Package org.apache.chemistry.opencmis.client.api

Examples of org.apache.chemistry.opencmis.client.api.ObjectType


    public void testTypes() {
        String documentBaseId = "cmis:document";
        String folderBaseId = "cmis:folder";

        // check document type definition
        ObjectType documentType = getSession().getTypeDefinition(documentBaseId);
        checkBaseType(documentBaseId, BaseTypeId.CMIS_DOCUMENT, documentType);

        // check folder type definition
        ObjectType folderType = getSession().getTypeDefinition(folderBaseId);
        checkBaseType(folderBaseId, BaseTypeId.CMIS_FOLDER, folderType);

        // get base types via getTypesChildren
        ItemIterable<ObjectType> baseTypes = getSession().getTypeChildren(null, true);
        assertNotNull(baseTypes);
View Full Code Here


    }

    private List<ObjectType> getAllTypes(String baseType) {
        logger.info("Getting all types");
        List<ObjectType> ret = new ArrayList<ObjectType>();
        ObjectType baseTypeObj = null;
        try {
            baseTypeObj = session.getTypeDefinition(baseType);
        } catch (CmisObjectNotFoundException e) {
            logger.warn("Type not found " + baseType);
            return ret;
        } catch (CmisInvalidArgumentException e) {
            logger.warn("Invalid base type: {}", baseType);
            return ret;
        }
        List<Tree<ObjectType>> types = baseTypeObj.getDescendants(DESCENDANT_DEPTH);
        List<ObjectType> objTypes = new ArrayList<ObjectType>();
        for (Tree<ObjectType> typeTree : types) {
            objTypes.addAll(accumulateTypesOnTree(typeTree));

        }
View Full Code Here

            }
        }

        // for each parent id create a superclass relation
        for (ObjectType type : objectTypes) {
            ObjectType parentType = type.getParentType();
            if (parentType != null) {
                OntClass klass = orh.createOntClassByObjectTypeDefinition(CMISModelMapper
                        .getObjectTypeDefinition(type));
                OntClass parentClass = orh.createOntClassByObjectTypeDefinition(CMISModelMapper
                        .getObjectTypeDefinition(parentType));
View Full Code Here

        }
        // Create super property relations
        for (RelationshipType relType : relationshipTypes) {
            OntProperty prop = orh.getPropertyByReference(relType.getId());
            ObjectType parentType = relType.getParentType();
            if (parentType != null) {
                // TODO Check if parent type is correctly resolved to an ont class
                OntProperty parentProp = orh.getPropertyByReference(parentType.getId());
                prop.addSuperProperty(parentProp);
            }
        }
    }
View Full Code Here

    @Override
    public List<PropertyDefinition> getPropertyDefinitions(ObjectTypeDefinition instance, Object session) throws RepositoryAccessException {
        try {
            Session cmisSession = checkSession(session);
            ObjectType objectType = cmisSession.getTypeDefinition(instance.getUniqueRef());
            CMISModelMapper.fillPropertyDefinitions(instance, objectType);
            return instance.getPropertyDefinition();
        } catch (CmisBaseException e) {
            throw new RepositoryAccessException("Error at accessing repository", e);
        }
View Full Code Here

    @Override
    public List<ObjectTypeDefinition> getParentTypeDefinitions(ObjectTypeDefinition instance, Object session) throws RepositoryAccessException {
        try {
            Session cmisSession = checkSession(session);
            ObjectType type = cmisSession.getTypeDefinition(instance.getUniqueRef());
            List<ObjectTypeDefinition> typeDefinitions = new ArrayList<ObjectTypeDefinition>();
            ObjectType parentTypeDef = type.getParentType();
            while (parentTypeDef != null) {
                typeDefinitions.add(CMISModelMapper.getObjectTypeDefinition(parentTypeDef));
                parentTypeDef = parentTypeDef.getParentType();
            }

            return typeDefinitions;
        } catch (CmisBaseException e) {
            throw new RepositoryAccessException("Error at accessing repository", e);
View Full Code Here

                                                                    Object session) throws RepositoryAccessException {
        try {
            Session cmisSession = checkSession(session);
            CmisObject node = cmisSession.getObject(CMISObjectId.getObjectId(instance.getUniqueRef()));
            if (node instanceof ObjectType) {
                ObjectType type = (ObjectType) node;
                CMISModelMapper.fillChildObjectTypeDefinitions(instance, type);
                return instance.getObjectTypeDefinition();
            } else {
                throw new RepositoryAccessException("No object type with id " + instance.getUniqueRef());
            }
View Full Code Here

        ObjectTypeDefinition otd = new ObjectTypeDefinition();
        otd.setLocalname(typeDef.getLocalName());
        otd.setNamespace(typeDef.getLocalNamespace());
        otd.setUniqueRef(typeDef.getId());
        // Resolve super types recursively
        ObjectType parentType = typeDef.getParentType();
        while (parentType != null) {
            otd.getParentRef().add(parentType.getId());
            parentType = parentType.getParentType();
        }
        return otd;

    }
View Full Code Here

    }

    public static void fillChildObjectTypeDefinitions(ObjectTypeDefinition instance, ObjectType type) {
        Iterator<ObjectType> children = type.getChildren().iterator();
        while (children.hasNext()) {
            ObjectType child = children.next();
            instance.getObjectTypeDefinition().add(getObjectTypeDefinition(child));
        }
    }
View Full Code Here

        properties.put(PropertyIds.SOURCE_ID, document1.getId());
        properties.put(PropertyIds.TARGET_ID, document2.getId());

        ObjectId id = this.session.createRelationship(properties, null, null, null);

        ObjectType ot = document1.getType();
        ItemIterable<Relationship> relations = document1.getRelationships(true, RelationshipDirection.EITHER, ot,
                this.session.getDefaultContext());
        for (Relationship r : relations) {
            assertNotNull(r);
            assertEquals(id, r.getId());
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.api.ObjectType

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.