WebObjects 

Title:  EODeleteRuleNoAction cannot be set in EOModeler

Entry Number: 
Creation Date: December 12, 1997
Last Updated: <<Date December 15, 1997>>
 
Keywords: WebObjects, EOModeler, EODeleteRuleNoAction, EOF 2.2, WebObjects 3.5.x

Overview

This README document describes how to install an EOModeler bundle used with the Enterprise Objects Framework version 2.2 and WebObjects Release 3.5.x in order to properly set the EODeleteRuleNoAction option in the EOModeler relationship inspector. 

The EODeleteRuleNoAction is a new option added to EOModeler starting with EOF Version 2.2.

This EOModeler bundle is the  fix for Apple bug ref. no. 2202107.

Bug Description

The bug occurs when you use the Advanced EORelationship inspector to set a relationship's DeleteRule to "No Action" in an eomodel file. When you attempt to open this model at a later point in time, the delete rule will be mistakenly set to "Nullify", and you will see the following message in the console or application event log:

"Invalid delete rule string:'EODeleteRunNoAction' on entity with name: 'toMovie'"

Bug Workarounds

1) From within your application you can use the public API on EORelationship to set the EODeleteRule to be the desired value. This can be done with the following code sample:

// need to import EOClassDescription.h from EOControl where the
// enum is defined.

-(void)deleteRuleFix
{
	// find out the relationship which needs to be fixed
    relToFix = [[[EOModelGroup defaultGroup] entityNamed:@"entityName"] relationshipNamed:@"relName"]; 
	// set to the proper delete rule
    [relToFix setDeleteRule:EODeleteRuleNoAction];
}

2) Or you can load the DeleteRuleFix.bundle  into EOModeler and any model written out will be correct. 
(See NextAnswer 2563_EODeleteRulePatchNT.tar.gz for the NT version, and NextAnswer 2564_DeleteRule.bundle.compressed for the 3-way fat Mach version (intel, m68K and sparc)).

Installation of the DeleteRuleFix.bundle

First, you need to install the bundle. Then, we recommend that you drop the bundle into the Resources   directory of the EOModeler.app.  You also need to set the user defaults to  get EOModeler to load the bundle during startup.

On NT (using the Bourne shell shipped with WebObjects):
<<Assuming that your $NEXT_ROOT is defined as C:/Next, that you have renamed the binary file to DeleteRuleFix.tar.gz, and that you have copied the NT binary patch into your C:/temp directory>>

  % cd $NEXT_ROOT/NextDeveloper/Apps/EOModeler.app/Resources
  % cp c:/temp/DeleteRuleFix.tar.gz .
  % gzip -d DeleteRuleFix.tar.gz
  % gnutar xf DeleteRuleFix.tar
  % rm DeleteRuleFix.tar
  % defaults write EOModeler BundlesToLoad "(c:/Next/NextDeveloper/Apps/EOModeler.app/Resources/DeleteRuleFix.bundle)"

On Mach,  first decompress the file 2564_DeleteRule.bundle.compressed by using the Workspace File menu "Decompress". Then, you'll need to su to root in order to install the bundle:
 <<Assuming that  Workspace is placing the decompressed file into the default location: /tmp/O_2564_DeleteRule_bundle/DeleteRuleFix.bundle >>
 
  % su
  Password:
  # cd /NextDeveloper/Apps/EOModeler.app/Resources
  # cp -r /tmp/O_2564_DeleteRule_bundle/DeleteRuleFix.bundle .
  # exit
  % defaults write EOModeler BundlesToLoad "(/NextDeveloper/Apps/EOModeler.app/Resources/DeleteRuleFix.bundle)"

Testing for a proper installation of the patch

1. During launch, EOModeler will log the bundles that it loads. So look for the following message in the console of the Application event log, which means that the installation was correct:

 Dec 11 16:01:05 EOModeler[17673] Loading bundle with path /NextDeveloper/Apps/EOModeler.app/Resources/DeleteRuleFix.bundle: NSBundle </NextDeveloper/Apps/EOModeler.app/Resources/DeleteRuleFix.bundle> (not yet loaded)

2. Modify an EORelationship to have a delete rule of "No Action", save the mode, and then revert. If the Relationship is still set to "No Action", the bundle is loaded.

Note that if you have your own tool that you use to create or modify EOModels, you will need to load this bundle into that tool also in order to preserve the EODeleteRuleNoAction setting.