<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>M.V.M-n.</title>
	<atom:link href="http://mvmn.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mvmn.wordpress.com</link>
	<description>Chronologically captured moments...</description>
	<lastBuildDate>Tue, 10 Jan 2012 15:14:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mvmn.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>M.V.M-n.</title>
		<link>http://mvmn.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mvmn.wordpress.com/osd.xml" title="M.V.M-n." />
	<atom:link rel='hub' href='http://mvmn.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Custom telnet Groovy shells &#8211; version with shared context</title>
		<link>http://mvmn.wordpress.com/2011/12/16/telnet-groovy-shells-w-shared-context/</link>
		<comments>http://mvmn.wordpress.com/2011/12/16/telnet-groovy-shells-w-shared-context/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 03:51:02 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sources]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=665</guid>
		<description><![CDATA[A follow-up to the previous post &#8211; custom Telnet shared Groovy shells. This time having shared context for all shells, i.e. shared variables! The trick was to get Binding object from current Groovy shell Interpreter and pass it in constructor to Groovy shells that we instantiate programmatically on socket connections. Not sure if it&#8217;s thread [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=665&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A follow-up to the <a href="http://mvmn.wordpress.com/2011/12/16/little-groovy-fun/">previous post</a> &#8211; <strong>custom Telnet shared Groovy shells</strong>. This time having shared context for all shells, i.e. shared variables!</p>
<p>The trick was to get Binding object from current Groovy shell Interpreter and pass it in constructor to Groovy shells that we instantiate programmatically on socket connections. Not sure if it&#8217;s thread safe BTW (this isn&#8217;t production ready (-: ).</p>
<p>The code is based on Groovy Shell internals a bit, so should probably be run only from Groovy shell. (And just in case &#8211; I&#8217;m using version 1.8.4 of Groovy).</p>
<p>In any case, here&#8217;s again some demo video:<br />
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/33762434' width='400' height='300' frameborder='0'></iframe></div></p>
<p>UPD: Also there&#8217;s <strong>the thread-safe version</strong>.<br />
In it each shell will have it&#8217;s own Binding object, i.e. separate variables context.<br />
But on creating shell we&#8217;ll inject two variables into that context:<br />
- <em>sharedConcurrentMap</em> &#8211; an instance of ConcurrentHashMap which will serve as thread-safe shared context for all shells, and is pre-populated with &#8220;server&#8221; and &#8220;sockets&#8221; (the latter are also made thread-safe);<br />
- <em>thisShellSocket</em> &#8211; a socket that is used for this child shell.</p>
<p>See source code at the end of the post.</p>
<p>As usual, a little demo video:<br />
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/33764497' width='400' height='300' frameborder='0'></iframe></div></p>
<p><strong>The source code</strong> <span id="more-665"></span><br />
1. The non-thread-safe version</p>
<div style="overflow:auto;">
<pre>
server = new ServerSocket(54321);
sockets = [];

serverThread = new Thread() {
    private ServerSocket server;
    private Collection sockets;
    private Binding binding;

    public void run() {

        while(!server.isClosed()) {
            server.accept {
                socket -&gt;
                println "Socket connection established"
                sockets.add(socket)
                socket.withStreams {
                    input, output -&gt;
                        println "Instantiating shell\n"
                        org.codehaus.groovy.tools.shell.Groovysh shell = new org.codehaus.groovy.tools.shell.Groovysh(binding, new org.codehaus.groovy.tools.shell.IO(input,output,output));
                        shell.run("");
                        println "Shell exit\n"
                }
                sockets.remove(socket)
            }
        }
    }

    public Thread init(ServerSocket server, Collection sockets, Binding binding) {
        this.server = server;
        this.sockets = sockets;
        this.binding = binding;
        return this;
    }
}.init(server, sockets, this.binding);

serverThread.start();
</pre>
</div>
<p>2. The thread-safe version</p>
<div style="overflow:auto;">
<pre>
sharedConcurrentMap = new java.util.concurrent.ConcurrentHashMap();
server = new ServerSocket(54321);
sockets = new java.util.concurrent.ConcurrentLinkedQueue();

sharedConcurrentMap.put("server", server);
sharedConcurrentMap.put("sockets", sockets);

serverThread = new Thread() {
    private ServerSocket server;
    private Collection sockets;
    private java.util.concurrent.ConcurrentHashMap sharedConcurrentMap;

    public void run() {

        while(!server.isClosed()) {
            server.accept {
                socket -&gt;
                println "Socket connection established"
                sockets.add(socket)
                socket.withStreams {
                    input, output -&gt;
                        println "Instantiating shell\n"
                        org.codehaus.groovy.tools.shell.Groovysh shell = new org.codehaus.groovy.tools.shell.Groovysh(new org.codehaus.groovy.tools.shell.IO(input,output,output));
                        shell.interp.context.setVariable("sharedConcurrentMap", sharedConcurrentMap);
                        shell.interp.context.setVariable("thisShellSocket", socket);
                        shell.run("");
                        println "Shell exit\n"
                }
                sockets.remove(socket)
            }
        }
    }

    public Thread init(ServerSocket server, Collection sockets, java.util.concurrent.ConcurrentHashMap sharedConcurrentMap) {
        this.server = server;
        this.sockets = sockets;
        this.sharedConcurrentMap = sharedConcurrentMap;
        return this;
    }
}.init(server, sockets, this.sharedConcurrentMap);

serverThread.start();
</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/665/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=665&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/12/16/telnet-groovy-shells-w-shared-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Little Groovy fun</title>
		<link>http://mvmn.wordpress.com/2011/12/16/little-groovy-fun/</link>
		<comments>http://mvmn.wordpress.com/2011/12/16/little-groovy-fun/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 00:21:29 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[sources]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=652</guid>
		<description><![CDATA[Got a bit of free time to play with Groovy today. So I checked out some groovy sockets example and made a little groovy shell server that is running in a groovy shell itself (-: UPD: A little video demo Sources (updated 2011-12-16 04:16): server = new ServerSocket(54321); sockets = []; serverThread = new Thread() [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=652&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Got a bit of free time to play with Groovy today.<br />
So I checked out <a href="http://programmingitch.blogspot.com/2010/04/groovy-sockets-example.html">some groovy sockets example</a> and made a little groovy shell server that is running in a groovy shell itself (-:</p>
<p>UPD: A little video demo<br />
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/33756025' width='400' height='300' frameborder='0'></iframe></div></p>
<p>Sources (<em>updated 2011-12-16 04:16</em>):<span id="more-652"></span></p>
<div style="overflow:auto;">
<pre>
server = new ServerSocket(54321);
sockets = [];

serverThread = new Thread() {
    private ServerSocket server;
    private Collection sockets;

    public void run() {

        while(true) {
            server.accept {
                socket -&gt;
                println "Socket connection established"
                sockets.add(socket)
                socket.withStreams {
                    input, output -&gt;
                        println "Instantiating shell"
                        new org.codehaus.groovy.tools.shell.Groovysh(new org.codehaus.groovy.tools.shell.IO(input,output,output)).run("");
                        println "Shell exit"
                }
            }
        }
    }

    public Thread init(ServerSocket server, Collection sockets) {
        this.server = server;
        this.sockets = sockets;
        return this;
    }
}.init(server, sockets);

serverThread.start();
</pre>
</div>
<p>There must be nicer Groovy syntax for instantiating Threads etc (and yeah, I still instinctively put brackets and semicolons in Java manner), but in general that is it.</p>
<p>Launch it, open some new terminal windows, run &#8220;telnet localhost 54321&#8243; in them, and le voila &#8211; <strong>groovy shells on Telnet</strong>.<br />
Note that <em>System.out</em> output is displayed in &#8220;master&#8221; shell, so whenever you do <em>System.out.println</em> in telnet shells the output appears in &#8220;master&#8221; shell window &#8211; which is kind-of fun (-:</p>
<p>I should find some nice way to share some kind of a context between those shells, so they could share objects with each other (it&#8217;s all running in one JVM after all) &#8211; then some interesting things can be done with this.</p>
<p>That&#8217;s all for now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/652/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=652&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/12/16/little-groovy-fun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Liferay dictionary</title>
		<link>http://mvmn.wordpress.com/2011/12/08/liferay-dictionary/</link>
		<comments>http://mvmn.wordpress.com/2011/12/08/liferay-dictionary/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 22:53:45 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Liferay]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=627</guid>
		<description><![CDATA[When I started working with Liferay some things took me a while to figure out due to a certain difference in names used for Liferay features in user documentation and interface (Control Panel in particular) and names used internally in Java APIs, database tables etc. So I though a little table of correspondence might come [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=627&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I started working with Liferay some things took me a while to figure out due to a certain difference in names used for Liferay features in user documentation and interface (Control Panel in particular) and names used internally in Java APIs, database tables etc. So I though a little table of correspondence might come handy for someone starting with Liferay or getting from user to developer level.</p>
<p>Let&#8217;s start with an extended example &#8211; Web Content, the base of Liferay CMS features.<br />
It is actually mentioned on Liferay Wiki that some time ago Web Content was called Journal or something like this, but at a certain point all related portlets, control panel sections etc got renamed. Yet internally you will find no sings of &#8220;Web Content&#8221;.<br />
The Java APIs for working with webcontent as well as DB tables are all still using old naming.</p>
<p>Web Content item is JournalArticle, Structure is JournalStructure and template is JournalTemplate.<br />
To manipulate those you would use classes like JournalArticle(Local)ServiceUtil, JournalStructure(Local)ServiceUtil, JournalTemplate(Local)ServiceUtil, and to see them in database you&#8217;d have to look up tables also called &#8220;journalarticle&#8221;, &#8220;journalstructure&#8221; and &#8220;journaltemplate&#8221;.</p>
<p>So, let&#8217;s move on to our vocabulary:<span id="more-627"></span></p>
<div style="overflow:auto;">
<table border="1" width="98%" cellpadding="2" cellspacing="0">
<thead>
<tr>
<td><b>Entity</b></td>
<td><b>Internal naming</b></td>
<td><b>Remarks</b></td>
</tr>
</thead>
<tbody>
<tr>
<td>Web Content Item, Structure, Template</td>
<td>JournalArticle, JournalStructure, JournalTemplate</td>
<td>Explained above.</td>
</tr>
<tr>
<td>Portal page</td>
<td>Layout</td>
<td>Yes, the layouts are actually &#8220;Layout Plugins&#8221;, and Pages are &#8220;Layouts&#8221; &#8211; this might be quite confusing at first. The often used name <b>plid</b> stands for Page Layout ID, I suppose, and it is an ID of a portal page. See &#8220;layout&#8221; DB table for all pages in a portal. ThemeDisplay.getLayout() returns current page, and ThemeDisplay.getLayout.getPlid() returns it&#8217;s ID (so I suppose, ThemeDisplay.getLayout().getPlid() always equals ThemeDisplay.getPlid() &#8211; unless there are some special cases I don&#8217;t know of yet, or, well, a bug in Liferay (-: ).</td>
</tr>
<tr>
<td>Community (and also Organization AFAIK)</td>
<td>Group</td>
<td>BTW each user has own private Community, so you&#8217;ll find plenty of interesting data in &#8220;group_&#8221; DB table.</td>
</tr>
<tr>
<td>Global Group (Scope)</td>
<td>(Default) Company Group</td>
<td>See for example ThemeDisplay method getCompanyGroupId() &#8211; it returns an ID of that &#8220;Global&#8221; group/scope you see in Control Panel.</td>
</tr>
<tr>
<td>Portal Instance</td>
<td>Company</td>
<td>Not to be confused with Organization. Portal instance is a completely separate set of portal communities, groups, pages, users etc (well, a separate Web Portal on same Liferay deployment, with same Portlets/Plugins, but different content). Portal Instance has it&#8217;s own URL. To find out which instance you&#8217;re using you check <b>companyId</b>, as in ThemeDisplay.getCompanyId().</td>
</tr>
<tr>
<td>Porlet Instance</td>
<td>Portlet Preferences</td>
<td>Yes, each instance of a portlet is represented by set of it&#8217;s preferences, and manipulated with API of PortletPreferences(Local)ServiceUtil and related. If you want to find out what pages have instance of youre portlet &#8211; it&#8217;s all in &#8220;portletpreferences&#8221; DB table. You can see &#8220;plid&#8221; column for Page Id, so it&#8217;s obvious these &#8220;preferences&#8221; are tied to portal pages</td>
</tr>
<tr>
<td>Custom Fields</td>
<td>Expando (Table, Row, Column, Value)</td>
<td>Expando tables are not exclusively used to store custom fields values, but that&#8217;s where you find those (see methods with &#8220;Default Table&#8221; in Expando API). Some portlets also use expando API to create their own tables (like WebForm portlet for example &#8211; each instance of it creates it&#8217;s own expando table to store in DB data of each form). You can create your own programmatically too &#8211; using Expando Bridge APIs.</td>
</tr>
<tr>
<td>Categories, Vocabularies, Tags</td>
<td>Asset Categories, Asset Vocabularies, Asset Tags</td>
<td>Well, this is just a bit different naming.</td>
</tr>
<tr>
<td>Document library documents, folders etc</td>
<td>DLFileEntry, DLFolder etc</td>
<td></td>
</tr>
<tr>
<td>Comments</td>
<td>MBThread, MBMessage</td>
<td>Yes, those comments you can add to an asset in Asset Publisher portlet are stored as MB (Message Board obviously) Message and MB Thread. As always, you can see corresponding DB tables and Java APIs</td>
</tr>
</tbody>
</table>
</div>
<p>Well, that&#8217;s more/less it. Enjoy.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/627/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=627&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/12/08/liferay-dictionary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Checking out Groovy&#8230;</title>
		<link>http://mvmn.wordpress.com/2011/10/30/checking-out-groovy/</link>
		<comments>http://mvmn.wordpress.com/2011/10/30/checking-out-groovy/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 09:00:42 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[velocity]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/2011/10/30/checking-out-groovy/</guid>
		<description><![CDATA[It&#8217;s a quite typical architecture for Java webapp to have Apache Velocity as templating engine that handles the View part of your MVC. Well, having worked for a while with it and checking out Groovy now I immediately felt it&#8217;s be very interesting to have Groovy there instead of Velocity. Velocity is sensibly weak in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=626&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a quite typical architecture for Java webapp to have Apache Velocity as templating engine that handles the View part of your MVC.</p>
<p>Well, having worked for a while with it and checking out Groovy now I immediately felt it&#8217;s be very interesting to have Groovy there instead of Velocity.</p>
<p>Velocity is sensibly weak in working with arrays and lists. But Groovy on contrary adds more power and convenience in this aspect. And doesn&#8217;t seem to be lacking in any other.</p>
<p>It seems someone in 2007 already though about this: http://raykrueger.blogspot.com/2007/07/groovy-views-in-spring-mvc.html</p>
<p>And even more &#8211; Grails, the Groovy framework, is actually based on Spring MVC, although this is a bit too much compared to just having Groovy scripts as &#8220;views&#8221; in Spring MVC.</p>
<p>All in all, it sounds like a good ting to try out.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/626/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=626&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/10/30/checking-out-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Few simple/obvious ideas on education</title>
		<link>http://mvmn.wordpress.com/2011/10/17/few-simpleobvious-ideas-on-education/</link>
		<comments>http://mvmn.wordpress.com/2011/10/17/few-simpleobvious-ideas-on-education/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 21:25:39 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[Abstract]]></category>
		<category><![CDATA[education]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=619</guid>
		<description><![CDATA[I&#8217;ve got a few rough idealistic &#8220;SCI-FI kind&#8221; ideas on education that I somehow would like to share. If you find them obvious or&#8230; ehm&#8230; even a bit silly &#8211; well, you might be right (-: Anyway&#8230; # University lectures generally don&#8217;t change much, and thus can be re-used over time by using recordings (that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=619&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a few rough idealistic &#8220;SCI-FI kind&#8221; ideas on education that I somehow would like to share.<br />
If you find them obvious or&#8230; ehm&#8230; even a bit silly &#8211; well, you might be right (-:</p>
<p>Anyway&#8230;</p>
<p><strong>#</strong> University lectures generally don&#8217;t change much, and thus can be re-used over time by using recordings (that are updated when necessary) &#8211; like <a href="http://www.youtube.com/user/UCBerkeley">Berkeley University did</a>.<br />
Also they can be re-used &#8220;in space&#8221; by using video-conferencing technologies.</p>
<p>Of-course, some theories are refined etc etc, but in general physics and mathematical analysis lectures remain mostly the same, thus making it reasonable to re-use them over time.<br />
Also physics and math are same, no matter which university (or not even necessarily university) they&#8217;re told in.</p>
<p>I see no compelling reason why lectures from one university cannot be re-used in another 10 or 10 000 universities (DRY principle for real world).</p>
<p>Berkeley recordings IMO are a good example how not to make recorded lectures BTW: these should be more presentation/screencast-like I think, certainly not a videotaping of typical lectures in front of live auditory with all the outcoming timewaste (that blabber about attending labs etc is especially annoying in it&#8217;s distracting irrelevance).<br />
Also Berkeley 2006 recordings look like early 90-es (-: &#8211; a bit weak sound (sometimes problems with it), bleak colours, all this chalk and dusty blackboards etc etc &#8211; even whiteboards + coloured markers would be a noticeable improvement.Compare Berkeley recordings to Google Tech Talks for instance, and you&#8217;ll know which is the direction to improve as I see it.</p>
<p>There are many different ways to modernize it &#8211; think of PowerPoint-like presentations, screencasts, iPad magazines ADs (-; (and flipboard app, heh) etc etc. Lots of space for imagination and experiments.</p>
<p><strong>#</strong> Videoconferencing for lectures can be particularly interesting if organized as <strong>cooperative lectures, performed by several lecturers from different universities together</strong>.</p>
<p>Imagine two (three, four, five&#8230;) best specialists/teachers in a field lead a lecture for auditory of millions of students, distributed over multiple universities all around the country/globe, at which local teachers (or professors, title doesn&#8217;t matter) are taking over when it comes the time for Q&amp;A (questions &amp; answers) &#8211; after cooperative lecture is over.</p>
<p>Of-course, practical part (labs etc) remain local, though can also be performed cooperatively, having, say, groups from 2 universities working together, having different universities each time &#8211; that&#8217;d be somewhat refreshing and help distributing ideas quicker I reckon.<br />
There are many variants here also &#8211; only sky is the limit.</p>
<p><strong>#</strong> It&#8217;s many years now since video-recording and video-conferencing have become common and quite inexpensive. Unlike it was in 80-es or early 90-es, there&#8217;s no need for any special equipment to make (let alone playback) video recordings, or even organize a video conference &#8211; every student now has a mobile phone now that can record video, and some smartphones can actually stream it to web where anyone can watch it (see <a href="http://www.justin.tv/">justin.tv</a> and the like).<br />
So there should be no problem experimenting with those until best working practices would be found.</p>
<p>Same/similar practices can be applied to schools and other educational facilities.</p>
<p><strong>#</strong> Outro: when my parents were young, television was something new and amazing. When I was younger, Internet was new and amazing. I sincerely envy subsequent generations (-:</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/619/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=619&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/10/17/few-simpleobvious-ideas-on-education/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Liferay 6 CP portlets for site admins + sources</title>
		<link>http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/</link>
		<comments>http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 19:15:02 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[6 EE SP1]]></category>
		<category><![CDATA[6.0.6]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[sources]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=608</guid>
		<description><![CDATA[As mentioned in previous post, I&#8217;ve been planning to make a little Control Panel portlet for Liferay 6 that would allow site admin to tell on which pages particular portlets are. Today I&#8217;ve written two portlets for this. One allows you to see which groups and pages you have, and check portlets are on those [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=608&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As mentioned in previous post, I&#8217;ve been planning to make a little Control Panel portlet for Liferay 6 that would allow site admin to tell on which pages particular portlets are.</p>
<p>Today I&#8217;ve written two portlets for this. One allows you to see which groups and pages you have, and check portlets are on those pages.<br />
Another &#8211; see what portlets you have, and check on what pages do you have instances of those portlets.</p>

<a href='http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/screen-shot-2011-08-24-at-21-57-49/' title='Screen shot 2011-08-24 at 21.57.49'><img data-attachment-id='609' data-orig-size='808,815' data-liked='0'width="148" height="150" src="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-57-49.png?w=148&#038;h=150" class="attachment-thumbnail" alt="Screen shot 2011-08-24 at 21.57.49" title="Screen shot 2011-08-24 at 21.57.49" /></a>
<a href='http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/screen-shot-2011-08-24-at-21-57-06/' title='Screen shot 2011-08-24 at 21.57.06'><img data-attachment-id='610' data-orig-size='1024,873' data-liked='0'width="150" height="127" src="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-57-06.png?w=150&#038;h=127" class="attachment-thumbnail" alt="Screen shot 2011-08-24 at 21.57.06" title="Screen shot 2011-08-24 at 21.57.06" /></a>
<a href='http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/screen-shot-2011-08-24-at-21-54-38/' title='Screen shot 2011-08-24 at 21.54.38'><img data-attachment-id='611' data-orig-size='782,757' data-liked='0'width="150" height="145" src="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-54-38.png?w=150&#038;h=145" class="attachment-thumbnail" alt="Screen shot 2011-08-24 at 21.54.38" title="Screen shot 2011-08-24 at 21.54.38" /></a>
<a href='http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/screen-shot-2011-08-24-at-21-53-58/' title='Screen shot 2011-08-24 at 21.53.58'><img data-attachment-id='612' data-orig-size='1023,855' data-liked='0'width="150" height="125" src="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-53-58.png?w=150&#038;h=125" class="attachment-thumbnail" alt="Screen shot 2011-08-24 at 21.53.58" title="Screen shot 2011-08-24 at 21.53.58" /></a>

<p>Little warning:<br />
Portlets are pretty fresh, so there&#8217;s a chance something might fail or not work quite right.<br />
Also the code is not very efficient, yet I haven&#8217;t got any OutOfMemory exceptions during the whole day of writing and checking, so in general they should be fine (-:</p>
<p>Without further due, <strong>here&#8217;s the <a href="http://mvmn.ho.ua/dld/PortalStructurePortlet-portlet-6.0.6.1.war">download link</a></strong>. <strong>Sources are contained inside WAR file</strong>.</p>
<p>Portlets are written for Liferay 6.0.6 Community Edition (using corresponding plugins SDK), and should also work just fine on Enterprise Edition (though I haven&#8217;t checked yet, I&#8217;m pretty sure they will).</p>
<p>WAR is compiled for Java 6, some occasional @Override-s are present in code &#8211; remove them and recompile if you need it for Java 5. I might as well change it to Java 5 version a bit later&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/608/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/608/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/608/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=608&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/08/24/liferay-6-portlets-for-admins-with-sources/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>

		<media:content url="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-57-49.png?w=148" medium="image">
			<media:title type="html">Screen shot 2011-08-24 at 21.57.49</media:title>
		</media:content>

		<media:content url="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-57-06.png?w=150" medium="image">
			<media:title type="html">Screen shot 2011-08-24 at 21.57.06</media:title>
		</media:content>

		<media:content url="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-54-38.png?w=150" medium="image">
			<media:title type="html">Screen shot 2011-08-24 at 21.54.38</media:title>
		</media:content>

		<media:content url="http://mvmn.files.wordpress.com/2011/08/screen-shot-2011-08-24-at-21-53-58.png?w=150" medium="image">
			<media:title type="html">Screen shot 2011-08-24 at 21.53.58</media:title>
		</media:content>
	</item>
		<item>
		<title>Liferay (6) small hint &#8211; where are my portlets?</title>
		<link>http://mvmn.wordpress.com/2011/08/19/liferay-6-small-hint-where-are-my-portlets/</link>
		<comments>http://mvmn.wordpress.com/2011/08/19/liferay-6-small-hint-where-are-my-portlets/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 09:32:05 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[6 EE SP1]]></category>
		<category><![CDATA[6.0.6]]></category>
		<category><![CDATA[Liferay]]></category>
		<category><![CDATA[hints]]></category>
		<category><![CDATA[LinkedIn]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=602</guid>
		<description><![CDATA[Note: We&#8217;re running Liferay 6 on MySQL DB. One day I just wanted to see on which pages my portlets are used. So I had to make a little query for this: select portletId, layout.plid, group_.friendlyURL, layout.friendlyURL from portletpreferences left join layout on layout.plid = portletpreferences.plid left join group_ on layout.groupId = group_.groupId where portletId [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=602&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Note: We&#8217;re running Liferay 6 on MySQL DB.</p>
<p>One day I just wanted to see on which pages my portlets are used. So I had to make a little query for this:<br />
<code>select portletId, layout.plid, group_.friendlyURL, layout.friendlyURL from portletpreferences left join layout on layout.plid = portletpreferences.plid left join group_ on layout.groupId = group_.groupId where portletId like '%_WAR_<strong>[YOUR WAR NAME GOES HERE]</strong>%';</code></p>
<p>If you want to see all of the portlets, you can remove the &#8220;where&#8221; clause (but be prepared to be overwhelmed with the output).</p>
<p>The results look like this:</p>
<pre>
+-----------+--------+--------------------+--------------------+
| portletId |  plid  | group_.friendlyURL | layout.friendlyURL |
+-----------+--------+--------------------+--------------------+
| 103       | 704033 | /guest             | /my-community      |
| 145       | 704033 | /guest             | /my-community      |
| 29        | 704033 | /guest             | /my-community      |
| 49        | 704033 | /guest             | /my-community      |
| 86        | 704033 | /guest             | /my-community      |
| 87        | 704033 | /guest             | /my-community      |
| 88        | 704033 | /guest             | /my-community      |
...
</pre>
<p>Maybe I should make a full-fledged control-panel portlet for this &#8211; who knows, it might come handy.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/602/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=602&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/08/19/liferay-6-small-hint-where-are-my-portlets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLite BLOB exporter with GUI</title>
		<link>http://mvmn.wordpress.com/2011/07/13/sqlite-blob-exporter-with-gui/</link>
		<comments>http://mvmn.wordpress.com/2011/07/13/sqlite-blob-exporter-with-gui/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 23:03:11 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[My Soft]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[sources]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=593</guid>
		<description><![CDATA[As promised in one of previous posts, I&#8217;ve written a little GUI-ed program in Java that allows exporting BLOBs data from SQLite to separate files. And I&#8217;m giving it away, with all sources. The program has only one dependency - sqlitejdbc-v056.jar, which is a JDBC driver for SQLite databases. Download it from www.zentus.com/sqlitejdbc/ and put in the same folder [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=593&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As promised in one of previous posts, I&#8217;ve written a little GUI-ed program in Java that allows exporting BLOBs data from SQLite to separate files. And I&#8217;m giving it away, with all sources.</p>
<p>The program has only one dependency - <a href="http://files.zentus.com/sqlitejdbc/sqlitejdbc-v056.jar">sqlitejdbc-v056.jar</a>, which is a JDBC driver for SQLite databases. Download it from <a title="ZentusCom SQLite JDBC" href="http://www.zentus.com/sqlitejdbc/" target="_blank">www.zentus.com/sqlitejdbc/</a> and put in the same folder where my program&#8217;s JAR is.</p>
<p>Besides the above-mentioned dependency, my program is just a single JAR file (sources are packed into it). To launch the program simple double-clicking on it should be just enough. If it isn&#8217;t, search web for &#8220;lanuch JAR&#8221; &#8211; you&#8217;ll find plenty of instructions. You must have Java installed, but that is an obvious thing I suppose.</p>
<p>Here&#8217;s the download link: <a title="SQLite BLOB exporter JAR" href="http://mvmn.ho.ua/dld/sliteblobexp.jar" target="_blank">mvmn.ho.ua/dld/sliteblobexp.jar</a> (MD5 checksum = 99ca2488ac62f48721dced3c119d1271).</p>
<p>A small video of it in action: <br />
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/26401926' width='400' height='300' frameborder='0'></iframe></div></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/593/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=593&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/07/13/sqlite-blob-exporter-with-gui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Liferay 6: querying webcontent dynamically</title>
		<link>http://mvmn.wordpress.com/2011/06/23/liferay-6-webcontent-query-dynamic/</link>
		<comments>http://mvmn.wordpress.com/2011/06/23/liferay-6-webcontent-query-dynamic/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 21:33:10 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[6.0.6]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[sources]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=584</guid>
		<description><![CDATA[Liferay 6 Problem: we need to obtain webcontent items by custom query with conditions, one of them being webcontent item type for instance. The JournalArticleLocalServiceUtil.dynamicQuery(DynamicQuery query) method seems to be just what we&#8217;re looking for. Let&#8217;s make a custom query to get 100 latest webcontent items of types &#8220;blogs&#8221; and &#8220;news&#8221;. We also add condition [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=584&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Liferay 6</p>
<p>Problem: we need to obtain webcontent items by custom query with conditions, one of them being <a href="http://www.liferay.com/community/forums/-/message_boards/message/512696">webcontent item type</a> for instance.</p>
<p>The <em>JournalArticleLocalServiceUtil.dynamicQuery(DynamicQuery query)</em> method seems to be just what we&#8217;re looking for.</p>
<p>Let&#8217;s make a custom query to get 100 latest webcontent items of types &#8220;blogs&#8221; and &#8220;news&#8221;. We also add condition on groupId, because we want only items from certain group:</p>
<div style="overflow:auto;"><code>DynamicQuery query = DynamicQueryFactoryUtil.forClass(JournalArticle.class, PortalClassLoaderUtil.getClassLoader())<br />
.add(PropertyFactoryUtil.forName("groupId").eq(groupId)<br />
.add(PropertyFactoryUtil.forName("type").in(new String[] {"blogs", "news"}))<br />
.addOrder(OrderFactoryUtil.desc("createDate"));<br />
query.setLimit(0, 100);</p>
<p>List &lt;JournalArticles&gt; = JournalArticleLocalServiceUtil.dynamicQuery(query);<br />
</code></div>
<p>It almost worked. Almost.<br />
<span id="more-584"></span><br />
We get all versions of webcontent items. What does it mean? When you create webcontent item, it gets a version number 1.0. When you edit it for the first time and save, it gets version 1.1 and so on. This query gets versions 1.0 and 1.1 as separate records.<br />
You cannot just filter out lower versions in your code &#8211; you&#8217;ll get less than 100 records returned! (And it&#8217;s also inefficient of-course).</p>
<p>So, what can we do?</p>
<p>We could resort to native SQL. The query would be something like this:</p>
<div style="overflow:auto;"><code>select * from journalarticle articleParent<br />
where groupId = ${groupId}<br />
and type in ('blogs', 'news')<br />
and id_ = (select max(id_) from journalarticle where articleId = articleParent.articleId)<br />
order by createdDate desc<br />
limit 0, 100<br />
</code></div>
<p>But can we somehow avoid native SQL calls? Especially considering the fact that we need certain extra effort to be able to make native SQL calls in Liferay portlets.</p>
<p>It turns out that yes, we can. Thanks to http://issues.liferay.com/browse/LEP-6600</p>
<p>Dynamic query is capable of handling correlated subqueries!<br />
So, corresponding code will look like this:</p>
<div style="overflow:auto;"><code><br />
DynamicQuery subQuery = DynamicQueryFactoryUtil.forClass(JournalArticle.class, "articleSub", PortalClassLoaderUtil.getClassLoader())<br />
.add(PropertyFactoryUtil.forName("articleId").eqProperty("articleParent.articleId"))<br />
.setProjection(ProjectionFactoryUtil.max("id"));</p>
<p>DynamicQuery query = DynamicQueryFactoryUtil.forClass(JournalArticle.class, "articleParent", PortalClassLoaderUtil.getClassLoader())<br />
.add(PropertyFactoryUtil.forName("id").eq(subQuery))<br />
.add(PropertyFactoryUtil.forName("groupId").eq(globalGroup.getGroupId()))<br />
.add(PropertyFactoryUtil.forName("type").in(new String[] {"blogs", "news"}))<br />
.addOrder(OrderFactoryUtil.desc("createDate"));<br />
query.setLimit(0, 100);</p>
<p>List &lt;JournalArticle&gt; journalArticles = JournalArticleLocalServiceUtil.dynamicQuery(query);<br />
</code></div>
<p>The <b>subQuery</b> is correlated with <b>query</b> by <b>table alias &#8220;articleParent&#8221;</b> that is referenced in <b>eqProperty(&#8220;articleParent.articleId&#8221;) clause</b>.</p>
<p>The results seems to work just fine. Yey!</p>
<p><b>! Important notice:</b> subQuery also uses alias &#8211; &#8220;articleSub&#8221;. It seems unnecessary, as this alias is never referenced. However, <b>removing it leads to weird incorrect results!</b> (I haven&quot;t been digging what exactly was it returning, but I&#8217;ve only got 1 record as a result when I removed &#8220;articleSub&#8221; alias).</p>
<p>This seems to be very weird, and very unpleasant, as it is easy to get caught by this very small change from <i>DynamicQueryFactoryUtil.forClass(JournalArticle.class, &#8220;articleSub&#8221;, PortalClassLoaderUtil.getClassLoader())</i> to <i>DynamicQueryFactoryUtil.forClass(JournalArticle.class, PortalClassLoaderUtil.getClassLoader())</i> that actually should have been completely legitimate.</p>
<p>Maybe I&quot;ll investigate later what difference does it make in queries sent to DB.</p>
<p>That&quot;s it for today.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/584/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=584&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/06/23/liferay-6-webcontent-query-dynamic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
		<item>
		<title>Liferay (6) practices</title>
		<link>http://mvmn.wordpress.com/2011/06/20/liferay-practices-6-0-6/</link>
		<comments>http://mvmn.wordpress.com/2011/06/20/liferay-practices-6-0-6/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 23:27:26 +0000</pubDate>
		<dc:creator>mvmn</dc:creator>
				<category><![CDATA[6.0.6]]></category>
		<category><![CDATA[Liferay]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[sources]]></category>

		<guid isPermaLink="false">http://mvmn.wordpress.com/?p=577</guid>
		<description><![CDATA[Working with Liferay always raises a lot of questions about best practices, or even just correct or even working ways to do things. That&#8217;s because Liferay is quite non-standard in many ways (which isn&#8217;t surprising actually, as really all Portlet containers invent their own tricks due to limitations of Portlets specificatin). Today I&#8217;ll share some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=577&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Working with Liferay always raises a lot of questions about best practices, or even just correct or even working ways to do things. That&#8217;s because Liferay is quite non-standard in many ways (which isn&#8217;t surprising actually, as really all Portlet containers invent their own tricks due to limitations of Portlets specificatin).</p>
<p>Today I&#8217;ll share some generic practices which I wish I myself knew when I was starting my Liferay experience.<br />
<span id="more-577"></span><br />
<br />
<strong>Embedding portlets and webcontent in theme &#8211; re-use webcontents and portlets instances on multiple pages</strong><br />
I have a hundred pages in my site, I want to have shared header+footer+navigation present on all those pages. Pretty usual thing to ask, isn&#8217;t it? And quite important at the same time.<br />
So how can I do this in Liferay?</p>
<p>It doesn&#8217;t have &#8220;Books&#8221; like BEA Portal has, where you can put pages in one &#8220;Book&#8221;, and they all &#8216;ll inherit content from the book. It doesn&#8217;t seem to have any similar functionality. So, were stuck? Ready to throw Liferay out to a trash bin? Don&#8217;t rush. Though this is indeed a serious shortcoming (actually it must be the most notable one that I&#8217;ve encountered in Liferay), there is a remedy to that.</p>
<p>The answer is custom theme with webcontent items or portlets &#8220;embedded&#8221; in theme itself. It&#8217;s not very flexible solution, but it does the job.</p>
<p>Preliminary things &#8211; put those to portal-ext.properties:</p>
<div style="overflow:auto;"><code>journal.template.velocity.restricted.variables=<br />
journal.article.force.autogenerate.id=false</code></div>
<p>First one will allow access to some things in Theme velocity templates.<br />
Second one will allow you to create webcontent items with custom (non-autogenerated) IDs, so you could use IDs like &#8220;GENERICHEADER&#8221; instead of autogenerated numbers (like 12355 or whatever).</p>
<p>So, to the point.<br />
In our custom theme _diffs/templates/portal_normal.vm we define this macro:</p>
<div style="overflow:auto;"><code>#macro(showArticleContent $article_id)<br />
$!journalContentUtil.getContent($getterUtil.getLong("$!group_id"), "$!article_id", null, "$!locale", $theme_display)<br />
#end</code></div>
<p>And now wherever in this template we want to render some webcontent items, we just add something like:</p>
<div style="overflow:auto;"><code>#showArticleContent("GENERICHEADER")</code></div>
<p>If hardcoded ID isn&#8217;t what you&#8217;re really looking for, or for some reason you&#8217;re not allowed to disable autogenerated IDs for webcontent, you can do it with Custom Fields (Control Panel: Portal: Custom Fields: Page: Edit). Let&#8217;s say we added custom field for pages, with same code &#8211; &#8220;GENERICHEADER&#8221;.<br />
So we put value like 12355 to (default) value of page custom field, and now we just have to modify our macro accordingly:</p>
<div style="overflow:auto;"><code>#macro(showArticleContent $fieldCode)<br />
#set($article_id = $!theme_display.getLayout().getExpandoBridge().getAttribute($fieldCode))<br />
$!journalContentUtil.getContent($getterUtil.getLong("$!group_id"), "$!article_id", null, "$!locale", $theme_display)<br />
#end</code></div>
<p>For a particular details <a title="JournalContentUtil" href="http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/journalcontent/util/JournalContentUtil.html" target="_blank">look up JournalContentUtil class</a>.</p>
<p>And embedding portlets in a theme is actually <a href="http://www.liferay.com/community/wiki/-/wiki/Main/Embedding+a+portlet+in+the+theme">already described on Liferay website</a></p>
<p>By the way, it&#8217;s reasonable to put any reusable stuff into portal_normal.vm. For example, we use some JavaScript code to count statistics of page accesses. The same JS code has to be present on absolutely all pages, so we just put it in the theme&#8217;s portal_normal.vm &#8211; that simple.<br />
<br />
<strong>Link Portlet URLs to another page + Configuration action</strong><br />
Liferay has an interesting feature that allows you to make portlet URLs point to other Portal page than the one on which the portlet was rendered. It&#8217;s nice to use when you want for example list/details pages for something &#8211; you put List portlet on List page, it lists for example company employees. You want employee Details page to open when user clicks on some of employees in a list &#8211; how would you do that?</p>
<p>Pretty simple &#8211; in &#8220;Look and Feel&#8221; portlet configuration (a bit weird place for it but whatever) you have &#8220;Link portlet URLs to Page&#8221; setting, where you can choose the page. Then, if your List portlet, say, renders action URLs, and on action it sends IPC event to details portlet with employee ID, you can now place those two portlets on two different pages &#8211; it&#8217;s still work. User will click action URL, action will be sent to your List portlet, IPC event from it will be sent to Details portlet, and Details page with Details portlet will be opened. That&#8217;s pretty nice.</p>
<p>However, there is one significant downside &#8211; if you have an EDIT mode in your portlet, where you display some form with configurations, you&#8217;ll see that it submits&#8230; to that other page too. And all in all EDIT mode doesn&#8217;t look too nice in Liferay.</p>
<p>To remedy that, you can implement Configuration Action for your portlet, and thus have your preferences edited in &#8220;Configuration&#8221; popup instead of separate EDIT mode.</p>
<p>Liferay website actually has quite <a title="How to add Configuration Action to Liferay Portlet" href="http://www.liferay.com/community/wiki/-/wiki/Main/How+to+Add+Configuration+Page+to+a+Plugin+Portlet" target="_blank">detailed description of way to add/implement configuration action</a> &#8211; so you probably should look it up there.<br />
One thing to note though is that Portlet Preferences of your portlet aren&#8217;t available in Configuration Action in a usual way &#8211; instead you have to make a call PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, ParamUtil.getString(actionRequest, &#8220;portletResource&#8221;)) to obtain them, so don&#8217;t miss this.<br />
<br />
<strong>In-memory time-based caching using Liferay Web Cache Util</strong><br />
That&#8217;s a nice facility in Liferay to allow you to cache stuff in memory for a specified period of time.</p>
<p>Let&#8217;s say that for example you build a portlet that displays content obtained from some REST webservice by certain URL. We want to cache the response of that webservie. Cache key will be the URL.<br />
Let&#8217;s say the API is webServiceClientInstance.getResponse(URL url).</p>
<p>In our portlet we have code like</p>
<div style="overflow:auto;"><code>WebServiceResponse response = webServiceClientInstance.getResponse(someUrl);<br />
request.setAttribute("wsResponse", response);<br />
</code></div>
<p>Let&#8217;s create WSCacheItem class that implements com.liferay.portal.kernel.webcache.WebCacheItem:</p>
<div style="overflow:auto;"><code>public class WSCacheItem implements WebCacheItem {<br />
private static final long serialVersionUID = -123123123123123123L; // Generated UID<br />
private WebServiceClient webServiceClientInstance;<br />
private URL url;</p>
<p>public WSCacheItem(WebServiceClient webServiceClientInstance, URL url) {<br />
this.webServiceClientInstance = webServiceClientInstance;<br />
this.url = url;<br />
}</p>
<p>@Override<br />
public WSResponse convert(String key) throws WebCacheException {<br />
try {<br />
WSResponse response = webServiceClientInstance.getResponse(url);<br />
return response;<br />
} catch (Exception e) {<br />
throw new WebCacheException(e);<br />
}<br />
}</p>
<p>@Override<br />
public long getRefreshTime() {<br />
return REFRESH_TIME;<br />
}</p>
<p>private static final long REFRESH_TIME = Time.HOUR * 2; // Cached for 2 hours<br />
}</code></div>
<p>Now our portlet code changes to this:</p>
<div style="overflow:auto;"><code>WebCacheItem wci = new WSCacheItem(webServiceClientInstance, url);<br />
WSResponse response;<br />
try {<br />
response = (WSResponse)WebCachePoolUtil.get(OurPortlet.class.getName() + StringPool.PERIOD + url.toExternalForm(), wci);<br />
} catch(ClassCastException e) {<br />
WebCachePoolUtil.clear();<br />
response = (ShopResponse)WebCachePoolUtil.get(OurPortlet.class.getName() + StringPool.PERIOD + url.toExternalForm(), wci);<br />
}<br />
request.setAttribute("wsResponse", response);<br />
</code></div>
<p>The &#8220;OurPortlet.class.getName() + StringPool.PERIOD + url.toExternalForm()&#8221; part is just to have unique per URL cache key for our portlet.</p>
<p>As for ClassCastException, this little trick is for hot redeploys of portlet, when cached item class is unloaded and new one is loaded &#8211; we have to clear cache and re-cache our item.</p>
<p>As you can see, the code isn&#8217;t very complex, but the logic for web-service call moves to WebCacheItem implementation convert method.<br />
<br />
<strong>Custom fields and problem with Document Library documents (DLFileEntry)</strong><br />
This is just a smaller hint, but might save some hours of digging for you.</p>
<p>As you may know, Liferay allows you to define custom fields for different types of Liferay objects, like for Organizations for instance, or for Document Library documents.</p>
<p>If you define custom field &#8220;myfield&#8221; on Organization, and you call:<br />
organizationInstance.getExpandoBridge().getAttribute(&#8220;random&#8221;) &#8211; returns null, because there&#8217;s no field &#8220;random&#8221; defined;<br />
organizationInstance.getExpandoBridge().getAttribute(&#8220;myfield&#8221;) &#8211; returns value as expected.<br />
Kind of obvious. But&#8230; DLFileEntry (document library documents) is very special here.</p>
<p>dlFileEntry.getExpandoBridge().getAttribute(&#8220;random&#8221;) &#8211; returns null, which is expected because there is no custom field &#8220;random&#8221;.<br />
dlFileEntry.getExpandoBridge().getAttribute(&#8220;myfield&#8221;) &#8211; always returns default value! (like empty string for Text, 1 Jan 1970 for Date etc), which is extremely confusing.</p>
<p>So, how do we get the actual value of custom field for Document Library Document? Well, this way:<br />
dlFileEntry.getFileVersion().getExpandoBridge().getAttribute(&#8220;myfield&#8221;) &#8211; returns desired value.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mvmn.wordpress.com/577/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mvmn.wordpress.com/577/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mvmn.wordpress.com/577/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mvmn.wordpress.com&amp;blog=5408801&amp;post=577&amp;subd=mvmn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mvmn.wordpress.com/2011/06/20/liferay-practices-6-0-6/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f00115ea3e54c43dbfd0094ddde4d663?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">mvmn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
