Package org.apache.chemistry.opencmis.commons.impl.dataobjects

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl


    public static ObjectData getObjectDataQueryResult(TypeDefinition typeDef, StoredObject so, String user,
            Map<String, String> requestedProperties, Map<String, String> requestedFuncs,
            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter
            ) {

        ObjectDataImpl od = new ObjectDataImpl();

        // build properties collection
        Properties props = getPropertiesFromObject(so, typeDef, requestedProperties, requestedFuncs);

        // fill output object
        if (null != includeAllowableActions && includeAllowableActions) {
            AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(so, user);
            od.setAllowableActions(allowableActions);
        }

        if (null != includeRelationships && includeRelationships != IncludeRelationships.NONE) {
            od.setRelationships(DataObjectCreator.fillRelationships(includeRelationships, so));
        }

        if (renditionFilter != null && renditionFilter.length() > 0) {
            od.setRenditions(DataObjectCreator.fillRenditions(so));
        }

        od.setProperties(props);

        return od;
    }
View Full Code Here


    /**
     * Compiles an object type object from a file or folder.�
     */
    private ObjectData compileObjectType(CallContext context, File file, Set<String> filter,
            boolean includeAllowableActions, boolean includeAcl, boolean userReadOnly, ObjectInfoHandler objectInfos) {
        ObjectDataImpl result = new ObjectDataImpl();
        ObjectInfoImpl objectInfo = new ObjectInfoImpl();

        result.setProperties(compileProperties(file, filter, objectInfo));

        if (includeAllowableActions) {
            result.setAllowableActions(compileAllowableActions(file, userReadOnly));
        }

        if (includeAcl) {
            result.setAcl(compileAcl(file));
            result.setIsExactAcl(true);
        }

        if (context.isObjectInfoRequired()) {
            objectInfo.setObject(result);
            objectInfos.addObjectInfo(objectInfo);
View Full Code Here

        assertDataObjectsEquals("TypeDefinition", obj1, obj2);
    }

    public void testObject() throws Exception {
        // dry run
        ObjectDataImpl obj1 = new ObjectDataImpl();
        ObjectData obj2 = Converter.convert(Converter.convert(obj1));

        assertDataObjectsEquals("Object", obj1, obj2);
    }
View Full Code Here

    public static ObjectData convert(CmisObjectType object) {
        if (object == null) {
            return null;
        }

        ObjectDataImpl result = new ObjectDataImpl();

        result.setAcl(convert(object.getAcl(), object.isExactACL()));
        result.setAllowableActions(convert(object.getAllowableActions()));
        if (object.getChangeEventInfo() != null) {
            ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
            if (object.getChangeEventInfo().getChangeTime() != null) {
                changeEventInfo.setChangeTime(object.getChangeEventInfo().getChangeTime().toGregorianCalendar());
            }
            changeEventInfo.setChangeType(convert(ChangeType.class, object.getChangeEventInfo().getChangeType()));
            convertExtension(object.getChangeEventInfo(), changeEventInfo);

            result.setChangeEventInfo(changeEventInfo);
        }
        result.setIsExactAcl(object.isExactACL());
        result.setPolicyIds(convert(object.getPolicyIds()));
        result.setProperties(convert(object.getProperties()));
        List<ObjectData> relationships = new ArrayList<ObjectData>();
        for (CmisObjectType cmisObject : object.getRelationship()) {
            relationships.add(convert(cmisObject));
        }
        result.setRelationships(relationships);
        List<RenditionData> renditions = new ArrayList<RenditionData>();
        for (CmisRenditionType rendition : object.getRendition()) {
            renditions.add(convert(rendition));
        }
        result.setRenditions(renditions);

        // handle extensions
        convertExtension(object, result);

        return result;
View Full Code Here

        assertDataObjectsEquals("TypeDefinition", obj1, obj2);
    }

    public void testObject() throws Exception {
        // dry run
        ObjectDataImpl obj1 = new ObjectDataImpl();
        ObjectData obj2 = Converter.convert(Converter.convert(obj1));

        assertDataObjectsEquals("Object", obj1, obj2);
    }
View Full Code Here

        List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);

        for (StoredObject spo : children) {
            ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();
            ObjectDataImpl objectData = new ObjectDataImpl();
            if (includePathSegments != null && includePathSegments)
                oifd.setPathSegment(spo.getName());
            if (includeAllowableActions != null && includeAllowableActions) {
                AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
                objectData.setAllowableActions(allowableActions);
            }
            if (includeRelationships != null && includeRelationships != IncludeRelationships.NONE) {
                objectData.setRelationships(null /* f.getRelationships() */);
            }
            if (renditionFilter != null && renditionFilter.length() > 0) {
                objectData.setRelationships(null /*
                                                  * f.getRenditions(renditionFilter
                                                  * )
                                                  */);
            }

            TypeDefinition td = fStoreManager.getTypeById(repositoryId, spo.getTypeId()).getTypeDefinition();
            Properties props = PropertyCreationHelper.getPropertiesFromObject(spo, td, requestedIds, true);
            objectData.setProperties(props);

            oifd.setObject(objectData);
            folderList.add(oifd);
            // add additional information for Atom
            if (objectInfos != null) {
View Full Code Here

            MultiFiling multiParentObj = (MultiFiling) sop;
            List<Folder> parents = multiParentObj.getParents();
            if (null != parents)
                for (Folder parent : parents) {
                    ObjectParentDataImpl parentData = new ObjectParentDataImpl();
                    ObjectDataImpl objData = new ObjectDataImpl();
                    copyFilteredProperties(repositoryId, parent, filter, objData);
                    parentData.setObject(objData);
                    parentData.setRelativePathSegment(multiParentObj.getPathSegment());
                    result.add(parentData);
                    if (objectInfos != null) {
View Full Code Here

    }

    private ObjectData getFolderParentIntern(String repositoryId, SingleFiling sop, String filter,
            ObjectInfoHandler objectInfos) {

        ObjectDataImpl parent = new ObjectDataImpl();

        Folder parentFolder = sop.getParent();

        if (null == parentFolder) {
            return null;
View Full Code Here

    private void convertList(List<ObjectData> lod, ObjectInFolderContainer obj) {
        lod.add(obj.getObject().getObject());
        // add dummy event info
        ObjectData oif = obj.getObject().getObject();
        ObjectDataImpl oifImpl = (ObjectDataImpl) oif;
        ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
        changeEventInfo.setChangeType(ChangeType.UPDATED);
        changeEventInfo.setChangeTime(new GregorianCalendar());
        oifImpl.setChangeEventInfo(changeEventInfo);
        if (null != obj.getChildren()) {
            for (ObjectInFolderContainer oifc : obj.getChildren()) {
                convertList(lod, oifc);
            }
        }
View Full Code Here

   
   public static ObjectData getObjectData(TypeDefinition typeDef, StoredObject so, String filter, String user,
            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
            Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {

        ObjectDataImpl od = new ObjectDataImpl();

        if (so == null)
            throw new CmisObjectNotFoundException("Illegal object id: null");

        // build properties collection
        List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
        Properties props = getPropertiesFromObject(so, typeDef, requestedIds, true);

        // fill output object
        if (null != includeAllowableActions && includeAllowableActions) {
            AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(so, user);
            od.setAllowableActions(allowableActions);
        }
        if (null != includeACL && includeACL)
            od.setAcl(null);
        od.setIsExactAcl(true);

        if (null != includePolicyIds && includePolicyIds)
            od.setPolicyIds(DataObjectCreator.fillPolicyIds(so));

        if (null != includeRelationships && includeRelationships != IncludeRelationships.NONE)
            od.setRelationships(DataObjectCreator.fillRelationships(includeRelationships, so));

        if (renditionFilter != null && renditionFilter.length() > 0)
            od.setRenditions(DataObjectCreator.fillRenditions(so));

        od.setProperties(props);

        // Note: do not set change event info for this call
        return od;
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl

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.