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

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


        return session.getObjectByPath(path);
    }

    public boolean isObjectTypeVersionable(String objectType) {
        if (CamelCMISConstants.CMIS_DOCUMENT.equals(objectType)) {
            ObjectType typeDefinition = session.getTypeDefinition(objectType);
            return ((DocumentType)typeDefinition).isVersionable();
        }
        return false;
    }
View Full Code Here


        return session.getObjectByPath(path);
    }

    public boolean isObjectTypeVersionable(String objectType) {
        if (CamelCMISConstants.CMIS_DOCUMENT.equals(objectType)) {
            ObjectType typeDefinition = session.getTypeDefinition(objectType);
            return ((DocumentType)typeDefinition).isVersionable();
        }
        return false;
    }
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

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

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

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

View Full Code Here

     * object and puts it into the cache.
     */
    private ObjectType convertTypeDefinition(TypeDefinition typeDefinition) {
        lock.writeLock().lock();
        try {
            ObjectType result = null;
            if (objectTypeCache == null) {
                objectTypeCache = new IdentityHashMap<TypeDefinition, ObjectType>();
            } else {
                result = objectTypeCache.get(typeDefinition);
            }
View Full Code Here

            statement.append('*');
        } else {
            statement.append(select);
        }

        final ObjectType type = getTypeDefinition(typeId);
        statement.append(" FROM ");
        statement.append(type.getQueryName());

        if (where != null && where.trim().length() > 0) {
            statement.append(" WHERE ");
            statement.append(where);
        }
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;
        List<SecondaryType> secondaryTypes = null;
        if (source instanceof CmisObject) {
            type = ((CmisObject) source).getType();
            secondaryTypes = ((CmisObject) source).getSecondaryTypes();
        } else {
            CmisObject sourceObj = getObject(source);
            type = sourceObj.getType();
            secondaryTypes = sourceObj.getSecondaryTypes();
        }

        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, secondaryTypes, CREATE_AND_CHECKOUT_UPDATABILITY),
View Full Code Here

        if (isNullOrEmpty(properties)) {
            throw new IllegalArgumentException("Objects must be set!");
        }

        ObjectType objectType = null;
        Map<String, SecondaryType> secondaryTypes = new HashMap<String, SecondaryType>();

        // gather secondary types
        if (addSecondaryTypeIds != null) {
            for (String stid : addSecondaryTypeIds) {
                ObjectType secondaryType = getTypeDefinition(stid);

                if (!(secondaryType instanceof SecondaryType)) {
                    throw new IllegalArgumentException("Secondary types contains a type that is not a secondary type: "
                            + secondaryType.getId());
                }

                secondaryTypes.put(secondaryType.getId(), (SecondaryType) secondaryType);
            }
        }

        // gather ids and change tokens
        List<BulkUpdateObjectIdAndChangeToken> objectIdsAndChangeTokens = new ArrayList<BulkUpdateObjectIdAndChangeToken>();
        for (CmisObject object : objects) {
            if (object == null) {
                continue;
            }

            objectIdsAndChangeTokens.add(new BulkUpdateObjectIdAndChangeTokenImpl(object.getId(), object
                    .getChangeToken()));

            if (objectType == null) {
                objectType = object.getType();
            }

            if (object.getSecondaryTypes() != null) {
                for (SecondaryType secondaryType : object.getSecondaryTypes()) {
                    secondaryTypes.put(secondaryType.getId(), secondaryType);
                }
            }
        }

        Set<Updatability> updatebility = EnumSet.noneOf(Updatability.class);
View Full Code Here

                            .get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
                    if (isNotEmpty(stids)) {
                        secondaryTypes = new ArrayList<SecondaryType>();
                        for (String stid : stids) {
                            if (stid != null) {
                                ObjectType type = session.getTypeDefinition(stid);
                                if (type instanceof SecondaryType) {
                                    secondaryTypes.add((SecondaryType) type);
                                }
                            }
                        }
View Full Code Here

        String cmisObjectTypeName = nodes.findCmisName(jcrNodeType);

        Folder parent = (Folder)session.getObject(parentId);

        // Ivan, we can pick up object type and prperty definition map from CMIS repo
        ObjectType objectType = session.getTypeDefinition(cmisObjectTypeName);
        Map<String, PropertyDefinition<?>> propDefs = objectType.getPropertyDefinitions();

        // assign mandatory properties
        Collection<PropertyDefinition<?>> list = propDefs.values();
        for (PropertyDefinition<?> pdef : list) {
            if (pdef.isRequired()) {
                params.put(pdef.getId(), "");
            }
        }

        String path = parent.getPath() + "/" + name.getLocalName();

        // assign(override) 100% mandatory properties
        params.put(PropertyIds.OBJECT_TYPE_ID, objectType.getId());
        params.put(PropertyIds.NAME, name.getLocalName());

        // create object and id for it.
        switch (objectType.getBaseTypeId()) {
            case CMIS_FOLDER:
                params.put(PropertyIds.PATH, path);
                return ObjectId.toString(ObjectId.Type.OBJECT, parent.createFolder(params).getId());
            case CMIS_DOCUMENT:
                return ObjectId.toString(ObjectId.Type.OBJECT, parent.createDocument(params, null, VersioningState.NONE).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.