Thx for response. It´s simplified code:
package dom.simple;
import org.apache.isis.applib.annotation.NotPersistable;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.util.ObjectContracts;
@ObjectType("APPLE")
@NotPersistable
public class Apple implements Comparable<Apple> {
private String name;
@Title
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String supplier;
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
@Override
public int compareTo(Apple other) {
return ObjectContracts.compare(this, other, "name,supplier");
}
}
package dom.simple;
import java.util.ArrayList;
import java.util.List;
import org.apache.isis.applib.AbstractFactoryAndRepository;
import org.apache.isis.applib.annotation.ActionSemantics;
public class Apples extends AbstractFactoryAndRepository {
@ActionSemantics(ActionSemantics.Of.SAFE)
public List<Apple> listAll() {
List<Apple> applebox=new ArrayList<Apple>();
Apple obj=new Apple();
obj.setName("SomeApple");
obj.setSupplier("SomeSupplier");
applebox.add(obj);
// ... add some more
return applebox;
}
}
... USAGE SOMEWHERE....
public void customApple(final Apple apple) {
System.out.println("receive an apple: "+apple.getName()+" from
"+apple.getSupplier());
}
public List<Apple> choices0CustomApple() {
return apples.listAll();
}
private Apples apples;
public void injectApples(final Apples apples) {
this.apples = apples;
}
> Dan Haywood <[email protected]> hat am 13. März 2014 um 17:45
> geschrieben:
>
>
> Can I see some more of the code here, to get a bit more of a clue.
>
> Would be good to see the listAll action, the class definition, the choices
> method etc
>
> Thx
> Dan
>
>
> On 13 March 2014 16:42, Matthias Held <[email protected]> wrote:
>
> > Hi,
> > I ' m sorry , I'm real ly a ll out of goo d ideas. I will use a
> > calculated list of objects (containing a String key and a String name) as
> > list
> > of choices. The object is annotated with @NotPersistable. There is a
> > AbstractFactoryAndRepository for this object with a method "listAll" which
> > produce the objects. The UI choice is rendered correctly but on exit:
> >
> > Caused by:
> > org.apache.isis.core.runtime.persistence.ObjectNotFoundException:
> > Object not found in store with oid
> > ...
> >
> > Caused by: java.lang.NullPointerException
> >
> > at
> >
> > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.clsOf(DataNucleusObjectStore.java:699)
> >
> > at
> >
> > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadPojo(DataNucleusObjectStore.java:399)
> >
> >
> >
> > at
> >
> > org.apache.isis.objectstore.jdo.datanucleus.persistence.adaptermanager.DataNucleusPojoRecreator.recreatePojo(DataNucleusPojoRecreator.java:38)
> >
> > Is it not possible by design?
> >
> > Have someone a good tip for me?
> >
> > Thanks
> >