Category Archives: web development

BeJUG Activiti talk notes

BeJUG session about Activiti, Tom Baeyens & Joram Barrez, March 31

Business process
– management view : flow chart
– technical : make it runnable

BPMN 2.0
– OMG standard: shapes, execution, semantics, XML format,…

Large pool of people knowing BPMN
many editors eg Visio, Aris,…

–> executable on Activiti

Activiti
– 100% java
– open source (APache)
– lightweight
– performant
– embeddable

Diagram as input
API (startProcess etc, and many forms as output)

Manual steps + automatic steps

Developers are crucial for a BPM process
– almost always coding of steps is needed

Custom tasks : implement JavaDelegate (use in a ServiceTask).

Activiti allows unit testing of processes
– @Deployment annotation loads the process (based on test class name etc)

Timers
– stop and other process or parallell process

Service bean & spring integration:
– activiti:method-expr=”${loanRequestBean.newLoanRequest(customerName, amount)}”
– activiti:result-variable-name=”loanRequest”
– loanRequestBean is a Spring or CDI bean

CDI/Spring annotations:
– @ProcessScope on class
– @StartProcess on method
– …

Activiti = many parts, including the best BPM engine

Activiti Modeler : web application for modelling BPMN 2.0 processes
Activiti Explorer : see tasks/process, run tasks
Activiti Probe : system administration
Activiti cycle : BPM collaboration done right
Activiti KickStart : allow very easy creation of processes, simple processes or rapid prototyping
Activiti REST API
Activiti Eclipse designer : modelling BPMN 2.0 processes in Eclipse
Mobile Activiti
Android client
Grails integration

Software development problem
– discuss requirements
– bild what they want
– show results
– re-iterate
–> you want faster prototyping

Process engine : combine automatic and manual steps

Automatic steps
– Java or scripting
– WS
– add activiti types automatically in designer
– SAAS, on-premise back-office integration : developer work

Why use process engine
– overview diagram
– rapid prototyping
– fast implementation, many automatic activities
– business benefit: improve communication between business and developers

Why Activiti?
– BPMN .0
– liberal OS license
– large and thriving community

Collaboration
– analyst build abstract process (requirement)
– developer makes that process executable (software)

Activiti cycle
– Collaboration for process solutions, using repositories (Alfresco, svn, jira, …)
– Link and discuss artifacts from different repos
– lifecycle guidance
– revamped in 5.4 (released April 1, no joke)

ACM and BPM, adaptive vs structured, see http://column2.com

Activiti will be integrated in Alfresco. A first development release with embedded Activiti is available now. It will be available in the next community release in August. This should then result in a new enterprise version in November which contains the Activiti integration.

The full talk was recorded and should become available on Parleys soon.

GWT, maven and using the standard maven src/main/webapp directory

We have changed some of our GWT projects back to using the standard maven location of src/main/webapp for the web resources. When we started these projects, the Eclipse GWT plug-in did not support that, so my colleagues insisted on using the war directory (I am an IntelliJ IDEA user/fan myself). Apart from being non-standard, this had the disadvantage that some generated content was also put in that directory cluttering the directory content and risking accident commits of these files (I know svn ignore can help, but still).

Unfortunately, the change was not as plain sailing as hoped. In fact, the gwt-maven-plugin seems to have some problems making this impossible. The advantage of open source solutions, you can create a patch :-).

Here are some excerpts from a pom configuration to make this work. To allow “mvn jetty:run” to work from a clean workspace:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.20</version>
    <configuration>
        <webAppConfig>
            <contextPath>/</contextPath>
            <baseResource implementation="org.mortbay.resource.ResourceCollection">
                <!-- need both the webbapp dir and location where GWT puts stuff -->
                <resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
            </baseResource>
        </webAppConfig>
        <reload>manual</reload>
    </configuration>
</plugin>

To allow “mvn gwt:run” to work from a clean workspace:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>1.2-CPFIX</version>
    <configuration>
        <disableCastChecking>true</disableCastChecking>
        <disableClassMetadata>true</disableClassMetadata>
        <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
        <module>org.geomajas.example.gwt.GeomajasSamples</module>
        <runTarget>samples.html</runTarget>
        <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>clean</goal>
                <goal>generateAsync</goal>
                <goal>i18n</goal>
                <goal>compile</goal>
                <goal>test</goal>
            </goals>
        </execution>
    </executions>
</plugin>

You can find the patched version of the gwt-maven-plugin as version 1.2.CPFIX on the Geomajas repo http://maven.geomajas.org/. Details of the patch can be found in the their issue tracker.

GWT: 0 to 60mph in no time, Chris Ramsdale

JBossWorld Boston notes, GWT: 0 to 60mph in no time, Chris Ramsdale

From 25000ft
– toolkit, not fframework
– code in java, run as JavaScript
– one codebase, any browser
– makes AJAX a pice of cake and faster
– used in many Google projects like Google Wave and AdWords

Family
– SDK, compiler, generator
– eclipse plug-in
– speed tracer

Focus on users
– Our users, Developers
— leverage existing IDEs and tools
— minimize refresh time between code changes
— automate where possible
– Your users, Customers
— minimize startup time
— make it a comfortable experience
— allow them to select the browser

Java to JavaScript compiler, right?
– compiling to JavaScript instead of compiling to Assembler?
– You can pretty print if needed

From code to deployment

Generators
– provide power behind your GWT app

Ajax helper

Creating UIs

Goals
– utilize common devevelopment practices
– minimize boilerplate code
– remove a few frustrations along the way

uiBinder XML with

Linker
– different ways of loading the JavaScript

Use “-gen” to display the generated code

Tips and tricks
– Reduce optimizations, reduce compile time
— -draftCompile : skip all optimizations, development only

Optimize for user
– bundle resources
– split code

interface Bla extends ClientBundle {
    @Source("Contexts.css)
    public ContactCss contextCss()

    @Source("Contexts.gif)
    public ClientImage contextImage()
}

insert runAsync for code splitting

@UiHandler("showImagesButton")
void onOkClicked(ClickEvent event) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            showImagesDialog()
        }
    }
}

“direct” approach
Write a bunch of widgets with self-contained logic
– hard to test – need GWTTestCase
– mocks not encouraged – harder to write smaller tests
– platform specific UI code – limits code reuse
– Too any dependencies, difficult to optimize

MVP approach
Cast
– model – DTOs and business logic
– View – the display
– Presenter – application logic
Goals
– be practical
– avoid rigid patters
– put complex login in presenters

MVP vs MVC
– C = view contains event logic
– P = render logic + event logic, separate view

You only have to test the model and presenter, rest is GWT itself and tested by Google :-)

Technology interoperability
– Seam
– JSF
– G4JSF

Making the cloud a reality