<?xml version="1.0"?>
<rss version="2.0">
<channel>
<link>http://helma.org/wiki/Creating+collections+programmatically/</link>
<title>helma.org/wiki/Creating collections programmatically</title>
<description>Updates for Page helma.org/wiki/Creating collections programmatically</description>
<pubDate>Thu, 24 May 2012 02:45:59 +0000</pubDate>
<item>
<title>Version 3</title>
<link>http://helma.org/wiki/Creating+collections+programmatically/history.diff?v=3</link>
<description>&lt;ul class=&#39;diffproperties&#39;&gt;&lt;li&gt;Set &lt;span class=&#39;diffpropname&#39;&gt;useMarkdown&lt;/span&gt; to &lt;span class=&#39;diffadded&#39;&gt;true&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;Helma 1.7 introduces a much requested feature to create HopObject collections programmatically and on the fly, without having to define them in the prototype&#39;s &lt;span class=&#39;diffremoved&#39;&gt;*type&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;[type&lt;/span&gt;.&lt;span class=&#39;diffremoved&#39;&gt;properties|docs/type&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;properties][documentation/type&lt;/span&gt;.properties &lt;span class=&#39;diffremoved&#39;&gt;documentation* &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;documentation] &lt;/span&gt;file.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;20&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;var c = Page.getCollection({&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;21&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;group: &amp;quot;author&amp;quot;,&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;22&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;quot;group.order&amp;quot;: &amp;quot;author&amp;quot;,&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;23&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;quot;group.prototype&amp;quot;: &amp;quot;AuthorGroup&amp;quot;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;24&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;});&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Tue, 22 Sep 2009 09:18:45 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 2</title>
<link>http://helma.org/wiki/Creating+collections+programmatically/history.diff?v=2</link>
<description>&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;Since I thought it would be handy, I also implemented &amp;quot;limit&amp;quot; and &amp;quot;offset&amp;quot; collection properties to implement easy &lt;span class=&#39;diffremoved&#39;&gt;pagination on dbs that support it (Postgresql and Mysql AFAIK): &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;pagination: &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;28&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;http://www.sql.org/sql-database/postgresql/manual/queries-limit.html&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;29&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;36&lt;/td&gt;&lt;td&gt;Note that &amp;quot;limit&amp;quot; is just an alias for &amp;quot;maxSize&amp;quot; introduced to be more consistent with the underlying SQL syntax. &lt;span class=&#39;diffremoved&#39;&gt;This feature is currently not supported on Oracle. If somebody can provide the SQL syntax needed to make this work on Oracle plus some testing support, I&#39;ll happily add this. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;37&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;38&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;This feature is currently implemented and known to work on MySQL, Postgresql, and Oracle. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Wed, 01 Apr 2009 17:54:21 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 1</title>
<link>http://helma.org/wiki/Creating+collections+programmatically/history.diff?v=1</link>
<description>&lt;ul class=&#39;diffproperties&#39;&gt;&lt;li&gt;Set &lt;span class=&#39;diffpropname&#39;&gt;tags&lt;/span&gt; to &lt;span class=&#39;diffadded&#39;&gt;helma 1.7, ORM&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Helma 1.7 introduces a much requested feature to create HopObject collections programmatically and on the fly, without having to define them in the prototype&#39;s *type.properties|docs/type.properties documentation* file.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;2&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;3&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;HopObject constructors now have a new static getCollection() method that takes a single JS object argument. The argument contains the collection properties as you would normally define them in the _children section of the type.properties file, e.g.:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;4&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; var c = Page.getCollection({&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order: &amp;quot;name&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filter: &amp;quot;id &amp;gt; 10&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;8&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;9&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;10&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;You can also specify the type of contained objects using the &amp;quot;collection&amp;quot; property, so the following collection is equivalent to the one defined above:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;11&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;12&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; var c = HopObject.getCollection({&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;13&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; collection: &amp;quot;Page&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;14&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; order: &amp;quot;name&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;15&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filter: &amp;quot;id &amp;gt; 10&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;16&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;17&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;18&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Note that for &amp;quot;nested&amp;quot; properties such as group.order or local.1 you have to use quoted &amp;quot;flat&amp;quot; properties, not nested objects:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;19&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;20&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; var c = Page.getCollection({&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;21&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; group: &amp;quot;author&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;22&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;group.order&amp;quot;: &amp;quot;author&amp;quot;,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;23&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;group.prototype&amp;quot;: &amp;quot;AuthorGroup&amp;quot;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;24&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; });&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;25&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Since I thought it would be handy, I also implemented &amp;quot;limit&amp;quot; and &amp;quot;offset&amp;quot; collection properties to implement easy pagination on dbs that support it (Postgresql and Mysql AFAIK): &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;27&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;28&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;http://www.sql.org/sql-database/postgresql/manual/queries-limit.html&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;29&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;30&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;So to fetch pages 11-20, you would do something like this:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;31&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;32&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; var q = Page.getCollection({&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;33&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; limit: 10,&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;34&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; offset: 10&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;35&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;36&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;37&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffadded&#39;&gt;Note that &amp;quot;limit&amp;quot; is just an alias for &amp;quot;maxSize&amp;quot; introduced to be more consistent with the underlying SQL syntax. This feature is currently not supported on Oracle. If somebody can provide the SQL syntax needed to make this work on Oracle plus some testing support, I&#39;ll happily add this. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Tue, 31 Mar 2009 14:45:54 +0000</pubDate>
<author>hannes</author>
</item>
</channel>
</rss>

