2024-07-19 10:54:58 +02:00
|
|
|
package oclib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2024-07-19 12:57:25 +02:00
|
|
|
"fmt"
|
2024-07-19 10:54:58 +02:00
|
|
|
|
|
|
|
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
|
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Workflow struct {
|
2024-07-19 13:15:51 +02:00
|
|
|
utils.AbstractObject
|
2024-07-19 10:54:58 +02:00
|
|
|
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)
|
2024-07-19 12:57:25 +02:00
|
|
|
fmt.Println(j, dma)
|
2024-07-19 10:54:58 +02:00
|
|
|
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
|
|
|
|
}
|