cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use custom OBJECT_ID

vipul_n
Champ in-the-making
Champ in-the-making
Hi,
When we are creating  document using API, we give PropertyIds.NAME & PropertyIds.OBJECT_TYPE_ID.
We would like to know if we can give customized object id which can be used further to fetch the document.

Currently, following is used to create a document in Alfresco


Map<String, Object> propertiesDocument = new HashMap<String, Object>();
propertiesDocument.put(PropertyIds.NAME, "test_Aspect.pdf");
propertiesDocument.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");

FileInputStream oInputStream = new FileInputStream("/abc.txt");
ContentStream contentStream = new ContentStreamImpl("abc.txt", null, "application/octet-stream", oInputStream);
Document document = folder.createDocument(propertiesDocument, contentStream, VersioningState.MAJOR);


Last statemnt will give unique Object ID which can be used to fetch the document later. Can we give our own custom unique key which can be used to fetch document later?

Thanks & Regards,
Vipul Nandha
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
yes you can. 

However you should probably use the noderef.

You can specify your value of noderef as long as its unique.

vipul_n
Champ in-the-making
Champ in-the-making
Thanks mrogers,
I would like to know how to use noderef? Can you provide an example to use noderef and fetch the document later?

Thanks in advance,