Skip to content

Commit

Permalink
Merge pull request #11 from bigbank-as/feature/FIP-findProcess
Browse files Browse the repository at this point in the history
Update findProcess to use array struct
  • Loading branch information
evertisland authored Oct 13, 2017
2 parents 5bb82bd + 6790b79 commit 6f3fc52
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea

1 change: 1 addition & 0 deletions client_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Process interface {

type ProcessInstance interface {
GetId() string
GetBusinessKey() string
}

type Task interface {
Expand Down
13 changes: 10 additions & 3 deletions rest/client_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ func (client *camundaClientRest) GetProcess(processId string) (go_camunda_client
}

func (client *camundaClientRest) FindProcess(query string) ([]go_camunda_client.ProcessInstance, error) {
var process []go_camunda_client.ProcessInstance
var dtoProcesses []dto.ProcessInstance
var processes []go_camunda_client.ProcessInstance

response, err := client.doRequest("GET", "process-instance?" + query)
if err == nil {
err = client.parseResponseJson(response, &process)
err = client.parseResponseJson(response, &dtoProcesses)
defer response.Body.Close()

processes = make([]go_camunda_client.ProcessInstance, len(dtoProcesses))
for i := range processes {
processes[i] = dtoProcesses[i]
}
}
return process, err
return processes, err
}

func (client *camundaClientRest) GetProcessVariable(processId, variableName string) (
Expand Down
4 changes: 4 additions & 0 deletions rest/dto/process_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ type ProcessInstance struct {

func (processInstance ProcessInstance) GetId() string {
return processInstance.Id
}

func (processInstance ProcessInstance) GetBusinessKey() string {
return processInstance.BusinessKey
}

0 comments on commit 6f3fc52

Please sign in to comment.