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

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


        List<ObjectParentData> result = null;
        if (sop instanceof SingleFiling) {
            ObjectData parent = getFolderParentIntern(repositoryId, (SingleFiling) sop, filter, objectInfos);
            if (null != parent) {
                ObjectParentDataImpl parentData = new ObjectParentDataImpl();
                parentData.setObject(parent);
                String path = ((SingleFiling) sop).getPath();
                int beginIndex = path.lastIndexOf(Filing.PATH_SEPARATOR) + 1; // Note
                // :
                // if
                // /
                // not
                // found
                // results in 0
                String relPathSeg = path.substring(beginIndex, path.length());
                parentData.setRelativePathSegment(relPathSeg);
                result = Collections.singletonList((ObjectParentData) parentData);
            } else
                result = Collections.emptyList();
        } else if (sop instanceof MultiFiling) {
            result = new ArrayList<ObjectParentData>();
            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) {
                        ObjectInfoImpl objectInfo = new ObjectInfoImpl();
                        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parent, objectInfo);
                        objectInfos.addObjectInfo(objectInfo);
View Full Code Here


        return result;
    }

    private ObjectParentDataImpl processParentEntry(AtomEntry entry, String repositoryId) {
        ObjectParentDataImpl result = null;
        String relativePathSegment = null;

        lockLinks();
        try {
            // clean up cache
            removeLinks(repositoryId, entry.getId());

            // walk through the entry
            for (AtomElement element : entry.getElements()) {
                if (element.getObject() instanceof AtomLink) {
                    addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
                } else if (element.getObject() instanceof CmisObjectType) {
                    result = new ObjectParentDataImpl(convert((CmisObjectType) element.getObject()));
                } else if (is(NAME_RELATIVE_PATH_SEGMENT, element)) {
                    relativePathSegment = (String) element.getObject();
                }
            }
        } finally {
            unlockLinks();
        }

        if (result != null) {
            result.setRelativePathSegment(relativePathSegment);
        }

        return result;
    }
View Full Code Here

            // it's a feed
            AtomFeed feed = (AtomFeed) base;

            // walk through the feed
            for (AtomEntry entry : feed.getEntries()) {
                ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);

                if (objectParent != null) {
                    result.add(objectParent);
                }
            }
        } else if (base instanceof AtomEntry) {
            // it's an entry
            AtomEntry entry = (AtomEntry) base;

            ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);

            if (objectParent != null) {
                result.add(objectParent);
            }
        }
View Full Code Here

    public static ObjectParentData convert(CmisObjectParentsType objectParent) {
        if (objectParent == null) {
            return null;
        }

        ObjectParentDataImpl result = new ObjectParentDataImpl();

        result.setObject(convert(objectParent.getObject()));
        result.setRelativePathSegment(objectParent.getRelativePathSegment());

        // handle extensions
        convertExtension(objectParent, result);

        return result;
View Full Code Here

        List<ObjectParentData> result = null;
        if (sop instanceof SingleFiling) {
            ObjectData parent = getFolderParentIntern(repositoryId, (SingleFiling) sop, filter, objectInfos);
            if (null != parent) {
                ObjectParentDataImpl parentData = new ObjectParentDataImpl();
                parentData.setObject(parent);
                String path = ((SingleFiling) sop).getPath();
                int beginIndex = path.lastIndexOf(Filing.PATH_SEPARATOR) + 1; // Note
                // :
                // if
                // /
                // not
                // found
                // results in 0
                String relPathSeg = path.substring(beginIndex, path.length());
                parentData.setRelativePathSegment(relPathSeg);
                result = Collections.singletonList((ObjectParentData) parentData);
            } else {
                result = Collections.emptyList();
            }
        } else if (sop instanceof MultiFiling) {
            result = new ArrayList<ObjectParentData>();
            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) {
                        ObjectInfoImpl objectInfo = new ObjectInfoImpl();
                        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parent, objectInfo);
                        objectInfos.addObjectInfo(objectInfo);
View Full Code Here

        // get parent
        JcrNode parent = jcrNode.getParent();
        ObjectData object = parent.compileObjectType(splitFilter(filter), includeAllowableActions, objectInfos,
                requiresObjectInfo);

        ObjectParentDataImpl result = new ObjectParentDataImpl();
        result.setObject(object);
        if (Boolean.TRUE.equals(includeRelativePathSegment)) {
            result.setRelativePathSegment(parent.getName());
        }

        return Collections.singletonList((ObjectParentData) result);
    }
View Full Code Here

        // get parent folder
        File parent = file.getParentFile();
        ObjectData object = compileObjectType(context, parent, filterCollection, iaa, false, userReadOnly, objectInfos);

        ObjectParentDataImpl result = new ObjectParentDataImpl();
        result.setObject(object);
        if (irps) {
            result.setRelativePathSegment(file.getName());
        }

        return Collections.singletonList((ObjectParentData) result);
    }
View Full Code Here

            // it's a feed
            AtomFeed feed = (AtomFeed) base;

            // walk through the feed
            for (AtomEntry entry : feed.getEntries()) {
                ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);

                if (objectParent != null) {
                    result.add(objectParent);
                }
            }
        } else if (base instanceof AtomEntry) {
            // it's an entry
            AtomEntry entry = (AtomEntry) base;

            ObjectParentDataImpl objectParent = processParentEntry(entry, repositoryId);

            if (objectParent != null) {
                result.add(objectParent);
            }
        }
View Full Code Here

        return result;
    }

    private ObjectParentDataImpl processParentEntry(AtomEntry entry, String repositoryId) {
        ObjectParentDataImpl result = null;
        String relativePathSegment = null;

        lockLinks();
        try {
            // clean up cache
            removeLinks(repositoryId, entry.getId());

            // walk through the entry
            for (AtomElement element : entry.getElements()) {
                if (element.getObject() instanceof AtomLink) {
                    addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
                } else if (element.getObject() instanceof CmisObjectType) {
                    result = new ObjectParentDataImpl(convert((CmisObjectType) element.getObject()));
                } else if (is(NAME_RELATIVE_PATH_SEGMENT, element)) {
                    relativePathSegment = (String) element.getObject();
                }
            }
        } finally {
            unlockLinks();
        }

        if (result != null) {
            result.setRelativePathSegment(relativePathSegment);
        }

        return result;
    }
View Full Code Here

    public static ObjectParentData convert(CmisObjectParentsType objectParent) {
        if (objectParent == null) {
            return null;
        }

        ObjectParentDataImpl result = new ObjectParentDataImpl();

        result.setObject(convert(objectParent.getObject()));
        result.setRelativePathSegment(objectParent.getRelativePathSegment());

        // handle extensions
        convertExtension(objectParent, result);

        return result;
View Full Code Here

TOP

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

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.