org.apache.chemistry.opencmis.commons.data.ObjectData Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.data.ObjectData.
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 |
/** * Create dispatch for AtomPub * * @param context call context * @param properties the properties * @param folderId identifier of the parent folder * @param contentStream stream of the document to create * @param versioningState state of the version * @param objectInfos informations * * @return the newly created object */ public ObjectData create(CallContext context, Properties properties, String folderId, ContentStream contentStream, VersioningState versioningState, ObjectInfoHandler objectInfos) { debug("create " + folderId); validatePermission(folderId, context, Permission.WRITE); String typeId = getTypeId(properties); TypeDefinition type = types.getType(typeId); if (type == null) throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); String objectId = null; if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) { objectId = createDocument(context, properties, folderId, contentStream, versioningState); return compileObjectType(context, getDocument(objectId), null, false, false, objectInfos); } else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { objectId = createFolder(context, properties, folderId); return compileObjectType(context, getFolder(objectId), null, false, false, objectInfos); } else { throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId + "'!"); } }
Example #2
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 #3
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 #4
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 #5
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 7 votes |
public List<ObjectData> getAllVersions(String objectId) { validatePermission(objectId, null, null); List<ObjectData> versions = new ArrayList<ObjectData>(); AbstractDocument doc = getDocument(objectId); List<Version> buf = versionDao.findByDocId(doc.getId()); if (doc instanceof Document) { for (Version version : buf) { ObjectData data = compileObjectType(null, version, null, true, false, null); versions.add(data); } } else { versions.add(compileObjectType(null, doc, null, true, false, null)); } return versions; }
Example #6
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 #7
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId, Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { checkRepositoryId(repositoryId); checkIds("Version Series Id", objectId, versionSeriesId); major = getDefaultFalse(major); includeAllowableActions = getDefaultFalse(includeAllowableActions); includeRelationships = getDefault(includeRelationships); renditionFilter = getDefaultRenditionFilter(renditionFilter); includePolicyIds = getDefaultFalse(includePolicyIds); includeAcl = getDefaultFalse(includeAcl); try { return getWrappedService().getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #8
Source File: CmisServiceBridge.java From spring-content with Apache License 2.0 | 6 votes |
ObjectInFolderList toObjectInFolderList(CmisRepositoryConfiguration config, CallContext callContext, Collection children, Set<String> filter, boolean root, ObjectInfoHandler objectInfos) { List<ObjectInFolderData> objectInFolderList = new ArrayList<>(); ObjectInFolderListImpl list = new ObjectInFolderListImpl(); list.setObjects(objectInFolderList); if (children == null) { return list; } for (Object child : children) { ObjectInFolderDataImpl folderData = new ObjectInFolderDataImpl(); ObjectData object = toObjectData(config, callContext, getType(child), child, root, filter, objectInfos); folderData.setObject(object); objectInFolderList.add(folderData); } return list; }
Example #9
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { checkRepositoryId(repositoryId); checkPath("Path", path); includeAllowableActions = getDefaultFalse(includeAllowableActions); includeRelationships = getDefault(includeRelationships); renditionFilter = getDefaultRenditionFilter(renditionFilter); includePolicyIds = getDefaultFalse(includePolicyIds); includeAcl = getDefaultFalse(includeAcl); try { return getWrappedService().getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #10
Source File: ContentCmisService.java From spring-content with Apache License 2.0 | 6 votes |
@Override public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return bridge.getObjectInternal(config, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, this.getCallContext(), this); }
Example #11
Source File: ContentCmisService.java From spring-content with Apache License 2.0 | 6 votes |
public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return bridge.getObjectByPath(config, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, this.getCallContext(), this); }
Example #12
Source File: CmisUtils.java From iaf with Apache License 2.0 | 6 votes |
public static ObjectList xml2ObjectList(Element result, IPipeLineSession context) { ObjectListImpl objectList = new ObjectListImpl(); objectList.setNumItems(CmisUtils.parseBigIntegerAttr(result, "numberOfItems")); objectList.setHasMoreItems(CmisUtils.parseBooleanAttr(result, "hasMoreItems")); List<ObjectData> objects = new ArrayList<ObjectData>(); Element objectsElem = XmlUtils.getFirstChildTag(result, "objects"); for (Node type : XmlUtils.getChildTags(objectsElem, "objectData")) { ObjectData objectData = xml2ObjectData((Element) type, context); objects.add(objectData); } objectList.setObjects(objects); return objectList; }
Example #13
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { checkRepositoryId(repositoryId); checkId("Object Id", objectId); includeAllowableActions = getDefaultFalse(includeAllowableActions); includeRelationships = getDefault(includeRelationships); renditionFilter = getDefaultRenditionFilter(renditionFilter); includePolicyIds = getDefaultFalse(includePolicyIds); includeAcl = getDefaultFalse(includeAcl); try { return getWrappedService().getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #14
Source File: CmisUtils.java From iaf with Apache License 2.0 | 6 votes |
public static ObjectInFolderList xml2ObjectsInFolderList(Element result) { ObjectInFolderListImpl objectInFolderList = new ObjectInFolderListImpl(); objectInFolderList.setNumItems(CmisUtils.parseBigIntegerAttr(result, "numberOfItems")); objectInFolderList.setHasMoreItems(CmisUtils.parseBooleanAttr(result, "hasMoreItems")); List<ObjectInFolderData> objects = new ArrayList<ObjectInFolderData>(); Element objectsElem = XmlUtils.getFirstChildTag(result, "objects"); for (Node type : XmlUtils.getChildTags(objectsElem, "object")) { ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl(); String pathSegment = CmisUtils.parseStringAttr(result, "pathSegment"); oifd.setPathSegment(pathSegment); ObjectData objectData = xml2ObjectData((Element) type, null); oifd.setObject(objectData); objects.add(oifd); } objectInFolderList.setObjects(objects); return objectInFolderList; }
Example #15
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
protected void checkEncoding(FileFolderService ffs, AuthenticationComponent authenticationComponent, final ObjectData objectData, String expectedEncoding) { // Authenticate as system to check the properties in alfresco authenticationComponent.setSystemUserAsCurrentUser(); try { NodeRef doc1NodeRef = cmisIdToNodeRef(objectData.getId()); doc1NodeRef.getId(); FileInfo fileInfo = ffs.getFileInfo(doc1NodeRef); Map<QName, Serializable> properties2 = fileInfo.getProperties(); ContentDataWithId contentData = (ContentDataWithId) properties2 .get(QName.createQName("{http://www.alfresco.org/model/content/1.0}content")); String encoding = contentData.getEncoding(); assertEquals(expectedEncoding, encoding); } finally { authenticationComponent.clearCurrentSecurityContext(); } }
Example #16
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private PropertyData<?> getPropIsLatestMajorVersion(ObjectData objectData) { List<PropertyData<?>> properties = objectData.getProperties().getPropertyList(); boolean found = false; PropertyData<?> propIsLatestMajorVersion = null; for (PropertyData<?> property : properties) { if (property.getId().equals(PropertyIds.IS_LATEST_MAJOR_VERSION)) { found = true; propIsLatestMajorVersion = property; break; } } //properties..contains(PropertyIds.IS_LATEST_MAJOR_VERSION); assertTrue("The PropertyIds.IS_LATEST_MAJOR_VERSION property was not found", found); if (found) { return propIsLatestMajorVersion; } return null; }
Example #17
Source File: IbisObjectService.java From iaf with Apache License 2.0 | 6 votes |
@Override public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extensions) { if(!eventDispatcher.contains(CmisEvent.GET_OBJECT)) { return objectService.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extensions); } else { XmlBuilder cmisXml = new XmlBuilder("cmis"); cmisXml.addSubElement(buildXml("repositoryId", repositoryId)); cmisXml.addSubElement(buildXml("objectId", objectId)); cmisXml.addSubElement(buildXml("filter", filter)); cmisXml.addSubElement(buildXml("includeAllowableActions", includeAllowableActions)); cmisXml.addSubElement(buildXml("includePolicies", includePolicyIds)); cmisXml.addSubElement(buildXml("includeAcl", includeAcl)); IPipeLineSession context = new PipeLineSessionBase(); context.put(CmisUtils.CMIS_CALLCONTEXT_KEY, callContext); Element cmisElement = eventDispatcher.trigger(CmisEvent.GET_OBJECT, cmisXml.toXML(), context); return CmisUtils.xml2ObjectData(cmisElement, context); } }
Example #18
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 5 votes |
@Override public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId, Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return getVersioningService() .getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }
Example #19
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private void assertVersions(final NodeRef nodeRef, final String expectedVersionLabel, final VersionType expectedVersionType) { transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<List<Void>>() { @Override public List<Void> execute() throws Throwable { assertTrue("Node should be versionable", nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)); Version version = versionService.getCurrentVersion(nodeRef); assertNotNull(version); assertEquals(expectedVersionLabel, version.getVersionLabel()); assertEquals(expectedVersionType, version.getVersionType()); return null; } }); withCmisService(new CmisServiceCallback<Void>() { @Override public Void execute(CmisService cmisService) { String repositoryId = cmisService.getRepositoryInfos(null).get(0).getId(); ObjectData data = cmisService.getObjectOfLatestVersion(repositoryId, nodeRef.toString(), null, Boolean.FALSE, null, null, null, null, null, null, null); assertNotNull(data); PropertyData<?> prop = data.getProperties().getProperties().get(PropertyIds.VERSION_LABEL); Object versionLabelCmisValue = prop.getValues().get(0); assertEquals(expectedVersionLabel, versionLabelCmisValue); return null; } }, CmisVersion.CMIS_1_1); }
Example #20
Source File: IbisObjectService.java From iaf with Apache License 2.0 | 5 votes |
@Override public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { if(!eventDispatcher.contains(CmisEvent.GET_OBJECT_BY_PATH)) { return objectService.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); } else { XmlBuilder cmisXml = new XmlBuilder("cmis"); cmisXml.addSubElement(buildXml("repositoryId", repositoryId)); cmisXml.addSubElement(buildXml("path", path)); cmisXml.addSubElement(buildXml("filter", filter)); cmisXml.addSubElement(buildXml("includeAllowableActions", includeAllowableActions)); cmisXml.addSubElement(buildXml("includeRelationships", includeRelationships)); cmisXml.addSubElement(buildXml("renditionFilter", renditionFilter)); cmisXml.addSubElement(buildXml("includePolicyIds", includePolicyIds)); cmisXml.addSubElement(buildXml("includeAcl", includeAcl)); IPipeLineSession context = new PipeLineSessionBase(); context.put(CmisUtils.CMIS_CALLCONTEXT_KEY, callContext); Element cmisElement = eventDispatcher.trigger(CmisEvent.GET_OBJECT_BY_PATH, cmisXml.toXML(), context); return CmisUtils.xml2ObjectData(cmisElement, context); } }
Example #21
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 5 votes |
@Override public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return getObjectService().getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }
Example #22
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 5 votes |
@Override public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return getObjectService().getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }
Example #23
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 #24
Source File: ContentCmisService.java From spring-content with Apache License 2.0 | 5 votes |
@Override public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) { return bridge.getFolderParent(config, folderId, filter, extension, this.getCallContext(), this); }
Example #25
Source File: CmisUtils.java From iaf with Apache License 2.0 | 5 votes |
public static XmlBuilder objectList2xml(ObjectList result) { XmlBuilder objectListXml = new XmlBuilder("objectList"); if(result.getNumItems() != null) objectListXml.addAttribute("numberOfItems", result.getNumItems().toString()); if(result.hasMoreItems() != null) objectListXml.addAttribute("hasMoreItems", result.hasMoreItems()); XmlBuilder objectDataXml = new XmlBuilder("objects"); for (ObjectData objectData : result.getObjects()) { objectDataXml.addSubElement(CmisUtils.objectData2Xml(objectData)); } objectListXml.addSubElement(objectDataXml); return objectListXml; }
Example #26
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter, Boolean includeAllowableActions, ExtensionsData extension) { checkRepositoryId(repositoryId); checkIds("Version Series Id", objectId, versionSeriesId); includeAllowableActions = getDefaultFalse(includeAllowableActions); try { return getWrappedService().getAllVersions(repositoryId, objectId, versionSeriesId, filter, includeAllowableActions, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #27
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) { checkRepositoryId(repositoryId); checkId("Folder Id", folderId); try { return getWrappedService().getFolderParent(repositoryId, folderId, filter, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #28
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId, Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return service .getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }
Example #29
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return service.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }
Example #30
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) { return service.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension); }