cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the NodeRef from getHomeSpaceId string?

csiege
Champ in-the-making
Champ in-the-making
I am trying to modify the webclient so the user can only check out working file into their home space.

I am close. I get the users homespace id and need to set the
selected space in the CheckinCheckoutBean, but need it as a NodeRef
object not a string (spaceID).

I bet this is simple, but can't seem to find it.
I got the code below, but I must not have the right format of the space id to create the correct noderef.

NodeRef refNode = new NodeRef(beanNav.getCurrentUser().getHomeSpaceId());
bean.setSelectedSpaceId(refNode);

Any ideas!

thanks!

Chris
2 REPLIES 2

csiege
Champ in-the-making
Champ in-the-making
Got this working!

Don't know if its the best way, but using the node browser I got the idea that seems to work.

bean.setCopyLocation("other");
   NodeRef refNode = new NodeRef("workspace://SpacesStore/" + beanNav.getCurrentUser().getHomeSpaceId());
   bean.setSelectedSpaceId(refNode);

gavinc
Champ in-the-making
Champ in-the-making
There is a slightly better way, rather than hardcoding the workspace use the following:


NodeRef refNode = new NodeRef(Repository.getStoreRef(), beanNav.getCurrentUser().getHomeSpaceId());