Tuesday, October 15, 2013

Mule - piggybacking SOAP calls in flows

I needed to handle session Cookie between connection calls and later data calls all in SOAP. I did this by using the same global HTTP connector with cookie enabled and using it on all the endpoints.

The connection call was in the first flow which then called the next ... that solves the Session handling without any coding, but i got mimetype/transformer exception on the 'return' / response path.

Errors like:
Could not find a transformer to transform "SimpleDataType{type=org.apache.cxf.staxutils.DepthXMLStreamReader, mimeType='text/xml'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".

The easy solution turned out to be saving the first SOAP response, calling the data flows with their own SOAP, and after the flow call, restoring the SOAP response.

<set-variable variableName="connectionUpPayload" value="#[message.payload]" doc:name="save response"/>
<flow-ref name="GetAllProperties" doc:name="GetAllProperties"/>
<set-payload value="#[flowVars['connectionUpPayload']]" doc:name="Set Payload"/>


Wednesday, October 9, 2013

Mule - Sharepoint Connector

I have been working a little with Mule ESB - Enterprise Edition. I needed to get a Sharepoint (duh - Imperial Star Battlecruisers), so I was happy to see the Mule Sharepoint Connector. The Connector implementents NTLMv2, so it can talk to newer Sharepoint versions. After getting past the first small gotchas (remember slash af URL, URL without the '_vti_bin' stuff, ListName is the list name & view name is the GUID) - the list was received as an SOAP Java object - GetListItemsResult.

Now that was perfect except the M$ SOAP service limits the result to 100 rows, if you do not specify a rowlimit, and i could not get that to work on the Sharepoint Connector component, so i 'just' made a java component from trial and error reverse engineering the component using the Java classes:

import org.mule.modules.sharepoint.SharepointConnector;
import org.mule.modules.sharepoint.microsoft.lists.GetListItems;
import org.mule.modules.sharepoint.microsoft.lists.GetListItemsResponse.GetListItemsResult;

SharepointConnector sc = new org.mule.modules.sharepoint.SharepointConnector();
             sc.connect("DOMAIN\\USERNAME", "PASSWORD", "URL_W_SLASH");

org.mule.modules.sharepoint.microsoft.lists.GetListItems request =
            new org.mule.modules.sharepoint.microsoft.lists.GetListItems();
request.setRowLimit("" + 0);
GetListItemsResult result = sc.listGetListItems(request);

Replace UPPERCASE names with real values. You can use the GetListAndView to get the GUIDs

Other ways of getting this to work is http://dmdaa.wordpress.com/2012/10/10/ntlm-v2-support-for-java-web-service-clients-wsimport-or-axis2-stubs-for-sharepoint-server/

However I did not succeed with that approach.

Thursday, September 12, 2013

Upgraded to Alfresco 4.2.d and lost your application menu bar ...

It might be because of an share-config override like:

  <config evaluator="string-compare" condition="WebFramework" replace="true">

Try removing replace="true" and if you need to replace, your should look up surf.xml to add all the new definitions.

Wednesday, September 4, 2013

Preview, index, thumbnail SVG in Alfresco

In modern browsers SVG is directly supported, so previewing is a smaller task. Ne add-on for Alfresco with enhanced SVG support for previewing, thumbnailing and indexing (search)

See more:

Wednesday, August 28, 2013

Alfresco Presence in Share

I made a new Alfresco Add-on which has to modes of presence:
- MS Lync via local MS client (using activeX)
- Alfreco local presence for presence (Share in browser)

Alfresco add-on page: http://addons.alfresco.com/addons/presence
Code page: http://code.google.com/p/alfresco-presence/

Thursday, June 6, 2013

Removing sharepoint / VTI lock - aspect cm:lockable

Install JavascriptConsole or run this as a script (might need a modification adding a search statement)

Use script (replacing <your username> with the real one) on document-node by invoking the doclib action for javascriptconsole:

//remove cm:lockable
document.properties["cm:lockOwner"]="<your username>";

//residual values
delete document.properties["webdav:opaquelocktoken"];
delete document.properties["webdav:lockScope"];
delete document.properties["webdav:lockDepth"];

Friday, May 10, 2013

Create new documents directly in MS Office from Alfresco

I added new feature for Alfresco, where you can open and edit MS Office directly from the toolbar-> Create Content menu in the Share documentlibrary (like Sharepoint).

What happens is similar to the edit-online except no document exist in Alfresco, before a save from MS Office is performed.

A work-around is also there for MS Office 2011 for Mac, which does not provide web location folder for saving. This works by copy-in and using edit-online.


Tuesday, April 16, 2013

Bulk file import in Alfresco

Used the bulk file import, found a bug in the in-place variant, so I had to use the streaming version (copy). But it was not that bad, 1 terabyte in a couple of hours. Well, Alfresco likes a great disk system :)

My recommendations:
  • So don't use In-place before this is fixed: http://code.google.com/p/alfresco-bulk-filesystem-import/issues/detail?id=125
  • Follow the tweaking here: http://wiki.alfresco.com/wiki/Bulk_Importer
  • Do not have the status page open (factor 2-4 slower)!
  • Delete from Alfresco can be slow, so do a test run (need a bulk delete?)

General Statistics
Source Directory:
Target Space:
/Company Home/Data_Import
Import Type:
Batch Weight:
Active Threads:
0 (of 0 total)
Start Date:
End Date:
0d 2h 59m 37s 99.317ms
Number of Completed Batches:
Source (read) Statistics
Last file or folder processed:

Content Versions
Metadata Versions
273344 (915.49GB)
0 (0B
0 (0B)
0 (0B)

27.32 entries scanned / sec
25.36 files read / sec
86.99MB / sec
Target (write) Statistics
Space Nodes:
# Created
# Replaced
# Skipped
# Properties

Content Nodes:
# Created
# Replaced
# Skipped
Data Written
# Properties

Content Versions:
# Created
Data Written
# Properties

27.31 nodes / sec
86.99MB / sec

Freemind module now has indexing also

The previous post presented the freemind file preview without file indexing support, this post announces that this is now fixed by transforming to a text rendition of the mm files.

Tuesday, March 12, 2013

Freemind preview in Share

Code and instructions on http://code.google.com/p/alfresco-freemind/

thanks to the other contributions from which I build this!

Tuesday, February 26, 2013

Generic printing of properties in complex javascript object

I needed to make a generic solution for printing ScriptNode and the like object to JSON using FreeMarker, without knowing which keys to include before the script runs ... So I wanted just to print all property like key and value pair (String/String).

Turns out this is a little cumbersome, so here is my 5 cents:

<#assign keys=item?keys>
<#assign values=item?values>
<#assign max=keys?size>
<#assign jsonIndex=0>

 <#list 0..max as index>
  <#if keys[index]?exists>
   <#if keys[index]?is_string>
    <#if values[index]?exists>
     <#if values[index]?is_string>
      <#if jsonIndex!=0>,

       <#assign jsonIndex=jsonIndex+1>
"${keys[index]}" : "${values[index]}"


Well, what does it do ... it keeps two different indexes, one for the key/value pair being processed and one for number of json lines added for adding commas. It seems FreeMarker cannot handle Hashes with non-strings, so to bypass this restriction you must index your way through and test for existens and for type being String. This is done over the keys and values sequences, which are read from item (Javascript object, which become a FreeMarker SimpleHash).

Friday, February 22, 2013

Easily make share the 'default' application in Tomcat

Normally you have a ROOT webapp in tomcat/webapps, which is a dummy Tomcat one.

To make this webapp redirect to i.e. alfresco share, when you type <server name>:<tomcat port> in your browser, but this in your tomcat/webapps/index.jsp file:

If there is an index.html og index.htm file remove it.
Now index.jsp will redirect and you do not need to change the share-webapp 
Note: there is other ways using Tomcat context and stuff 

Saturday, February 16, 2013

Visio preview in Alfresco

Just tested Alfresco CE 4.2.c and Libreoffice 4.0 release, and looking through the release notes, saw that it had much improve Visio support (improved libvisio) ...

Well uploaded some samples from M$ and they all renders fine in thumbnail and preview PDF :)

Alfresco uses PDF.js viewer and Libreoffice 4.0

Libreoffice 4 release notes: https://www.libreoffice.org/download/4-0-new-features-and-fixes#Filters

Please not some older star office and MS office formats are no longer supported!

I tried use 'soffice.bin' instead of 'soffice' as program in alfresco-global.properties, this had the effect on my installation, that oosplash process is not started!

Friday, February 1, 2013

Alfresco webscript description file schema ...

I was mocking about and decided to test reverse engineering the Alfresco / Spring framework Webscript description file schema ...


Beware this contains alot of features and some are probable coupled to the webscript kind (attribute) :)

Another schema by SURF - eclipse plugin: https://anonsvn.springframework.org/svn/se-surf/trunk/spring-surf-devtools/spring-surf-eclipse-extensions/spring-surf-webscript-editor/schemas/DescriptionXMLSchema.xsd

Thursday, January 3, 2013

Avoid coding by exceptions

generally it is a good practice to avoid using exception for standard coding control, like instead of using if-statements. This hold for javascript as well. There is a lot of reasons for this, one being performance and another debugger breaking. Normally a debugger will stop/break on an exception and the Alfresco Rhino debugger does this as well. So the following code-snipplet from Alfresco server-side JS file: header.get.js should be rewritten:

const PREF_COLLAPSED_TWISTERS = "org.alfresco.share.twisters.collapsed";
function getTwisterPrefs()
response = eval('(' + result + ')');collapsedTwisters = eval('try{(response.' + PREF_COLLAPSED_TWISTERS + ')}catch(e){}');
if (typeof collapsedTwisters != "string")

     collapsedTwisters = "";

header.get.js (improved)
function getTwisterPrefs()
 if (response.org.alfresco.share["twisters"] && typeof(response.org.alfresco.share.twisters["collapsed"]) === string){
    collapsedTwisters = response.org.alfresco.share.twisters.collapsed;
    collapsedTwisters = "";


So now the debugger does not break there if the twisters are not defined...