test copy
This commit is contained in:
@@ -57,8 +57,6 @@ type WorkflowResource struct {
|
||||
WorkflowID string `bson:"workflow_id,omitempty" json:"workflow_id,omitempty"`
|
||||
}
|
||||
|
||||
func (d *WorkflowResource) BindID(id string) { d.WorkflowID = id }
|
||||
|
||||
func (d *WorkflowResource) GetAccessor() utils.Accessor {
|
||||
data := &WorkflowResourceMongoAccessor{}
|
||||
data.SetLogger(utils.WORKFLOW_RESOURCE)
|
||||
|
@@ -21,6 +21,17 @@ func (wfa *WorkflowResourceMongoAccessor) StoreOne(data utils.DBObject) (utils.D
|
||||
return wfa.GenericStoreOne(data, wfa)
|
||||
}
|
||||
|
||||
func (wfa *WorkflowResourceMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
res, _, _ := wfa.LoadOne(data.GetID())
|
||||
data.(*WorkflowResource).WorkflowID = data.GetID()
|
||||
if res == nil {
|
||||
return wfa.GenericStoreOne(data, wfa)
|
||||
} else {
|
||||
data.(*WorkflowResource).UUID = res.GetID()
|
||||
return wfa.GenericUpdateOne(data.Serialize(), res.GetID(), wfa)
|
||||
}
|
||||
}
|
||||
|
||||
func (wfa *WorkflowResourceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
var workflow WorkflowResource
|
||||
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
|
||||
|
Reference in New Issue
Block a user