Skip to content

Commit

Permalink
Merge branch 'master' into stop-workflow
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.md
	nflow-jetty/pom.xml
	nflow-rest-api/src/main/java/com/nitorcreations/nflow/rest/v1/WorkflowInstanceResource.java
	nflow-rest-api/src/test/java/com/nitorcreations/nflow/rest/v1/WorkflowInstanceResourceTest.java
  • Loading branch information
Edvard Fonsell committed Jan 16, 2015
2 parents dc46133 + 63a7df1 commit 88afebe
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Added service to stop the execution of the workflow instance
- nflow-rest:
- Added service to stop the execution of the workflow instance
- Add support for user-provided action description when updating a workflow instance

## 1.2.0 (2014-12-23)

Expand Down
80 changes: 47 additions & 33 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
## 1.X.X
## Next release

* fixes and new features based on production needs
* more examples of nflow usage
* screencast of making example application

## 2.0.0 (Vuohi)

**target date 28.11.2014**

* nFlow radiator
* pie chart for workflows in different states
* graphs for visualizing incoming/processed workflow instances
* nFlow management UI
* search workflow instances
* update workflow instance state
* visualization of workflow instances (incl. action history)
* workflow management
* high-level locks - only one workflow against lock running at a time
* subworkflow support
* internal nFlow metastate for workflows (created, started, finished)?
* archive tables
* performance testing
* quickstart maven archetype
* improved PostgreSQL support
* optional support for flyway
* Performance test framework
* Performance improvements
* Support for sub-workflows
* Status for workflows (created, in progress, finished etc.)
* Type for workflow actions (normal, manual, recovery etc.)
* Improvement for handling not permitted state changes
* Add checksum for workflow definitions in database to allow easy comparison
* Improvement for handling invalid states
* Training material
* Marketing material
* Fixes and new features based on production needs

## Future releases

* improved human workflow support
* e.g. send ticket (http-link containing token) through email for opening a form in which human task can be performed
* tools for generating workflow definition skeleton based on graph
* alarms (with configurable thresholds)
* additional data storage support
* Oracle
* MongoDB
* DB2
* Quickstart maven archetype
* Optional support for database migration tool
* RequestData validation based on workflow definition when inserting new workflow instances
* Support for other databases
* High-level locks - only one workflow instance against lock running at a time
* Archive tables
* Improved human workflow support
* Tools for generating workflow definition skeletons
* Human-friendly mode for REST API
* Immediate execution of new workflow instance (if not busy)
* Increase test coverage
* Screencast of making an example application
* Support alarms
* Support alarm configuration in Explorer
* Support WAR and EAR packaging
* Option to skip writing workflow action when updating workflow instance to database
* Switch from JodaTime to Java 8 Date and Time API
* Java client for nFlow REST API
* nFlow Eclipse plugin
* Replace CXF with Jersey
* Add package-descriptions to javadocs
* Design and order nFlow stickers
* Support large amount of results in workflow instance search
* Provide more examples on using nFlow in different ways
* Support specifying next activation time as delta instead of absolute time in API
* Guice module that starts nFlow engine
* Define allowed state changes with annotations
* Support multiple executor groups in one Explorer
* Align Explorer page "buttons" to left
* Avoid throwing generic RuntimeExceptions
* Add missing javadocs for public API
* Configuration to disable Swagger and/or Explorer
* Fork/join support
* Collect metrics from REST API
* Remove need for transactions when using PostgreSQL to allow enabling auto-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static javax.ws.rs.core.Response.status;
import static javax.ws.rs.core.Response.Status.CONFLICT;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.trimToEmpty;
import static org.apache.commons.lang3.StringUtils.trimToNull;
import static org.joda.time.DateTime.now;
Expand Down Expand Up @@ -86,14 +87,18 @@ public Response createWorkflowInstance(@Valid CreateWorkflowInstanceRequest req)
public Response updateWorkflowInstance(@ApiParam("Internal id for workflow instance") @PathParam("id") int id,
UpdateWorkflowInstanceRequest req) {
WorkflowInstance.Builder builder = new WorkflowInstance.Builder().setId(id);
String msg = "";
String msg = defaultIfBlank(req.actionDescription, "");
if (!isEmpty(req.state)) {
builder.setState(req.state);
msg = "API changed state to " + req.state + ". ";
if (isBlank(req.actionDescription)) {
msg = "API changed state to " + req.state + ". ";
}
}
if (req.nextActivationTime != null) {
builder.setNextActivation(req.nextActivationTime);
msg += "API changed nextActivationTime to " + req.nextActivationTime + ".";
if (isBlank(req.actionDescription)) {
msg += "API changed nextActivationTime to " + req.nextActivationTime + ".";
}
}
if (msg.isEmpty()) {
return noContent().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public class UpdateWorkflowInstanceRequest {
@ApiModelProperty(value = "New next activation time for next workflow instance processing", required=false)
public DateTime nextActivationTime;

@ApiModelProperty(value = "Description of the action", required = false)
public String actionDescription;
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,18 @@ public void whenUpdatingStateUpdateWorkflowInstanceWorks() {
req.state = "newState";
resource.updateWorkflowInstance(3, req);
verify(workflowInstances).updateWorkflowInstance((WorkflowInstance) argThat(hasField("state", equalTo(req.state))),
(WorkflowInstanceAction)argThat(hasField("stateText", equalTo("API changed state to newState."))));
(WorkflowInstanceAction) argThat(hasField("stateText", equalTo("API changed state to newState."))));
}

@Test
public void whenUpdatingStateWithDescriptionUpdateWorkflowInstanceWorks() {
when(workflowInstances.getWorkflowInstance(3)).thenReturn(i);
UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest();
req.state = "newState";
req.actionDescription = "description";
resource.updateWorkflowInstance(3, req);
verify(workflowInstances).updateWorkflowInstance((WorkflowInstance) argThat(hasField("state", equalTo(req.state))),
(WorkflowInstanceAction) argThat(hasField("stateText", equalTo("description"))));
}

@Test
Expand All @@ -93,8 +104,10 @@ public void whenUpdatingNextActivationTimeUpdateWorkflowInstanceWorks() {
UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest();
req.nextActivationTime = new DateTime(2014,11,12,17,55,0);
resource.updateWorkflowInstance(3, req);
verify(workflowInstances).updateWorkflowInstance((WorkflowInstance) argThat(hasField("state", equalTo(null))),
(WorkflowInstanceAction)argThat(hasField("stateText", equalTo("API changed nextActivationTime to " + req.nextActivationTime + "."))));
verify(workflowInstances).updateWorkflowInstance(
(WorkflowInstance) argThat(hasField("state", equalTo(null))),
(WorkflowInstanceAction) argThat(hasField("stateText", equalTo("API changed nextActivationTime to "
+ req.nextActivationTime + "."))));
}

@Test
Expand All @@ -111,6 +124,17 @@ public void stoppingWorkflowInstanceWithEmptyActionDescriptionWorks() {
verify(workflowInstances).stopWorkflowInstance(3, "Workflow stopped via API");
}

@Test
public void whenUpdatingNextActivationTimeWithDescriptionUpdateWorkflowInstanceWorks() {
when(workflowInstances.getWorkflowInstance(3)).thenReturn(i);
UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest();
req.nextActivationTime = new DateTime(2014, 11, 12, 17, 55, 0);
req.actionDescription = "description";
resource.updateWorkflowInstance(3, req);
verify(workflowInstances).updateWorkflowInstance((WorkflowInstance) argThat(hasField("state", equalTo(null))),
(WorkflowInstanceAction) argThat(hasField("stateText", equalTo("description"))));
}

@SuppressWarnings("unchecked")
@Test
public void listWorkflowInstancesWorks() {
Expand Down

0 comments on commit 88afebe

Please sign in to comment.