AnsweredAssumed Answered

Noderef doesn't exist after creation

Question asked by amandine.b on Aug 25, 2015
Latest reply on Oct 6, 2015 by amandine.b
Hi,

I'm using Alfresco 5.0.1 Enterprise and I have a persistence problem.

I create a NodeRef by using the "copy" fonction :

String nameRep = "122451";
FileInfo FiRep = serviceRegistry.getFileFolderService().copy(sourceNodeRef, destNodeRef, nameRep);
node = FiRep.getNodeRef();


Then, I need to get a specific child of this node :

NamespaceService namespaceService = getServiceRegistry().getNamespaceService();
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
Path pathRep = nodeService.getPath(node);
ResultSet rsRepDA = serviceRegistry.getSearchService().query(storeRef, SearchService.LANGUAGE_LUCENE,
      "PATH:\""+pathRep.toPrefixString(namespaceService)+"/cm:Documents_x0020_contractuels\"");
   
NodeRef result = null;
try
{
   result = rsRepDA.getNodeRef(0);
}
catch (Exception e) {
   log.error("Erreur lors de la récupération du répertoire");
}

Here I get the exception.
In Share interface, my node is not created.

When I'm debugging the code, I can see that the "node" is not null and has a NodeRef reference.
This NodeRef reference doesn't exist when I try to find it by the node browser.

How is it possible to create a Noderef and use it then (into the same action) ?

Thanks !

Outcomes