Search code examples
javaalfrescocmisopencmisnodereference

Is it possible to create a node in alfresco with a specific NodeRef?


I'm currently using openCMIS to create a node inside Alfresco. I want to specify that the newly made content uses a specific nodeRef id. For example:

workspace://SpacesStore/6e619192-61c0-46fc-85c1-81badbb9b93e

Currently I have this CMIS code:

Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, "TestFolder");
properties.put(PropertyIds.OBJECT_ID, "workspace://SpacesStore/6e619192-61c0-46fc-85c1-81badbb9b93e");
folder.createFolder(properties);

I want it that the newly made folder Names "TestFolder" has an nodeRef that matches the OBJECT_ID specified. However Alfresco still generates a different unique nodeRef.

Is there a way to specify a nodeRef when creating content in Alfresco?


Solution

  • No, it is not possible to set your own node reference. It's an implementation detail that, in theory, you shouldn't care about.

    However, you may have a valid reason for this (for example, importing data from an existing repository?). If for some reason you need to keep this node reference, consider storing this noderef as a separate metadata property.

    You may want to submit a separate question explaining in more detail why you want to do something like this.