Tuy,

Could you post a diff of your current export-preferences.crn file?

One thought for the change Drew suggested is there is already a ${PORTAL_CONTEXT} variable defined for all of the import/export/delete scripts so that long line could probably be:

<with-attribute key="portletEntities" value="${groovy(PORTAL_CONTEXT.getBean('portletEntityPreferenceHandler').getEntityPreferences(USER_ID.intValue()))}">

Also if you can get a diff we can try it in a few other environments and see if we can get a patch in for 3.0.1

-Eric

Tuyhang Ly wrote:
Thanks Drew!

This change works fine.

Tuy.

Drew Wills wrote:
Tuy,

That's too bad -- based on what I had read, I thought Groovy would happily convert a BigDecimal to an int in this case.

I believe we can still use intValue(), as you originally suggested.

For this approach, change line 36 () to the following:

<with-attribute key="portletEntities" value="${groovy(org.jasig.portal.spring.PortalApplicationContextLocator.getApplicationContext().getBean('portletEntityPreferenceHandler').getEntityPreferences(USER_ID.intValue()))}">

drew wills

Tuyhang Ly wrote:
Hi Drew,

We use Oracle 10g and I've tried using your new version of this file, but it failed with this exception:

Caused by: groovy.lang.MissingMethodException: No signature of method: org.jasig.portal.io.support.PortletEntityPreferenceHandler.getEntityPreferences() is applicable for argument types: (java.math.BigDecimal) values: {-5} at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:572) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:450) at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:119) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:111) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:187)
        at Script17.run(Script17.groovy:1)
at com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:244)
        ... 102 more


Thanks,
Tuy.


Drew Wills wrote:
Tuyhang,

What RDBMS are you using? My local HSQLDB instance indicates a TYPE_NAME of INTEGER for the up_user.user_id field, and the export-preferences.crn XML works for me as-is.

The fix you suggested...

   <parameter value="${jexl(USER_ID.intValue())}" />

would work perfectly as far as I'm aware, thanks in part to the magic of duck-typing (i.e. it will work both for instances of BigDecimal & Integer).

But here's another suggestion: in looking at this file it seemed to me it could benefit from some refactoring. Here's a new version of the file, plus a .patch file that highlights the changes. I didn't count, but I think it trims ~15 or so lines of noise.

Again -- it works on my DB.  Let me know how it works for you.

drew wills

Tuyhang Ly wrote:
Hi,

When using the export-preferences.crn script in uP3, we encountered the following RuntimeException:

"Unable to locate method 'getEntityPreferences' on object of class 'org.jasig.portal.io.support.PortletEntityPreferenceHandler' (argument types follow):
arg type=java.math.BigDecimal"

The USER_ID column type is NUMBER and the JDBC mapping is BigDecimal. Hence, we have to explicitly convert it to integer, the expected argument type for the getEntityPreferences() method, such as on line 45 of this script,

* should it be: <parameter value="${jexl(USER_ID.intValue())}" />

* instead of: <parameter value="${USER_ID}" />

Thanks,
Tuy.

--

You are currently subscribed to uportal-dev@lists.ja-sig.org as: [EMAIL PROTECTED] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/uportal-dev



--

You are currently subscribed to uportal-dev@lists.ja-sig.org as: [EMAIL PROTECTED] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/uportal-dev



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to