Search in sources :

Example 1 with ObjectParentDataImpl

use of org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectParentDataImpl in project structr by structr.

the class CMISNavigationService method getObjectParents.

@Override
public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String propertyFilter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) {
    final App app = StructrApp.getInstance();
    try (final Tx tx = app.tx()) {
        final List<ObjectParentData> data = new LinkedList<>();
        final AbstractFile graphObject = app.get(AbstractFile.class, objectId);
        final Folder parent = graphObject.getParent();
        final ObjectData element = parent != null ? CMISObjectWrapper.wrap(parent, propertyFilter, includeAllowableActions) : new CMISRootFolder(propertyFilter, includeAllowableActions);
        final ObjectParentDataImpl impl = new ObjectParentDataImpl(element);
        impl.setRelativePathSegment(graphObject.getProperty(AbstractNode.name));
        data.add(impl);
        tx.success();
        return data;
    } catch (Throwable t) {
        logger.warn("", t);
    }
    return null;
}
Also used : StructrApp(org.structr.core.app.StructrApp) App(org.structr.core.app.App) ObjectParentData(org.apache.chemistry.opencmis.commons.data.ObjectParentData) AbstractFile(org.structr.web.entity.AbstractFile) Tx(org.structr.core.graph.Tx) ObjectData(org.apache.chemistry.opencmis.commons.data.ObjectData) CMISRootFolder(org.structr.files.cmis.repository.CMISRootFolder) CMISRootFolder(org.structr.files.cmis.repository.CMISRootFolder) Folder(org.structr.web.entity.Folder) ObjectParentDataImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectParentDataImpl) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 ObjectData (org.apache.chemistry.opencmis.commons.data.ObjectData)1 ObjectParentData (org.apache.chemistry.opencmis.commons.data.ObjectParentData)1 ObjectParentDataImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectParentDataImpl)1 App (org.structr.core.app.App)1 StructrApp (org.structr.core.app.StructrApp)1 Tx (org.structr.core.graph.Tx)1 CMISRootFolder (org.structr.files.cmis.repository.CMISRootFolder)1 AbstractFile (org.structr.web.entity.AbstractFile)1 Folder (org.structr.web.entity.Folder)1