• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOCopyable Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOCopyable Problems


  • Subject: Re: EOCopyable Problems
  • From: Kieran Kelleher <email@hidden>
  • Date: Wed, 4 Jul 2007 11:37:54 -0400

You may need to check your implementation of the interface methods.

For example, I typically copy attributes using one of the EOCopyable utilities and selectively copy relationships that make sense. For each entity, you still have to think through the mechanics of what "copy" actually means for the entity you are dealing with. Chuck Hill is best

For example I have a simple mailing address entity as follows (irrelevant methods removed for clarity of EOCopyable implementation) and that is folloowed by another entity example:

public class CTAddress extends _CTAddress implements GeocodedMailingAddress, GeocodeLevel, EOCopyable, GeoPoint {
.
.
.
/** EOCopyable interface */
public EOEnterpriseObject copy() {
return copy( new NSMutableDictionary() );
}


/** EOCopyable interface */
public EOEnterpriseObject copy( NSMutableDictionary copiedObjects ) {
return EOCopyable.DefaultImplementation.copy( copiedObjects, this );
}


/** EOCopyable interface
We just copy the CTDataList and related CTDataRecords. */
public EOEnterpriseObject duplicate( NSMutableDictionary copiedObjects ) {
// First make a copy with attributes only
EOEnterpriseObject theCopy = EOCopyable.Utility.newInstance ( this );
EOCopyable.Utility.copyAttributes( this , theCopy );


        return theCopy;
    }
.
.
.

}



/** A campaign represents a direct mail campaign. */
public class CTCampaign extends _CTCampaign implements EOCopyable, CampaignBehaviour {
.
.
.
.


    /** EOCopyable interface */
    public EOEnterpriseObject copy() {
        return copy( new NSMutableDictionary() );
    }

/** EOCopyable interface */
public EOEnterpriseObject copy( NSMutableDictionary copiedObjects ) {
return EOCopyable.DefaultImplementation.copy( copiedObjects, this );
}


/** EOCopyable interface
We just copy the CTDataList and related CTDataRecords. */
public EOEnterpriseObject duplicate( NSMutableDictionary copiedObjects ) {
// First make a copy with attributes only
EOEnterpriseObject theCopy = EOCopyable.Utility.newInstance ( this );
EOCopyable.Utility.copyAttributes( this, theCopy);


theCopy.addObjectToBothSidesOfRelationshipWithKey( program (), "program" );
theCopy.addObjectToBothSidesOfRelationshipWithKey( location (), "location" );
theCopy.addObjectToBothSidesOfRelationshipWithKey ( mediaTemplate(), "mediaTemplate" );


// Initialize attributes that should be initialized and not copied
theCopy.takeValueForKey( null, "campaignCode" );
theCopy.takeValueForKey( null, "recAddTime" );
theCopy.takeValueForKey( null, "recAddUser" );
theCopy.takeValueForKey( null, "recModTime" );
theCopy.takeValueForKey( null, "recModUser" );
theCopy.takeValueForKey( WORKFLOW_INITIATED_STATE, KEY_WORKFLOW_STATE );


        // Begin Jobsite radius attributes
        // Now here after STrategy implementation
        EOCopyable.Utility.deepCopyRelationship( copiedObjects,
                this,
                theCopy,
                "centroidAddress" );

        EOCopyable.Utility.deepCopyRelationship( copiedObjects,
                this,
                theCopy,
                "centroidPerson" );

// END Jobsite Radius attributes
if ( log.isDebugEnabled() ) log.debug("Copy = " + theCopy.valueForKey( "toLongString" ) );


        return theCopy;
    }

.
.
.

}



On Jul 4, 2007, at 10:03 AM, David Avendasora wrote:

Hi all,

I've implemented EOCopyable from Practical WebObjects so I can easily clone some of my complicated classes.

The problem is that when I call copy(new NSMutableDictionary()); I get nothing back. If I call EOEnityCopier(ec,this) it works just fine.

Are there any known problems with using this interface?

Thanks!

Dave


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: EOCopyable Problems
      • From: Kieran Kelleher <email@hidden>
References: 
 >EOCopyable Problems (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: EOEditingContext and WO Services (was Subclassing EOEditingContext)
  • Next by Date: Re: EOCopyable Problems
  • Previous by thread: EOCopyable Problems
  • Next by thread: Re: EOCopyable Problems
  • Index(es):
    • Date
    • Thread