• 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: Weird problem with D2W rules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird problem with D2W rules


  • Subject: Re: Weird problem with D2W rules
  • From: Ramsey Gurley <email@hidden>
  • Date: Sat, 30 Mar 2013 11:18:46 -0700


On Mar 29, 2013, at 3:37 PM, Ramsey Gurley wrote:

On Mar 29, 2013, at 2:27 PM, Freddie Tilley wrote:

at er.modern.directtoweb.components.header.ERMD2WSimpleHeader.headerString(ERMD2WSimpleHeader.java:25)


My wonder says that line is:

return stringValueForBinding(Keys.displayNameForPageConfiguration);

What is your rule for displayNameForPageConfiguration? It doesn't look like your stack trace goes through ERDDefaultDisplayNameAssignment.

Kieran,

This also looks like a bug in wonder. ERXGenericRecord doesn't handle a null editingContext() in handleQueryForUnboundKey(). That's going to be the case on deleted objects.

I think that should just check entity().primaryKeyAttributeNames().contains(key) first. That method is called a lot and there's no reason to be building pk dictionaries every time. This shouldn't wait for the next integration merge.

Ramsey

Hmm, even calling entity() repeatedly is going to add overhead. Adding a private static entity var may be needed to cache the EOEntity and prevent constantly searching through the models :-/ The other problem I see is that entity() may result in null when there's no ec and the entity is not in the default model group. Not sure how often that happens.

I'm thinking this method should look something like to prevent the NPE:

public Object handleQueryWithUnboundKey(String key) {
// Handles primary key attribute values
if(entity().primaryKeyAttributeNames().contains(key)) {
// Deleted object. Return null.
if(editingContext() == null) {
return null;
}
NSDictionary pkDict = EOUtilities.primaryKeyForObject(editingContext(), this);
// New object. Return null.
if(pkDict == null) {
return null;
}
// Return value for key
return pkDict.objectForKey(key);
}
return super.handleQueryWithUnboundKey(key);
}

Alternately, is this something that we could simply remove and put into an eogen template for anyone who needs this? The more I look at this the less I like it. This method is going to get called a ton for any ERD2W app that uses object.someKey in rules. 

In my ERUsers framework I have

55 : (pageConfiguration = 'CreateERUser' and propertyKey = 'clearPassword' and object.password.length > 0) => componentName = "R2D2WPropertyMessage" [com.webobjects.directtoweb.Assignment]

Which means the current method is called and creating a pkDict for every single property level component on every single page that isn't an ERUser. I just tested it on a ListMovie page. On a ten item page, handleQueryWithUnboundKey is called 960 times. This is not good. This method needs to be very fast or it needs to be removed.

Ramsey

 _______________________________________________
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: Weird problem with D2W rules
      • From: Ramsey Gurley <email@hidden>
References: 
 >Weird problem with D2W rules (From: Freddie Tilley <email@hidden>)
 >Re: Weird problem with D2W rules (From: Ramsey Gurley <email@hidden>)
 >Re: Weird problem with D2W rules (From: Freddie Tilley <email@hidden>)
 >Re: Weird problem with D2W rules (From: Ramsey Gurley <email@hidden>)

  • Prev by Date: Determining database plugin at runtime
  • Next by Date: Re: Determining database plugin at runtime
  • Previous by thread: Re: Weird problem with D2W rules
  • Next by thread: Re: Weird problem with D2W rules
  • Index(es):
    • Date
    • Thread