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

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


     */
    private List<Tree<ObjectType>> convertTypeDescendants(List<TypeDefinitionContainer> descendantsList) {
        List<Tree<ObjectType>> result = new ArrayList<Tree<ObjectType>>();

        for (TypeDefinitionContainer container : descendantsList) {
            ObjectType objectType = objectFactory.convertTypeDefinition(container.getTypeDefinition());
            List<Tree<ObjectType>> children = convertTypeDescendants(container.getChildren());

            result.add(new TreeImpl<ObjectType>(objectType, children));
        }

View Full Code Here


        if ((source == null) || (source.getId() == null)) {
            throw new IllegalArgumentException("Source must be set!");
        }

        // get the type of the source document
        ObjectType type = null;
        if (source instanceof CmisObject) {
            type = ((CmisObject) source).getType();
        } else {
            CmisObject sourceObj = getObject(source);
            type = sourceObj.getType();
        }

        if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
            throw new IllegalArgumentException("Source object must be a document!");
        }

        String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(),
                objectFactory.convertProperties(properties, type, CREATE_UPDATABILITY),
View Full Code Here

        List<ObjectType> result = new ArrayList<ObjectType>();

        List<Tree<ObjectType>> types = clientSession.getSession().getTypeDescendants(rootTypeId, -1, false);
        addType(types, result);

        ObjectType rootType = clientSession.getSession().getTypeDefinition(rootTypeId);
        boolean isCreatable = (rootType.isCreatable() == null ? true : rootType.isCreatable().booleanValue());
        if (isCreatable) {
            result.add(rootType);
        }

        Collections.sort(result, new Comparator<ObjectType>() {
View Full Code Here

    public CmisObject convertObject(ObjectData objectData, OperationContext context) {
        if (objectData == null) {
            throw new IllegalArgumentException("Object data is null!");
        }

        ObjectType type = getTypeFromObjectData(objectData);

        /* determine type */
        switch (objectData.getBaseTypeId()) {
        case CMIS_DOCUMENT:
            return new DocumentImpl((SessionImpl) this.session, type, objectData, context);
View Full Code Here

        objectOperationContext = new ClientOperationContext(OBJECT_PREFIX, sessionParameters);

        // folder operation context
        if (!sessionParameters.containsKey(FOLDER_PREFIX + ClientOperationContext.FILTER)) {
            ObjectType type = session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());

            StringBuilder filter = new StringBuilder();
            for (String propId : PROPERTY_SET) {
                PropertyDefinition<?> propDef = type.getPropertyDefinitions().get(propId);
                if (propDef != null) {
                    if (filter.length() > 0) {
                        filter.append(",");
                    }
                    filter.append(propDef.getQueryName());
View Full Code Here

public abstract class AbstractReadOnlyTypeIT extends AbstractSessionTest {

    @Test
    public void readOptionalBaseTypePolicy() {
        try {
            ObjectType otd = this.session.getTypeDefinition(ObjectType.POLICY_BASETYPE_ID);
            Assert.assertTrue(otd instanceof PolicyType);
            Assert.assertEquals(ObjectType.POLICY_BASETYPE_ID, otd.getId());
            Assert.assertEquals(null, otd.getBaseType());
        } catch (CmisObjectNotFoundException e) {
            // policies not supported
        }
    }
View Full Code Here

    }

    @Test
    public void readOptionalBaseTypeRelation() {
        try {
            ObjectType otd = this.session.getTypeDefinition(ObjectType.RELATIONSHIP_BASETYPE_ID);
            Assert.assertNotNull(otd);
            Assert.assertTrue(otd instanceof RelationshipType);
            Assert.assertEquals(ObjectType.RELATIONSHIP_BASETYPE_ID, otd.getId());
            Assert.assertEquals(null, otd.getBaseType());
        } catch (CmisObjectNotFoundException e) {
            // policies not supported
        }
    }
View Full Code Here

        }
    }

    @Test
    public void readBaseTypeDocument() {
        ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
        Assert.assertNotNull(otd);
        Assert.assertTrue(otd instanceof DocumentType);
        Assert.assertEquals(ObjectType.DOCUMENT_BASETYPE_ID, otd.getId());
        Assert.assertEquals(null, otd.getBaseType());

    }
View Full Code Here

    }

    @Test
    public void readBaseTypeFolder() {
        ObjectType otf = this.session.getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
        Assert.assertNotNull(otf);
        Assert.assertTrue(otf instanceof FolderType);
        Assert.assertEquals(ObjectType.FOLDER_BASETYPE_ID, otf.getId());
        Assert.assertEquals(null, otf.getBaseType());
    }
View Full Code Here

        Assert.assertEquals(null, otf.getBaseType());
    }

    @Test
    public void readTypeChildrenDocument() {
        ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
        Assert.assertNotNull(otd);
        this.session.getDefaultContext().setMaxItemsPerPage(2);
        ItemIterable<ObjectType> pc = this.session.getTypeChildren(otd.getId(), true);
        Assert.assertNotNull(pc);

        for (ObjectType ot1 : pc) {
            ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
            Assert.assertEquals(ot1.getId(), ot2.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.