cancel
Showing results for 
Search instead for 
Did you mean: 

Report questions

ericsnyder
Champ on-the-rise
Champ on-the-rise
I want to write a report that gives an expandable list (tree) of all tasks and information about jobs at that task. Example -

Say we have three tasks in a process (task1, task2 and task3). the report would look like this:
- task1
      Job 27   Kermit, Fozzie
+ task2
+ task3

Basically it would be a list of who has what task for management purposes. Obviously the design pattern for this report could be reused to create a list of what users have what tasks:
- Kermit
      Job 27   task1
      Job 22   task3
+ Fozzie (3 items)

It looks to me like the database table ACT_RU_TASK would be a good place to start. My question is that I have read the documentation on reports and it looks like there is some report capability. You can create bar chart, pie chart, line chart and a list. I assume that the list is a simple list without tree capability.

My thought is to get the default process engine from Explorer get the data and build a page using Vaadin. Could someone please give me their thoughts on this?
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
All of what you write is possible.
A tree is indeed not supported in the current reporting capabilities (it is a firs release after all), but should be fairly easy to add.

You are not restricted to the reporting functionality of Explorer, actually any reporting/charting library would do the trick.

ericsnyder
Champ on-the-rise
Champ on-the-rise
jbarrez:
Thank you for the prompt answer. You are right, I could use Jasper Reports or BIRT.

Next question. I am digging into the code for explorer and see that there is a fair degree of abstraction going on:
CustomComponet -> AbstractPage -> AbstractTablePage -> SavedReportsPage (and so on)

I would be interested in using a tree. I see there is an AbstractTreePage class but it seems unfinished. I have overridden the "createTree" method added some code to create a demo Vaadin Tree object (ripped shamelessly from the Vaddin book). I end up getting a tree on a page but no vertical split and it seems no way to add a component on the right hand side. I tried <blockcode>grid.addComponent(new TextArea("Hello"), 2, 0, 2, 2);</blockcode> in my constructor but that did not work. My code:

<blockcode>/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sharpline;

import org.activiti.explorer.ui.AbstractTreePage;
import org.activiti.explorer.ui.custom.ToolBar;
import org.activiti.explorer.ui.reports.ReportsMenuBar;

import com.vaadin.ui.Component;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.Tree;
import com.vaadin.ui.VerticalSplitPanel;


/**
* @author Frederik Heremans
*/
public class CustomReportsPage extends AbstractTreePage {

public CustomReportsPage() {
  super();
  this.addMainLayout();
  grid.addComponent(new TextArea("Hello"), 2, 0, 2, 2);
  }

/**
  *
  */

private static final long serialVersionUID = 1624598539717116635L;

  
@Override
protected Tree createTree() {

  final Object[][] planets = new Object[][]{
          new Object[]{"Mercury"},
          new Object[]{"Venus"},
          new Object[]{"Earth", "The Moon"},   
          new Object[]{"Mars", "Phobos", "Deimos"},
          new Object[]{"Jupiter", "Io", "Europa", "Ganymedes", "Callisto"},
          new Object[]{"Saturn",  "Titan", "Tethys", "Dione", "Rhea", "Iapetus"},
          new Object[]{"Uranus",  "Miranda", "Ariel", "Umbriel", "Titania", "Oberon"},
          new Object[]{"Neptune", "Triton", "Proteus", "Nereid", "Larissa"}};
         
  Tree tree = new Tree("The Planets and Major Moons");

  /* Add planets as root items in the tree. */
  for (int i=0; i<planets.length; i++) {
      String planet = (String) (planets[0]);
      tree.addItem(planet);
     
      if (planets.length == 1) {
          // The planet has no moons so make it a leaf.
          tree.setChildrenAllowed(planet, false);
      } else {
          // Add children (moons) under the planets.
          for (int j=1; j<planets.length; j++) {
              String moon = (String) planets[j];
             
              // Add the item as a regular item.
              tree.addItem(moon);
             
              // Set it to be a child.
              tree.setParent(moon, planet);
             
              // Make the moons look like leaves.
              tree.setChildrenAllowed(moon, false);
          }

          // Expand the subtree.
          tree.expandItemsRecursively(planet);
      }
  }
  
  return tree;
}


@Override
protected ToolBar createMenuBar() {
     return new ReportsMenuBar();
}



}
</blockcode>

How would I add content to the RH side? (Still learning Java)

PS> Like the new forum!

gromar
Champ in-the-making
Champ in-the-making

ericsnyder
Champ on-the-rise
Champ on-the-rise
gromar: Very interesting, I'll check that out further. Thanks for the pointer!

jbarrez
Star Contributor
Star Contributor
The AbstractTreePage is a legacy class from a really long time ago (if I remember correctly).
I don't know if it would 'fit' in the 'newer' architecture we have.

Typically, we use the AbstractTablePage, the lefthand side is implemented by subclasses implementing the  protected abstract Table createList(); method. The right hand side is actually done in the AbstractPage class. Check the setDetailComponent() method.

For example for process definitions, the table on the left has a value change listener:

<blockcode>
  processDefinitionTable.addListener(new Property.ValueChangeListener() {
      private static final long serialVersionUID = 1L;

      public void valueChange(ValueChangeEvent event) {
        showProcessDefinitionDetail((String) event.getProperty().getValue());
      }
    });
</blockcode>

and it calls this method:

<blockcode>
protected void showProcessDefinitionDetail(String selectedModelId) {
    detailPanel = new EditorProcessDefinitionDetailPanel(selectedModelId, this);
    setDetailComponent(detailPanel);
    changeUrl("" + selectedModelId);
  }
</blockcode>


the setDetailComponent() will change the right hand side.