AnsweredAssumed Answered

Get all users (but with Java not Javascript)

Question asked by kaffi on Nov 10, 2015
Latest reply on Nov 16, 2015 by jpotts
Hey Guys

I have seen that it is totally easy to get all user data with JavaScript, but my customer wants to have it written in JAVA therefore and I am very new to the Alfresco API. I have written the following code:
   protected Map<String, Object> executeImpl(WebScriptRequest req,
         Status status, Cache cache) {

      
      model = new HashMap<String, Object>();
      requestedUser = req.getParameter("name");
      authorityService = this.getAuthorityService();

      if(!requestedUser.trim().isEmpty()||requestedUser!=null &&personService.personExists(requestedUser)){

         NodeRef singleUser = personService.getPerson(requestedUser);
         log.debug(singleUser);
         model.put("user", nodeService.getProperties(singleUser));
         
      }else{
         userList = personService.getPeople("*",true,new ArrayList<QName>() ,new ArrayList<Pair<QName,Boolean>>(),new PagingRequest(personService.countPeople()));
         
      }
      
      return model;
   }
   

I am not sure how to bind it to the model and how I can I get access it in my json view? Or is there an easier way?

Regards
Kaffi

Outcomes