-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bigbank-as/feature/camunda-get-variables
Get process/task variables
- Loading branch information
Showing
8 changed files
with
193 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package dto | ||
|
||
import ( | ||
"fmt" | ||
"encoding/json" | ||
) | ||
|
||
type Process struct { | ||
id string | ||
isEnded bool | ||
} | ||
|
||
func (process Process) GetId() string { | ||
return process.id | ||
} | ||
|
||
func (process Process) IsEnded() bool { | ||
return process.isEnded | ||
} | ||
|
||
func (response *Process) UnmarshalJSON(data []byte) error { | ||
var responseRaw struct{ | ||
Id string `json:"id"` | ||
IsEnded bool `json:"ended"` | ||
} | ||
if err := json.Unmarshal(data, &responseRaw); err != nil { | ||
return fmt.Errorf("Failed to parse variable: %s", err) | ||
} | ||
|
||
response.id = responseRaw.Id | ||
response.isEnded = responseRaw.IsEnded | ||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package dto | ||
|
||
import ( | ||
"fmt" | ||
"encoding/json" | ||
) | ||
|
||
type Task struct { | ||
id string | ||
name string | ||
taskDefinitionKey string | ||
} | ||
|
||
func (task Task) GetId() string { | ||
return task.id | ||
} | ||
|
||
func (task Task) GetName() string { | ||
return task.name | ||
} | ||
|
||
func (task Task) GetTaskDefinitionKey() string { | ||
return task.taskDefinitionKey | ||
} | ||
|
||
func (response *Task) UnmarshalJSON(data []byte) error { | ||
var responseRaw struct{ | ||
Id string `json:"id"` | ||
Name string `json:"name"` | ||
TaskDefinitionKey string `json:"taskDefinitionKey"` | ||
} | ||
if err := json.Unmarshal(data, &responseRaw); err != nil { | ||
return fmt.Errorf("Failed to parse variable: %s", err) | ||
} | ||
|
||
response.id = responseRaw.Id | ||
response.name = responseRaw.Name | ||
response.taskDefinitionKey = responseRaw.TaskDefinitionKey | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package dto | ||
|
||
import ( | ||
"fmt" | ||
"encoding/json" | ||
"strings" | ||
) | ||
|
||
type VariableResponse struct { | ||
value string | ||
valueType string | ||
valueFormat string | ||
} | ||
|
||
func (response VariableResponse) GetValue() string { | ||
return response.value | ||
} | ||
|
||
func (response *VariableResponse) UnmarshalJSON(data []byte) error { | ||
var responseRaw struct{ | ||
Type string `json:"type"` | ||
Value string `json:"value"` | ||
ValueInfo struct{ | ||
SerializationDataFormat string `json:"serializationDataFormat"` | ||
} `json:"valueInfo"` | ||
} | ||
if err := json.Unmarshal(data, &responseRaw); err != nil { | ||
return fmt.Errorf("Failed to parse variable: %s", err) | ||
} | ||
|
||
response.value = strings.Replace(responseRaw.Value, `\\\"`, `"`, -1) | ||
response.valueType = responseRaw.Type | ||
response.valueFormat = responseRaw.ValueInfo.SerializationDataFormat | ||
return nil | ||
} | ||
|
||
|