org.apache.chemistry.opencmis.commons.data.ObjectParentData Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.data.ObjectParentData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { checkRepositoryId(repositoryId); checkId("Object Id", objectId); includeAllowableActions = getDefaultFalse(includeAllowableActions); includeRelationships = getDefault(includeRelationships); renditionFilter = getDefaultRenditionFilter(renditionFilter); includeRelativePathSegment = getDefaultFalse(includeRelativePathSegment); try { return getWrappedService().getObjectParents(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #2
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 6 votes |
@Transactional public ObjectData getFolderParent(CmisRepositoryConfiguration config, String folderId, String filter, ExtensionsData extension, CallContext context, ObjectInfoHandler handler) { List<ObjectParentData> parentData = this.getObjectParents(config, folderId, filter, false, IncludeRelationships.NONE, null, false, extension, context, handler); if (parentData != null && parentData.size() > 0) { return parentData.get(0).getObject(); } return toObjectData(config, context, typeMap.get("cmis:folder"), new Root(), true, null, handler); }
Example #3
Source File: ContentCmisService.java From spring-content with Apache License 2.0 | 6 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { return bridge.getObjectParents(config, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension, this.getCallContext(), this); }
Example #4
Source File: LDCmisService.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { validateSession(); return getRepository().getObjectParents(getCallContext(), objectId, filter, includeAllowableActions, includeRelativePathSegment, this); }
Example #5
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { return service.getObjectParents(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension); }
Example #6
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 5 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { return getNavigationService().getObjectParents(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension); }
Example #7
Source File: IbisNavigationService.java From iaf with Apache License 2.0 | 5 votes |
@Override public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) { // TODO Auto-generated method stub return navigationService.getObjectParents(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension); }
Example #8
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
/** * CMIS getObjectParents * * @param context the call context * @param objectId identifier of the file/folder * @param filter an optional filter * @param includeAllowableActions if the allowable actions must be included * @param includeRelativePathSegment if the path segment must be included * @param objectInfos informations * * @return list of parents */ @SuppressWarnings("unchecked") public List<ObjectParentData> getObjectParents(CallContext context, String objectId, String filter, Boolean includeAllowableActions, Boolean includeRelativePathSegment, ObjectInfoHandler objectInfos) { debug("getObjectParents " + objectId + " " + filter); validatePermission(objectId, context, null); try { // split filter Set<String> filterCollection = splitFilter(filter); // set defaults if values not set boolean iaa = (includeAllowableActions == null ? false : includeAllowableActions.booleanValue()); boolean irps = (includeRelativePathSegment == null ? false : includeRelativePathSegment.booleanValue()); // get the file or folder PersistentObject object = getObject(objectId); // don't climb above the root folder if (root.equals(object)) return Collections.emptyList(); // set object info of the the object if (context.isObjectInfoRequired()) compileObjectType(context, object, null, false, false, objectInfos); Folder parent; if (object instanceof AbstractDocument) parent = ((AbstractDocument) object).getFolder(); else parent = folderDao.findFolder(((Folder) object).getParentId()); // get parent folder ObjectData obj = compileObjectType(context, parent, filterCollection, iaa, false, objectInfos); ObjectParentDataImpl result = new ObjectParentDataImpl(); result.setObject(obj); if (irps) { if (object instanceof Document) result.setRelativePathSegment(((Document) object).getFileName()); else result.setRelativePathSegment(((Folder) object).getName()); } return Collections.singletonList((ObjectParentData) result); } catch (Throwable t) { return (List<ObjectParentData>) catchError(t); } }
Example #9
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * MNT-14951: Test that the list of parents can be retrieved for a folder. */ @Test public void testCMISGetObjectParents() throws Exception { // setUp audit subsystem setupAudit(); AuthenticationUtil.pushAuthentication(); AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); try { final NodeRef folderWithTwoParents = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<NodeRef>() { @Override public NodeRef execute() throws Throwable { NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome(); String folder1 = GUID.generate(); FileInfo folderInfo1 = fileFolderService.create(companyHomeNodeRef, folder1, ContentModel.TYPE_FOLDER); assertNotNull(folderInfo1); String folder2 = GUID.generate(); FileInfo folderInfo2 = fileFolderService.create(companyHomeNodeRef, folder2, ContentModel.TYPE_FOLDER); assertNotNull(folderInfo2); // Create folder11 as a subfolder of folder1 String folder11 = GUID.generate(); FileInfo folderInfo11 = fileFolderService.create(folderInfo1.getNodeRef(), folder11, ContentModel.TYPE_FOLDER); assertNotNull(folderInfo11); // Add folder2 as second parent for folder11 nodeService.addChild(folderInfo2.getNodeRef(), folderInfo11.getNodeRef(), ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS); return folderInfo11.getNodeRef(); } }); withCmisService(new CmisServiceCallback<Void>() { @Override public Void execute(CmisService cmisService) { List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null); assertNotNull(repositories); assertTrue(repositories.size() > 0); String repositoryId = repositories.iterator().next().getId(); List<ObjectParentData> parents = cmisService.getObjectParents(repositoryId, folderWithTwoParents.getId(), null, Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null); // Check if the second parent was also returned. assertEquals(2, parents.size()); return null; } }, CmisVersion.CMIS_1_1); } finally { auditSubsystem.destroy(); AuthenticationUtil.popAuthentication(); } }
Example #10
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 4 votes |
@Transactional public List<ObjectParentData> getObjectParents(CmisRepositoryConfiguration config, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension, CallContext context, ObjectInfoHandler handler) { if (objectId.equals(getRootId())) { throw new CmisInvalidArgumentException("The root folder has no parent!"); } Set<String> filterCol = splitFilter(filter); Object object = getObjectInternal(config, objectId, filterCol, false, IncludeRelationships.NONE, renditionFilter, false, false, extension); String parentProperty = findParentProperty(object); BeanWrapper wrapper = new BeanWrapperImpl(object); Object parents = wrapper.getPropertyValue(parentProperty); if (parents == null) { return Collections.emptyList(); } if (context.isObjectInfoRequired()) { toObjectData(config, context, getType(object), object, false, filterCol, handler); } List<ObjectParentData> results = new ArrayList<>(); ObjectParentDataImpl result = new ObjectParentDataImpl(); // TODO: handle parents when it is a collection // result.setObject(toObjectData(config, context, typeMap.get("cmis:folder"), parents /* singleton only!*/, false, filterCol, handler)); if (includeRelativePathSegment) { result.setRelativePathSegment(getName(object)); } results.add(result); return results; }