Child pages
  • Using a custom EOEditingContext (ERXEC) Subclass

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Create the EditingContext Subclass

Code Block
public class MyEditingContext extends ERXEC {

    public MyEditingContext(EOObjectStore anObjectStore) {
        super(anObjectStore);
    }

    public MyEditingContext() {
	super();
    }

    // Your custom logic here...

}

Create the ERXEC.DefaultFactory Subclass

Code Block
public class MyEditingContextFactory extends ERXEC.DefaultFactory {

    public MyEditingContextFactory() {
        super();
    }

    protected EOEditingContext _createEditingContext(EOObjectStore parent) {
        return new MyEditingContext(parent == null ? EOEditingContext.defaultParentObjectStore() : parent);;
    }
}

Tell Wonder to Use Your Custom Factory

In your Application constructor, set your custom editing context factory as the default factory for ERXEC as shown here for example:

Code Block
public Application() {
        super();

        // Configure the Editing Context factory for my subclass of ERXEC
        ERXEC.setFactory( new MyEditingContextFactory() );

        // More app initialization code......

    }

Creating an Instance of Your Custom Editing Context Subclass

Code Block
EOEditingContext ec = ERXEC.newEditingContext();