Porting MG:U(2) Applications to MG:G (3)

If you are on CF8, you can use per-application mappings (Ex. this["mappings"]["/ModelGlue"] = "/path/to/MG3") to test out your apps in MG:G

  1. Change index.cfm to point to ModelGlue.gesture.ModelGlue
  2. Change the modelGlueConfiguration bean class to ModelGlue.gesture.configuration.ModelGlueConfiguration
  3. Change the modelGlueConfiguration bean id to modelglue.modelGlueConfiguration
  4. Add the helper mappings, if you want
    <property name="helperMappings"><value>/ModelGlue/helpers</value></property>
  5. Add the missingEvent event
    <property name="missingEvent"><value>page.missing</value></property>
  6. Add the generationEnabled property
    <property name="generationEnabled"><value>false</value></property>
  7. Change any ModelGlue.getBeanFactory() calls to ModelGlue.getBean().

    You can rename controllers, I guess, although there is some stuff in place that makes that, and perhaps editing index.cfm, um, not a necessity.

    If you are doing anything custom with the ViewRenderer, you'll probably have to change your code around a bit.

    Think that's it, mostly. If I come up with other stuff I'll add it.

AOP and MG's GenericORMController

I quick cut and paste entry:

Re: Authorization via AOP

Oh, hey, I'd been meaning to post a follow up. Using the GenericORMController, it was a piece of cake, but then I thought, "hey!", I should probably wrap it around the reactor bits instead, since I've got OO queries and reads and whatnot.

Anyways, I haven't gotten around to that yet, but if you want an example of before advice on the genericORMController, I'll put it up somewhere.

Only took like 10 minutes... I love this AOP stuff, man, love it.

I used "The AOP" example, (you can tell by the comments ;-) for a basis.

Hell, it might take me ages to blog some stuff...

Here's the relevant part of the customized Configuration.xml file (I called mine mg.core.config.xml), just replace the projects.myproject aspect with your own class (this bit, of course, replaces the original ormController bean):

<!--
This the controller to use for generic ORM interaction (uses the ormAdapter).
-->

<bean id="ormControllerTarget" class="ModelGlue.unity.controller.GenericORMController" autowire="false">
<constructor-arg name="modelGlue"><ref bean="modelGlue" /></constructor-arg>
<constructor-arg name="name"><value>ORMController</value></constructor-arg>
<constructor-arg name="debug"><value>false</value></constructor-arg>
</bean>

<!--define the loggingBeforeAdvice and set its logging service property to reference the ProxyFactoryBean bean below -->
<bean id="ormControllerBeforeAdvice" class=" projects.myproject.aspects.ORMControllerBeforeAdvice">
<property name="ormController">
<ref bean="ormController" />
</property>
</bean>

<!-- now define a NamedMethodPointcutAdvisor, set the advice property to the bean above, and set its mappedNames property to '*' which will create a pointcut to match all methods excluding any init method -->
<bean id="ormControllerAdvisor" class="coldspring.aop.support.NamedMethodPointcutAdvisor">
<property name="advice">
<ref bean="ormControllerBeforeAdvice" />
</property>
<property name="mappedNames">
<value>*</value>
</property>
</bean>

<!-- now create a ProxyFactoryBean with the id ormController, set the target to the ormControllerTarget bean above, and give it ,the id of the NamedMethodPointcutAdvisor above in the list of interceptorNames -->
<bean id="ormController" class="coldspring.aop.framework.ProxyFactoryBean">
<property name="target">
<ref bean="ormControllerTarget" />
</property>
<property name="interceptorNames">
<list>
<value>ormControllerAdvisor</value>
</list>
</property>
</bean>

Properties available in Edit.xsl

FIELDNAME

struct
COMMENT [empty string]
LABEL FieldLabel
LINKINGRELATIONSHIP false
PLURALRELATIONSHIP false
RELATIONSHIP false
SOURCECOLUMN [empty string]
SOURCEKEY [empty string]
SOURCEOBJECT [empty string]
alias fieldAlias
cfDataType date
cfSqlType cf_sql_timestamp
dbDataType datetime
default [empty string]
identity false
length 0
name fieldName
nullable false
object tablename
primaryKey false
sequence [empty string]

BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.000. Contact Blog Owner