Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module - Usage Data Collector #34

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
<artifactId>jbpm-form-modeler-renderer-backend</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-console-ng-usage-data-client</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.uberfire</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
import org.jboss.errai.ioc.client.api.Caller;
import org.jbpm.console.ng.ht.client.i18n.Constants;
import org.jbpm.console.ng.ht.service.TaskServiceEntryPoint;
import org.jbpm.console.ng.udc.client.event.ActionsUsageData;
import org.jbpm.console.ng.udc.client.event.LevelsUsageData;
import org.jbpm.console.ng.udc.client.event.StatusUsageEvent;
import org.jbpm.console.ng.udc.client.event.UsageEvent;
import org.uberfire.client.annotations.OnReveal;
import org.uberfire.client.annotations.OnStart;
import org.uberfire.client.annotations.WorkbenchPartTitle;
Expand Down Expand Up @@ -74,6 +78,9 @@ public interface QuickNewTaskView extends UberView<QuickNewTaskPresenter> {

@Inject
private PlaceManager placeManager;

@Inject
private Event<UsageEvent> usageDataEvent;

@OnStart
public void onStart( final PlaceRequest place ) {
Expand Down Expand Up @@ -131,6 +138,8 @@ public void addTask( final List<String> users, List<String> groups,
@Override
public void callback( Long taskId ) {
view.displayNotification( "Task Created and Started (id = " + taskId + ")" );
usageDataEvent.fire( new UsageEvent(taskId.toString(), identity.getName(),
ActionsUsageData.HUMAN_TASKS_CREATED_STARTED, StatusUsageEvent.SUCCESS, LevelsUsageData.INFO) );
close();

}
Expand All @@ -140,6 +149,9 @@ public void callback( Long taskId ) {
@Override
public void callback( Long taskId ) {
view.displayNotification( "Task Created (id = " + taskId + ")" );
usageDataEvent.fire( new UsageEvent(taskId.toString(), identity.getName(),
ActionsUsageData.HUMAN_TASKS_CREATED, StatusUsageEvent.SUCCESS, LevelsUsageData.INFO) );

close();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import org.jboss.errai.bus.client.api.ErrorCallback;
import org.jboss.errai.bus.client.api.Message;
import com.google.gwt.core.client.GWT;
import java.util.HashMap;
import org.jboss.errai.bus.client.api.RemoteCallback;
Expand All @@ -41,6 +44,11 @@
import org.jbpm.console.ng.ht.model.Day;
import org.jbpm.console.ng.ht.model.TaskSummary;
import org.jbpm.console.ng.ht.service.TaskServiceEntryPoint;
import org.jbpm.console.ng.udc.client.event.ActionsUsageData;
import org.jbpm.console.ng.udc.client.event.LevelsUsageData;
import org.jbpm.console.ng.udc.client.event.StatusUsageEvent;
import org.jbpm.console.ng.udc.client.event.UsageEvent;
import org.jbpm.console.ng.udc.client.usagelist.UsageDataPresenter;
import org.uberfire.client.annotations.WorkbenchPartTitle;
import org.uberfire.client.annotations.WorkbenchPartView;
import org.uberfire.client.annotations.WorkbenchScreen;
Expand All @@ -58,6 +66,13 @@ public class TasksListPresenter {

private Map<Day, List<TaskSummary>> currentDayTasks;

@Inject
private Event<UsageEvent> usageEvent;

@Inject
private UsageDataPresenter usageDataPresenter;


public List<TaskSummary> getAllTaskSummaries() {
return allTaskSummaries;
}
Expand Down Expand Up @@ -188,42 +203,82 @@ public void startTasks( final List<Long> selectedTasks,
@Override
public void callback( List<TaskSummary> tasks ) {
view.displayNotification( "Task(s) Started" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_STARTED, StatusUsageEvent.SUCCESS,
LevelsUsageData.INFO);
view.refreshTasks();
}
}, new ErrorCallback() {
@Override
public boolean error( Message message, Throwable throwable ) {
view.displayNotification( "Task(s) Started - ERROR" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_STARTED, StatusUsageEvent.ERROR,
LevelsUsageData.ERROR);
return false;
}
} ).startBatch( selectedTasks, userId );
}

public void releaseTasks( List<Long> selectedTasks,
public void releaseTasks( final List<Long> selectedTasks,
final String userId ) {
taskServices.call( new RemoteCallback<List<TaskSummary>>() {
@Override
public void callback( List<TaskSummary> tasks ) {
view.displayNotification( "Task(s) Released" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_RELEASED, StatusUsageEvent.SUCCESS,
LevelsUsageData.INFO);
view.refreshTasks();
}
}, new ErrorCallback() {
@Override
public boolean error( Message message, Throwable throwable ) {
view.displayNotification( "Task(s) Released - ERROR" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_RELEASED, StatusUsageEvent.ERROR,
LevelsUsageData.ERROR);
return false;
}
} ).releaseBatch( selectedTasks, userId );
}

public void completeTasks( List<Long> selectedTasks,
public void completeTasks( final List<Long> selectedTasks,
final String userId ) {
taskServices.call( new RemoteCallback<List<TaskSummary>>() {
@Override
public void callback( List<TaskSummary> tasks ) {
view.displayNotification( "Task(s) Completed" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_COMPLETED, StatusUsageEvent.SUCCESS,
LevelsUsageData.INFO);
view.refreshTasks();
}
}, new ErrorCallback() {
@Override
public boolean error( Message message, Throwable throwable ) {
view.displayNotification( "Task(s) Completed - ERROR" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_COMPLETED, StatusUsageEvent.ERROR,
LevelsUsageData.ERROR);
return false;
}
} ).completeBatch( selectedTasks, userId, null );
}

public void claimTasks( List<Long> selectedTasks,
public void claimTasks( final List<Long> selectedTasks,
final String userId ) {
taskServices.call( new RemoteCallback<List<TaskSummary>>() {
@Override
public void callback( List<TaskSummary> tasks ) {
view.displayNotification( "Task(s) Claimed" );
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_CLAIMED, StatusUsageEvent.SUCCESS,
LevelsUsageData.INFO);
view.refreshTasks();

}
}, new ErrorCallback() {
@Override
public boolean error(Message message, Throwable throwable) {
view.displayNotification("Task(s) Claimed - ERROR");
saveNewUsageDataEvent(selectedTasks, userId, ActionsUsageData.HUMAN_TASKS_CLAIMED, StatusUsageEvent.ERROR,
LevelsUsageData.ERROR);
return false;
}
} ).claimBatch( selectedTasks, userId );
}

Expand Down Expand Up @@ -418,4 +473,12 @@ public ListDataProvider<TaskSummary> getDataProvider() {
return dataProvider;
}

public void saveNewUsageDataEvent(List<Long> selectedTasks, String idUser, ActionsUsageData actionHistory,
StatusUsageEvent status, LevelsUsageData level) {
for (Long taskId : selectedTasks) {
usageEvent.fire(new UsageEvent(taskId.toString(), idUser, actionHistory, status, level));
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<inherits name="org.uberfire.UberfireWidgetsCommons" />

<inherits name="org.jbpm.console.ng.ht.JbpmConsoleNGHumanTasksAPI" />
<inherits name="org.jbpm.console.ng.udc.JbpmConsoleNGUsageDataClient"/>

<inherits name="com.github.gwtbootstrap.datetimepicker.Datetimepicker" />
<inherits name="com.github.gwtbootstrap.datepicker.Datepicker" />
Expand Down
18 changes: 17 additions & 1 deletion jbpm-console-ng-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@
<artifactId>jbpm-console-ng-process-runtime-backend</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-console-ng-usage-data-client</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-console-ng-usage-data-backend</artifactId>
<version>${project.version}</version>
</dependency>


<dependency>
<groupId>org.jbpm</groupId>
Expand Down Expand Up @@ -601,7 +614,10 @@
<compileSourcesArtifact>org.jbpm:jbpm-console-ng-process-runtime-client</compileSourcesArtifact>
<compileSourcesArtifact>org.jbpm:jbpm-console-ng-business-domain-api</compileSourcesArtifact>
<compileSourcesArtifact>org.jbpm:jbpm-console-ng-business-domain-client</compileSourcesArtifact>

<compileSourcesArtifact>org.jbpm:jbpm-console-ng-usage-data-api</compileSourcesArtifact>
<compileSourcesArtifact>org.jbpm:jbpm-console-ng-usage-data-client</compileSourcesArtifact>


<compileSourcesArtifact>org.jbpm:jbpm-designer-api</compileSourcesArtifact>
<compileSourcesArtifact>org.jbpm:jbpm-designer-client</compileSourcesArtifact>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public void execute() {
} ).endMenu().newTopLevelMenu( constants.Authoring() ).withItems( getAuthoringViews() ).endMenu()
.newTopLevelMenu( constants.Deploy() ).withItems( getDeploymentViews() ).endMenu()
.newTopLevelMenu( constants.Process_Management() ).withItems( getProcessMGMTViews() ).endMenu()
.newTopLevelMenu( constants.Usage_Data() ).withItems( getUsageDataCollectorViews() ).endMenu()
.newTopLevelMenu( constants.Work() ).withItems( getWorkViews() ).endMenu().newTopLevelMenu( constants.Dashboards() )
.withItems( getDashboardsViews() ).endMenu().newTopLevelMenu( constants.LogOut() ).respondsWith( new Command() {
@Override
Expand Down Expand Up @@ -176,6 +177,20 @@ public void execute() {
} ).endMenu().build().getItems().get( 0 ) );


return result;
}

private List<? extends MenuItem> getUsageDataCollectorViews() {
final List<MenuItem> result = new ArrayList<MenuItem>( 1 );

result.add( MenuFactory.newSimpleItem( constants.Usage_Data_Collector() ).respondsWith( new Command() {
@Override
public void execute() {
placeManager.goTo( new DefaultPlaceRequest( "Usage Data" ) );
}
} ).endMenu().build().getItems().get( 0 ) );


return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public interface Constants extends Messages {
String Deployments();

String newItem();

String Usage_Data();

String Usage_Data_Collector();



}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ Process_Definitions=Process Definitions
Process_Instances=Process Instances
Deploy=Deploy
Deployments=Deployments
newItem=New Item
newItem=New Item
Usage_Data=Usage Data
Usage_Data_Collector=Usage Data Collector
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ Process_Definitions=Definiciones de Procesos
Process_Instances=Instancias de Proceso
Deploy=Despliegue
Deployments=Despliegues
newItem=Nuevo Item
newItem=Nuevo Item
Usage_Data=Datos de Uso
Usage_Data_Collector=Colector datos de uso
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<!-- jbpm-wb -->
<inherits name="org.jbpm.console.ng.bh.JbpmConsoleNGBPMHomeClient"/>
<inherits name="org.jbpm.console.ng.ht.JbpmConsoleNGHumanTasksClient"/>
<inherits name="org.jbpm.console.ng.udc.JbpmConsoleNGUsageDataClient"/>
<inherits name="org.jbpm.console.ng.pr.JbpmConsoleNGProcessRuntimeClient"/>
<inherits name="org.jbpm.console.ng.bd.JbpmConsoleNGBusinessDomainClient"/>
<inherits name="org.jbpm.console.ng.es.JbpmConsoleNGExecutorServiceClient"/>
Expand Down
24 changes: 24 additions & 0 deletions jbpm-console-ng-usage-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/target
/local
/src/main/gwt-unitCache/
/src/main/webapp/WEB-INF/classes/
/src/main/webapp/WEB-INF/deploy/
/src/main/webapp/WEB-INF/lib/
/src/main/webapp/org.drools.guvnor.jBPMShowcase/

# Eclipse, Netbeans and IntelliJ files
/.*
/**/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml

# GwtTest
gwt-unitCache
www-test

# Repository wide ignore mac DS_Store files
.DS_Store

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/target
/local
/src/main/gwt-unitCache/
/src/main/webapp/WEB-INF/classes/
/src/main/webapp/WEB-INF/deploy/
/src/main/webapp/WEB-INF/lib/
/src/main/webapp/org.drools.guvnor.jBPMShowcase/

# Eclipse, Netbeans and IntelliJ files
/.*
/**/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml

# GwtTest
gwt-unitCache
www-test

# Repository wide ignore mac DS_Store files
.DS_Store

Loading