cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Evaluator and service access

maxenced
Champ in-the-making
Champ in-the-making
Hello all !

I have a little problem.
I want to acces in my evaluator to the personService, has anyone know how to do it ?

Extract form web-client-config.xml:

   <config>
      <actions>
         <!– Launch Add Aspect Dialog –>
         <action id="addValidableTechniqueAction">
            <permissions>
               <!– each permission can be an Allow or Deny check –>
               <permission allow="true">MYAPP_Approbateur_technique</permission>
            </permissions>
            <evaluator>com.myapp.gdoc.evaluator.ValidationTechniqueEvaluator</evaluator>
            <label-id>myapp_validation_technique</label-id>
            <image>/images/icons/completed_workflow_item.gif</image>
            <action>dialog:AddValidableTechniqueActionDialog</action>
            <action-listener>#{BrowseBean.setupContentAction}</action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>

Extract from my java Evaluator class:

   @Override
   public boolean evaluate(Node arg0) {
      // TODO Auto-generated method stub
      logger.debug("INSIDE EVALUATOR");
      logger.debug("CurrentUserName:" + AuthenticationUtil.getCurrentUserName());
      logger.debug("SystemUserName:" + AuthenticationUtil.getSystemUserName());

      logger.debug("Infos service person:" + personService); //personService is null, and isn't be initialized becaus my action ins not yet called!!!!
      NodeRef nodeUser = personService.getPerson(AuthenticationUtil.getCurrentUserName());
      logger.debug("Mail:" + (String)nodeService.getProperty(nodeUser, ContentModel.PROP_EMAIL));
      return true;
   }

Thanks in advance,
Maxence
2 REPLIES 2

dhalupa
Champ on-the-rise
Champ on-the-rise
You can get a reference to ServiceRegistry with


org.alfresco.web.bean.repository.Repository.getServiceRegistry(FacesContext.getCurrentInstance())

Kind regards,

Denis

maxenced
Champ in-the-making
Champ in-the-making
It works !

Thanks