<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>krypthonas.de</title>
	<link>http://portal.krypthonas.de</link>
	<description>Some thoughts about ECM, Alfresco, BPM, JEE and other things</description>
	<pubDate>Sun, 22 Nov 2009 12:02:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>AccessDeniedException Due to Creating of Thumbnails in Alfresco Share</title>
		<link>http://portal.krypthonas.de/2009/11/22/accessdeniedexception-due-to-creating-of-thumbnails-in-alfresco-share/</link>
		<comments>http://portal.krypthonas.de/2009/11/22/accessdeniedexception-due-to-creating-of-thumbnails-in-alfresco-share/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 12:02:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/11/22/accessdeniedexception-due-to-creating-of-thumbnails-in-alfresco-share/</guid>
		<description><![CDATA[This week i was in struggle with a realy strange issue in Alfresco. If you belong to a site with lower permissions on this site or something similary you got an exception on Thumnbail-creation. For sure, you can upload and edit a document being added to a site but the creation of the previewes like [...]]]></description>
			<content:encoded><![CDATA[<p>This week i was in struggle with a realy strange issue in Alfresco. If you belong to a site with lower permissions on this site or something similary you got an exception on Thumnbail-creation. For sure, you can upload and edit a document being added to a site but the creation of the previewes like the images in the doclib as well as the whole webpreview failed if you have no permissions doing a appropriate operation on the particular document you have actually under edit. Thus, its getting weird if you got to a document-details page and its gettin showed up the old content of the old version of the document. So a normal user expects a failure of himself so he is giving himself another try to upload a new version and runs into the same pitfall as the time before &#8230; Actually there exists a JIRA-Bug-entry at Alfresco but its still keeped under the open issues so we have to move on with our own ifx regarding this:</p>
<p>So the easiest solution without cross-cutting concers is to using Aspect-orientied programming. With that technique we getting rid of the current AuthenticationContext (the current logged on user) so we can run the thumnailcreation with admin-permissions. This has no drawbacks about permissions.</p>
<p>At first we have to create the appropriated Proxy-Helper class to register a AOP-Class. But be aware its just a little excerpt where you can starting from:</p>
<pre name="code" class="java">
public class PostBeanServiceProcessor implements BeanFactoryPostProcessor { ...

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
   for (String bean : affectedBeans) {
      BeanDefinition beanDefinition = beanFactory.getBeanDefinition(bean);
      List&lt;RuntimeBeanNameReference&gt; proxies = (List&lt;RuntimeBeanNameReference&gt;) beanDefinition
      .getPropertyValues().getPropertyValue("interceptorNames").getValue();

      proxies.add(new RuntimeBeanNameReference(this.interceptorName));

      ((DefaultListableBeanFactory) beanFactory).registerBeanDefinition(bean, beanDefinition);
    }
}
...
}</pre>
<p>There we go: next step is to add the particular code we want to run on it at a particular timepoint. On our implementation means this that we want to use that code if a thumbnail shall be created or at least updated to a upper version. Then we run this creation with Admin-Functionality.</p>
<pre name="code" class="java">
public class ProxyAdminThumbnailService implements MethodInterceptor{...

public Object invoke(final MethodInvocation method) throws Throwable {
    if( method.getMethod().getName().equals("createThumbnail") ||
       method.getMethod().getName().equals("updateThumbnail")){

       return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() {

          public Object doWork() throws Exception {
            try {
             return method.proceed();
            }
            catch (Throwable e) {
                throw new RuntimeException(e);
            }
          }
       }, AuthenticationUtil.SYSTEM_USER_NAME);
}

return method.proceed();
...
}</pre>
<p>This is all we have to do right here: last step is to add the beandefinition for this two classes:</p>
<pre name="code" class="xml">&lt;bean id="mcgThumbnailInterceptor" class="com.westernacher.wps.alfresco.aop.ProxyAdminThumbnailService"&gt;
&lt;/bean&gt;
&lt;bean id="mcgThumbnailInterception" class="com.westernacher.wps.alfresco.aop.PostBeanServiceProcessor"&gt;
   &lt;property name="interceptorName" value="mcgThumbnailInterceptor"/&gt;
   &lt;property name="affectedBeans"&gt;
      &lt;list&gt;
        &lt;value&gt;ThumbnailService&lt;/value&gt;
      &lt;/list&gt;
   &lt;/property&gt;
&lt;/bean&gt;</pre>
<p>Gotcha! Next issue!</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/11/22/accessdeniedexception-due-to-creating-of-thumbnails-in-alfresco-share/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A jBPM-Timer Is Not A jBPM-Timer In Relation To Alfresco</title>
		<link>http://portal.krypthonas.de/2009/11/03/a-jbpm-timer-is-not-a-jbpm-timer-in-relation-to-alfresco/</link>
		<comments>http://portal.krypthonas.de/2009/11/03/a-jbpm-timer-is-not-a-jbpm-timer-in-relation-to-alfresco/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 20:21:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/11/03/a-jbpm-timer-is-not-a-jbpm-timer-in-relation-to-alfresco/</guid>
		<description><![CDATA[Today i was wondering about an unexpected behaviour in jBPM 3.2.2. Im accustomed to add a business time directly on workflowstart so i can set my variables in the processdefinition in the right manner. For instance:

&#60;timer duedate="#{myDueDate}"&#62;
   &#60;action&#62;...&#60;/action&#62;
&#60;/timer&#62;
And this was my AlfrescoCode:

workflowParameters.put("dueDate", "10 business days");
workflowService.startWorkflow(def.id, workflowParameters);
So it doesnt work at all using the [...]]]></description>
			<content:encoded><![CDATA[<p>Today i was wondering about an unexpected behaviour in jBPM 3.2.2. Im accustomed to add a business time directly on workflowstart so i can set my variables in the processdefinition in the right manner. For instance:</p>
<pre class="xml" name="code">
&lt;timer duedate="#{myDueDate}"&gt;
   &lt;action&gt;...&lt;/action&gt;
&lt;/timer&gt;</pre>
<p>And this was my AlfrescoCode:</p>
<pre class="java" name="code">
workflowParameters.put("dueDate", "10 business days");
workflowService.startWorkflow(def.id, workflowParameters);</pre>
<p>So it doesnt work at all using the Alfresco-Integration of jBPM. I thought im so stupid to forget all the bunch of jBPM-Peaces that i´ve compelled to fillin my head but this wasnt the point as i can see it by now after i wented home and reviewing the codings.</p>
<p>As Alfresco overrides and extends the CreateTimerAction of jBPM we dont calling it anymore &#8220;extening&#8221; rather than decreasing the amount of possibilities we can take from that Timer as the functionality were partly removed from the base-class (CreateTimerClass). This means in brief, that we can not using such a duration-format like ive mentioned above (10 business hours) as following lines occures at the point of concern where the Baseclass was able to fullfill this cool feature:</p>
<pre name="code" class="java">
if (dueDateExpression.startsWith("#{")) { 
   Object result = JbpmExpressionEvaluator.evaluate(dueDateExpression, executionContext);
   if (!(result instanceof Date)) {
     throw new WorkflowException("duedate expression must evaluate to a date");
}
...</pre>
<p>Here we going. We have to pass a ready to start date and you have to calulate out your relativly value being passed to that dueDate. But dont worry, as jBPM helps you alot with this part <img src='http://portal.krypthonas.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre name="code" class="java">
Duration duration = new Duration("10 business hours"); 
dueDate = businessCalendar.add(new Date(), duration);   

//and the start again
workflowParameters.put("dueDate", dueDate);
workflowService.startWorkflow(def.id, workflowParameters);</pre>
<p>I hope i can write the next time very sooner as it is by now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/11/03/a-jbpm-timer-is-not-a-jbpm-timer-in-relation-to-alfresco/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JBPM 4 - A New Tale&#8230; With To Much Obstacles (right now)</title>
		<link>http://portal.krypthonas.de/2009/09/07/jbpm-4-a-new-tale-with-to-much-obstacles-right-now/</link>
		<comments>http://portal.krypthonas.de/2009/09/07/jbpm-4-a-new-tale-with-to-much-obstacles-right-now/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 18:35:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JBPM]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/09/07/jbpm-4-a-new-tale-with-to-much-obstacles-right-now/</guid>
		<description><![CDATA[Well, its been a while i´ve cryed out so much terrible words as by now.
JBPM 4 is cool in many details, especially the Service-API (i guess its stolen from Alfresco, its biggest implementor i guess).
Yesterday - on Sunday - i´ve tried to implement my custom task-logic from JBPM 3&#8230; i saw the new TaskService API [...]]]></description>
			<content:encoded><![CDATA[<p>Well, its been a while i´ve cryed out so much terrible words as by now.</p>
<p>JBPM 4 is cool in many details, especially the Service-API (i guess its stolen from Alfresco, its biggest implementor i guess).</p>
<p>Yesterday - on Sunday - i´ve tried to implement my custom task-logic from JBPM 3&#8230; i saw the new TaskService API for this case to take use of it. Couldnt be easier, isnt so?</p>
<pre name="code" class="java">
taskService.setVariables("taskId", taskVariablesAsMap);</pre>
<p>&#8220;Considered it done&#8221; - ive said to me yesterday but the expected results turns into a little journey into forum-posts, commentations as well as heavily reading of the current userguides/developer guides. Because of what manner?</p>
<p>Well, the task-variables wont be task-variables as these variables will be propagated to the processinstance. So this means in brief: all task can have access to these variables. So theres no scoping yet available to let it say that some variables should be only - AND THIS MEANS JUST ONLY - locally managed task-variables, so multiple variables with the same name can not be overwritten by itself. By now this will be happen if you got more than one task in your process-definition. That really sucks guys - sorry!</p>
<p>Excerpted from the userguide i read following about this (http://docs.jboss.com/jbpm/v4.0/userguide/html_single/#taskservice):</p>
<blockquote><p> Tasks can read and update process variables. Later tasks will have the option to declare task-local process variables.</p></blockquote>
<p>Well done&#8230; i´ve to implement scoping for my own as long as JBoss does not scoring this big disadvantage today.</p>
<p>Well dont understand me in the wrong-case! I love what they do, its pretty fine but i hope it will be fixed as soon as possible due to the current release-plan so move on guys, heeejaaaaa!</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/09/07/jbpm-4-a-new-tale-with-to-much-obstacles-right-now/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stay Tuned on Oracle-Magazine (DOAG)</title>
		<link>http://portal.krypthonas.de/2009/08/12/stay-tuned-on-oracle-magazine-doag/</link>
		<comments>http://portal.krypthonas.de/2009/08/12/stay-tuned-on-oracle-magazine-doag/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 06:03:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ECM]]></category>

		<category><![CDATA[Alfresco]]></category>

		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/08/12/stay-tuned-on-oracle-magazine-doag/</guid>
		<description><![CDATA[Well met.
Next days  a new Article gets released which i´ve wrote some months ago. The article handles about ECM, particulary catches-up the Performance-Corner, focussing Alfresco in association with the State-Of-The-Art Database Oracle.
The main question where the most time will be spended in the article belongs to the issue on how sophisticated databasas can help us [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.doag.org/pub/docs/Publikationen/DOAGNews/2009/Q3-09/2009-Q3-00-Titel.jpg" align="left" />Well met.</p>
<p>Next days  a new Article gets released which i´ve wrote some months ago. The article handles about ECM, particulary catches-up the Performance-Corner, focussing Alfresco in association with the State-Of-The-Art Database Oracle.</p>
<p>The main question where the most time will be spended in the article belongs to the issue on how sophisticated databasas can help us to achieve a better performance using ECM-Systems. Thats not far from business i guess even you thing yet so! Because if you looking through the wide-spreaded scape of DMS/ECM-Systems you dont see so many Systems which have the opportunity on being fast <img src='http://portal.krypthonas.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> Well most business-customers doesnt care about such a manner as long as the business gets slowed down (4 Seconds to wait for one operation is okay if you have millions of documents with versioning and a much higher amount of corresponding metadata). The Kasus Knaxus here is, in which way can we tune the ECM-System by default and how can a Enterprise-Database like Oracle assist us to monitor the performance and how to optimize the whole system. Is this possible at all? Are we lost in the mailstream of Enterprise-Frameworks, Business-Usecases that can not be adopted to a ECM-System without big performance-changes?</p>
<p>Some things you would probably learn on reading this article being published on August 14 2009 in the magazin of the community of Oracle in Germany.</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/08/12/stay-tuned-on-oracle-magazine-doag/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Just married: Alfresco &#038; VTiger</title>
		<link>http://portal.krypthonas.de/2009/08/08/just-married-alfresco-vtiger/</link>
		<comments>http://portal.krypthonas.de/2009/08/08/just-married-alfresco-vtiger/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 08:12:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Alfresco]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/08/08/just-married-alfresco-vtiger/</guid>
		<description><![CDATA[Very well. On my work some people are in fraud with its business-contacts that must be managed twice: VTiger (a CRM-TOOL) as well as in Alfresco. We´ve had looking for a cool solution that brings together all those peaces to get rid of the management-overhead. And we found&#8230; nothing&#8230; realy strange i guess as i [...]]]></description>
			<content:encoded><![CDATA[<p>Very well. On my work some people are in fraud with its business-contacts that must be managed twice: VTiger (a CRM-TOOL) as well as in Alfresco. We´ve had looking for a cool solution that brings together all those peaces to get rid of the management-overhead. And we found&#8230; nothing&#8230; realy strange i guess as i guess that both tools will be used more frequently and in some cases together. Why there exists no free-solution to fetch data from vTiger into Alfresco and vice-versa(okay first way is unidirectional towards Alfresco)</p>
<p>Okay, i´ve enough spoked and flamed regarding that outstanding-issue.</p>
<p>What can we do to get marriaged both worlds? Well we using Alfresco´s nice connector-api to solve the whole problem. The way to achieve an one-way synchronisation descripes only the way from vtiger towards alfresco. So Alfresco posses after a synchronisation more data than before ;-D</p>
<p>I´ve tested my basic-authentication as well as fetching of data with Alfresco 3.2 as well as vTiger-CRM Version 5.1.0</p>
<p>Steps i want to introduce:</p>
<p>1. Defining of the vTiger-Authenticator<br />
2. Authentication with vTiger<br />
3. fetching of Leads/Contacts</p>
<p>At first, we have  to setup the connector, thus knows alfresco which location must be taken to connect with a particular (Web-)Service. Therefor we add following lines to the file tomcat/shared/classes/alfresco/web-extension/webscript-framework-config-custom.xml following lines:</p>
<pre name="code" class="xml">
&lt;config evaluator="string-compare" condition="Remote"&gt;
  &lt;remote&gt;
    &lt;endpoint&gt;
      &lt;id&gt;vTiger&lt;/id&gt;
      &lt;name&gt;vTiger&lt;/name&gt;
      &lt;description&gt;vTiger vTiger vTiger&lt;/description&gt;
      &lt;connector-id&gt;http&lt;/connector-id&gt;
      &lt;endpoint-url&gt;http://localhost:82&lt;/endpoint-url&gt;
      &lt;identity&gt;none&lt;/identity&gt;
    &lt;/endpoint&gt;
  &lt;/remote&gt;
&lt;/config&gt;</pre>
<p>Next step descripes the setup for the spring-context. If you have sucesfully done this step you are able to retrive informations about vTiger in your whole application. In my case i adding a quite other way on implementing a webscript (but that doesnt matter at all):</p>
<pre name="code" class="xml">&lt;bean id="webscript.de.dmc.VTiger.get" class="de.dmc.alfresco.VTigerWebScript" parent="webscript"&gt;       
  &lt;property name="scriptRemote" ref="webscripts.script.remote" /&gt;  
&lt;/bean&gt;</pre>
<p>Now its time to implement most important functionality.</p>
<p>Firstly, i obtain the vTiger-Connector being defined in the file webscript-framework-config-custom.xml:</p>
<pre name="code" class="java">
ScriptRemoteConnector vTigerConnector = scriptRemote.connect("vTiger");</pre>
<p>Next we have to get a valid sessionId, so we can start quering the database of vTiger. As you have to know that vTiger-Authentication is using a chalange-response-mechanism to avoiding password-sending. But its nothing to worring about: its quite simple. What for ingredients we must own:</p>
<p><strong>A valid Access Key</strong>: that key will be encrypted with an computed-number (token) from serversite. You can find this key in you user-account in vTiger.</p>
<p><strong>A username</strong>: surely you need this part ;-D</p>
<p>You have to know about vTiger that the WebService-Protocoll is based on REST and simple HTTP-mechanism. The returned value from vTiger is in every case a JSON-Object. Oh did i had say in every case? In some circumstances you get nothing back if you got made some errors &#8230; really bad.</p>
<pre name="code" class="java">
String key = "wJAsUpRC6Bp5qKm3";Response response = connector.call("/webservice.php?operation=getchallenge&amp;username=admin");
JSONObject resultObject = new JSONObject(response.getResponse());
resultObject = resultObject.getJSONObject("result");Map&lt;String, String&gt; data = new HashMap&lt;String, String&gt;();
data.put("operation", "login");
data.put("username", "admin");
data.put("accessKey", md5(resultObject.get("token").toString() + key));
String postBody = "";
boolean isFirst=true;
for(Map.Entry&lt;String, String&gt; entry : data.entrySet()){
  if(!isFirst)

  postBody+="&amp;";
  postBody+=entry.getKey()+"="+entry.getValue();
  isFirst = false;
}

response = connector.post("/webservice.php", postBody, "application/x-www-form-urlencoded");
resultObject = new JSONObject(response.getResponse());

//returns the sessionKey
return (String)resultObject.getJSONObject("result").get("sessionName");

public String md5(Object obj){

  String toEnc = new String(obj.toString());
  MessageDigest mdEnc = null;

  try {
    mdEnc = MessageDigest.getInstance("MD5");
  }
  catch (NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
  }

  mdEnc.update(toEnc.getBytes(), 0, toEnc.length());

  return new BigInteger(1, mdEnc.digest()).toString(16);
}</pre>
<p>In my depicted example i want to get a valid authenticaten with an admin-account so i take use of the user &#8220;admin&#8221;.</p>
<p>The returned value is nothing less than the sessionId. Ever preceeding call must posses this sessionId on adding this part as a param/value-pair upon the url.</p>
<p>Last step we have to go is to retrieving - for instance - the list of contacts in vTiger.</p>
<pre name="code" class="java">
org.alfresco.connector.Response response = connector.call("/webservice.php?operation=query&amp;query=" + org.alfresco.util.URLEncoder.encode("select * from Contacts;") + "&amp;sessionName=" + sessionKey);return new JSONObject(response.getResult());</pre>
<p>We are done&#8230; the next steps are quite simple as you got the data already. Subsequent doings on adding persons based on Leads/Contacts being stored in vTiger are the easiest part.</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/08/08/just-married-alfresco-vtiger/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alfresco 3.2 Share: Pimp The Document-Library for Custom Document Types</title>
		<link>http://portal.krypthonas.de/2009/08/04/alfresco-32-share-pimp-the-document-library-for-custom-document-types/</link>
		<comments>http://portal.krypthonas.de/2009/08/04/alfresco-32-share-pimp-the-document-library-for-custom-document-types/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:37:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Alfresco]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/08/04/alfresco-32-share-pimp-the-document-library-for-custom-document-types/</guid>
		<description><![CDATA[What we´ve seen from my last post about the tales through the features of the newest Alfresco Version was just the first trick. The second trick belongs to the documentLibrary of share: How can we pimp the document-library for our custom Document-Types? Well, if we want to provide additional menu-items - to obtain  just [...]]]></description>
			<content:encoded><![CDATA[<p>What we´ve seen from my last post about the tales through the features of the newest Alfresco Version was just the first trick. The second trick belongs to the documentLibrary of share: How can we pimp the document-library for our custom Document-Types? <img src="http://krypthonas.de/images/documentLibrary-AlfrescoShare32.PNG" style="padding: 20px" align="left" />Well, if we want to provide additional menu-items - to obtain  just a document-list that belongs to one document-type, we have to configure and extend alfresco in both directions:</p>
<ol>
<li>Alfresco Explorer</li>
<li>Alfresco Share</li>
</ol>
<p>The left displayed image gives you a first imagination we want to implement the next steps.</p>
<p>When calls arriving Alfresco with the aim to retrieve a bunch of documents they will be processed by a WebScript that is mapping some JavaClasses in its JavaScript-Code. These classes are responsible to retrieve the results on using Alfresco-Service-API. Following example shows up an appropriated example how you can call these &#8220;backin-classes&#8221;. For instance, the object search isnt defined in any javascript-line but via Spring.</p>
<pre name="code" class="javascript">
if (args["id"] != null) {
  var id = args["id"]; 
  object = search.findNode(id);
  if (object != null &amp;&amp; args["shortQNames"] != null &amp;&amp; args["shortQNames"] == "true") {
    model.put = object.toJSON(true);
  }

  model.put = object.toJSON(true);

}</pre>
<p>Within the configuration-file <em>script-services-context.xml</em> we can find the definition of all scriptObjects that can be used via scripting. But thats not the matter i want to discuess here - i digress regarding the main-thematic here&#8230;</p>
<p>If the left site, of the documentlibrary is being in construction, a call is set via proxy-connector of share towards Alfresco-Explorer. So here comes the way: the <em>doclist.get.js</em> will be executed where the passed arguments of the call are processed in such a way, that a lucene-query is being constructed.</p>
<pre name="code" class="javascript">
filterParams = getFilterParams(filter, parsedArgs, favourites)</pre>
<p>The method <em>getFilterParams</em> is defined in the same directory in the file <em>filters.lib.js</em>. In that file theres a switch-construct defined which checks the passed <strong>filterId </strong>(i will introduce this <strong>filterId </strong>later) to made-up the query: so here you can add you´re case-block:</p>
<pre name="code" class="javascript">
      case "butchersBay":

         var filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";

         filterParams.query = filterQuery + ' AND +TYPE:"{http://www.dmc.de/ns/dmc/1.0}butchersBay"' ;

         break;</pre>
<p>Right here, we have defined a case-block which is executed if a filterId is passed with the name &#8220;butchersBay&#8221; - our custom model. It doesnt matter whether its a realy existing content model but its a common approach. Very well, what brings out the query we´ve just defined? All items with type of &#8220;butchersBay&#8221; gettin returned from a specificaly path (e.g. /app:company_home/st:Sites/cm:MySite/cm:documentLibrary) - nothing else.</p>
<p>Now after we´ve done the first step, we have to change some things within Alfresco Share. Within the file <em>filter.get.config.xml</em> you define the <strong>filterId </strong>that we have already added to the alfresco-part of our current tale: the &#8220;butchersBay&#8221;-filterid:</p>
<pre name="code" class="xml">
&lt;filter id="butchersBay" label="link.butchersBay" /&gt;</pre>
<p>Now we´ve defined the filter which will be recognized by share on restart or on using the &#8220;Refresh WebScript&#8221;-Functionality. Now its time to add the language-part of that filter so we get displayed a human-readable text in the left pane of the documentlibrary. Therefore we open the file <em>filter.get.properties</em> and add the label <em>link.butchersBay</em> with an appropriated text. Very well done!</p>
<p>We´re ready for Takeoff. Test it guy!</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/08/04/alfresco-32-share-pimp-the-document-library-for-custom-document-types/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alfresco 3.2 Share: FormService Seems To Be cool. But Whats About Associations?</title>
		<link>http://portal.krypthonas.de/2009/07/25/alfresco-32-share-formsservice-is-cool-but-whats-about-associations/</link>
		<comments>http://portal.krypthonas.de/2009/07/25/alfresco-32-share-formsservice-is-cool-but-whats-about-associations/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 18:28:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Alfresco]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/07/25/alfresco-32-share-formsservice-is-cool-but-whats-about-associations/</guid>
		<description><![CDATA[Alfresco 3.2 bears new cool features to the community, especially an easy way to display custom metadata in Share. Actually it was´nt possible, displaying custom metadata-properties in Share without doing customizations on the underlying Share/SURF-Code.
Well these times are over &#8230; almost over!
If you using an association between two nodes, you get not the same feeling [...]]]></description>
			<content:encoded><![CDATA[<p>Alfresco 3.2 bears new cool features to the community, especially an easy way to display custom metadata in Share. Actually it was´nt possible, displaying custom metadata-properties in Share without doing customizations on the underlying Share/SURF-Code.</p>
<p>Well these times are over &#8230; almost over!</p>
<p>If you using an association between two nodes, you get not the same feeling about the result as you probably though about it. Because  if you looking to you´re document-library in Share, <strong>you will receive just a node-reference to the property-association</strong>. Oh thats fairly crappy but i guess, its just a temporary problem until Alfresco drops out the next version. Well, in the meantime we have to solve this issue going another way.</p>
<p>The following approach likey differs from a great customizations so we expect to get the solution in less then a few minutes.</p>
<p>At first i will show you my contentmodel i´ve been extended. This content-type is called<strong> &#8220;myModel&#8221;</strong>:</p>
<pre name="code" class="xml">...
&lt;associations&gt; 
   &lt;association name="dmc:contactPerson"&gt;
      &lt;source&gt;
         &lt;mandatory&gt;false&lt;/mandatory&gt;
         &lt;many&gt;true&lt;/many&gt;
      &lt;/source&gt;
      &lt;target&gt;
         &lt;class&gt;cm:person&lt;/class&gt;
         &lt;mandatory&gt;false&lt;/mandatory&gt;
         &lt;many&gt;false&lt;/many&gt;
      &lt;/target&gt;
   &lt;/association&gt;
&lt;/associations&gt;
...</pre>
<p>I´ve just added an association to a person that is targeted as &#8220;contact-person&#8221;. Using Alfresco-Explorer all works fine and you are able to select a person. Following image depicts our newly created association with an assigned contact-person:</p>
<p><img src="http://krypthonas.de/images/alfresco_association.png" width="313" height="76" /></p>
<p>Cool!</p>
<p>If you have such a document-Type in your documentlibrary of share stored, its likely normal to display this property as well.</p>
<p>So, therefore its time to add this newly added property of the the model &#8220;myModel&#8221; to Share. Therefore we create the file tomcat/shared/classes/alfresco/web-extension/web-framework-config-custom.xml:</p>
<pre name="code" class="xml">
...
   &lt;show id="dmc:contactPerson" for-mode="view"/&gt; 
&lt;/field-visibility&gt;
&lt;appearance&gt;
   &lt;field id="dmc:contactPerson"&gt;
      &lt;control template="/org/alfresco/components/form/controls/association.ftl" /&gt;
   &lt;/field&gt;</pre>
<p>Now this gives a show-up of the the nodeRef as i´ve descriped earlier in that post. Thats not the solution we want.</p>
<p>Change the control-tag attribute to following value:  /org/alfresco/components/form/controls/association_person.ftl</p>
<p>Next we have to extend the form.get.js, responsible for managing all form-properties in Alfresco-Share.</p>
<p>Next we will edit this file, starting with method setupField:</p>
<pre name="code" class="javascript">...

 // setup text for the field i.e. the label, description &amp; help
setupFieldText(fieldDef, fieldConfig);// setup constraints for the field

setupFieldConstraints(fieldDef, fieldConfig);

// setup the value for the field
setupFieldValue(formModel, fieldDef, fieldConfig);
//thats the new line of code we´ve just added here
//setup associations for the field
setupAssociations(formModel, fieldDef, fieldConfig);</pre>
<p>At the bottom of this file we add the corresonding method:</p>
<pre name="code" class="javascript">
function setupAssociations(formModel, fieldDef, fieldConfig){
   if(fieldDef.type !== "association")
     return;

   connector = remote.connect("alfresco");
   json = connector.get("/webframework/content/metadata?id=" + fieldDef.value);

   try {

     fieldModel = eval('(' + json + ')');

     if(json.status == 200) {

       props = new Array();

       for (key in fieldModel.properties) {
          trimmed_key = key.substring(key.indexOf('}')+1,key.length)
          props[trimmed_key] = fieldModel.properties[key];
       }

       fieldDef.assocProperties = props

   }
}

 catch(e){
    logger.getSystem().out( e );
}

}</pre>
<p>Thats all, we got to do. The method calls the server back due to retrieve more informations about the assosciation-nodeRef. We just call another alfresco-rest-script. Even though this method is not realy the best peace of code i´ve wrote the last years ago, we expect almost a fast solution. For instance, the fully qualified definition-names of all properties will be ereased as freemarker can not handle simplehashmaps with special-chars like &#8216;}&#8217;. So this should be fixed on mapping the fully qualified qnames with its corresponding short-names with character-replacing of &#8216;:&#8217; to &#8216;_&#8217;.</p>
<p>Finaly we´ve to create a file being called  <strong>association_person.ftl</strong> in /org/alfresco/components/form/controls/association.ftl  for displaying the appropriated association-property :</p>
<pre name="code" class="javascript">&lt;#include "common/picker.inc.ftl" /&gt;

&lt;#assign controlId = fieldHtmlId + "-cntrl"&gt;
  &lt;div class="form-field"&gt;
    &lt;#if form.mode == "view"&gt;
      &lt;div id="${controlId}" class="viewmode-field"&gt;
        &lt;#if field.endpointMandatory &amp;&amp; field.value == ""&gt;
           &lt;span class="incomplete-warning"&gt;&lt;img src="${url.context}/components/form/images/warning-16.png" title="${msg("form.field.incomplete")}" /&gt;&lt;span&gt;
        &lt;/#if&gt;
        &lt;span class="viewmode-label"&gt;${field.label?html}:&lt;/span&gt;
        &lt;span id="${controlId}-currentValueDisplay" class="viewmode-value current-values"&gt;
           &lt;a href="${url.context}/page/user/${field.assocProperties.userName}/profile"&gt;${field.assocProperties.firstName} ${field.assocProperties.lastName}&lt;/a&gt;
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/#if&gt;
&lt;/div&gt;</pre>
<p>We are done. Try it on refreshing your Share-Webscripts! Its even possible to click on the contactperson where the profile-site of this person gets displayed.</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/07/25/alfresco-32-share-formsservice-is-cool-but-whats-about-associations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Re-Attaching Hibernate-Objects In New Transaction</title>
		<link>http://portal.krypthonas.de/2009/07/22/re-attaching-hibernate-objects-in-new-transaction/</link>
		<comments>http://portal.krypthonas.de/2009/07/22/re-attaching-hibernate-objects-in-new-transaction/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 19:45:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/07/22/re-attaching-hibernate-objects-in-new-transaction/</guid>
		<description><![CDATA[Well i lovin it, using actionListener of JSF as the results of it is nothing less than the object itself, stored as a parameter of a UICommandButton or UICommandLink. The other thing is using direct mapping of values to input-elements.
For instance, following line gives me the whole object back:


 
	value=&#8221;#{WorkflowManager.taskInstances}&#8221;
	rows=&#8221;15&#8243; columnClasses=&#8221;tableCol&#8221;&#62;
	
     [...]]]></description>
			<content:encoded><![CDATA[<p>Well i lovin it, using actionListener of JSF as the results of it is nothing less than the object itself, stored as a parameter of a UICommandButton or UICommandLink. The other thing is using direct mapping of values to input-elements.</p>
<p>For instance, following line gives me the whole object back:</p>
<pre name="code" class="java">

 <ice:datatable id="taskInstanceList" var="taskInstance">
</ice:datatable>	value=&#8221;#{WorkflowManager.taskInstances}&#8221;
	rows=&#8221;15&#8243; columnClasses=&#8221;tableCol&#8221;&gt;
	<ice:column>
                <f:facet name="header">
		    <ice:outputtext id="column1" value="Name"></ice:outputtext>
		</f:facet>
	        <ice:inputtext value="#{taskInstance.name}"></ice:inputtext>
	</ice:column>
      &#8230;.</pre>
<p>Well if i want to save this current change of the name (do you see the inputText in the code, äh?), normaly you write following lines of code to achieve this:</p>
<pre name="code" class="java">
...
Object ret = getHibernateTemplate().get(WorkflowPersistenceTemplate.class, persistenceTemplate.getId());
if (ret == null)
    id = (Long) getHibernateTemplate().save(persistenceTemplate);
else {
    id = persistenceTemplate.getId();
    getHibernateTemplate().update(merge);
}
  ...</pre>
<p>So, the persistenceTemplate is the same object we have seen in the first code-snippet. I dont want to rebuild all of that peace of informations each time of HttpRequest to made up a new object - whats the time hu? In place of sucessfuly saving of the workflowtemplate we get punished with following exception:</p>
<pre name="code" class="java">
Caused by: org.hibernate.NonUniqueObjectException: a different object with the s
ame identifier value was already associated with the session: [com.logicaldoc.wo
rkflow.persistence.WorkflowPersistenceTemplate#2]
        at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(State
fulPersistenceContext.java:590)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdat
e(DefaultSaveOrUpdateEventListener.java:284)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDeta
ched(DefaultSaveOrUpdateEventListener.java:223)
        at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdat
e(DefaultUpdateEventListener.java:33)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpda
te(DefaultSaveOrUpdateEventListener.java:70)
        at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:564)
        at org.hibernate.impl.SessionImpl.update(SessionImpl.java:552)
        at org.hibernate.impl.SessionImpl.update(SessionImpl.java:544)
        at org.springframework.orm.hibernate3.HibernateTemplate$14.doInHibernate
(HibernateTemplate.java:715)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(Hibern
ateTemplate.java:419)
        ... 67 more</pre>
<p>Why does hibernate bother us with this simple operation? Well if you receive this error, you have ran into the same problem as the rest of developers-world. If you load a object from the database into you application, Hibernate stores this in the Session-Cache. Hibernate supports transactions and in the most cases, one transaction is exact so lang as a request is done to the server. For instance, in my application i´ve got a transaction-intercepter added through spring, so a transaction-template will be used to commit/rollback a transaction after each request.</p>
<p>But you have another cache in your application being called your JSF-Brain. So, if you JSF-TreeComponent is in rebuild (a new HttpRequest is done), the already existing object in jsf will be used. <strong>Actually you work with an detached hibernate object</strong>!<br />
If you storing this object into your database (see code-snippet two) you receive the already depicted errormessage.</p>
<p>So how can you &#8220;reattach&#8221; you object to the hibernate session? How can we put some candies to hibernate to make him happy? <strong>By simply using the merge-method of hibernate!</strong></p>
<pre name="code" class="java">
WorkflowPersistenceTemplate merge = (WorkflowPersistenceTemplate)getHibernateTemplate().merge(persistenceTemplate);</pre>
<p>So, if you have done this, <strong>you have an attached object</strong> within the hibernate-session <strong>with you current values</strong> you´ve probably netered in the mean time! Merging does nothing more than obtaining the eventually available object in the session and applying the new values on it. You receive the &#8220;old&#8221; attached object with the new values.</p>
<p>Save it now before its gettin detached!! ;-D</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/07/22/re-attaching-hibernate-objects-in-new-transaction/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stay Tuned On it-republik.de</title>
		<link>http://portal.krypthonas.de/2009/07/08/stay-tuned-on-it-republikde/</link>
		<comments>http://portal.krypthonas.de/2009/07/08/stay-tuned-on-it-republikde/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 18:22:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/07/08/stay-tuned-on-it-republikde/</guid>
		<description><![CDATA[Today it was a realy &#8220;relaxing&#8221; day for me at work&#8230; it was just like dreaming about the mention to send a REALY private message to a customer rather than to send it to a friend! Yes that was a strike!
But for my relief the customer wasnt angry rather than more ugly about this. What [...]]]></description>
			<content:encoded><![CDATA[<p>Today it was a realy &#8220;relaxing&#8221; day for me at work&#8230; it was just like dreaming about the mention to send a REALY private message to a customer rather than to send it to a friend! Yes that was a strike!</p>
<p>But for my relief the customer wasnt angry rather than more ugly about this. What a lucky guy am i? <img src='http://portal.krypthonas.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>So this wasn´t not the main content here. Another big thing i could finish and blow away today: my article-series on it-republik.de</p>
<p>The thematic handles about an easy way to link-up external components on a centralized page to start interaction with its parts. I just talking about Portal-Technology with respect to Liferay. I´m talking about an easy way to connect-up alfrescos document-view in liferay on implementing two portlets with Richfaces-Power.</p>
<p>Obstacles will be introduced and discussed at the second part of the article-series. I hope for an urgently release!</p>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/07/08/stay-tuned-on-it-republikde/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Curb the Belly of the Beast: Drag &#038; Drop ServerRequest-Hell And Icefaces</title>
		<link>http://portal.krypthonas.de/2009/07/04/curb-the-belly-of-the-beast-drag-drop-serverrequest-hell-and-icefaces/</link>
		<comments>http://portal.krypthonas.de/2009/07/04/curb-the-belly-of-the-beast-drag-drop-serverrequest-hell-and-icefaces/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 12:52:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JSF]]></category>

		<category><![CDATA[J2EE]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://portal.krypthonas.de/2009/07/04/curb-the-belly-of-the-beast-drag-drop-serverrequest-hell-and-icefaces/</guid>
		<description><![CDATA[Icefaces supports drag-and-drop functinality regarding its component-library. For sure its easily to implement with much more issues afterwards. Some things brought me almost to cry. If you have a droplistener on your dropArea, your calling event does probably  not bearing your dragged value.



#{workflowTask.name}







   Drop Target 1

As you can see, the dropping zone posseses [...]]]></description>
			<content:encoded><![CDATA[<p>Icefaces supports drag-and-drop functinality regarding its component-library. For sure its easily to implement with much more issues afterwards. Some things brought me almost to cry. If you have a droplistener on your dropArea, your calling event does probably  not bearing your dragged value.</p>
<pre class="xml" name="code">
<!-- The Draggable Component! -->
<ice:panelgroup draggable="true" droptarget="true" dragvalue="#{workflowTask}" dragoptions="revert" dropmask="hover_start" hoverclass="seriesHover">
<h3>#{workflowTask.name}</h3>

<ice:outputtext></ice:outputtext>
</ice:panelgroup>

<!-- The Dropping Zone -->

<ice:panelgroup dropvalue="Target 1" droptarget="true" droplistener="#{workflowTemplateManagerBean.addTaskDestinationToTransition}">
   <em>Drop Target 1</em>
</ice:panelgroup></pre>
<p>As you can see, the dropping zone posseses an appropriated dropListener. The regarding Java-Code seems correct for me as well:</p>
<pre class="java" name="code">
   public void addTaskDestinationToTransition(DropEvent event) {
		if (event.getEventType() == DndEvent.DROPPED) {
            String targetId = event.getTargetClientId();
            if ((targetId != null)) {

               WorkflowTask  workflowTask = (WorkflowTask)((HtmlPanelGroup) event.getComponent()).getDragValue();
              ...
            }
        }
	}</pre>
<p>But it doesnt matter what i do, the DragValue seems alway be null. Its a bug in IceFaces 1.7.2SP1. Well, be smart, and add instead a dragListener that makes somethin similary. Simply add a dragListener to the dragged component and change the argument of the java-method to DragEvent.</p>
<p>If its done, you run into another problem that seems much harder for me.The dragged component (if its in a drag-state on push the component away from its current place) reverts its state after a few seconds without doing anything. You just holding down the mouse on the left mouse button and moving it on the page up and down&#8230;</p>
<p>How can we curbing this issue? Well, at first you have to grasp mostly every reaching of a dropping zone or even moving of the dragging-component invokes an AJAX-Request. And you know, you move the mouse not in everycase straigh forward to the finish-line but more in &#8220;flowing-movements&#8221; up and down. This increases excessively Pages-Requests that must be avoided. In most cases you dont have an &#8220;localhost-infrastructure&#8221; rather than a WAN-Landscape wher people will connecting to youre site from india or australia. Its a pidy about that tcp-packet-exchange!!</p>
<p>Well, for me i have implied that this problems belongs to this AJAX-problematic. So if we can stop sending traffic-jam to Skynet we can probably farily increasing our drag-and-drop behaviour.</p>
<p>Icefaces comes along with &#8220;<strong>sendmasks</strong>&#8221; which nothing less then descriptive flags about information-states that have to be sent to the server. For instance, if you want to know when a user starts an dragging-operation, this can be exposed as such a flag. Normaly you dont want bother the server (and your self) with such logentries. The only thing you likely want to know is WHAT you´ve dropped- not WHEN OR WHO. So therefore we using the attribute <strong>dragMask </strong>in every dragging-component to constraining the send-behaviour:</p>
<pre class="xml" name="code">
<!-- The Draggable Component! DRAGMASK AS WELL AS LISTENER ADDED -->
<ice:panelgroup dragmask="hover_start, dragging, hover_end, drag_cancel" draggable="true" droptarget="true" dragvalue="#{workflowTask}" dragoptions="revert" dropmask="hover_start" hoverclass="seriesHover" draglistener="#{workflowTemplateManagerBean.addTaskDestinationToTransition}">
<h3>#{workflowTask.name}</h3>

<ice:outputtext></ice:outputtext>
</ice:panelgroup></pre>
]]></content:encoded>
			<wfw:commentRss>http://portal.krypthonas.de/2009/07/04/curb-the-belly-of-the-beast-drag-drop-serverrequest-hell-and-icefaces/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
