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

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


    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


    /**
     * 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

   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 = so.getAllowableActions(user);
            od.setAllowableActions(allowableActions);
        }
       
        if (null != includeACL && includeACL) {
            od.setAcl(so.getAcl());
        }
        od.setIsExactAcl(true);

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

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

        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

    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);
          AllowableActions allowableActions = so.getAllowableActions(user);
            od.setAllowableActions(allowableActions);
        }

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

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

        od.setProperties(props);

        return od;
    }
View Full Code Here

    private ObjectData getFolderParentIntern(String repositoryId, SingleFiling sop, String filter,
        Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String user, ObjectInfoHandler objectInfos) {

        ObjectDataImpl parent = new ObjectDataImpl();

        Folder parentFolder = sop.getParent();

        if (null == parentFolder) {
            return null;
        }

        copyFilteredProperties(repositoryId, parentFolder, filter, parent);
       
        parent.setRelationships(DataObjectCreator.getRelationships(includeRelationships, parentFolder, user));
       
        if (includeAllowableActions != null && includeAllowableActions) {
            //  AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
            AllowableActions allowableActions = parentFolder.getAllowableActions(user);
            parent.setAllowableActions(allowableActions);
          }
       
        if (objectInfos != null) {
            ObjectInfoImpl objectInfo = new ObjectInfoImpl();
            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parentFolder, objectInfo);
View Full Code Here

    private ObjectData getFolderParentIntern(String repositoryId, SingleFiling sop, String filter,
        Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String user, ObjectInfoHandler objectInfos) {

        ObjectDataImpl parent = new ObjectDataImpl();

        Folder parentFolder = sop.getParent();

        if (null == parentFolder) {
            return null;
        }

        copyFilteredProperties(repositoryId, parentFolder, filter, parent);
       
        parent.setRelationships(DataObjectCreator.getRelationships(includeRelationships, parentFolder, user));
       
        if (includeAllowableActions != null && includeAllowableActions) {
            //  AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
            AllowableActions allowableActions = parentFolder.getAllowableActions(user);
            parent.setAllowableActions(allowableActions);
          }
       
        if (objectInfos != null) {
            ObjectInfoImpl objectInfo = new ObjectInfoImpl();
            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parentFolder, objectInfo);
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 = so.getAllowableActions(user);
            od.setAllowableActions(allowableActions);
        }

        if (null != includeACL && includeACL) {
            Acl acl = so instanceof DocumentVersion ? ((DocumentVersion) so).getParentDocument().getAcl() : so.getAcl();
            od.setAcl(acl);
        }
        od.setIsExactAcl(true);

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

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

        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

    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);
            AllowableActions allowableActions = so.getAllowableActions(user);
            od.setAllowableActions(allowableActions);
        }

        od.setAcl(so.getAcl());
        od.setIsExactAcl(true);

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

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

        od.setProperties(props);

        return od;
    }
View Full Code Here

    public static ObjectData convertObject(Map<String, Object> json) {
        if (json == null) {
            return null;
        }

        ObjectDataImpl result = new ObjectDataImpl();

        result.setAcl(convertAcl(getMap(json.get(JSON_OBJECT_ACL)), getBoolean(json, JSON_OBJECT_EXACT_ACL)));
        result.setAllowableActions(convertAllowableActions(getMap(json.get(JSON_OBJECT_ALLOWABLE_ACTIONS))));
        Map<String, Object> jsonChangeEventInfo = getMap(json.get(JSON_OBJECT_CHANGE_EVENT_INFO));
        if (jsonChangeEventInfo != null) {
            ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();

            changeEventInfo.setChangeTime(getDateTime(jsonChangeEventInfo, JSON_CHANGE_EVENT_TIME));
            changeEventInfo.setChangeType(getEnum(jsonChangeEventInfo, JSON_CHANGE_EVENT_TYPE, ChangeType.class));

            convertExtension(json, result, CHANGE_EVENT_KEYS);

            result.setChangeEventInfo(changeEventInfo);
        }
        result.setIsExactAcl(getBoolean(json, JSON_OBJECT_EXACT_ACL));
        result.setPolicyIds(convertPolicyIds(getList(json.get(JSON_OBJECT_POLICY_IDS))));
        result.setProperties(convertProperties(getMap(json.get(JSON_OBJECT_PROPERTIES))));
        List<Object> jsonRelationships = getList(json.get(JSON_OBJECT_RELATIONSHIPS));
        if (jsonRelationships != null) {
            result.setRelationships(convertObjects(jsonRelationships));
        }
        List<Object> jsonRenditions = getList(json.get(JSON_OBJECT_RENDITIONS));
        if (jsonRenditions != null) {
            result.setRenditions(convertRenditions(jsonRenditions));
        }

        convertExtension(json, result, OBJECT_KEYS);

        return result;
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

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.