// Path: reladomo-tour/tour-examples/simple-bank/src/main/java/simplebank/domain/Customer.java
// public class Customer extends CustomerAbstract
// {
//     public Customer()
//     {
//         super();
//         // You must not modify this constructor. Mithra calls this internally.
//         // You can call this constructor. You can also add new constructors.
//     }
// 
//     public Customer(int customerId, String firstName, String lastName)
//     {
//         super();
//         this.setCustomerId(customerId);
//         this.setFirstName(firstName);
//         this.setLastName(lastName);
//     }
// }
// 
// Path: reladomo-tour/tour-examples/simple-bank/src/main/java/simplebank/domain/CustomerList.java
// public class CustomerList extends CustomerListAbstract
// {
//     public CustomerList()
//     {
//         super();
//     }
// 
//     public CustomerList(int initialSize)
//     {
//         super(initialSize);
//     }
// 
//     public CustomerList(Collection c)
//     {
//         super(c);
//     }
// 
//     public CustomerList(Operation operation)
//     {
//         super(operation);
//     }
// }


import com.fasterxml.jackson.core.JsonProcessingException;
import com.gs.fw.common.mithra.MithraManager;
import com.gs.fw.common.mithra.util.serializer.SerializationConfig;
import com.gs.fw.common.mithra.util.serializer.Serialized;
import com.gs.fw.common.mithra.util.serializer.SerializedList;
import simplebank.domain.Customer;
import simplebank.domain.CustomerFinder;
import simplebank.domain.CustomerList;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
                .shallowWithDefaultAttributes(CustomerFinder.getFinderInstance());
        serializationConfig.withDeepDependents();
    }

    @POST
    public Response createCustomer(
            @FormParam("customerId") int customerId,
            @FormParam("firstName") String firstName,
            @FormParam("lastName") String lastName)
    {
        Customer customer = new Customer();
        customer.setCustomerId(customerId);
        customer.setFirstName(firstName);
        customer.setLastName(lastName);
        customer.insert();
        return Response.ok().build();
    }

    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Serialized<Customer> getCustomerById(@PathParam("id") int customerId) throws JsonProcessingException
    {
        Customer customer = CustomerFinder.findByPrimaryKey(customerId);
        return new Serialized<>(customer, serializationConfig);
    }

    @GET
    @Path("/findByLastName")
    @Produces(MediaType.APPLICATION_JSON)
// Path: reladomo-tour/tour-examples/simple-bank/src/main/java/simplebank/domain/Customer.java
// public class Customer extends CustomerAbstract
// {
//     public Customer()
//     {
//         super();
//         // You must not modify this constructor. Mithra calls this internally.
//         // You can call this constructor. You can also add new constructors.
//     }
// 
//     public Customer(int customerId, String firstName, String lastName)
//     {
//         super();
//         this.setCustomerId(customerId);
//         this.setFirstName(firstName);
//         this.setLastName(lastName);
//     }
// }
// 
// Path: reladomo-tour/tour-examples/simple-bank/src/main/java/simplebank/domain/CustomerList.java
// public class CustomerList extends CustomerListAbstract
// {
//     public CustomerList()
//     {
//         super();
//     }
// 
//     public CustomerList(int initialSize)
//     {
//         super(initialSize);
//     }
// 
//     public CustomerList(Collection c)
//     {
//         super(c);
//     }
// 
//     public CustomerList(Operation operation)
//     {
//         super(operation);
//     }
// }


// Path: reladomo-tour/tour-examples/simple-bank/src/main/java/simplebank/web/CustomerResource.java
import com.fasterxml.jackson.core.JsonProcessingException;
import com.gs.fw.common.mithra.MithraManager;
import com.gs.fw.common.mithra.util.serializer.SerializationConfig;
import com.gs.fw.common.mithra.util.serializer.Serialized;
import com.gs.fw.common.mithra.util.serializer.SerializedList;
import simplebank.domain.Customer;
import simplebank.domain.CustomerFinder;
import simplebank.domain.CustomerList;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

                .shallowWithDefaultAttributes(CustomerFinder.getFinderInstance());
        serializationConfig.withDeepDependents();
    }

    @POST
    public Response createCustomer(
            @FormParam("customerId") int customerId,
            @FormParam("firstName") String firstName,
            @FormParam("lastName") String lastName)
    {
        Customer customer = new Customer();
        customer.setCustomerId(customerId);
        customer.setFirstName(firstName);
        customer.setLastName(lastName);
        customer.insert();
        return Response.ok().build();
    }

    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Serialized<Customer> getCustomerById(@PathParam("id") int customerId) throws JsonProcessingException
    {
        Customer customer = CustomerFinder.findByPrimaryKey(customerId);
        return new Serialized<>(customer, serializationConfig);
    }

    @GET
    @Path("/findByLastName")
    @Produces(MediaType.APPLICATION_JSON)
    public SerializedList<Customer, CustomerList> getCustomersByLastName(@QueryParam("lastName") String lastName)