cancel
Showing results for 
Search instead for 
Did you mean: 

Get nodeRef from nodeID

franciscoduarte
Champ in-the-making
Champ in-the-making

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 ACCEPTED ANSWER

angelborroy
Community Manager Community Manager
Community Manager

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 answer in original post

1 REPLY 1

angelborroy
Community Manager Community Manager
Community Manager

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