differentiate links and cells post unmarshalling
This commit is contained in:
@@ -62,6 +62,8 @@ type Workflow struct {
|
||||
MxgraphXML string `description:"State of the mxgraph"`
|
||||
}
|
||||
|
||||
// TODO : describe what use case this interface satisfies
|
||||
|
||||
type ResourceObject interface {
|
||||
getHost() *string
|
||||
getName() *string
|
||||
@@ -536,6 +538,11 @@ func ParseMxGraph(username, workflowName, xmlData string) (err error, mxissues [
|
||||
return err, nil
|
||||
}
|
||||
|
||||
err = xmlModel.createLinks()
|
||||
if err != nil {
|
||||
logs.Alert("Error creating links")
|
||||
return err, nil
|
||||
}
|
||||
// Move the attribute of the object's tags into the mxCell's for an easier processing
|
||||
|
||||
// currentWorkflow.extractMxCell(xmlModel)
|
||||
@@ -597,21 +604,9 @@ func (ws Workspace) ConsumeMxGraphModel(xmlmodel MxGraphModel) (returned_wf *Wor
|
||||
return xmlmodel.Root.MxCell[i].RID != nil
|
||||
})
|
||||
|
||||
|
||||
|
||||
// For each cell of the xml graph,
|
||||
// in the case cell has a rID retrieve its rType from the value of rID of the component in the worfklow
|
||||
// retrieve the component's type
|
||||
// create an object from the rType
|
||||
// update the existing workflow with the new component
|
||||
// or by defautlt : the cell represents an arrow
|
||||
// if the source or the target of the arrow is a datacenter
|
||||
// define which end of the arrow is the DC
|
||||
// if the other other end of the arrow is a computing component
|
||||
// create a computing object
|
||||
// attach the DC to it
|
||||
// update the workflow with the object : create the list of this type of component or update the list with the id of the component with the object
|
||||
|
||||
// Create the object and add it to the appropriate list
|
||||
// for all the components with setting, which are identified
|
||||
// by a MxObject tag in the xml
|
||||
for _, object := range *xmlmodel.Root.MxObject{
|
||||
|
||||
resObj, err, mxissues := returned_wf.mxCellToComponent(object.MxCell,ws)
|
||||
@@ -656,6 +651,9 @@ func (ws Workspace) ConsumeMxGraphModel(xmlmodel MxGraphModel) (returned_wf *Wor
|
||||
sourceObj := returned_wf.GetResource(cell.Source)
|
||||
targetObj := returned_wf.GetResource(cell.Target)
|
||||
|
||||
link := NewLink(sourceObj,targetObj)
|
||||
_ = link
|
||||
|
||||
if sourceObj == nil || targetObj == nil {
|
||||
if sourceObj == nil && targetObj == nil {
|
||||
issues = append(issues, errors.New("Arrow "+cell.ID+" is alone"))
|
||||
|
||||
Reference in New Issue
Block a user