er.extensions.eof
Class ERXDummyRecord
java.lang.Object
com.webobjects.eocontrol.EOCustomObject
er.extensions.eof.ERXDummyRecord
- All Implemented Interfaces:
- _EOPrivateMemento, EODeferredFaulting, EOEnterpriseObject, EOFaulting, EOKeyValueCoding, EOKeyValueCoding._BestBindingCreation._ForwardingBindingCheck, EOKeyValueCoding._KeyBindingCreation, EOKeyValueCodingAdditions, EORelationshipManipulation, EOValidation, NSKeyValueCoding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._ReflectionKeyBindingCreation.Callback, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable
public class ERXDummyRecord
- extends EOCustomObject
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
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor |
| Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor |
| Methods inherited from class com.webobjects.eocontrol.EOCustomObject |
__classDescription, __clearPendingChanges, __editingContext, __globalID, __hasAuxillaryObservers, __hasPendingChanges, __hasPendingUpdate, __isInitialized, __isPendingDeletion, __isPendingInsertion, __isShared, __lastSnapshot, __originalSnapshot, __retainCount, __setAuxillaryObservers, __setClassDescription, __setEditingContext, __setGlobalID, __setInitialized, __setLastSnapshot, __setOriginalSnapshot, __setPendingDeletion, __setPendingInsertion, __setPendingUpdate, __setRetainCount, __setShared, _createKeyGetBindingForKey, _createKeySetBindingForKey, _createStoredKeyGetBindingForKey, _createStoredKeySetBindingForKey, _fieldKeyBinding, _forwardingBindingNeededForClass, _keyGetBindingForKey, _keySetBindingForKey, _methodKeyGetBinding, _methodKeySetBinding, _storedKeyGetBindingForKey, _storedKeySetBindingForKey, addObjectToBothSidesOfRelationshipWithKey, addObjectToPropertyWithKey, allPropertyKeys, attributeKeys, awakeFromClientUpdate, awakeFromFetch, awakeFromInsertion, canAccessFieldsDirectly, changesFromSnapshot, classDescription, classDescriptionForDestinationKey, clearFault, clearProperties, deleteRuleForRelationshipKey, editingContext, entityName, eoDescription, eoShallowDescription, equals, excludeObjectFromPropertyWithKey, faultHandler, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hashCode, includeObjectIntoPropertyWithKey, inverseForRelationshipKey, invokeRemoteMethod, isFault, isReadOnly, isToManyKey, opaqueState, ownsDestinationObjectsForRelationshipKey, prepareValuesForClient, propagateDeleteWithEditingContext, readResolve, reapplyChangesFromDictionary, removeObjectFromBothSidesOfRelationshipWithKey, removeObjectFromPropertyWithKey, shouldUseStoredAccessors, snapshot, storedValueForKey, takeStoredValueForKey, takeValueForKey, takeValueForKeyPath, takeValuesFromDictionary, takeValuesFromDictionaryWithMapping, toManyRelationshipKeys, toOneRelationshipKeys, toString, turnIntoFault, unableToSetNullForKey, updateFromSnapshot, userPresentableDescription, usesDeferredFaultCreation, validateClientUpdate, validateForDelete, validateForInsert, validateForSave, validateForUpdate, validateTakeValueForKeyPath, validateValueForKey, valueForKey, valueForKeyPath, valuesForKeys, valuesForKeysWithMapping, willChange, willRead, willReadRelationship |
ERXDummyRecord
protected ERXDummyRecord(Object o)
object
public Object object()
_otherStorageBinding
public NSKeyValueCoding._KeyBinding _otherStorageBinding(String key)
- Specified by:
_otherStorageBinding in interface NSKeyValueCoding._ReflectionKeyBindingCreation.Callback- Overrides:
_otherStorageBinding in class EOCustomObject
classDescriptionForObject
public static EOClassDescription classDescriptionForObject(Object object)
registerDescriptionForClass
public static void registerDescriptionForClass(Class clazz,
NSArray keys)
dataSourceForObjects
public static EOArrayDataSource dataSourceForObjects(EOEditingContext ec,
NSArray list)
recordForObject
public static EOEnterpriseObject recordForObject(EOEditingContext ec,
Object o)
Copyright © 2002 – 2007 Project Wonder.