AnsweredAssumed Answered

obtain the coordinator users from a space with a java functi

Question asked by elenaor on Nov 2, 2007
Latest reply on Nov 9, 2007 by kevinr
Hello,

I would like to make a java function in which I could obtain all the users with the coordinator role from a specific space. I have read many posts and a I have some ideas, but I don´t have found the answer yet.

Some ideas:


    FacesContext fc = FacesContext.getCurrentInstance();
    ServiceRegistry services = Repository.getServiceRegistry(fc);
    NavigationBean navigator = (NavigationBean)     FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);

    NodeRef space = navigator.getCurrentNode().getNodeRef();

    //Once I have the current space, I would like to get its users. (And what I don't have any idea about is how to insert the coordinator role comparision

// I don't know if the following code is correct
     services.getNodeService().getProperty(space, ContentModel.PROP_USERNAME));
 

Another ideas from
http://forums.alfresco.com/viewtopic.php?t=5140:


NodeRef peopleRef = personService.getPeopleContainer();
         List<ChildAssociationRef> childRefs = nodeService.getChildAssocs(peopleRef);
         for (ChildAssociationRef ref: childRefs)
         {
            // get the NodeRef of the person
            NodeRef personRef = ref.getChildRef();
            if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_PERSON))
            {
               … do some work with person properties here …
            }
         }

Outcomes