ERXDummyRecord Class Reference

Inherits com::webobjects::eocontrol::EOCustomObject.

Collaboration diagram for ERXDummyRecord:

Collaboration graph
[legend]

List of all members.

Classes

class  GlobalID
class  ProxyBinding

Public Member Functions

NSKeyValueCoding._KeyBinding _otherStorageBinding (String key)
Object object ()

Static Public Member Functions

static EOClassDescription classDescriptionForObject (Object object)
static EOArrayDataSource dataSourceForObjects (EOEditingContext ec, NSArray list)
static EOEnterpriseObject recordForObject (EOEditingContext ec, Object o)
static synchronized void registerDescriptionForClass (Class clazz, NSArray keys)

Protected Member Functions

 ERXDummyRecord (Object o)

Static Private Member Functions

static Field _fieldForName (Class clazz, String name)
static Method _methodForName (Class clazz, String name)
static Field fieldForName (Class clazz, String name)
static NSArray fieldNamesFromClass (Class clazz)
static Method methodForName (Class clazz, String name)

Private Attributes

Object object

Static Private Attributes

static EOModel pojoModel


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: 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

ERXDummyRecord ( Object  o  )  [protected]


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]

Object object (  ) 

static EOEnterpriseObject recordForObject ( EOEditingContext  ec,
Object  o 
) [static]

static synchronized void registerDescriptionForClass ( Class  clazz,
NSArray  keys 
) [static]


Member Data Documentation

Object object [private]

EOModel pojoModel [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:08 2012 for Project Wonder by  doxygen 1.5.8