43 lines
767 B
Go
43 lines
767 B
Go
|
package oclib
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
||
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||
|
)
|
||
|
|
||
|
type Workflow struct {
|
||
|
utils.AbstractObject
|
||
|
w.AbstractWorkflow
|
||
|
}
|
||
|
|
||
|
func (d *Workflow) GetName() string {
|
||
|
return d.Name
|
||
|
}
|
||
|
|
||
|
func (d *Workflow) GetAccessor() utils.Accessor {
|
||
|
data := &WorkflowMongoAccessor{}
|
||
|
data.SetLogger(utils.WORKFLOW)
|
||
|
return data
|
||
|
}
|
||
|
|
||
|
func (dma *Workflow) Deserialize(j map[string]interface{}) utils.DBObject {
|
||
|
b, err := json.Marshal(j)
|
||
|
if err != nil {
|
||
|
return nil
|
||
|
}
|
||
|
json.Unmarshal(b, dma)
|
||
|
return dma
|
||
|
}
|
||
|
|
||
|
func (dma *Workflow) Serialize() map[string]interface{} {
|
||
|
var m map[string]interface{}
|
||
|
b, err := json.Marshal(dma)
|
||
|
if err != nil {
|
||
|
return nil
|
||
|
}
|
||
|
json.Unmarshal(b, dma)
|
||
|
return m
|
||
|
}
|