Project Wonder 5.0.0.8795

er.extensions.eof
Class ERXDummyRecord

java.lang.Object
  extended by com.webobjects.eocontrol.EOCustomObject
      extended by 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:

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 Class Summary
static class ERXDummyRecord.GlobalID
           
static class ERXDummyRecord.ProxyBinding
           
 
Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOCustomObject
EOCustomObject._BooleanFieldBinding, EOCustomObject._FieldBinding, EOCustomObject._LazyFieldBinding, EOCustomObject._NumberFieldBinding
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueCodingAdditions
EOKeyValueCodingAdditions.DefaultImplementation, EOKeyValueCodingAdditions.Utility
 
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.eocontrol.EOKeyValueCoding
EOKeyValueCoding._BestBindingCreation, EOKeyValueCoding._KeyBindingCreation, EOKeyValueCoding._StoredForwardingBinding
 
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.NSValidation
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.ValidationException
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol._EOPrivateMemento
_EOPrivateMemento.DefaultImplementation
 
Field Summary
 
Fields inherited from class com.webobjects.eocontrol.EOCustomObject
__readOnly, _CLASS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
protected ERXDummyRecord(Object o)
           
 
Method Summary
 NSKeyValueCoding._KeyBinding _otherStorageBinding(String key)
           
static EOClassDescription classDescriptionForObject(Object object)
           
static EOArrayDataSource dataSourceForObjects(EOEditingContext ec, NSArray list)
           
 Object object()
           
static EOEnterpriseObject recordForObject(EOEditingContext ec, Object o)
           
static void registerDescriptionForClass(Class clazz, NSArray keys)
           
 
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ERXDummyRecord

protected ERXDummyRecord(Object o)
Method Detail

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)

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.