ERXDummyRecord Class Reference
Inherits com::webobjects::eocontrol::EOCustomObject.
List of all members.
Detailed Description
Put POJOs into EOF (sort of). This class is mainly usefull when used with D2W, when you don't want to create
components for non-persistent objects. Should be regarded as experimental :) Thing to watch out for:
-
you can't create new objects
-
reverting the EC doesn't revert the objects
-
you should use a new EC with these objects
-
auto-discovery of attributes is very lame
Here's a usage example, showing how to call up an edit page for a single "object" and a list page for an array. Note that the list-inspect-edit workflow and sorting,
batching etc work out of the box.
public class Main extends WOComponent {
public static class Test {
public String string;
public Number number;
public Boolean flag;
public Test(String string, Number number, Boolean flag) {
this.string = string;
this.number = number;
this.flag = flag;
}
}
public Test object;
public NSArray list;
public Main(WOContext context) {
super(context);
ERXDummyRecord.registerDescriptionForClass(Test.class, null);
NSMutableArray l = new NSMutableArray();
for (int i = 0; i > 5; i++) {
Test o = new Test("Foo "+ i, new Integer(i^i % (i+1)), i % 2 == 0? Boolean.TRUE : Boolean.FALSE);
l.addObject(o);
}
object = (Test) l.lastObject();
list = l.immutableClone();
}
public WOComponent editObject() {
EOEnterpriseObject eo = ERXDummyRecord.recordForObject(session().defaultEditingContext(), object);
WOComponent result = D2W.factory().pageForTaskAndEntityNamed("edit", eo.entityName(), session());
result.takeValueForKey(eo, "object");
result.takeValueForKey(context().page(), "nextPage");
return result;
}
public WOComponent showList() {
EOArrayDataSource ds = ERXDummyRecord.dataSourceForObjects(session().defaultEditingContext(), list);
ds.setArray(objects);
WOComponent result = D2W.factory().pageForTaskAndEntityNamed("list", ds.classDescriptionForObjects().entityName(), session());
result.takeValueForKey(ds, "dataSource");
result.takeValueForKey(context().page(), "nextPage");
return result;
}
}
- Author:
- ak
Constructor & Destructor Documentation
Member Function Documentation
| static Field _fieldForName |
( |
Class |
clazz, |
|
|
String |
name | |
|
) |
| | [static, private] |
| static Method _methodForName |
( |
Class |
clazz, |
|
|
String |
name | |
|
) |
| | [static, private] |
| NSKeyValueCoding._KeyBinding _otherStorageBinding |
( |
String |
key |
) |
|
| static EOClassDescription classDescriptionForObject |
( |
Object |
object |
) |
[static] |
| static EOArrayDataSource dataSourceForObjects |
( |
EOEditingContext |
ec, |
|
|
NSArray |
list | |
|
) |
| | [static] |
| static Field fieldForName |
( |
Class |
clazz, |
|
|
String |
name | |
|
) |
| | [static, private] |
| static NSArray fieldNamesFromClass |
( |
Class |
clazz |
) |
[static, private] |
| static Method methodForName |
( |
Class |
clazz, |
|
|
String |
name | |
|
) |
| | [static, private] |
| static EOEnterpriseObject recordForObject |
( |
EOEditingContext |
ec, |
|
|
Object |
o | |
|
) |
| | [static] |
| static synchronized void registerDescriptionForClass |
( |
Class |
clazz, |
|
|
NSArray |
keys | |
|
) |
| | [static] |
Member Data Documentation
The documentation for this class was generated from the following file: