cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve archived node

qsdmv
Champ in-the-making
Champ in-the-making
Alfresco node browser admin tool use DbNodeServiceImpl to find archived node. Here is the code fragment

if (queryLanguage.equals("noderef"))
                {
                    // ensure node exists
                    NodeRef nodeRef = new NodeRef(query);
                    boolean exists = getNodeService().exists(nodeRef);
                    if (!exists)
                    {
                        throw new AlfrescoRuntimeException("Node " + nodeRef + " does not exist.");
                    }
                    setNodeRef(nodeRef);
                    return "node";
                }


But node browser always return true and found

In my customized code, I passed exact nodeRef and use DbNodeServiceImpl  as well

NodeRef archivedNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, nodeRef.getId());
       boolean exists = this.dbNodeService.exists(archivedNodeRef);
        return exists;


My code always return false, not found

The same class, same method class and exact same parameter which is node reference. How could exists(nodeRef) returns different results. What is wrong or do I miss something?

Thank you in advance

1 REPLY 1

qsdmv
Champ in-the-making
Champ in-the-making
If you deeply look into, it is about nodesCache in AbstractNodeDAOImpl:

public boolean exists(NodeRef nodeRef)
    {
        NodeEntity node = new NodeEntity(nodeRef);
        Pair<Long, Node> pair = nodesCache.getByValue(node);
        return pair != null && !pair.getSecond().getDeleted(qnameDAO);
    }

Since nodeRef is same, node browser tool gets different Pair from mine. The only possible way to have different Pair is that I have different nodeCache from admintool. How could this happen from the same instance? Any work around?

Thanks