On 2011-08-15, at 1:36 PM, Kevin Hinkson wrote:
Hi,
I've implemented a D2W on an EOModel containing a Place EO with a flattened to-many relationship to ERAttachment (Place >> PlaceERAttachment >> ERAttachment). "Place" has several other properties so I created a new action in MenuHeader.java using EditPageInterface and the rule to enable a wizard and that works fine.
What is PlaceERAttachment?
I always model my to-many attachments so that there is an intermediate EO that has a to-one relationship to ERAttachment.
For actually adding new photos within the wizard things seem to fall apart. Initially I was getting an exception about the abstract class ERAttachment being instantiated, but "solved" that by mapping the relationship to ERFileAttachment instead of ERAttachment.
You shouldn't model to the subclass.
Place ->> Photo -> ERAttachment
I've also attempted to add a rule to tell D2W how to edit an ERAttachment.
Using: (
entity.name = 'Place' and task = 'edit' and propertyKey = 'photos') => componentName = "ERMD2WEditAttachment"
Gives me: java.lang.ClassCastException: com.webobjects.eocontrol._EOCheapCopyMutableArray cannot be cast to er.attachment.model.ERAttachment
Photos is an array. You need to edit a single attachment.
Do you have your properties set?
er.attachment.Photo.attachment.storageType = file
er.attachment.Photo.attachment.file.overwrite = false
er.attachment.Photo.attachment.file.filesystemPath = /tmp/erattachment
So...
Using: (task = 'edit' and
entity.name = 'PlaceERFileAttachment' and propertyKey = 'erFileAttachment') => componentName = "ERMD2WEditAttachment"
Gives me: java.lang.IllegalArgumentException: This form is missing a 'enctype=multipart/form-data' attribute. It is required for WOFileUpload to work.
Did you set your attachmentConfiguration in Rules to match your properties?
100 : ((pageConfiguration like 'Edit*Photo' or pageConfiguration like 'Create*Photo') and propertyKey = 'attachment') => attachmentConfigurationName = "Photo.attachment" [com.webobjects.directtoweb.Assignment]
And now I'm not sure how else to proceed. Does anyone have any suggestions?
Additional rules I have:
100 : pageConfiguration like 'Create*Photo' => displayPropertyKeys = ("attachment") [com.webobjects.directtoweb.Assignment]
100 : pageConfiguration like 'Edit*Photo' => displayPropertyKeys = ("attachment") [com.webobjects.directtoweb.Assignment]
100 : ((pageConfiguration like 'Edit*Photo' or pageConfiguration like 'Create*Photo') and propertyKey = 'attachment') => componentName = "ERMD2WEditAttachment" [com.webobjects.directtoweb.Assignment]
See the thread called "ERAttachment... to-many and thumbs" from last week.
David
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