org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl.
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 |
/** * CMIS updateProperties * * @param context the call context * @param objectId identifier of the object * @param properties the properties * @param objectInfos informations * * @return the updated object */ public ObjectData updateProperties(CallContext context, Holder<String> objectId, Properties properties, ObjectInfoHandler objectInfos) { debug("updateProperties " + objectId); validatePermission(objectId.getValue(), context, Permission.WRITE); try { // get the document or folder PersistentObject object = getObject(objectId.getValue()); // get old properties Properties oldProperties = compileProperties(object, null, new ObjectInfoImpl()); update(object, oldProperties, properties); return compileObjectType(context, object, null, false, false, objectInfos); } catch (Throwable t) { return (ObjectData) catchError(t); } }
Example #2
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 7 votes |
public ObjectInfo getObjectInfo(String objectId, ObjectInfoHandler handler) { debug("getObjectInfo " + objectId); validatePermission(objectId, null, null); try { // check id if ((objectId == null)) throw new CmisInvalidArgumentException("Object Id must be set."); ObjectInfoImpl info = new ObjectInfoImpl(); PersistentObject object = getObject(objectId); compileProperties(object, null, info); ObjectData data = compileObjectType(null, object, null, true, true, handler); info.setObject(data); return info; } catch (Throwable t) { log.warn("Not able to retrieve object {}", objectId); return (ObjectInfo) catchError(t); } }
Example #3
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 #4
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 #5
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 #6
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 5 votes |
@Transactional public ObjectData getObjectInternal(CmisRepositoryConfiguration config, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension, CallContext context, ObjectInfoHandler handler) { Set<String> filterCol = splitFilter(filter); Object object = null; ObjectDataImpl result = null; ObjectInfoImpl objectInfo = new ObjectInfoImpl(); if (objectId.equals(getRootId())) { object = new Root(); result = toObjectData(config, context, getType(object), object, true, filterCol, handler); } else { object = this.getObjectInternal(config, objectId, filterCol, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); result = toObjectData(config, context, getType(object), object, false, filterCol, handler); } return result; }
Example #7
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 5 votes |
static void compileObjectMetadata(ObjectInfoImpl objectInfo, TypeDefinition type) { if (type.getId().equals(BaseTypeId.CMIS_FOLDER.value())) { objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER); objectInfo.setTypeId(BaseTypeId.CMIS_FOLDER.value()); objectInfo.setContentType(null); objectInfo.setFileName(null); objectInfo.setHasAcl(true); objectInfo.setHasContent(false); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(null); objectInfo.setRelationshipTargetIds(null); objectInfo.setRenditionInfos(null); objectInfo.setSupportsDescendants(true); objectInfo.setSupportsFolderTree(true); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(false); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); } else { objectInfo.setBaseType(BaseTypeId.CMIS_DOCUMENT); objectInfo.setTypeId(BaseTypeId.CMIS_DOCUMENT.value()); objectInfo.setHasAcl(true); objectInfo.setHasContent(true); objectInfo.setHasParent(true); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(null); objectInfo.setRelationshipTargetIds(null); objectInfo.setRenditionInfos(null); objectInfo.setSupportsDescendants(false); objectInfo.setSupportsFolderTree(false); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(false); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); } }
Example #8
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private void setRelaionshipsToObjectInfo(ObjectData object, ObjectInfoImpl info) { info.setRelationshipSourceIds(null); info.setRelationshipTargetIds(null); IncludeRelationships includeRelationships = getRequestParameterIncludeRelationships(); if (includeRelationships != IncludeRelationships.NONE) { List<ObjectData> relationships = object.getRelationships(); if (relationships != null && relationships.size() > 0) { List<String> sourceIds = new ArrayList<String>(); List<String> targetIds = new ArrayList<String>(); for (ObjectData relationship : relationships) { String sourceId = getIdProperty(relationship, PropertyIds.SOURCE_ID); String targetId = getIdProperty(relationship, PropertyIds.TARGET_ID); if (object.getId().equals(sourceId)) { sourceIds.add(relationship.getId()); } if (object.getId().equals(targetId)) { targetIds.add(relationship.getId()); } } if (sourceIds.size() > 0 && (includeRelationships == IncludeRelationships.SOURCE || includeRelationships == IncludeRelationships.BOTH)) { info.setRelationshipSourceIds(sourceIds); } if (targetIds.size() > 0 && (includeRelationships == IncludeRelationships.TARGET || includeRelationships == IncludeRelationships.BOTH)) { info.setRelationshipTargetIds(targetIds); } } } }
Example #9
Source File: CmisRepository.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * Reads and adds properties. */ private void readCustomProperties(Node node, PropertiesImpl properties, Set<String> filter, ObjectInfoImpl objectInfo) { ObjectData obj = new ObjectDataImpl(); if (obj.getProperties() != null) { // add it to properties for (PropertyData<?> prop : obj.getProperties().getPropertyList()) { // overwrite object info if (prop instanceof PropertyString) { String firstValueStr = ((PropertyString) prop).getFirstValue(); if (PropertyIds.NAME.equals(prop.getId())) { objectInfo.setName(firstValueStr); } else if (PropertyIds.OBJECT_TYPE_ID.equals(prop.getId())) { objectInfo.setTypeId(firstValueStr); } else if (PropertyIds.CREATED_BY.equals(prop.getId())) { objectInfo.setCreatedBy(firstValueStr); } else if (PropertyIds.CONTENT_STREAM_MIME_TYPE.equals(prop.getId())) { objectInfo.setContentType(firstValueStr); } else if (PropertyIds.CONTENT_STREAM_FILE_NAME.equals(prop.getId())) { objectInfo.setFileName(firstValueStr); } } if (prop instanceof PropertyDateTime) { GregorianCalendar firstValueCal = ((PropertyDateTime) prop).getFirstValue(); if (PropertyIds.CREATION_DATE.equals(prop.getId())) { objectInfo.setCreationDate(firstValueCal); } else if (PropertyIds.LAST_MODIFICATION_DATE.equals(prop.getId())) { objectInfo.setLastModificationDate(firstValueCal); } } // check filter if (filter != null) { if (!filter.contains(prop.getId())) { continue; } else { filter.remove(prop.getId()); } } // don't overwrite id if (PropertyIds.OBJECT_ID.equals(prop.getId())) { continue; } // don't overwrite base type if (PropertyIds.BASE_TYPE_ID.equals(prop.getId())) { continue; } // add it properties.replaceProperty(prop); } } }