cancel
Showing results for 
Search instead for 
Did you mean: 

Parameters for action rules

madnicow
Champ in-the-making
Champ in-the-making
Hi,

I tried to add some rules on a folder thanks to the WebService api.
I have already seen the others topics on this subject and I can now add rules with extract medata or add aspect actions. Smiley Happy
However, I would like to know what are the parameters to add for the others possible actions (email,move, transform …).

Here is the method which I would like to know the parameters :

newAction.setParameters(new NamedValue[]{new NamedValue(name,isMultiValue,value,values)});

In order to find  String name, boolean isMultiValue, String value, String[] values for the rules on a particular node, I tried this code:

private static void enumParameters(Reference node) throws ActionFault, RemoteException{
      Rule[] array = WebServiceFactory.getActionService().getRules(node,new RuleFilter());
      String trace = "There are "+ array.length + " rules on this node:\n";
      for (int i=0; i<=(array.length-1); i++){
         trace += "rule("+i+"): "+array[i].getTitle() + " | " + array[i].getDescription()+"\n";
         NamedValue[] parameters=array[i].getAction().getParameters();
         if (parameters!=null){
            trace += "There are "+ parameters.length + " parameters lines for this action:\n";
            for (int j=0; j<=(parameters.length-1); j++){
               trace += "parameters line("+j+"): "+parameters[j].getName() +", "+parameters[j].getIsMultiValue()+", "+parameters[j].getValue()+"\n";               
            }
         }
      }
   System.out.println(trace);
}

Unfortunatly, this only returns the parameters of the rules that I added thanks to the api and not with the web client. And I'm always at the same point. :cry:
So is there anybody who found what are the different parameters to put in NamedValue ??


thanks
4 REPLIES 4

madnicow
Champ in-the-making
Champ in-the-making
Finally, I found how to obtain the name and the type of the action parameters thanks to the action name:

Try this code:

public static void getActionItemDefinition(String actionName) throws Exception
   {
//   Récupération du service Action d'Alfresco
   ActionServiceSoapBindingStub actionService = WebServiceFactory.getActionService();

      // Récupérer une action
      ActionItemDefinition actionDefinition = actionService.getActionItemDefinition(actionName, ActionItemDefinitionType.action);
      System.out.println("Definition de l'action "+actionDefinition.getName());
      System.out.println("Titre de l'action : "+actionDefinition.getTitle());
      System.out.println("Description de l'action :"+actionDefinition.getDescription());
      System.out.println("Propriétés non définies acceptées :"+actionDefinition.isAdHocPropertiesAllowed());
      //paramètres definis pour cette action
      ParameterDefinition[] parameters=actionDefinition.getParameterDefinition();
      System.out.println("Paramètres de l'action :");
      if(parameters!=null)
      {
         for(ParameterDefinition parameter : parameters){
            System.out.println("Nom du paramètre :"+parameter.getName());
            System.out.println("Type du paramètre :"+parameter.getType());
            System.out.println("Paramètre obligatoire :"+parameter.isIsMandatory());
            System.out.println("Description du paramètre :"+parameter.getDisplayLabel());
         }
      }
      else{
         System.out.println("aucun paramètre");
      }
   }
Hope this can help someone else

sylvain78
Champ in-the-making
Champ in-the-making
Thanks a lot!

This is really helpful.

I also found them in the org.alfresco.repo.action.executer.MailActionExecuter class:

public static final String NAME = "mail";
public static final String PARAM_TO = "to";
public static final String PARAM_TO_MANY = "to_many";
public static final String PARAM_SUBJECT = "subject";
public static final String PARAM_TEXT = "text";
public static final String PARAM_FROM = "from";
public static final String PARAM_TEMPLATE = "template";

sylvain78
Champ in-the-making
Champ in-the-making
Did anyone try to use the template parameter with the Web Service API?

Trying to subscribe to the mail notification, it works with "text" but not with "template".  I validated my noderef in the node browser.

 new NamedValue("template", new Boolean(false), "workspace://SpacesStore/743a9c70-d31a-11db-996d-2961b2b1650b", null)

I don't get any errors (and any emails…).
Any help or comment would be appreciated!

markjay50
Champ in-the-making
Champ in-the-making
Someone is using the parameter with the WEB API, thank you for your help!!!!!!