Skip to content

Commit

Permalink
Merge pull request #29 from axonivy-market/develop
Browse files Browse the repository at this point in the history
Update new change to master
  • Loading branch information
trungmaihova authored Jun 24, 2024
2 parents 3342acf + 3ac1ae8 commit 5fe3fb9
Show file tree
Hide file tree
Showing 25 changed files with 1,402 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import java.util.Map;
import java.util.stream.Collectors;

import javax.annotation.PostConstruct;
import javax.faces.event.AjaxBehaviorEvent;

import org.primefaces.component.selectoneradio.SelectOneRadio;
import org.primefaces.model.FilterMeta;

import com.axonivy.utils.process.analyzer.AdvancedProcessAnalyzer;
import com.axonivy.utils.process.analyzer.demo.constant.FindType;
Expand All @@ -23,6 +25,7 @@
import com.axonivy.utils.process.analyzer.internal.ProcessAnalyzer;
import com.axonivy.utils.process.analyzer.model.DetectedAlternative;
import com.axonivy.utils.process.analyzer.model.DetectedElement;
import com.axonivy.utils.process.analyzer.model.DetectedTask;

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.model.BaseElement;
Expand All @@ -45,7 +48,9 @@ public class ProcessAnalyzerBean {
private List<Analyzer> analyzers = new ArrayList<>();

private List<Process> processes = emptyList();


private List<FilterMeta> filterBy;

private Analyzer selectedAnalyzer = null;

AdvancedProcessAnalyzer processAnalyzer;
Expand Down Expand Up @@ -73,7 +78,19 @@ public Analyzer getSelectedAnalyzer() {
public void setSelectedAnalyzer(Analyzer selectedAnalyzer) {
this.selectedAnalyzer = selectedAnalyzer;
}

public List<FilterMeta> getFilterBy() {
return filterBy;
}

public void setFilterBy(List<FilterMeta> filterBy) {
this.filterBy = filterBy;
}

@PostConstruct
public void init() {
filterBy = new ArrayList<>();
}
public List<SingleTaskCreator> getAllTaskModifier() {
this.processAnalyzer = new ProcessAnalyzer();
return getElementOfProcess(this.selectedAnalyzer.getProcess()).stream()
Expand Down Expand Up @@ -196,6 +213,17 @@ public String getShortPid(String pid) {
return pid.substring(index + 1);
}

public List<String> getParentElementNames(){
if(selectedAnalyzer != null) {
return selectedAnalyzer.getTasks().stream()
.filter(DetectedTask.class::isInstance)
.map(DetectedTask.class::cast)
.map(DetectedTask::getDisplayParentElementNames)
.distinct()
.toList();
}
return emptyList();
}
private AdvancedProcessAnalyzer updateProcessAnalyzer(Analyzer analyzer) {
Map<String, String> flowOverrides = getProcessFlowOverride(analyzer);
processAnalyzer.disableDescribeAlternativeElements();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
<p:dataTable value="#{analyzer.tasks}" var="task" stripedRows="true"
lazy="false" resizableColumns="true" rowIndexVar="row"
widgetVar="tableTask"
styleClass="ui-datatable-sm ui-datatable-gridlines">
filterBy="#{data.processAnalyzerBean.filterBy}"
styleClass="ui-datatable-sm ui-datatable-gridlines ui-datatable-header-filter">
<p:column headerText="#" width="20px">
<h:outputText value="#{row + 1}" />
</p:column>
Expand All @@ -56,20 +57,38 @@
title="#{task.pid}" />
</p:column>

<p:column headerText="Task Name" styleClass="text-overflow">
<p:column headerText="Task Name" sortBy="#{task.taskName}"
filterBy="#{task.taskName}" filterMatchMode="contains"
styleClass="text-overflow">
<h:outputText value="#{task.taskName}" title="#{task.taskName}" />
</p:column>

<p:column headerText="Element Name" styleClass="text-overflow">
<h:outputText value="#{task.elementName}" title="#{task.elementName}" />
<p:column headerText="Element Name" sortBy="#{task.elementName}"
filterBy="#{task.elementName}" filterMatchMode="contains"
styleClass="text-overflow">
<h:outputText value="#{task.elementName}"
title="#{task.elementName}" />
</p:column>

<p:column headerText="Estimated Duration">
<h:outputText
value="#{data.processAnalyzerBean.getDisplayDuration(task.estimatedDuration)}" />
</p:column>

<p:column headerText="Parent Element Names" styleClass="text-overflow">
<p:column headerText="Parent Element Names"
sortBy="#{task.displayParentElementNames}"
filterBy="#{task.displayParentElementNames}"
styleClass="text-overflow">

<f:facet name="filter">
<p:selectOneMenu onchange="PF('tableTask').filter()"
styleClass="ui-custom-filter" filter="true"
filterMatchMode="contains">
<f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{data.processAnalyzerBean.getParentElementNames()}" />
</p:selectOneMenu>
</f:facet>

<h:outputText value="#{task.displayParentElementNames}"
title="#{task.displayParentElementNames}" />
</p:column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@
.ui-datatable-data .text-overflow {
white-space: nowrap;
text-overflow: ellipsis;
}
}
.ui-datatable-header-filter .ui-selectonemenu {
width: 100%;
min-width: 100% !important;
}

.ui-datatable-header-filter .ui-selectonemenu-label {
white-space: nowrap;
text-overflow: ellipsis;
}

table thead tr {
vertical-align: text-top;
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
<cc:attribute name="updateFormId" />
</cc:interface>
<cc:implementation>

<h:outputStylesheet name="analyzer-selection.css" library="ivy-dialog" />
<p:panel id="analyzer-selection">
<p:panelGrid columns="6" layout="grid"
columnClasses="ui-grid-col-1, ui-grid-col-3, ui-grid-col-1, ui-grid-col-3, ui-grid-col-1, ui-grid-col-3"
styleClass="customPanelGrid" contentStyleClass="ui-fluid">
styleClass="customPanelGrid ui-grid-selection" contentStyleClass="ui-fluid">
<p:outputLabel for="selectOneProcess" value="Process:" />
<p:selectOneMenu id="selectOneProcess" converter="pojoConverter"
required="true" requiredMessage="Process is required"
value="#{data.processAnalyzerBean.selectedAnalyzer.process}">
value="#{data.processAnalyzerBean.selectedAnalyzer.process}"
filter="true" filterMatchMode="contains">
<f:selectItem itemLabel="Select a process..." itemValue="null"
noSelectionOption="true" />
<f:selectItems value="#{data.processAnalyzerBean.processes}"
Expand All @@ -34,7 +35,8 @@
<p:outputLabel for="selectOneElement" value="Start Elements:" />
<p:selectOneMenu id="selectOneElement" converter="pojoConverter"
required="true" requiredMessage="Start element is required"
value="#{data.processAnalyzerBean.selectedAnalyzer.startElement}">
value="#{data.processAnalyzerBean.selectedAnalyzer.startElement}"
filter="true" filterMatchMode="contains">
<f:selectItem itemLabel="Select an elements..." itemValue="" />
<f:selectItems
value="#{data.processAnalyzerBean.selectedAnalyzer.elements}"
Expand All @@ -47,15 +49,17 @@
<p:outputLabel for="selectOneFindType" value="Find Type:" />
<p:selectOneMenu id="selectOneFindType" converter="pojoConverter"
required="true" requiredMessage="Find type is required"
value="#{data.processAnalyzerBean.selectedAnalyzer.findType}">
value="#{data.processAnalyzerBean.selectedAnalyzer.findType}"
filter="true" filterMatchMode="contains">
<f:selectItem itemLabel="Select an find type" itemValue="" />
<f:selectItems value="#{data.processAnalyzerBean.allFindType}"
var="type" itemLabel="#{type.displayName}" itemValue="#{type}" />
</p:selectOneMenu>

<p:outputLabel for="selectOneUseCase" value="Use Case:" />
<p:selectOneMenu id="selectOneUseCase" converter="pojoConverter"
value="#{data.processAnalyzerBean.selectedAnalyzer.useCase}">
value="#{data.processAnalyzerBean.selectedAnalyzer.useCase}"
filter="true" filterMatchMode="contains">
<f:selectItem itemLabel="Select use case" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{data.processAnalyzerBean.allUseCases}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@charset "ISO-8859-1";

.ui-grid-selection .ui-selectonemenu {
width: 100%;
min-width: 100% !important;
}

.ui-grid-selection .ui-selectonemenu-label {
white-space: nowrap;
text-overflow: ellipsis;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/README.md=UTF-8
15 changes: 14 additions & 1 deletion process-analyzer-product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ In the project, you only add the dependency in your pom.xml and call public APIs
public void enableDescribeAlternativeElements()
public void disableDescribeAlternativeElements()
```
**4. You can call `findAllTasks`, `findTasksOnPath`, `calculateEstimatedDuration` to analyze your process.**
**4. You can call `findAllTasks`, `findTasksOnPath`, `calculateWorstCaseDuration` `calculateDurationOfPath` to analyze your process.**
```java
/**
* Return a list of all tasks in the process which can be reached from the starting element.
Expand Down Expand Up @@ -92,6 +92,19 @@ In the project, you only add the dependency in your pom.xml and call public APIs
* @throws Exception
*/
public Duration calculateWorstCaseDuration(BaseElement startElement, Enum<?> useCase) throws Exception

/**
* This method can be used to calculate expected duration from a starting point
* using a named flow or default flow. For parallel segments of the process, it
* will still use the “critical path” (same logic like worst case duration).
*
* @param startElement - Element where we start traversing the process
* @param useCase - Use case that should be used to read duration values.
* Durations will be set to 0 in case not provided.
* @return
* @throws Exception
*/
public Duration calculateDurationOfPath(BaseElement startElement, Enum<?> useCase, String flowName) throws Exception;
```

### Example
Expand Down
6 changes: 6 additions & 0 deletions process-analyzer-product/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"artifactId": "process-analyzer-demo",
"version": "${version}",
"type": "iar"
},
{
"groupId": "com.axonivy.utils.process.analyzer",
"artifactId": "process-analyzer-test",
"version": "${version}",
"type": "iar"
}
],
"repositories": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FlowMixedSubProcessData #class
com.axonivy.utils.estimator.test #namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FlowTriggerCallData #class
com.axonivy.utils.estimator.test #namespace
Loading

0 comments on commit 5fe3fb9

Please sign in to comment.