cancel
Showing results for 
Search instead for 
Did you mean: 

After move: The node's content is missing

robertmarkbram
Champ in-the-making
Champ in-the-making
Hi All,

I am writing a class that extends BaseWizardBean. I have the following code to move the node (which represents a file) to a different folder.

NodeService ns = getNodeService();// get the Space to apply changes tooNodeRef nodeRef = this.getNode().getNodeRef();// Folder this doc belongs to.NodeRef docFolder = ns.getPrimaryParent(nodeRef).getParentRef();// Get ebns - parent folder to docFolder.NodeRef ebns = ns.getPrimaryParent(docFolder).getParentRef();// Find destination folder within ebns.NodeRef destNodeRef = this.getFileFolderService().searchSimple(ebns, "nextFolderName");// Move the node.try {   getFileFolderService().move(nodeRef, destNodeRef, "some new name");} catch (FileExistsException e) {   e.printStackTrace();} catch (FileNotFoundException e) {   e.printStackTrace();}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

My problem is that the node (or at least the metadata) does indeed appear under the new node, but the content has gone. When I click on it I get:

The node's content is missing:    node: workspace://SpacesStore/e16ed62d-36b7-45ef-93c2-b19eafffc1e6    reader: null  Please contact your system administrator.‍‍‍‍

No exceptions occurred. Any help would be most appreciated!

Rob
Smiley Happy
1 REPLY 1

robertmarkbram
Champ in-the-making
Champ in-the-making
Found the problem.. was doing this

Map<QName, Serializable> properties = new HashMap<QName, Serializable>();this.getNodeService().setProperties(this.getNode().getNodeRef(), properties);‍‍

instead of this:

Map<QName, Serializable> properties = getNodeService().getProperties(nodeRef);this.getNodeService().setProperties(this.getNode().getNodeRef(), properties);‍‍

I.e. blowing away all the other properties by creating a new map of properties rather than editing the existing map of properties.