add workflow func tools
This commit is contained in:
		@@ -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)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user