Re: D2W Auto-Qualifying all listings
Re: D2W Auto-Qualifying all listings
- Subject: Re: D2W Auto-Qualifying all listings
- From: Daniel Beatty <email@hidden>
- Date: Tue, 21 Sep 2010 10:33:48 -0700
Greetings David,
Just following up on one of these weirditiies. I am trying to follow the Bug Tracker example, and I get a nasty SQL error when trying to run the bug tracker. For example, I run a script containing the following:
#!/bin/sh
( cd /Library/WebObjects/JavaApplications/BugTracker.woa ;
./BugTracker \
-Der.javamail.centralize=false \
-Der.extensions.ERXApplication.developmentMode=true \
-DdbConnectURLGLOBAL=jdbc:mysql://localhost/bug?capitalizeTypenames=true \
-DdbConnectUserGLOBAL=bugUser \
-DdbConnectPasswordGLOBAL=changeIt \
-DdbConnectPluginGLOBAL= \
-DdbConnectDriverGLOBAL= \
-DdbEOPrototypesEntityGLOBAL=EOJDBCMySQLPrototypes )
When I run this script I get stopped at :
1401 [main] WARN er.extensions.eof.ERXModelGroup - Clearing previous class descriptions
1700 [main] INFO er.corebusinesslogic.audittrail.ERCAuditTrail - Configuration : {}
1810 [main] INFO com.thimbleware.jmemcached.MemCacheDaemon - Listening on localhost:12345
1811 [main] INFO er.caching.ERCaching - Server started: 127.0.0.1:12345 maxItems=0 maxMemory=128
1811 [main] ERROR er.caching.ERCaching - No Servers found, set er.caching.servers=server1:port1,server2:port2...
1895 [main] WARN er.extensions.migration.ERXMigrator - er.migration.modelNames is not set, defaulting to modelGroup.models() order instead.
4331 [main] INFO er.extensions.migration.ERXMigrator - Upgrading ERAttachment to version 1 with migration 'er.attachment.migrations.ERAttachment1@1a9db992'
4343 [main] INFO er.extensions.jdbc.ERXJDBCUtilities - Executing alter table ERAttachment null available VARCHAR(5) NOT NULL
4354 [main] ERROR er.extensions.appserver.ERXApplication - BugTracker failed to start.
The complaint that I get is that MySQL does not like the syntax being applied. Any ideas?
Thank you,
Dan
On Sep 9, 2010, at 3:32 PM, David Holt wrote:
> Hi David!
>
> On 2010-09-09, at 3:03 PM, David Avendasora wrote:
>
>> Hi all D2W Gurus,
>>
>> I'm starting a new D2W app, and one of the things it needs to do is automatically pre-qualify all listings of of entities to filter down to only the EOs that the user is allowed to see.
>
> Bug Tracker does stuff like this in the Factory class. You'll find that actions return different qualified lists of things and likely uses a different pageConfiguration for each one (I'm going from memory here). It also heavily leverages the clazz pattern. Take a look at the EO for Bug.
>
> The way I have been doing it is to set up a navigationRootChoice based on the logged in user (conditionally display tabs). Then when they further differentiate themselves I store that to ERXThreadStorage, and the tabs reconfigure based on this new layer of qualification. You could do this multiple times, I guess. Take a look at childrenChoices code in the NavigationMenu.plist for BugTracker
>
>> The logic to tell if a user is allowed will be somewhat complicated as a user can belong to one or more organizations, and may have one or more roles within each organization.
>
> Rules should handle it. See Bug.java for the different ways lists of Bugs are returned to the app.
>
>>
>> I want to add a qualifiers to all searches that they perform that take their Organizations and Roles into account. Each entity that they search on will have their own set of qualifiers to do this filtering.
>
> I think you may want to do this in your business logic. You will need to leverage ERXThreadStorage to do so, however.
>
>>
>> I'm figuring on adding the qualifiers to the session so I can grab them from there.
>
> ERXThreadStorage. Then you can use them directly in your business logic. You can set fetch specifications that can be as complex as you wish using the qualifiers that you have stored.
>
>> There are hints of how to do this in this email chain from a couple years ago: http://lists.apple.com/archives/webobjects-dev/2007/Sep/msg00032.html but I'm not sure where to start implementing this for my project, and I didn't see any obvious examples in the BugTracker demo app.
>>
>> Any tips or pointers to other apps that do this?
>
> You can also do this in the navigation menu. Conditionally show or hide whole pageConfigurations based on some method. (see NavigationRootChoice method in BugTracker on the Session class)
> You can also hide and show attributes on a page with rules such as entity.name = 'Media' and 'session.user.isAdmin' = true => displayPropertyKeys = ("x","y","z")
>
> I have found that out of the box the restricting object stuff worked reliably for one, but as soon as my needs got more complex, I had much better success moving what I wanted to do to business logic. If you step back, you'll probably agree it makes more sense to be there than in the component or controller anyway.
>
> BUT, there are many ways to skin this cat.
>
> HTH,
>
> d
>
>>
>> Thanks!
>>
>> Dave _______________________________________________
>> 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
>
> _______________________________________________
> 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
_______________________________________________
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