Java Code Examples for org.apache.chemistry.opencmis.commons.server.CallContext#isObjectInfoRequired()
The following examples show how to use
org.apache.chemistry.opencmis.commons.server.CallContext#isObjectInfoRequired() .
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: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 7 votes |
/** * Compiles an object type object from a document or folder * * @param context the call context * @param object the persistent object * @param filter optional filter * @param includeAllowableActions if the allowable actions must be included * @param includeAcl if the ACL must be included * @param objectInfos informations * * @return the object */ private ObjectData compileObjectType(CallContext context, PersistentObject object, Set<String> filter, boolean includeAllowableActions, boolean includeAcl, ObjectInfoHandler objectInfos) { ObjectDataImpl result = new ObjectDataImpl(); ObjectInfoImpl objectInfo = new ObjectInfoImpl(); result.setProperties(compileProperties(object, filter, objectInfo)); if (includeAllowableActions) { result.setAllowableActions(compileAllowableActions(object)); } if (includeAcl) { result.setAcl(compileAcl(object)); result.setIsExactAcl(true); } if ((context != null) && context.isObjectInfoRequired() && (objectInfos != null)) { objectInfo.setObject(result); // objectInfo.setVersionSeriesId(getId(object)); objectInfos.addObjectInfo(objectInfo); } return result; }
Example 2
Source File: CmisRepository.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Compiles an object type object from a file or folder. */ private ObjectData compileObjectType(CallContext context, Node node, Set<String> filter, boolean includeAllowableActions, boolean includeAcl, ObjectInfoHandler objectInfos) { ObjectDataImpl result = new ObjectDataImpl(); ObjectInfoImpl objectInfo = new ObjectInfoImpl(); result.setProperties(compileProperties(node, filter, objectInfo)); if (includeAllowableActions) { result.setAllowableActions(compileAllowableActions(node)); } if (includeAcl) { result.setAcl(compileAcl(node)); result.setIsExactAcl(true); } if (context.isObjectInfoRequired()) { objectInfo.setObject(result); objectInfos.addObjectInfo(objectInfo); } return result; }
Example 3
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 6 votes |
static ObjectDataImpl toObjectData(CmisRepositoryConfiguration config, CallContext context, TypeDefinition type, Object object, boolean root, Set<String> filter, ObjectInfoHandler objectInfos) { ObjectDataImpl result = new ObjectDataImpl(); ObjectInfoImpl objectInfo = new ObjectInfoImpl(); compileObjectMetadata(objectInfo, type); result.setProperties(compileProperties(config, type, object, root, filter, objectInfo)); result.setAllowableActions(compileAllowableActions(type, object, false, false)); if (context.isObjectInfoRequired()) { objectInfo.setObject(result); objectInfos.addObjectInfo(objectInfo); } return result; }
Example 4
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 5
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; }