Custom Report in Enterprise Activiti

cancel
Showing results for 
Search instead for 
Did you mean: 
durai
Member II

Custom Report in Enterprise Activiti

Jump to solution

Hi,

We are using Enterprise Activiti 1.5, wanted to create custom report by allowing user to select/enter input parameter and generate report for that parameter. 

Looked into "activiti-custom-reports" in github but that doesn't accept any parameters from the user. I see in documentation suggesting to override "getParameterDefinitions()" method to get user-selected parameter but not sure how to add my controls in UI for the user to select. 

Any suggestion/ideas steps to implement this?

Thanks,

Durai

1 Solution

Accepted Solutions
gdharley
Intermediate

Re: Custom Report in Enterprise Activiti

Jump to solution

Yup, something else Alfresco forgot to document.

Took a little bit of playing around but it turns out it is pretty easy.

The following definition:

@Override
public ParametersDefinition getParameterDefinitions(Map<String, Object> parameterValues) {
    ParametersDefinition definition = new ParametersDefinition();
    definition.getParameters().add(new Parameter("processDefinitionId", null, "processDefinitionId", Parameter.TYPE_PROCESS_DEFINITION, parameterValues.get("processDefinitionId")));
    definition.getParameters().add(new Parameter("includeCompleted", null, "includeCompleted", Parameter.TYPE_BOOLEAN, parameterValues.get("includeCompleted")));
    return definition;
}

Results in the following report parameter view:

There are a limited number of available search parameters in the Parameter class:

public static final String TYPE_DATE = "date";
public static final String TYPE_DATE_RANGE = "dateRange";
public static final String TYPE_DATE_INTERVAL = "dateInterval";
public static final String TYPE_DURATION = "duration";
public static final String TYPE_PROCESS_DEFINITION = "processDefinition";
public static final String TYPE_TASK = "task";
public static final String TYPE_STATUS = "status";
public static final String TYPE_INTEGER = "integer";
public static final String TYPE_BOOLEAN = "boolean";

So make sure your queries are formed to make use of the available types.

The special types such as TYPE_PROCESS_DEFINITION, TYPE_TASK, TYPE_STATUS will auto populate with available task names, process definition names and process instances status's from the elasticseach repo.

Hope this gets you where you need to be.

Greg

View solution in original post

7 Replies
gdharley
Intermediate

Re: Custom Report in Enterprise Activiti

Jump to solution

Yup, something else Alfresco forgot to document.

Took a little bit of playing around but it turns out it is pretty easy.

The following definition:

@Override
public ParametersDefinition getParameterDefinitions(Map<String, Object> parameterValues) {
    ParametersDefinition definition = new ParametersDefinition();
    definition.getParameters().add(new Parameter("processDefinitionId", null, "processDefinitionId", Parameter.TYPE_PROCESS_DEFINITION, parameterValues.get("processDefinitionId")));
    definition.getParameters().add(new Parameter("includeCompleted", null, "includeCompleted", Parameter.TYPE_BOOLEAN, parameterValues.get("includeCompleted")));
    return definition;
}

Results in the following report parameter view:

There are a limited number of available search parameters in the Parameter class:

public static final String TYPE_DATE = "date";
public static final String TYPE_DATE_RANGE = "dateRange";
public static final String TYPE_DATE_INTERVAL = "dateInterval";
public static final String TYPE_DURATION = "duration";
public static final String TYPE_PROCESS_DEFINITION = "processDefinition";
public static final String TYPE_TASK = "task";
public static final String TYPE_STATUS = "status";
public static final String TYPE_INTEGER = "integer";
public static final String TYPE_BOOLEAN = "boolean";

So make sure your queries are formed to make use of the available types.

The special types such as TYPE_PROCESS_DEFINITION, TYPE_TASK, TYPE_STATUS will auto populate with available task names, process definition names and process instances status's from the elasticseach repo.

Hope this gets you where you need to be.

Greg

durai
Member II

Re: Custom Report in Enterprise Activiti

Jump to solution

Greg,

Thank you for the code it worked.

Question, so we can have only the predefined types as parameters? our requirement is, list all the users in the drop-down and on-select of the user display all the workflows started by that selected user. Is it possible? Please let me know.

-Durai

gdharley
Intermediate

Re: Custom Report in Enterprise Activiti

Jump to solution

Dural,

Unfortunately there is nothing "open" about Enterprise Edition.

I had to retrieve the source from Alfresco's private nexus repo in order to investigate this question.

Had I not had access, I would not have been able to answer (short of decompiling the classes).

That said, the only available parameter options are those I posted.

Could we add new options? Certainly, we could overload the Parameter class as well as the report renderer library to be able to understand the new parameter. In fact, that is the sort of work my company (BP3) does.

Alternatively, you could open a feature request with Alfresco.

Let me know if you want to investigate  an enhancement through BP3.

Thanks,
Greg

durai
Member II

Re: Custom Report in Enterprise Activiti

Jump to solution

Greg,

Thank you for the quick reply!! will look into Alfresco classes and see how we can implement the additional parameters.

Regards,

Durai

gdharley
Intermediate

Re: Custom Report in Enterprise Activiti

Jump to solution

Good luck with that. Keep in mind, any changes you make will need to be maintained and re-introduced when you upgrade.

G

gbanks
Active Member II

Re: Custom Report in Enterprise Activiti

Jump to solution

Hey Greg, I see that the search parameters are indeed limited. Have you been able to set up report parameters based on the variables within a process? E.g. a process includes a form where "Company Name", "Payment Amount", etc are entered. I'd like to be able to create a report where these values can be filtered. Company Name = x. Payment amount >= 500. Payment Amount < 1,000

gdharley
Intermediate

Re: Custom Report in Enterprise Activiti

Jump to solution

Hey Greer,

Unfortunately the list of available parameter types does not include process variables.

Below is the list I have taken from source:

And, the report parameter types dont appear to have been built in a way that we can extend easily.

So, it kind of makes the out of box reporting a little anemic. 

What is interesting though is a github project that Ciju Joseph (an Alfresco engineer) has built out that creates a different ElasticSearch repo and populates process instance data along with process variables. I havent tested, but you may be able to use Kibana or something similar to build out your reports from this repo.
Check it out here: GitHub - cijujoseph/activiti-analytics-spring-boot: A standalone app (ETL pattern using spring-boot)... 

Cheers,

Greg