<?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/"
	>

<channel>
	<title>Devon Hillard Tech Blog &#187; repositories</title>
	<atom:link href="http://www.digitalsanctuary.com/tech-blog/tag/repositories/feed" rel="self" type="application/rss+xml" />
	<link>http://www.digitalsanctuary.com/tech-blog</link>
	<description>Java, ATG, Seam, and related Technologies</description>
	<lastBuildDate>Thu, 01 Jul 2010 21:06:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding the &#8220;Upload Image&#8221; Button in the ACC</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/atg/adding-the-upload-image-button-in-the-acc.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/atg/adding-the-upload-image-button-in-the-acc.html#comments</comments>
		<pubDate>Mon, 14 Apr 2008 23:32:20 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[ATG]]></category>
		<category><![CDATA[repositories]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=96</guid>
		<description><![CDATA[If you have your own content repository items defined, and you&#8217;d like the ACC to provide the Upload Image functionality for your internal binary properties, Russell Moore has figured it out:
In /atg/devtools/ create a local version of admins.xml:


  
    Your Content
    YourRepository
    
   [...]]]></description>
			<content:encoded><![CDATA[<p>If you have your own content repository items defined, and you&#8217;d like the ACC to provide the Upload Image functionality for your internal binary properties, <a href="http://www.russellmoore.net" target="_new">Russell Moore</a> has figured it out:</p>
<p>In /atg/devtools/ create a local version of admins.xml:</p>
<pre lang="xml">
<repository-admins>
  <default-admin id="YourRepository">
    <display-name>Your Content</display-name>
    <repository-name>YourRepository</repository-name>
    <create-bean-displays>
      <bean-display type="media" class="atg.ui.repository.MediaInternalBinaryEditor">
<property name="internalBinaryExcludedTableProperties" value="path, version, mimeType,data, length,url"/>
      </bean-display>
    </create-bean-displays>
    <standard-bean-displays>
      <bean-display type="media" class="atg.ui.repository.MediaInternalBinaryEditor">
<property name="internalBinaryExcludedTableProperties" value="version, mimeType, data, length, url"/>
<property name="internalBinaryTableReadOnlyProperties" value="path"/>
      </bean-display>
    </standard-bean-displays>
  </default-admin>
</repository-admins>
</pre>
<p>Thanks Russell!</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.digitalsanctuary.com/tech-blog/java/atg/adding-the-upload-image-button-in-the-acc.html" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/atg/adding-the-upload-image-button-in-the-acc.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing nested Item properties within a RepositoryFormHandler programatically</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/atg/accessing-nested-item-properties-within-a-repositoryformhandler-programatically.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/atg/accessing-nested-item-properties-within-a-repositoryformhandler-programatically.html#comments</comments>
		<pubDate>Mon, 27 Aug 2007 16:48:35 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[ATG]]></category>
		<category><![CDATA[repositories]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/java/atg/accessing-nested-item-properties-within-a-repositoryformhandler-programatically.html</guid>
		<description><![CDATA[If you have a RepositoryItem which has a collection of other RepositoryItems as a property, editing things on them via a single form and RepositoryFormHandler can pose some difficulties.
For instance, you have an Item called Garage, and it has a List of Car RepositoryItems as a property named cars.  If you are using a [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a RepositoryItem which has a collection of other RepositoryItems as a property, editing things on them via a single form and RepositoryFormHandler can pose some difficulties.</p>
<p>For instance, you have an Item called Garage, and it has a List of Car RepositoryItems as a property named cars.  If you are using a different type of collection, some of the following will need to be adjusted accordingly, but the overall approach is the same.  A Car Item has a name and an option picture as properties.  If you have a form to display and allow for editing of a Garage, including all of its cars, which is handled by a sub-class of a RepositoryFormHandler, you can edit values on both the Garage, as well as the Cars within cars, without much difficulty.</p>
<p>What gets tricky is if you need to access form submission values for properties on the Cars.  For instance if you wanted to allow a user to delete a car by simply blanking it&#8217;s name, or if you wanted to automatically assign a picture based on the make and model in the name field.  You can&#8217;t just access the submitted but un-updated values (say from within the preUpdateItem method) using simple nested getValueProperties.  Here is what you can do:</p>
<p><span id="more-36"></span></p>
<p>First you need to get the List of cars.  This is actually an instance of a RepositoryFormList.</p>
<p><code>RepositoryFormList carsFormList = (RepositoryFormList) getValueProperty("cars");</code></p>
<p>This is a subclass of ArrayList, and can be iterated through to get at each car&#8217;s incoming values.  Remember we aren&#8217;t dealing with the actual RepositoryItems, that would be easy, this is what to do in order to grab the form submitted values destined for properties on these sub-Items in the preUpdateItem life-cycle phase.  The contents of this ArrayList are RepositoryFormHashtables.</p>
<p><code>Iterator iter = carsFormList.iterator();<br />
while (iter.hasNext()) {<br />
RepositoryFormHashtable rfh = (RepositoryFormHashtable) iter.next();<br />
....</code></p>
<p>The incoming property values are in this Hashtable, keyed by the property&#8217;s CAPITALIZED name:</p>
<p><code>String incomingName = (String) rfh.get("NAME");</code></p>
<p>Now that you have the name you can see if it&#8217;s blank and then delete the related car Item (hint: the repositoryId of the car Item this set of properties is destined for is in the Hashtable with the key of &#8220;REPOSITORYID&#8221;), or parse it and search for a normalized version, or find a related image automatically, or whatever else you wanted to do with it prior to the actual handleUpdate phase.</p>
<p>You can also get the RepositoryItem by calling:<br />
<code>RepositoryItem rfhitem = rfh.getRepositoryItem();</code></p>
<p>To be on the safe side your best bet is validate that and do something like this:</p>
<p><code>final RepositoryItem rfhitem = rfh.getRepositoryItem();<br />
MutableRepositoryItem carItem = null;<br />
if (rfhitem instanceof MutableRepositoryItem) {<br />
carItem = (MutableRepositoryItem) rfhitem;<br />
} else {<br />
if (!(rfh.isEmpty() || ((rfh.size() == 1) &amp;amp;&amp;amp; (rfh.get("REPOSITORYID") != null)))) {<br />
try {<br />
carItem = this.getRepository().getItemForUpdate(rfhitem.getRepositoryId(),<br />
MyConstants.CAR_ITEM_DESCRIPTOR);<br />
} catch (final RepositoryException e) {<br />
if (isLoggingError()) {<br />
logError(<br />
"GarageFormHandler.handleUpdate: repository error while accessing an car.",<br />
e);<br />
}<br />
}<br />
}<br />
}</code></p>
<p>Then you can access the existing car Item in order to delete it, or compare values to the incoming values, etc&#8230;</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.digitalsanctuary.com/tech-blog/java/atg/accessing-nested-item-properties-within-a-repositoryformhandler-programatically.html" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/atg/accessing-nested-item-properties-within-a-repositoryformhandler-programatically.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ItemToXMLDroplet</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/itemtoxmldroplet.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/itemtoxmldroplet.html#comments</comments>
		<pubDate>Tue, 07 Aug 2007 03:52:17 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[ATG]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[droplet]]></category>
		<category><![CDATA[repositories]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/archives/24</guid>
		<description><![CDATA[This is an extremely simple Droplet with source, a config file, and a sample JSP.  All the droplet does it transform a passed-in RepositoryItem into XML and dump it out.  It would be handy for vending data to client-side logic in JavaScript or Flash, when you don&#8217;t want to write-up a full WebService.
You [...]]]></description>
			<content:encoded><![CDATA[<p>This is an extremely simple Droplet with source, a config file, and a sample JSP.  All the droplet does it transform a passed-in RepositoryItem into XML and dump it out.  It would be handy for vending data to client-side logic in JavaScript or Flash, when you don&#8217;t want to write-up a full WebService.</p>
<p>You can download it all <a href="http://digitalsanctuary.com/tech-files/ItemToXML.zip" title="ItemToXML">here</a>.</p>
<p>The example JSP takes in a query parameter userId and generates the XML for the user profile with that id.  For instance, if you call:</p>
<p><code>http://alita.local:8840/test/test.jsp?userId=930003</code></p>
<p>you get this&#8230;&#8230;</p>
<p><span id="more-24"></span></p>
<p><code>&lt;user:user id="user930003" repositoryid="_003930003" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:user="http://www.atg.com/ns/UserProfiles/user" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.atg.com/ns/UserProfiles/user UserProfiles+user.xsd "&gt;<br />
&lt;user:user.securitystatus xsi:type="integer"&gt;0&lt;/user:user.securitystatus&gt;<br />
&lt;user:user.scenarioinstances xsi:nil="true"&gt;&lt;/user:user.scenarioinstances&gt;<br />
&lt;user:user.votecount xsi:nil="true"&gt;&lt;/user:user.votecount&gt;<br />
&lt;user:user.firstname xsi:type="string"&gt;<!--[CDATA[Devon]]-->&lt;/user:user.firstname&gt;<br />
&lt;user:user.gender xsi:type="string"&gt;<!--[CDATA[male]]-->&lt;/user:user.gender&gt;<br />
&lt;user:user.emailstatus xsi:type="string"&gt;<!--[CDATA[unknown]]-->&lt;/user:user.emailstatus&gt;<br />
&lt;user:user.dateofbirth xsi:type="date"&gt;1980-02-11&lt;/user:user.dateofbirth&gt;<br />
&lt;user:user.markers xsi:nil="true"&gt;&lt;/user:user.markers&gt;<br />
&lt;user:user.locale xsi:nil="true"&gt;&lt;/user:user.locale&gt;<br />
&lt;user:user.lastactivity xsi:nil="true"&gt;&lt;/user:user.lastactivity&gt;<br />
&lt;user:user.slotinstances xsi:nil="true"&gt;&lt;/user:user.slotinstances&gt;<br />
&lt;user:user.lastname xsi:type="string"&gt;<!--[CDATA[Hillard]]-->&lt;/user:user.lastname&gt;<br />
&lt;user:user.description xsi:nil="true"&gt;&lt;/user:user.description&gt;<br />
&lt;user:user.email xsi:nil="true"&gt;&lt;/user:user.email&gt;<br />
&lt;user:user.autologin xsi:type="boolean"&gt;false&lt;/user:user.autologin&gt;<br />
&lt;user:user.businessprocessmarkers xsi:nil="true"&gt;&lt;/user:user.businessprocessmarkers&gt;<br />
&lt;user:user.middlename xsi:type="string"&gt;<!--[CDATA[D]]-->&lt;/user:user.middlename&gt;<br />
&lt;user:user.password xsi:type="string"&gt;<!--[CDATA[1a1dc91c907325c69271ddf0c944bc72]]-->&lt;/user:user.password&gt;<br />
&lt;user:user.receiveaffemail xsi:nil="true"&gt;&lt;/user:user.receiveaffemail&gt;<br />
&lt;user:user.lastpasswordupdate xsi:type="timestamp"&gt;2007-08-06T20:13:46.0&lt;/user:user.lastpasswordupdate&gt;<br />
&lt;user:user.generatedpassword xsi:type="boolean"&gt;false&lt;/user:user.generatedpassword&gt;<br />
&lt;user:user.receivepcaemail xsi:nil="true"&gt;&lt;/user:user.receivepcaemail&gt;<br />
&lt;user:user.receiveemail xsi:type="string"&gt;<!--[CDATA[yes]]-->&lt;/user:user.receiveemail&gt;<br />
&lt;user:user.registrationdate xsi:nil="true"&gt;&lt;/user:user.registrationdate&gt;<br />
&lt;user:user.usertype xsi:nil="true"&gt;&lt;/user:user.usertype&gt;<br />
&lt;user:user.previouspasswords xsi:nil="true"&gt;&lt;/user:user.previouspasswords&gt;<br />
&lt;user:user.member xsi:type="boolean"&gt;false&lt;/user:user.member&gt;<br />
&lt;user:user.login xsi:type="string"&gt;<!--[CDATA[devon]]-->&lt;/user:user.login&gt;<br />
&lt;user:user.mailings xsi:nil="true"&gt;&lt;/user:user.mailings&gt;<br />
&lt;user:user.scenariovalues xsi:nil="true"&gt;&lt;/user:user.scenariovalues&gt;<br />
&lt;user:user.nickname xsi:nil="true"&gt;&lt;/user:user.nickname&gt;<br />
&lt;user:user.lastemailed xsi:nil="true"&gt;&lt;/user:user.lastemailed&gt;<br />
&lt;/user:user&gt;</code></p>
<p>I may extend it to serve out collections of items (currently if you nest it in an RQLForEach or similar, you get the <code>&lt;?xml</code> line once per item.  It&#8217;s not much, but hey, this is my first ATG post:)</p>
<p>Devon</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.digitalsanctuary.com/tech-blog/java/itemtoxmldroplet.html" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/itemtoxmldroplet.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
