On 19-Mar-08, at 8:41 AM, David Avendasora wrote:
On Mar 19, 2008, at 8:33 AM, David LeBer wrote:
On 19-Mar-08, at 8:21 AM, David Avendasora wrote:
Hi all,
I've run into something that _seems_ to work, but just seems
"wrong" and I don't see how to do it "right".
I have the following inheritance structure in my model:
LotCode (NOT abstract)
ManufacturedBatch extends LotCode.
When I call awakeFromInsertion on the superclass I do it as
follows :
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null) {
setLotCodeType(1);
}
}
But when I call awakeFromInsertion on the subclass I have to do
this:
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null || lotCodeType.equals(1)) {
setLotCodeType(1);
}
}
I've never used a concrete superclass but how about:
Superclass:
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null) setLotCodeType(1);
}
Subclass:
public void awakeFromInsertion(EOEditingContext ec) {
if (lotCodeType() == null) setLotCodeType(2);
super.awakeFromInsertion(ec);
}
I thought about this, but since it is also an "EO-No-No" to do
_anything_ before calling awakeFromInsertion I didn't want to do
anything before inserting the super.
Hmm, you are right. How about this:
Superclass:
public void awakeFromInsertion(EOEditingContext ec) {
awakeWithCodeType(ec, 1);
}
public void awakeWithCodeType(EOEditingContext ec, int codeType) {
super.awakeFromInsertion(ec);
setLotCodeType(codeType);
}
Subclass:
public void awakeFromInsertion(EOEditingContext ec) {
awakeWithCodeType(ec, 2);
}
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]