cancel
Showing results for 
Search instead for 
Did you mean: 

ServiceRegistry

sarag
Champ in-the-making
Champ in-the-making
Hi!

On this code to get a NodeRef from a node-uuid:

public static NodeRef getNodeByUUID(ServiceRegistry serviceRegistry, StoreRef storeRef, String uuId) throws Exception{ 
       
       SearchService searchService = serviceRegistry.getSearchService();
        String searchString = "@sys\\:node-uuid:\"" + uuId + "\"";
         ResultSet rs = searchService.query(storeRef,SearchService.LANGUAGE_LUCENE, searchString );
        if (rs==null){
           return(null);
        }
        int nbRecords = rs.length();
        NodeRef nodeRef;
        if (nbRecords < 1) {
           nodeRef=null;
        }
        else nodeRef = rs.getNodeRef(0);
        rs.close();
        return(nodeRef);
    }

Where can I get the ServiceRegistry?

Thanks on advance
2 REPLIES 2

derek
Star Contributor
Star Contributor
Hi,

You need to inject the ServiceRegistry bean into one of your classes, or you need to get the bean from the ApplicationContext.

Regards

davidc
Star Contributor
Star Contributor