getParameters is filter is empty

3 views
Skip to first unread message

Dave

unread,
Aug 22, 2010, 8:23:21 PM8/22/10
to Mach-II for CFML
Hi All,

I can't see to access getParameters from without a filter. eg:


<event-filter name="JobTaskPermissionToAccess"
type="sys.jo.core.m2filter.Task">
<parameters>
<parameter name="PersistTaskItem" value="true"/>
<parameter name="action" value="getStaticAccessPermissions"/>
<parameter name="AccessTaskTypes" value="Configure User Job
Permission,Configure Assessment Processes,Initialise JCW,Create Job
From Template,View Configuration Log,Manual Override of Auto Reference
Number,Manage Job Files for Applicants,Manage Job Files for
Recruiters,Configure Application Form,Configure Online Candidate
Scheduling,Access PreVisor Assessment"/>
<parameter name="haltOnNoPermission" value="false"/>
<parameter name="itemResultArg" value="permissionToAccess" />
</parameters>
</event-filter>
</event-filters>




<filter name="JobTaskPermissionToAccess" />


When I do a dump of getParameters in the filter, it dumps an empty
struct.

Any ideas?

Thanks,
dave

Peter J. Farrell

unread,
Aug 22, 2010, 10:00:26 PM8/22/10
to mach-ii-for...@googlegroups.com
A few questions for you.

* Where are you dumping the parameters?
* What does you filter code look like? Please share.
* Do you have an init() method in your filter CFC? If you do, you
probably should be using the configure() method instead. The init()
method is not meant to be overridden and all "setup" code should be done
in the configure() method. We do pass in the parameters to the init()
method which is automatically called by the framework (it's an inherited
method). So if they are missing, I bet you're overriding the init()
method and therefore there are not being set for you.

Here's the FAQ about this:

http://trac.mach-ii.com/machii/wiki/FAQDifferenceBetweenUsingInitAndConfig

.pjf

Dave said the following on 08/22/2010 07:23 PM:

Dave

unread,
Aug 22, 2010, 10:40:36 PM8/22/10
to Mach-II for CFML
Hi Peter,

I'm dumping in the FilterEvent method.

<cffunction name="filterEvent" access="public" returntype="boolean"
output="false">
<cfargument name="Event" type="MachII.framework.Event"
required="true" />
<cfargument name="EventContext" type="MachII.framework.EventContext"
required="true" />
<cfargument name="paramArgs" type="struct" required="false"
default="#StructNew()#" />

<cfdump var="#getParameters()#">
<cfdump var="#variables#">
<cfabort>
I can see variables.parameters in the above dump, however the struct
is empty.


My Filter extends="machii.framework.EventFilter" and there is no
configure/init method defined at this local level.

Regards,
Dave


On Aug 23, 12:00 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:
> A few questions for you.
>
> * Where are you dumping the parameters?
> * What does you filter code look like?  Please share.
> * Do you have an init() method in your filter CFC?  If you do, you
> probably should be using the configure() method instead.  The init()
> method is not meant to be overridden and all "setup" code should be done
> in the configure() method.  We do pass in the parameters to the init()
> method which is automatically called by the framework (it's an inherited
> method).  So if they are missing, I bet you're overriding the init()
> method and therefore there are not being set for you.
>
> Here's the FAQ about this:
>
> http://trac.mach-ii.com/machii/wiki/FAQDifferenceBetweenUsingInitAndC...

Peter J. Farrell

unread,
Aug 22, 2010, 11:04:12 PM8/22/10
to mach-ii-for...@googlegroups.com
What version of Mach-II are you using? If you are using 1.8 or higher,
trying dumping:

<cfdump var="#getProxy().getOriginalParameters()#"/>

If this is an empty struct, then you must not be reloading the
application. If you are reloading an individual component using the
dashboard, the original version of the XML file that was used at
startup. So if you added items to your xml file and only just reloaded
the CFC in the dashboard -- the XML file changes won't be reflected.

.pjf

Dave said the following on 08/22/2010 09:40 PM:

Priya K

unread,
Aug 23, 2010, 7:13:22 AM8/23/10
to mach-ii-for...@googlegroups.com
It should either not be reloaded or you are not dumping in the right filter. B'se you are using paramArgs you can get every parameters from this argument. <cfdump var = '#arguments.paramArgs()#'> 
Is your type in the event-filter correct ?

--
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to mach-ii-for...@googlegroups.com
To unsubscribe from this group, send email to mach-ii-for-coldf...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Peter J. Farrell

unread,
Aug 23, 2010, 7:30:09 AM8/23/10
to mach-ii-for...@googlegroups.com
Just to be sure Dave, you're asking about configure time parameters?  Not runtime paramArgs (like Priya mentions).   Here's the difference:

http://trac.mach-ii.com/machii/wiki/IntroToFilters#UsingParameterswithFilters

* Configure-time parameters are global and are set when you declare and register the filter with the framework.
* Runtime-parameters are passed in via the paramArgs argument in the filterEvent() method and are local to that invocation of that method for that call only. You'd define these parameters inside the <filter name="etc"> part inside your *event-handler* when you want to use the filter.

HTH,
.Peter

Priya K said the following on 08/23/2010 06:13 AM:

Priya K

unread,
Aug 23, 2010, 7:39:08 AM8/23/10
to mach-ii-for...@googlegroups.com
You are absolutely right but you will get both configure type and time
type parameters in paramargs.
Type using isdedined and see if the parameter is really defined.. Just
a double check.

Dave

unread,
Aug 23, 2010, 5:30:52 PM8/23/10
to Mach-II for CFML
Hi Peter,

Runtime params work perfectly, it's the config time ones were causing
the issues.

I say "were ", because i created another very simple test case and
it's now working as expected, ie, I can see both the Global Params in
the getParameters() call and also the local params via param-args.

Thanks guys, will re-check my orig code :)

dave






On Aug 23, 9:30 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:
> Just to be sure Dave, you're asking about configure time parameters?
> Not runtime paramArgs (like Priya mentions).   Here's the difference:
>
> http://trac.mach-ii.com/machii/wiki/IntroToFilters#UsingParameterswit...
>
> * Configure-time parameters are global and are set when you declare and
> register the filter with the framework.
> * Runtime-parameters are passed in via the paramArgs argument in the
> filterEvent() method and are local to that invocation of that method for
> that call only. You'd define these parameters inside the <filter
> name="etc"> part inside your *event-handler* when you want to use the
> filter.
>
> HTH,
> .Peter
>
> Priya K said the following on 08/23/2010 06:13 AM:
>
>
>
> > It should either not be reloaded or you are not dumping in the right
> > filter. B'se you are using paramArgs you can get every parameters from
> > this argument. <cfdump var = '#arguments.paramArgs()#'>
> > Is your type in the event-filter correct ?
>
> >     <mailto:mach-ii-for...@googlegroups.com>
> >     To unsubscribe from this group, send email to
> >     mach-ii-for-coldf...@googlegroups.com
> >     <mailto:mach-ii-for-coldf...@googlegroups.com>

Dave

unread,
Aug 23, 2010, 7:30:39 PM8/23/10
to Mach-II for CFML
I think the "auto-merging" of configure time and runtime args into
ParamArgs would rock.

IE, if we find we are constantly using the same filter definition (ie,
same params), then we should be able to redefine the filter with a
different name in the event-filters section of the XML, together with
it's params then use that filter in events, overriding params as
needed.

To achieve this at the moment we need to modify the filter's CFC's to
merge the Runtime params into the configTime params.


Dave




On Aug 23, 9:39 pm, Priya K <priya23...@gmail.com> wrote:
> You are absolutely right but you will get both configure type and time
> type parameters in paramargs.
> Type using isdedined and see if the parameter is really defined.. Just
> a double check.
> On Monday, August 23, 2010, Peter J. Farrell <pe...@mach-ii.com> wrote:
>
>
>
>
>
> > Just to be sure Dave, you're asking about configure time parameters?
> > Not runtime paramArgs (like Priya mentions).   Here's the difference:
>
> >http://trac.mach-ii.com/machii/wiki/IntroToFilters#UsingParameterswit...
>
> > * Configure-time parameters are global and are set when you declare and
> > register the filter with the framework.
> > * Runtime-parameters are passed in via the paramArgs argument in the
> > filterEvent() method and are local to that invocation of that method
> > for that call only. You'd define these parameters inside the <filter
> > name="etc"> part inside your *event-handler* when you want to use
> > the filter.
>
> > HTH,
> > .Peter
>
> > Priya K said the following on 08/23/2010 06:13 AM:
> > It should either not be reloaded or you are not dumping in
> > the right filter. B'se you are using paramArgs you can get every
> > parameters from this argument. <cfdump var =
> > '#arguments.paramArgs()#'>
> >   Is your type in the event-filter correct ?
>
> >   On Sun, Aug 22, 2010 at 10:40 PM, Dave <davidame...@gmail.com>
> > For more options, visit this group athttp://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>
> > ***New URLs as of April 29th, 2010***
> > SVN:http://svn.mach-ii.com/machii/
> > Wiki / Documentation / Tickets:http://trac.mach-ii.com/machii/
>
> > --
> > You received this message because you are subscribed to Mach-II for CFML list.
> > To post to this group, send email to mach-ii-for...@googlegroups.com
> > To unsubscribe from this group, send email to mach-ii-for-coldf...@googlegroups.com
> > For more options, visit this group athttp://groups.google.com/group/mach-ii-for-coldfusion?hl=en
Reply all
Reply to author
Forward
0 new messages