Hmm, it's a good question. Ultimately what goes in the autoComplete is up to you... it takes a string but that doesn't have to map to any particular property.
As a little experiment, I just tweaked the todoapp's ToDoItem#autoComplete for adding dependencies. Normally this searches on the description, but I could change it to also allow the string to match all item in a given category: @Programmatic // not part of metamodel public List<ToDoItem> autoComplete(final String description) { final SortedSet<ToDoItem> items = Sets.newTreeSet(); items.addAll(toDoItemRepository .findByAtPathAndDescriptionContains(currentUsersAtPath(), description)); // this is the new bit try { final Category category = Category.valueOf(description.toUpperCase()); items.addAll(toDoItemRepository .findByAtPathAndCategory(currentUsersAtPath(), category)); } catch(Exception ex) { } // end of the new bit return Lists.newArrayList(items); } which gives the result as shown in this screenshot [1] Hopefully that might give some ideas for your use case. Thx Dan [1] http://imgur.com/6bD7cHv On 19 November 2015 at 00:05, Cesar Lugo <cesar.l...@sisorg.com.mx> wrote: > Hello, > > > > So far, when I have created action methods that prompts for some domain > object(s) as parameters, I have used the autoCompleteRepository definition > within the @DomainObject annotation, which works great in the Wicket Viewer > for finding entities using a string property. I have some cases where the > domain object used as a parameter within the action method does not contain > string properties, but I need to ask it as a parameter. The user could > select it in the Wicket Viewer parameters dialog using a combination of a > numeric (Long) customerSubscriptionId field plus a string obtained from > another related parent entity (Customer's name), or just by picking it from > a list of customerSubscriptionId's .Is there a suggested alternative > approach for that? > > > > Class: CustomerSubscription, properties: > > private Long customerSubscriptionId; > > private Customer customer; > > > > Class: Customer, properties: > > private string customerId; > > private string name; > > > > Action method: > > public CustomerOrder addCustomerOrderPayment( > > final @ParameterLayout(named="Customer Order") CustomerOrder > customerOrder, > > final @Parameter(optionality = Optionality.OPTIONAL) > @ParameterLayout(named="Customer Subscription") > > CustomerSubscription customerSubscription > > ) > > { > > ... > > container.persistIfNotAlready(obj); > > return obj.getCustomerOrder(); > > } > > > > I thought of defining a JDO query within customerSubscription that queries > customerSubscriptionId and customer.getName and then use the auto complete > repository with the combination of both. Any suggestions will be > appreciated. > > > > Cesar. > > > > > > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus >