As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
defined the properties directly within the document types
private ObjectId createDocument(String barcode, String filePath, Folder dmsFolderTest) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document"); properties.put(PropertyIds.NAME, "some name"); properties.put("bc:num", "12345"); ContentStream contentStream = getFileContentStream(filePath); return dmsFolderTest.createDocument(properties, contentStream, VersioningState.NONE); }
private void updateProperties(ObjectId documentId) { CmisObject document = session.getObject(documentId); Map<String, Object> updateproperties = new HashMap<String, Object>(); updateproperties.put("bc:num", "12345"); document.updateProperties(updateproperties); }
/*This method is for create the document*/ public void PutFile(CMISDocument document) { IObjectId cmisObjectFolder = (IObjectId)session.GetObject(document.FolderId); IDictionary<string, object> properties = new Dictionary<string, object>(); properties[PropertyIds.Name] = document.ContentStreamFileName; properties[PropertyIds.ObjectTypeId] = "cmis:document"; properties[PropertyIds.CreationDate] = DateTime.Now; ContentStream contentStream = new ContentStream(); contentStream.FileName = document.ContentStreamFileName; contentStream.MimeType = document.ContentStreamMimeType; contentStream.Length = document.Stream.Length; contentStream.Stream = document.Stream; IObjectId objectId = session.CreateDocument(properties, cmisObjectFolder, contentStream, DotCMIS.Enums.VersioningState.None); PutFileDetail(objectId,document.Owner); } /*This method is for add properties of a specific aspect*/ internal void PutFileDetail(IObjectId objectId,string actorIdCard) { ICmisObject cmisObject = session.GetObject(objectId); IDictionary<string, object> properties = new Dictionary<string, object>(); properties[PropertyIds.ObjectTypeId] = "adm:aridoctypBase"; properties["adm:actidcard"] = actorIdCard; IObjectId newId = cmisObject.UpdateProperties(properties); if (newId.Id == cmisObject.Id) { // the repository updated this object - refresh the object cmisObject.Refresh(); } else { // the repository created a new version - fetch the new version cmisObject = session.GetObject(newId); } }