You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Cesar Lugo <ce...@sisorg.com.mx> on 2015/11/19 01:05:29 UTC

Domain object as a parameter in action methods

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