How to use a field using the user suggestion widget ?

I have a field called reviewers (multi valued string) it is populated thanks to the user suggestion widget i d like to use its content for a setACE operation in a chain but i get a casting error :

No type adapter found for input: class [Ljava.lang.String; and output class java.lang.String

I already made it, but can't remember how :-(

0 votes

2 answers

1379 views

ANSWER



So if you are on 5.4.2, you have 2 solutions :

  • Upgrade your Nuxeo to 5.6 :D
  • Or if you have some development skills create your operation with Nuxeo IDE.

With Nuxeo IDE it will be really quick to do that :

  • I let you look the Nuxeo IDE installation documentation : http://doc.nuxeo.com/x/ZYKE

  • Then you create a new Nuxeo Plugin Project (click on the yellow button > new Nuxeo Plugin name it > next > next )

  • Create a new Operation (click on the yellow button > new Operation > name it > Next > Next )

  • And finally you fill the operation :

    @Operation(id = YourOpertion.ID, category = Constants.CAT_SUBCHAIN_EXECUTION, label = “Run For Each”, description = ““) public class YourOpertion {

    public static final String ID = "YourOpertion";
    
    @Context
    protected OperationContext ctx;
    
    @Context
    protected AutomationService service;
    
    @Param(name = "id")
    protected String chainId;
    
    @Param(name = "list")
    protected String listName;
    
    @Param(name = "item", required = false, values = "item")
    protected String itemName = "item";
    
    @Param(name = "isolate", required = false, values = "true")
    protected boolean isolate = true;
    
    @OperationMethod
    public void run() throws Exception {
        Map<String, Object> vars = isolate ? new HashMap<String, Object>(
                ctx.getVars()) : ctx.getVars();
        OperationContext subctx = new OperationContext(ctx.getCoreSession(),
                vars);
        subctx.setInput(ctx.getInput());
        for (Object value : (Collection<?>) ctx.get(listName)) {
            subctx.put(itemName, value);
            service.run(subctx, chainId);
        }
    }
    

    }

1 votes



That's what i was about to do. What a pity this was not backported to 5.4.2 as it seems the code is not 5.5 specific.
09/11/2012

Backporting new feature is bad… :)
09/11/2012

Feel free to contribute an addon on github for missing operations :D
09/11/2012

Create a new Question please…
09/12/2012


Did you try the run for each operation with a sub operation.

0 votes



unforunately, i'm running a 5.4.2 project and the the "run for each " operation seems to be 5.5
09/11/2012