use of org.apache.chemistry.opencmis.commons.data.ObjectParentData 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;
}
use of org.apache.chemistry.opencmis.commons.data.ObjectParentData in project copper-cms by PogeyanOSS.
the class NavigationActor method getParents.
private JSONArray getParents(QueryGetRequest request) throws CmisRuntimeException {
String permission = request.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "get")) {
throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
}
String objectId = request.getObjectId();
String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
Boolean includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
IncludeRelationships includeRelationships = request.getEnumParameter(QueryGetRequest.PARAM_RELATIONSHIPS, IncludeRelationships.class);
String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
Boolean includeRelativePathSegment = request.getBooleanParameter(QueryGetRequest.PARAM_RELATIVE_PATH_SEGMENT);
boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
List<ObjectParentData> parents = CmisNavigationService.Impl.getObjectParents(request.getRepositoryId(), objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null, request.getUserObject().getUserDN());
if (parents == null) {
throw new CmisRuntimeException("Parents are null!");
}
JSONArray jsonParents = new JSONArray();
for (ObjectParentData parent : parents) {
jsonParents.add(JSONConverter.convert(parent, CmisTypeCacheService.get(request.getRepositoryId()), succinct, dateTimeFormat));
}
return jsonParents;
}
use of org.apache.chemistry.opencmis.commons.data.ObjectParentData in project copper-cms by PogeyanOSS.
the class OperationContextTest method runLowLevelApiTests.
/**
* Checks for change events and path segments.
*/
public void runLowLevelApiTests(Session session, Folder testFolder, Document testDocument) {
CmisTestResult f;
String repositoryId = session.getRepositoryInfo().getId();
String filter = "cmis:objectId,cmis:baseTypeId,cmis:objectTypeId";
// get the object
ObjectData doc1 = session.getBinding().getObjectService().getObject(repositoryId, testDocument.getId(), filter, Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, null);
// check for change events
f = createResult(CmisTestResultStatus.WARNING, "getObject() delivered a change event, which doesn't make sense.");
addResult(assertNull(doc1.getChangeEventInfo(), null, f));
// get the test folder children
ObjectInFolderList children = session.getBinding().getNavigationService().getChildren(repositoryId, testFolder.getId(), filter, null, Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null, BigInteger.ZERO, null);
// check for path segments
for (ObjectInFolderData child : children.getObjects()) {
f = createResult(CmisTestResultStatus.WARNING, "getChildren() delivered a path segment, although it hasn't been requested.");
addResult(assertNull(child.getPathSegment(), null, f));
}
// get the document parent
List<ObjectParentData> parents = session.getBinding().getNavigationService().getObjectParents(repositoryId, testDocument.getId(), filter, Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null);
// check for relative path segments
for (ObjectParentData parent : parents) {
f = createResult(CmisTestResultStatus.WARNING, "getObjectParents() delivered a relative path segment, although it hasn't been requested.");
addResult(assertNull(parent.getRelativePathSegment(), null, f));
}
}
Aggregations