Get nodeRef from nodeID

cancel
Showing results for 
Search instead for 
Did you mean: 
franciscoduarte
Member II

Get nodeRef from nodeID

Jump to solution

Hello,

I think this should be a simple thing but I'm not finding any information to get a nodeRef from a nodeId.

Is there any way to do this through the Java api?

Best regards,

Francisco Duarte

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: Get nodeRef from nodeID

Jump to solution

The NodeRef includes information about the Store, that includes by default one protocol and one identifier.

https://github.com/Alfresco/alfresco-data-model/blob/master/src/main/java/org/alfresco/service/cmr/r...

Default stores are the Workspace(StoreRef STORE_REF_WORKSPACE_SPACESSTORE = new StoreRef(PROTOCOL_WORKSPACE, "SpacesStore")) and the Archive (StoreRef STORE_REF_ARCHIVE_SPACESSTORE = new StoreRef(PROTOCOL_ARCHIVE, "SpacesStore")).

The nodeId (by itself) doesn't include information about the Store, so you need to add this information to build a NodeRef.

NodeRef nodeRef = 
    new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACES_STORE, nodeId);
Hyland Developer Evangelist

View solution in original post

1 Reply
angelborroy
Alfresco Employee

Re: Get nodeRef from nodeID

Jump to solution

The NodeRef includes information about the Store, that includes by default one protocol and one identifier.

https://github.com/Alfresco/alfresco-data-model/blob/master/src/main/java/org/alfresco/service/cmr/r...

Default stores are the Workspace(StoreRef STORE_REF_WORKSPACE_SPACESSTORE = new StoreRef(PROTOCOL_WORKSPACE, "SpacesStore")) and the Archive (StoreRef STORE_REF_ARCHIVE_SPACESSTORE = new StoreRef(PROTOCOL_ARCHIVE, "SpacesStore")).

The nodeId (by itself) doesn't include information about the Store, so you need to add this information to build a NodeRef.

NodeRef nodeRef = 
    new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACES_STORE, nodeId);
Hyland Developer Evangelist