AnsweredAssumed Answered

NodeRef to Node and Exception

Question asked by avware on Jan 9, 2008
Latest reply on Jan 10, 2008 by avware
Hello,
I am adding a new feature to my version of Alfresco. I would like to see a list of all the discussions to which I was invited.

Then you have to be authenticated by the session and services from the repository. I can run the query through lucene to extract all discussions (identified by fm: discussion).

Now I need to point the child next to the node fm: discussion and find the information (see title of the discussion, creator and our link), but I can not convert a NodeRef in javax.jcr.Node.

This is the code that I am using that goes in with exception:
Net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext

The code:



User user = (User) session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);

if (user == null) {
  response.sendRedirect(request.getContextPath() + "/faces/jsp/login.jsp");
}

if (user != null) {

  WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
  final ServiceRegistry serviceRegistry = (ServiceRegistry) context.getBean(ServiceRegistry.SERVICE_REGISTRY);

  SearchService searchService = serviceRegistry.getSearchService();
  NodeService nodeService = serviceRegistry.getNodeService();
 
  StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
  ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, "PATH:\"/*\" TEXT:\"/fm:discussion\"");

  for (ResultSetRow row : resultSet) {
     NodeRef nodeRef = row.getNodeRef();
    if ( nodeService.exists(nodeRef) ) {

        // todo: Node node = new Node(nodeRef);
       // NodeIterator iterator = node.getNodes();
       // scroll to child and print some data
    }

  }
  resultSet.close();
 
}

Outcomes