public class DataEntry extends WOComponent {
private Listing listing = new Listing();
private Basic basic = new Basic();
private Specific specific = new Specific();
private ERXEC ec = new ERXEC();
public Basic aBasic = new Basic();
public Specific aSpecific = new Specific();
public DataEntry(WOContext context) {
super(context);
ec.insertObject(listing);
ec.insertObject(basic);
ec.insertObject(specific);
}
public ERXEC editingContext() {
return ec;
}
public Listing listing() {
if (listing == null) {
ec.revert();
listing = (Listing)EOUtilities.createAndInsertInstance(ec, "Listing");
}
return listing;
}
public NSArray allSpecificTypes() {
return EOUtilities.objectsForEntityNamed(ec, "Specific");
}
public NSArray allBasicTypes() {
return EOUtilities.objectsForEntityNamed(ec, "Basic");
}
public WOComponent saveChanges() {
listing().setLastModified(new NSTimestamp());
listing().setUserId(1);
listing().addObjectToPropertyWithKey(aSpecific, "specific");
listing().addObjectToPropertyWithKey(aBasic, "basics");
ec.saveChanges();
setBasic(null);
setSpecific(null);
setListing(null);
return context().page();
}
public void setListing(Listing newListing) {
listing = newListing;
}
public Basic basicListing() {
return basic;
}
public Specific specificListing() {
return specific;
}
public void setBasic(Basic newBasic) {
basic = newBasic;
}
public void setSpecific(Specific newSpecific) {
specific = newSpecific;
}
}