add workflow func tools

This commit is contained in:
mr 2024-10-03 17:13:50 +02:00
parent 34212e86a5
commit 91128313fc

View File

@ -26,24 +26,6 @@ type AbstractWorkflow struct {
Shared []string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workflow Shared []string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workflow
} }
func (w AbstractWorkflow) isADependancy(id string) (bool, []string) {
dependancyOfIDs := []string{}
isDeps := false
for _, link := range w.Graph.Links {
source := w.Graph.Items[link.Destination.ID].Processing
if id == link.Source.ID && source != nil {
isDeps = true
dependancyOfIDs = append(dependancyOfIDs, link.Destination.ID)
}
wourceWF := w.Graph.Items[link.Destination.ID].Workflow
if id == link.Source.ID && wourceWF != nil {
isDeps = true
dependancyOfIDs = append(dependancyOfIDs, link.Destination.ID)
}
}
return isDeps, dependancyOfIDs
}
func (w *AbstractWorkflow) GetStoragesByRelatedProcessing(processingID string, relatedToData bool, ignoreRelation bool) (map[string][]utils.DBObject, map[string]map[string][]utils.DBObject) { func (w *AbstractWorkflow) GetStoragesByRelatedProcessing(processingID string, relatedToData bool, ignoreRelation bool) (map[string][]utils.DBObject, map[string]map[string][]utils.DBObject) {
storages := make(map[string][]utils.DBObject) storages := make(map[string][]utils.DBObject)
datasRelatedToStorage := make(map[string]map[string][]utils.DBObject) datasRelatedToStorage := make(map[string]map[string][]utils.DBObject)