uPortal IRC Logs-2011-04-01

[12:15:11 CDT(-0500)] <athena> EricDalquist: you ok with moving *.cpd to maybe *.ppd.xml?
[12:15:18 CDT(-0500)] <EricDalquist> +1
[12:15:31 CDT(-0500)] <athena> any ideas for the top XML element name?
[12:15:44 CDT(-0500)] <athena> portlet-publishing-document seems cumbersome
[12:15:54 CDT(-0500)] <athena> have most everything else working now though
[12:16:03 CDT(-0500)] <EricDalquist> portlet-publishing-definition?
[12:16:16 CDT(-0500)] <EricDalquist> as you said the other day I don't think these will be touched much
[12:16:40 CDT(-0500)] <athena> ok (smile)
[12:16:58 CDT(-0500)] <athena> i took out the "controls" section
[12:17:08 CDT(-0500)] <EricDalquist> sounds good
[13:50:01 CDT(-0500)] <athena> ugh
[13:50:08 CDT(-0500)] <athena> so JAXB generates a value() method for enums
[13:50:16 CDT(-0500)] <athena> which . . . is not accessible via JSTL
[13:50:43 CDT(-0500)] <EricDalquist> huh
[13:54:17 CDT(-0500)] <athena> might be able to use something like this to generate another method: http://stackoverflow.com/questions/780567/how-can-i-extend-java-code-generated-by-jaxb-cxf-or-hibernate-tools
[13:54:37 CDT(-0500)] <EricDalquist> hrm yeah, that would be nice
[13:55:27 CDT(-0500)] <athena> yeah
[13:56:26 CDT(-0500)] <athena> uhhh . . . .
[13:56:30 CDT(-0500)] <athena> yeah guess that won't work
[13:56:38 CDT(-0500)] <athena> since it would require extending an enum
[13:56:45 CDT(-0500)] <EricDalquist> oh ... heh
[13:56:58 CDT(-0500)] <EricDalquist> I wonder if you can override that method name in the bindings file
[13:57:19 CDT(-0500)] <athena> doesn't look like it as far as i can tell
[13:57:30 CDT(-0500)] <athena> seems like those tags just cover renaming methods based on your properties
[13:57:45 CDT(-0500)] <EricDalquist> :/
[13:57:56 CDT(-0500)] <EricDalquist> I don't have the trunk code handy right now
[13:57:57 CDT(-0500)] <athena> guess i could create a JSTL tag that calls that method
[13:58:04 CDT(-0500)] <EricDalquist> so I can't look to see if I have any other ideas
[13:58:13 CDT(-0500)] <EricDalquist> yeah, just a static method call or something
[13:58:19 CDT(-0500)] <athena> yeah
[13:58:37 CDT(-0500)] <athena> just kinda stupid that they didn't use a real bean name (smile)
[13:59:36 CDT(-0500)] <EricDalquist> yeah
[13:59:40 CDT(-0500)] <EricDalquist> it is
[14:00:28 CDT(-0500)] <EricDalquist> so the xjc generated class has "SomeEnum value()" instead of "SomeEnum getValue()"
[14:01:24 CDT(-0500)] <athena> yep
[14:01:32 CDT(-0500)] <EricDalquist> that's weird
[14:01:34 CDT(-0500)] <athena> found another complaint about it
[14:01:35 CDT(-0500)] <athena> yeah, it is
[14:18:06 CDT(-0500)] <athena> well, uhhhhh
[14:18:09 CDT(-0500)] <athena> i wrote code that does work
[14:18:26 CDT(-0500)] <athena> though i don't know how we feel about using reflection inside a method that's called by JSTL?
[14:19:15 CDT(-0500)] <EricDalquist> seems fine
[14:19:22 CDT(-0500)] <EricDalquist> just have it fail gracefully
[14:19:26 CDT(-0500)] <athena> ok
[14:19:33 CDT(-0500)] <EricDalquist> since that is generally what jstl does
[14:19:49 CDT(-0500)] <athena> wound up using reflection because unfortunately the enums don't share a common interface
[14:20:07 CDT(-0500)] <EricDalquist> hrm
[14:20:14 CDT(-0500)] <EricDalquist> so what are you trying to do with an enum in jstl?
[14:20:19 CDT(-0500)] <athena> maybe someday we'll figure out how to make the java side a little saner
[14:20:27 CDT(-0500)] <athena> the enum is the class that has value() instead of getValue()
[14:20:44 CDT(-0500)] <athena> JAXB generates enums when you restrict a string value to one of a few choices
[14:20:54 CDT(-0500)] <EricDalquist> oh
[14:20:56 CDT(-0500)] <athena> i have the publishing document configured such that it enumerates the valid input display types
[14:21:11 CDT(-0500)]

<EricDalquist> and doing test="$

Unknown macro: {myEnum == 'foo'}

" doesn't work?


[14:21:26 CDT(-0500)] <EricDalquist> actually could you pastebin me the enum?
[14:21:32 CDT(-0500)] <EricDalquist> the jaxb generated enum that is
[14:21:34 CDT(-0500)] <athena> sure
[14:22:14 CDT(-0500)] <athena> http://pastebin.com/evNzupYh
[14:22:32 CDT(-0500)] <athena> hmmm
[14:22:39 CDT(-0500)] <athena> wonder why this doesn't have a tostring
[14:22:51 CDT(-0500)] <athena> dunno if that would make a difference
[14:22:54 CDT(-0500)] <EricDalquist> all enums extend from java.lang.Enum
[14:22:58 CDT(-0500)] <EricDalquist> at runtime
[14:23:32 CDT(-0500)] <athena> yes
[14:23:43 CDT(-0500)] <athena> so i guess probably the default tostring is good enough anyway
[14:24:21 CDT(-0500)] <EricDalquist> http://stackoverflow.com/questions/123598/access-enum-value-using-el-with-jstl
[14:24:37 CDT(-0500)] <EricDalquist> it looks like JSTL already supports enum -> string coercion
[14:24:47 CDT(-0500)] <EricDalquist> http://stackoverflow.com/questions/123598/access-enum-value-using-el-with-jstl/4848979#4848979
[14:25:54 CDT(-0500)]

<EricDalquist> so the only weirdness you may see is that $

Unknown macro: {display == "hidden"}

would likely fail but $

Unknown macro: {display == "HIDDEN"}

would likely work


[14:26:09 CDT(-0500)] <athena> hm
[14:26:12 CDT(-0500)] <EricDalquist> because the name for the enums in that code are all upper case
[14:26:20 CDT(-0500)] <athena> i was gettign stack traces
[14:27:11 CDT(-0500)] <EricDalquist> huh
[14:27:24 CDT(-0500)] <athena> "Cannot convert hidden of type class java.lang.String to class org.jasig.portal.portletpublishing.xml.SingleChoiceDisplay"
[14:27:31 CDT(-0500)]

<EricDalquist> it looks like what should be happening is

Unknown macro: {A == 'B'}

gets converted to

Unknown macro: {A == Enum.valueOf(A.getClass(), 'B')}

[14:27:47 CDT(-0500)] <EricDalquist> try making hidden HIDDEN
[14:27:50 CDT(-0500)] <EricDalquist> and see if that fixes it
[14:27:55 CDT(-0500)] <athena> ah interesting
[14:27:55 CDT(-0500)] <EricDalquist> since there is no enum named
[14:27:57 CDT(-0500)] <EricDalquist> hidden
[14:28:08 CDT(-0500)] <athena> wow that does work
[14:28:09 CDT(-0500)] <athena> go eric
[14:28:15 CDT(-0500)] <athena> also that's kind of insane
[14:28:27 CDT(-0500)] <EricDalquist> enums are (for good and bad) case sensitive
[14:28:33 CDT(-0500)] <athena> yeah
[14:28:47 CDT(-0500)] <EricDalquist> and extra data provided, in this case the value, are completely outside of the cares of the Enum class
[14:29:05 CDT(-0500)] <EricDalquist> it is still annoying that xjc doesn't generate that as getValue()
[14:29:13 CDT(-0500)]

<athena> i think if it'd written the implementation i'd have instead converted to

Unknown macro: {A.toString() == 'B'}

[14:29:34 CDT(-0500)] <EricDalquist> yeah I think they do it this way to be class-loader safe
[14:29:56 CDT(-0500)] <athena> kind of bad that it totally crashes the page if you have a bad value
[14:30:50 CDT(-0500)] <EricDalquist> yeah
[14:30:55 CDT(-0500)] <EricDalquist> that is the danger of enums
[14:31:16 CDT(-0500)] <EricDalquist> that Enum.valueOf method throws an exception if there isn't a match
[14:31:24 CDT(-0500)] <athena> yeah
[14:31:36 CDT(-0500)] <athena> JSTL usually defaults to writing code that won't break
[14:31:40 CDT(-0500)] <athena> a lot of stuff fails quietly
[14:31:46 CDT(-0500)] <athena> feels like this isn't consistent
[14:31:47 CDT(-0500)] <EricDalquist> yeah
[14:31:50 CDT(-0500)] <athena> but oh well, works now
[14:31:53 CDT(-0500)] <athena> i'll complain to shawn
[14:31:58 CDT(-0500)] <EricDalquist> (smile)
[16:14:33 CDT(-0500)] <athena> wooo, think the portlet admin portlet actually might work again (tongue)
[16:14:41 CDT(-0500)] <athena> need to check this all in
[16:14:48 CDT(-0500)] <athena> at which point you'll need to re-import the portlet types
[16:14:53 CDT(-0500)] <athena> since i renamed all the PPD files
[16:14:58 CDT(-0500)] <EricDalquist> yay!
[16:15:00 CDT(-0500)] <EricDalquist> ok
[16:15:08 CDT(-0500)] <EricDalquist> I'll just do another initdb
[16:16:12 CDT(-0500)] <athena> will let you know when i get it in (smile)