Setup
This commit is contained in:
@@ -132,6 +132,7 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
|||||||
},
|
},
|
||||||
"ComputeUnit": func() resources.ResourceInterface {
|
"ComputeUnit": func() resources.ResourceInterface {
|
||||||
return &resources.ComputeResource{
|
return &resources.ComputeResource{
|
||||||
|
|
||||||
AbstractInstanciatedResource: resources.AbstractInstanciatedResource[*resources.ComputeResourceInstance]{
|
AbstractInstanciatedResource: resources.AbstractInstanciatedResource[*resources.ComputeResourceInstance]{
|
||||||
Instances: []*resources.ComputeResourceInstance{},
|
Instances: []*resources.ComputeResourceInstance{},
|
||||||
},
|
},
|
||||||
@@ -146,6 +147,7 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
|||||||
for n, new := range resourceCatalog {
|
for n, new := range resourceCatalog {
|
||||||
if strings.Contains(line, n+"(") && !strings.Contains(line, "!procedure") { // should exclude declaration of type.
|
if strings.Contains(line, n+"(") && !strings.Contains(line, "!procedure") { // should exclude declaration of type.
|
||||||
newRes := new()
|
newRes := new()
|
||||||
|
newRes.SetID(uuid.New().String())
|
||||||
varName, graphItem, err := d.extractResourcePlantUML(line, newRes, n, request.PeerID)
|
varName, graphItem, err := d.extractResourcePlantUML(line, newRes, n, request.PeerID)
|
||||||
fmt.Println(varName, graphItem, err)
|
fmt.Println(varName, graphItem, err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -231,11 +233,10 @@ func (d *Workflow) extractLink(line string, graphVarName map[string]*graph.Graph
|
|||||||
link.Source = tmp
|
link.Source = tmp
|
||||||
}
|
}
|
||||||
splittedComments := strings.Split(line, "'")
|
splittedComments := strings.Split(line, "'")
|
||||||
if len(splittedComments) <= 1 {
|
if len(splittedComments) > 1 {
|
||||||
return errors.New("Can't deserialize Object, there's no commentary")
|
|
||||||
}
|
|
||||||
comment := strings.ReplaceAll(splittedComments[1], "'", "") // for now it's a json.
|
comment := strings.ReplaceAll(splittedComments[1], "'", "") // for now it's a json.
|
||||||
json.Unmarshal([]byte(comment), link)
|
json.Unmarshal([]byte(comment), link)
|
||||||
|
}
|
||||||
d.Graph.Links = append(d.Graph.Links, *link)
|
d.Graph.Links = append(d.Graph.Links, *link)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -257,7 +258,7 @@ func (d *Workflow) extractResourcePlantUML(line string, resource resources.Resou
|
|||||||
if len(splitted) <= 1 {
|
if len(splitted) <= 1 {
|
||||||
return "", nil, errors.New("Can't deserialize Object, there's no name")
|
return "", nil, errors.New("Can't deserialize Object, there's no name")
|
||||||
}
|
}
|
||||||
resource.SetName(splitted[1])
|
resource.SetName(strings.ReplaceAll(splitted[1], "\\\\n", ""))
|
||||||
|
|
||||||
splittedComments := strings.Split(line, "'")
|
splittedComments := strings.Split(line, "'")
|
||||||
if len(splittedComments) > 1 {
|
if len(splittedComments) > 1 {
|
||||||
@@ -291,12 +292,10 @@ func (d *Workflow) getNewGraphItem(dataName string, resource resources.ResourceI
|
|||||||
case "Data":
|
case "Data":
|
||||||
d.Datas = append(d.Datas, resource.GetID())
|
d.Datas = append(d.Datas, resource.GetID())
|
||||||
d.DataResources = append(d.DataResources, resource.(*resources.DataResource))
|
d.DataResources = append(d.DataResources, resource.(*resources.DataResource))
|
||||||
fmt.Println("r", graphItem, resource)
|
|
||||||
graphItem.Data = resource.(*resources.DataResource)
|
graphItem.Data = resource.(*resources.DataResource)
|
||||||
case "Processing":
|
case "Processing":
|
||||||
d.Processings = append(d.Processings, resource.GetID())
|
d.Processings = append(d.Processings, resource.GetID())
|
||||||
d.ProcessingResources = append(d.ProcessingResources, resource.(*resources.ProcessingResource))
|
d.ProcessingResources = append(d.ProcessingResources, resource.(*resources.ProcessingResource))
|
||||||
fmt.Println("r", graphItem, resource)
|
|
||||||
graphItem.Processing = resource.(*resources.ProcessingResource)
|
graphItem.Processing = resource.(*resources.ProcessingResource)
|
||||||
case "Event":
|
case "Event":
|
||||||
access := resources.NewAccessor[*resources.NativeTool](tools.NATIVE_TOOL, &tools.APIRequest{
|
access := resources.NewAccessor[*resources.NativeTool](tools.NATIVE_TOOL, &tools.APIRequest{
|
||||||
@@ -310,12 +309,10 @@ func (d *Workflow) getNewGraphItem(dataName string, resource resources.ResourceI
|
|||||||
case "Storage":
|
case "Storage":
|
||||||
d.Storages = append(d.Storages, resource.GetID())
|
d.Storages = append(d.Storages, resource.GetID())
|
||||||
d.StorageResources = append(d.StorageResources, resource.(*resources.StorageResource))
|
d.StorageResources = append(d.StorageResources, resource.(*resources.StorageResource))
|
||||||
fmt.Println("r", graphItem, resource)
|
|
||||||
graphItem.Storage = resource.(*resources.StorageResource)
|
graphItem.Storage = resource.(*resources.StorageResource)
|
||||||
case "ComputeUnit":
|
case "ComputeUnit":
|
||||||
d.Computes = append(d.Computes, resource.GetID())
|
d.Computes = append(d.Computes, resource.GetID())
|
||||||
d.ComputeResources = append(d.ComputeResources, resource.(*resources.ComputeResource))
|
d.ComputeResources = append(d.ComputeResources, resource.(*resources.ComputeResource))
|
||||||
fmt.Println("r", graphItem, resource)
|
|
||||||
graphItem.Compute = resource.(*resources.ComputeResource)
|
graphItem.Compute = resource.(*resources.ComputeResource)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user