lightest + clearest code
This commit is contained in:
@@ -18,12 +18,8 @@ import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/collaborative_area"
|
||||
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
|
||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/compute"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/processing"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
||||
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||
@@ -452,73 +448,73 @@ func CopyOne(collection LibDataEnum, object map[string]interface{}, peerID strin
|
||||
|
||||
// ================ CAST ========================= //
|
||||
|
||||
func (l *LibData) ToDataResource() *data.DataResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.DATA_RESOURCE.String() {
|
||||
return l.Data.(*data.DataResource)
|
||||
func (l *LibData) ToDataResource() *resources.DataResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.DATA_RESOURCE {
|
||||
return l.Data.(*resources.DataResource)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToComputeResource() *compute.ComputeResource {
|
||||
if l.Data != nil && l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COMPUTE_RESOURCE.String() {
|
||||
return l.Data.(*compute.ComputeResource)
|
||||
func (l *LibData) ToComputeResource() *resources.ComputeResource {
|
||||
if l.Data != nil && l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COMPUTE_RESOURCE {
|
||||
return l.Data.(*resources.ComputeResource)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToStorageResource() *storage.StorageResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.STORAGE_RESOURCE.String() {
|
||||
return l.Data.(*storage.StorageResource)
|
||||
func (l *LibData) ToStorageResource() *resources.StorageResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.STORAGE_RESOURCE {
|
||||
return l.Data.(*resources.StorageResource)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToProcessingResource() *processing.ProcessingResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.PROCESSING_RESOURCE.String() {
|
||||
return l.Data.(*processing.ProcessingResource)
|
||||
func (l *LibData) ToProcessingResource() *resources.ProcessingResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.PROCESSING_RESOURCE {
|
||||
return l.Data.(*resources.ProcessingResource)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToWorkflowResource() *w.WorkflowResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW_RESOURCE.String() {
|
||||
return l.Data.(*w.WorkflowResource)
|
||||
func (l *LibData) ToWorkflowResource() *resources.WorkflowResource {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW_RESOURCE {
|
||||
return l.Data.(*resources.WorkflowResource)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToPeer() *peer.Peer {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.PEER.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.PEER {
|
||||
return l.Data.(*peer.Peer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToWorkflow() *w2.Workflow {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW {
|
||||
return l.Data.(*w2.Workflow)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToWorkspace() *workspace.Workspace {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKSPACE.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKSPACE {
|
||||
return l.Data.(*workspace.Workspace)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToCollaborativeArea() *collaborative_area.CollaborativeArea {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COLLABORATIVE_AREA.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COLLABORATIVE_AREA {
|
||||
return l.Data.(*collaborative_area.CollaborativeArea)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToRule() *rule.Rule {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COLLABORATIVE_AREA.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.COLLABORATIVE_AREA {
|
||||
return l.Data.(*rule.Rule)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToWorkflowExecution() *workflow_execution.WorkflowExecution {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW_EXECUTION.String() {
|
||||
if l.Data.GetAccessor("", []string{}, nil).GetType() == tools.WORKFLOW_EXECUTION {
|
||||
return l.Data.(*workflow_execution.WorkflowExecution)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user