Hi, I am with a problem trying to implement something on Apache Isis.
Here is what I want to do:
I have a class Country that has a String with the name of the country. Also
I have a class called Client which represents a client with the following
variables: String name, String surname, String address, Country country. I
made the setters and getters for all the properties. I also have the
classes Countries and Clients. Both of this classes have the methods create
and listAll. My problem is: I want to create a new Client and when I create
it, I want to have a select with the countries that I already persisted.
The problem is that I can't achieve this. I send the classes done on
attachment to understand how I am doing it. But basically is that what I
want, that when I create a new client, this one has a name, surname and
address to complete and a select with the countries that I already
persisted.
Thank you
public class Client {
private String name;
private String surname;
private String address;
private Country country;
@javax.jdo.annotations.Column(allowsNull = "false")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@javax.jdo.annotations.Column(allowsNull = "false")
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
@javax.jdo.annotations.Column(allowsNull = "false")
public String getAddress() {
return address;
}
public void setCountry(String address) {
this.address = address;
}
@javax.jdo.annotations.Column(allowsNull = "false")
public String getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
// I have the injects with the domainContainer
}
public class Clients {
@ActionSemantics(Of.SAFE)
public Client create(final @Named("Nombre") String name, final @Named("Apellido") String surname, final @Named("Direccion") String address, final @Named("Pais") Country country) {
final Client client = newTransientInstance(Client.class);
client.setName(name);
client.setSurname(surname);
client.setAddress(address);
client.setCountry(country);
persist(client);
return client;
}
@ActionSemantics(Of.SAFE)
public List<Client> listAll() {
return container.allInstances();
}
// I have the injects with the domainContainer
}
public class Country {
@ActionSemantics(Of.SAFE)
public Country create(final @Named("Pais") String country) {
final Country c = newTransientInstance(Country.class);
c.setCountry(country);
persist(c);
return c;
}
@ActionSemantics(Of.SAFE)
public List<Country> listAll() {
return container.allInstances();
}
// I have the injects with the domainContainer
}
public class Country {
private String country;
@javax.jdo.annotations.Column(allowsNull = "false")
public String getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
// I have the injects with the domainContainer
}