Hi All,
Finally, to solve the creating/editing object issue I followed the
suggestions made and used pageConfigurations.
I'll post here what I did, just in case someone has to do a similar thing or
has a suggestion to add.
.
First, as my application did not use pageConfigs, I had to change (in
templates and pages code) all of
D2W.factory().
editPageForNewObjectWithEntityNamed(entityName(), session());
with
D2W.factory().
editPageForNewObjectWithConfigurationNamed("Create"+entityName(),
session());

Similarly all
D2W.factory().
editPageForEntityNamed(object().entityName(), session());
with
D2W.factory().
pageForConfigurationNamed("Edit"+entityName(), session());


To reduce the number of rules to write, I used the like operator:
(pageConfiguration like 'Edit*') => task = 'edit'
(pageConfiguration like 'Create*') => task = 'edit'

And for each entity I created a rule:
(pageConfiguration like '*Customer') => entity = "Customer" (Entity
Assigment)

So that it matches "EditCustomer" and "CreateCustomer".
I don't like much this part, but I suppose that if I have 100 entities, it
is better to add a few rules for each one, than having them freezed or
worse.

Finally, with all that set, I used rules like the one below to make those
small differences between creating and editing an object.

As an example, here is one to make the id attribute readonly:
(pageConfiguration='EditCustomer' and propertyKey = 'id') => componentName =
"D2WDisplayString"

If someone has any suggestions or notes to add I would like to hear them.
Thanks for all the help, it was very usefull.

-- 
  Cuauhtemoc Hohman

On Wed, Apr 23, 2008 at 12:05 PM, Cuauhtemoc Hohman <[EMAIL PROTECTED]>
wrote:

> Hi Guido,
>
> > Use the pageConfiguration:
> >
> > pageConfiguration = "CreateMyObject" vs pageConfiguration =
> > "EditMyObject"
> >
> I haven't used pageConfigurations before, but reading about it I see a
> problem with them for the issue I want them, because for it to work
> correctly I have to specify in the rules a few things.
> "As a minimum, you need to provide rules for task and entity so the D2W
> Factory can determine what kind of page it is creating"
> (pageConfiguration = 'CreateCustomer') => task = "edit"
> (pageConfiguration = 'CreateCustomer') => entity = "Customer"
>
> Does that mean that I would need to create a pair of configurations
> (EditXxx and CreateXxx) for each entity I have??
>
> I suppose I would also need to change (in templates and pages code) all
> D2W.factory().
> editPageForNewObjectWithEntityNamed(entityName(), session());
> with
> D2W.factory().
> pageForConfigurationNamed("Create"+entityName(), session());
>
> I suppose it's possible, but it's a bit troublesome, or maybe I'm not
> getting the idea still.
>
> Thanks for your support.
>
> --
> Cuauhtemoc Hohman
>
> On Mon, Apr 21, 2008 at 6:27 PM, Guido Neitzer <[EMAIL PROTECTED]> wrote:
>
> > On 21.04.2008, at 17:11, Cuauhtemoc Hohman wrote:
> >
> >  However, I don't really get how does this help my EditPage Template to
> > > distinguish between edit and create modes.
> > > In my testing, both continue using task "edit", so how do I
> > > differentiate them in the Rule System?
> > >
> >
> > Use the pageConfiguration:
> >
> > pageConfiguration = "CreateMyObject" vs pageConfiguration =
> > "EditMyObject"
> >
> >
> > cug
> >
> >
>
-- 
   Cuauhtemoc Hohman
 _______________________________________________
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]

Reply via email to