You've got a bad rule returning a string for the RHS key 'entity'

On Sep 6, 2012, at 11:56 AM, Ângelo Andrade Cirino wrote:

> Hi all,
> 
> I would like to be more useful to the list, contributing with answers more 
> than I ask for help, but I must ask for help again.
> 
> I am trying to implement a D2W application as much as possible reusable and 
> tried the following code in my MainNavigationController:
> 
>     public WOComponent listAnEntityAction() {
>       return listPageForEntityName(AnEntity.ENTITY_NAME);
>     } 
> …
>     private WOComponent listPageForEntityName(String entityName) {
>       ListPageInterface newListPage = 
> (ListPageInterface)D2W.factory().pageForConfigurationNamed("List" + 
> entityName, session());
>       EODataSource ds = new EODatabaseDataSource(ERXEC.newEditingContext(), 
> entityName);
>       newListPage.setDataSource(ds);
>       return (WOComponent) newListPage;
>     }
> 
> But the end result is an exception that I was not able to track to D2WContext:
> 
> ClassCastException: java.lang.String cannot be cast to 
> com.webobjects.eoaccess.EOEntity
>   at com.webobjects.directtoweb.D2WContext.entity(D2WContext.java:394)
>   at 
> com.webobjects.directtoweb.ERD2WContext.setDynamicPage(ERD2WContext.java:103)
>   at 
> er.directtoweb.ERD2WFactory.pageForConfigurationNamed(ERD2WFactory.java:169)
>   at 
> com.visionar.administraAgencia.app.MainNavigationController.listPageForEntityName(MainNavigationController.java:95)
>   at 
> com.visionar.administraAgencia.app.MainNavigationController.listAgênciasAction(MainNavigationController.java:32)
> 
> I have already implemented a navigation menu with page configurations but 
> with a lengthier code, but I think this style is more reusable and concise. I 
> searched the examples and was able to see that the BugTracker and ERMovies 
> examples implement actions and page configurations in this style, so I think 
> I'm not doing something overly wrong.
> 
> Cheers,
> 
> Angelo
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to