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

Migrate human task information on process definition details #11

Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -24,14 +24,18 @@ public class TaskDefSummary implements Serializable {
private long id;
private String name;

public TaskDefSummary(long id, String name) {
super();
public TaskDefSummary(long id, final String name) {
this(name);
this.id = id;
this.name = name;
}

public TaskDefSummary(final String name) {
super();
this.name = name;
}

public TaskDefSummary() {
super();
}

public long getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.jbpm.console.ng.bd.model.ProcessInstanceSummary;
import org.jbpm.console.ng.bd.model.ProcessSummary;
import org.jbpm.console.ng.bd.model.RuntimeLogSummary;
import org.kie.internal.query.QueryFilter;
import org.jbpm.console.ng.bd.model.TaskDefSummary;

@Remote
public interface RemoteRuntimeDataService {
Expand All @@ -47,4 +47,7 @@ public interface RemoteRuntimeDataService {
List<ProcessSummary> getProcessesByFilter(String serverTemplateId, String textSearch, Integer page, Integer pageSize);

ProcessSummary getProcessesByContainerIdProcessId(String serverTemplateId, String containerId, String processId);
}

List<TaskDefSummary> getProcessUserTasks(String serverTemplateId, String containerId, String processId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

Expand All @@ -29,10 +30,11 @@
import org.jbpm.console.ng.bd.model.ProcessInstanceSummary;
import org.jbpm.console.ng.bd.model.ProcessSummary;
import org.jbpm.console.ng.bd.model.RuntimeLogSummary;
import org.jbpm.console.ng.bd.model.TaskDefSummary;
import org.jbpm.console.ng.bd.model.UserTaskSummary;
import org.jbpm.console.ng.pr.service.integration.RemoteRuntimeDataService;
import org.kie.internal.query.QueryFilter;
import org.kie.server.api.model.definition.ProcessDefinition;
import org.kie.server.api.model.definition.UserTaskDefinitionList;
import org.kie.server.api.model.instance.NodeInstance;
import org.kie.server.api.model.instance.ProcessInstance;
import org.kie.server.api.model.instance.TaskEventInstance;
Expand Down Expand Up @@ -236,6 +238,15 @@ public ProcessSummary getProcessesByContainerIdProcessId(String serverTemplateId
return summary;
}

@Override
public List<TaskDefSummary> getProcessUserTasks(final String serverTemplateId, final String containerId, final String processId){
ProcessServicesClient processServicesClient = getClient(serverTemplateId, ProcessServicesClient.class);

final UserTaskDefinitionList userTaskDefinitionList = processServicesClient.getUserTaskDefinitions(containerId, processId);

return userTaskDefinitionList.getItems().stream().map(t -> new TaskDefSummary(t.getName())).collect(Collectors.toList());
}

@Override
public List<RuntimeLogSummary> getRuntimeLogs(String serverTemplateId, Long processInstanceId) {
List<NodeInstance> processInstanceHistory = getProcessInstanceHistory(serverTemplateId, processInstanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.IsWidget;
import org.jboss.errai.bus.client.api.messaging.Message;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.jbpm.console.ng.bd.model.ProcessDefinitionKey;
Expand Down Expand Up @@ -173,35 +172,45 @@ private void refreshAssociatedEntities( Map<String, String[]> entities ) {
}
}

private void refreshTaskDef( List<TaskDefSummary> tasks ) {
view.getNroOfHumanTasksText().setText(
String.valueOf( tasks.size() ) );
private void refreshTaskDef( final String serverTemplateId, final String deploymentId, final String processId ) {
view.getNroOfHumanTasksText().setText( "" );
view.getHumanTasksListBox().setText( "" );
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
if (tasks.isEmpty()) {
safeHtmlBuilder.appendEscapedLines(constants.NoUserTasksDefinedInThisProcess());
view.getHumanTasksListBox().setStyleName( "muted" );
view.getHumanTasksListBox().setHTML(
safeHtmlBuilder.toSafeHtml() );
} else {
for (TaskDefSummary t : tasks) {
safeHtmlBuilder.appendEscapedLines( t.getName() + "\n" );

processDefService.call(new RemoteCallback<List<TaskDefSummary>>() {

@Override
public void callback(final List<TaskDefSummary> userTaskSummaries) {
view.getNroOfHumanTasksText().setText( String.valueOf(userTaskSummaries.size()) );

SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
if (userTaskSummaries.isEmpty()) {
safeHtmlBuilder.appendEscapedLines(constants.NoUserTasksDefinedInThisProcess());
view.getHumanTasksListBox().setStyleName( "muted" );
view.getHumanTasksListBox().setHTML(
safeHtmlBuilder.toSafeHtml() );
} else {
for (TaskDefSummary t : userTaskSummaries) {
safeHtmlBuilder.appendEscapedLines( t.getName() + "\n" );
}
view.getHumanTasksListBox().setHTML(
safeHtmlBuilder.toSafeHtml() );
}
}
view.getHumanTasksListBox().setHTML(
safeHtmlBuilder.toSafeHtml() );
}

}, new DefaultErrorCallback()).getProcessUserTasks(serverTemplateId, deploymentId, processId);

}

@Override
protected void refreshProcessDef( String serverTemplateId, final String deploymentId, final String processId ) {
protected void refreshProcessDef( final String serverTemplateId, final String deploymentId, final String processId ) {

processDefService.call( new RemoteCallback<ProcessSummary>() {

@Override
public void callback( ProcessSummary process ) {
if (process != null) {

// refreshTaskDef( process. );
refreshTaskDef( serverTemplateId, deploymentId, processId );

refreshAssociatedEntities( process.getAssociatedEntities() );

Expand Down