Monday, February 28, 2011

Updating Aspect Properties in Alfresco with CMIS

The current CMIS 1.0 specification does not address the dynamic metadata assignment like the concept of aspects used within Alfresco. In the Alfresco 3.4d Community release, an attempt to send a CMIS request to update metadata properties on fields which have been assigned via aspects fails.

For example, in developing the Formtek EDM module, we attempted to send a request to update the value for a property which was assigned to a document through the addition of an aspect.

An example of the CMIS request to update metadata and the associated ATOM document are as follows:

PUT /alfresco/s/cmis/s/workspace:SpacesStore/i/4073281a-5e9c-45cc-966a-4a2f32a933b8

<entry xmlns="http://www.w3.org/2005/Atom"
  xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" 
  xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" 
  xmlns:alf="http://www.alfresco.org">
    <title>2d_house_plan.dwg</title>
    <cmisra:object>
      <cmis:properties>
        <cmis:propertyString propertyDefinitionId="edm:program_project"
 queryName="edm:program_project"><cmis:value>2d_house_plan.dwg</cmis:value>
        </cmis:propertyString>
          </cmis:properties>
    </cmisra:object>
</entry>

Here the property edm:program_project is a property of a custom document type associated with the document via a mandatory aspect.

The request fails with the following error:

The WebScript has responded with a status of 400 - Bad Request.
400 Description: Request sent by the client was syntactically incorrect.
Message: Property edm:program_project is not a known property for type D:edm:engineeringDrawing


I was able to fix this by replacing lines 227-228 of the file /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/lib/modify.lib.js


// is this a valid property?
var propDef = typeDef == null ? cmis.queryProperty(propName) : typeDef.propertyDefinitions[propName];

with this:

// is this a valid property?
var propDef;
if(typeDef != null)
{
    propDef = typeDef.propertyDefinitions[propName];
}
    if(propDef == null)
{
    propDef = cmis.queryProperty(propName);
}

Thursday, January 20, 2011

Formtek to Deliver Engineering Data Management Webinar





Formtek to Deliver Engineering Data Management Webinar

On February 3, 2011, Formtek's Chief Technology Officer, Dick Weisinger, will present a webinar, sponsored by Alfresco, entitled: Engineering Data Management Module for Alfresco.

The Formtek Engineering Data Management (EDM) Module is a pre-packaged extension to the Alfresco data repository and Share application that is designed to improve the management, accessibility and search capability of engineering data. The EDM Module provides pre-configured content models specific to the needs of engineering organizations for the management of drawings and documents within the Alfresco repository.

Within Alfresco Share, the EDM Module provides packaged view, edit and advanced search forms that enable engineering metadata to be displayed, edited and efficiently searched. The EDM Module also supports popular AutoCAD® file formats, including DWG, DXF and DWF. Thumbnails and Flash (SWF) previews of AutoCAD files are automatically generated for display and use within the Share Document Library.

To register for this event, visit Alfresco's registration page.

For additional information about Formtek's Engineering Data Management offerings, download the product data sheet or contact: sales@formtek.com.


About Formtek: For over two decades, Formtek has been providing mission-critical Enterprise Document and Content Management solutions and services to some of the most demanding industrial operations in the world. Our capabilities and experience, particularly in the areas of engineering drawing management, technical document management, and secure collaboration, have helped both small organizations as well as large global enterprises manage their most important information assets. Formtek solutions address real, day-to-day document management, content management, and records management requirements for worldwide customers in manufacturing, aerospace, defense, telecommunication, utility, and government.

Monday, October 25, 2010

JBPM Workflow in Alfresco Share 3.4a community release

There's some interesting improvements available for Workflow in the Alfresco 3.4a Share community release.  Alfresco community downloads are available here.  


Gavin Cornwell from Alfresco has updated the Alfresco wiki with information about 3.4 Share workflow.

Starting a Workflow in Share
Workflows can be started by clicking on the "Start Workflow" action links from either the document details page, from the actions along the right on an item row in the list of Document Library items, or from the select items menu which applies to all items selected in the Document Library page.



After clicking on that, the start-workflow page comes up.  It's a little bit sparse.  The main element is a button that lets you choose which workflow to assign from a popup list of all available Workflows that can be initiated.


The available workflows are those that have been registered with the JBPM engine.  The Alfresco wiki outlines the steps for adding a new custom workflow.  Once added, the new workflow automatically becomes available in this dropdown.  Prior to release 3.4 in Share, the workflow items that could be assigned in Share were hardcoded.


In the screenshot above we can see the new "Custom Lifecycle Review" workflow added using the code from the Alfresco wiki.


As an aside: The server-side Javascript file tomcat\webapps\share\WEB-INF\classes\site-webscripts\org\alfresco\components\workflow\workflow.lib.js that contains the code used on this page to query out the available workflows (getWorkflowDefinitions).


The list of scripts displayed are determined for the dropdown menu from the webscript:
http://localhost:8080/alfresco/service/api/workflow-definitions
Workflows can be filtered out from this list, for example, if you don't want to see WCM workflows.  These workflows are identified by the tag <hidden-workflows> in the tomcat\webapps\share\WEB-INF\classes\alfresco\share-config.xml file, and also in the wcmquickstart-share-config.xml file in that same directory.

Form for Starting and Assigning a Workflow


After you select one of the workflows in the list, the form to enter the parameters that define the workflow is displayed.  I didn't expect to see too much when I selected the new Custom Lifecycle workflow since I had not defined a form for it, but it wasn't too bad.  The layout wasn't great, but everything seemed to work OK, and assigning the workflow worked too.


We can customize the look of this form easily.  For example, by adding the following code to the tomcat\shared\classes\alfresco\web-extensions\share-config-custom.xml file, the layout can be changed.  (The file tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml defined where form definitions and overrides can be placed.)

The important thing here is to match the name of the workflow correctly in the condition for identifying the form that will be matched to it, like condition="jbpm$wfl:lifecycleapproval" in the example below.

<config condition="jbpm$wfl:lifecycleapproval" evaluator="string-compare">
      <forms>
         <form>
<field-visibility>
               <show id="bpm:workflowDescription">
               <show id="bpm:workflowDueDate">
               <show id="bpm:workflowPriority">
               <show id="bpm:assignee">
               <show id="packageItems">
            </show></show></show></show></show></field-visibility>
            <appearance>
               <set appearance="title" id="" label-id="workflow.set.general">
               <set appearance="" id="info" template="/org/alfresco/components/form/2-column-set.ftl">
               <set appearance="title" id="assignee" label-id="workflow.set.assignee">
               <set appearance="title" id="items" label-id="workflow.set.items">
               
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info">
               <field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
                  <control template="/org/alfresco/components/form/controls/workflow/priority.ftl">
               </control></field>
               <field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee">
               <field id="packageItems" set="items">
            </field></field></field></set></set></set></set></appearance>
         </form>
</forms>
   </config>

User Task and Started Workflow Lists


The uppermost Share navigation toolbar has been redesigned.  A "More" button is available which now includes links to user areas like "My Profile", "My Sites", and "My Content".  Links to two pages that are new to the 3.4 release are also included in this dropdown list: "My Tasks" and "Workflows I've Started".  We'll talk about these two new features in just a bit.


Also included in this dropdown list are links to administrative functions like "Application" settings, "Groups", "Users", and another new-for-3.4 capability, "Replication Jobs".  These are grouped together in the menu in a category called "Tools".  I think that I would prefer that these administrative tasks be broken out into their own menu, but this layout is still workable given the current set of features in Share.


The "My Tasks" page presents a nice summary of the outstanding tasks for the user.  Filters along the left let you quickly zoom in on a specific set of tasks if there are many in your list.

A similar page exists for the user to see the workflows that they've started.  Unfortunately though, once the 'Task Complete' task is done it is removed from the list.  It would be nice to be able to review the workflows that have completed.