Skip to content

Commit

Permalink
Move default query-archived state to constant(s) in base class
Browse files Browse the repository at this point in the history
  • Loading branch information
gmokki committed Apr 27, 2020
1 parent 939f727 commit 1647be9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

**Details**
- `nflow-engine`
- Query interfaces allow to request searching of archived workflow instances.
- Query interfaces allow to request searching of archived workflow instances if not enough matches found from main tables.
- `nflow-rest-api-jax-rs` and `nflow-rest-api-spring-web`
- Support for querying archived workflow instances when passing `queryArchive=true` query parameter.
- Support for querying archived workflow instances when passing `queryArchive=true` query parameter if not enough matches found from main tables.
- `nflow-explorer`
- Query and show archived workflow instances by default. Configurable in `config.js`.
- Query and show archived workflow instances by default if not enough matches found from main tables. Configurable in `config.js`.

## 7.2.0 (2020-04-27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ public abstract class ResourceBase {
new SimpleEntry<>(actionStateVariables, WorkflowInstanceInclude.ACTION_STATE_VARIABLES),
new SimpleEntry<>(childWorkflows, WorkflowInstanceInclude.CHILD_WORKFLOW_IDS))
.collect(toMap(Entry::getKey, Entry::getValue)));
protected static final String QUERY_ARCHIVED_DEFAULT_S = "false";

This comment has been minimized.

Copy link
@efonsell

efonsell Apr 27, 2020

Member

QUERY_ARCHIVED_DEFAULT_STR?

protected static final boolean QUERY_ARCHIVED_DEFAULT = Boolean.parseBoolean(QUERY_ARCHIVED_DEFAULT_S);

public List<ListWorkflowDefinitionResponse> listWorkflowDefinitions(final List<String> types,
final WorkflowDefinitionService workflowDefinitions, final ListWorkflowDefinitionConverter converter,
final WorkflowDefinitionDao workflowDefinitionDao) {
final WorkflowDefinitionService workflowDefinitions, final ListWorkflowDefinitionConverter converter,

This comment has been minimized.

Copy link
@efonsell

efonsell Apr 27, 2020

Member

Strange formatting rules?

final WorkflowDefinitionDao workflowDefinitionDao) {
List<AbstractWorkflowDefinition<? extends WorkflowState>> definitions = workflowDefinitions.getWorkflowDefinitions();
Set<String> reqTypes = new HashSet<>(types);
Set<String> foundTypes = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Response fetchWorkflowInstance(@ApiParam("Internal id for workflow instan
@QueryParam("maxActions") @ApiParam("Maximum number of actions returned for each workflow instance") Long maxActions,
@QueryParam("queryArchive") @ApiParam("Query also the archive if not found from main tables") Boolean queryArchive) {
return handleExceptions(
() -> ok(super.fetchWorkflowInstance(id, include, maxActions, ofNullable(queryArchive).orElse(false), workflowInstances, listWorkflowConverter)));
() -> ok(super.fetchWorkflowInstance(id, include, maxActions, ofNullable(queryArchive).orElse(QUERY_ARCHIVED_DEFAULT), workflowInstances, listWorkflowConverter)));
}

@GET
Expand All @@ -143,7 +143,7 @@ public Response listWorkflowInstances(@QueryParam("id") @ApiParam("Internal id o
@QueryParam("maxActions") @ApiParam("Maximum number of actions returned for each workflow instance") Long maxActions,
@QueryParam("queryArchive") @ApiParam("Query also the archive if not enough results found from main tables") Boolean queryArchive) {
return handleExceptions(() -> ok(super.listWorkflowInstances(ids, types, parentWorkflowId, parentActionId, states, statuses,
businessKey, externalId, include, maxResults, maxActions, ofNullable(queryArchive).orElse(false), workflowInstances, listWorkflowConverter).iterator()));
businessKey, externalId, include, maxResults, maxActions, ofNullable(queryArchive).orElse(QUERY_ARCHIVED_DEFAULT), workflowInstances, listWorkflowConverter).iterator()));
}

@PUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public ResponseEntity<?> updateWorkflowInstance(@ApiParam("Internal id for workf
public ResponseEntity<?> fetchWorkflowInstance(@ApiParam("Internal id for workflow instance") @PathVariable("id") long id,
@RequestParam(value = "include", required = false) @ApiParam(value = INCLUDE_PARAM_DESC, allowableValues = INCLUDE_PARAM_VALUES, allowMultiple = true) String include,
@RequestParam(value = "maxActions", required = false) @ApiParam("Maximum number of actions returned for each workflow instance") Long maxActions,
@RequestParam(value = "queryArchive", required = false, defaultValue = "false") @ApiParam("Query also the archive if not found from main tables") boolean queryArchive) {
@RequestParam(value = "queryArchive", required = false, defaultValue = QUERY_ARCHIVED_DEFAULT_S) @ApiParam("Query also the archive if not found from main tables") boolean queryArchive) {
return handleExceptions(
() -> ok(super.fetchWorkflowInstance(id, include, maxActions, queryArchive, this.workflowInstances, this.listWorkflowConverter)));
}
Expand All @@ -129,7 +129,7 @@ public ResponseEntity<?> listWorkflowInstances(
@RequestParam(value = "include", required = false) @ApiParam(value = INCLUDE_PARAM_DESC, allowableValues = INCLUDE_PARAM_VALUES, allowMultiple = true) String include,
@RequestParam(value = "maxResults", required = false) @ApiParam("Maximum number of workflow instances to be returned") Long maxResults,
@RequestParam(value = "maxActions", required = false) @ApiParam("Maximum number of actions returned for each workflow instance") Long maxActions,
@RequestParam(value = "queryArchive", required = false, defaultValue = "false") @ApiParam("Query also the archive if not enough results found from main tables") boolean queryArchive) {
@RequestParam(value = "queryArchive", required = false, defaultValue = QUERY_ARCHIVED_DEFAULT_S) @ApiParam("Query also the archive if not enough results found from main tables") boolean queryArchive) {
return handleExceptions(
() -> ok(super.listWorkflowInstances(ids, types, parentWorkflowId, parentActionId, states, statuses, businessKey,
externalId, include, maxResults, maxActions, queryArchive, this.workflowInstances, this.listWorkflowConverter).iterator()));
Expand Down

0 comments on commit 1647be9

Please sign in to comment.