TIBCOSoftware / flogo-cli

Project Flogo Command Line Interface
http://flogo.io
BSD 3-Clause "New" or "Revised" License
57 stars 28 forks source link

Added logic to traverse new app model and find all dependencies #87

Closed vijaynalawade closed 6 years ago

vijaynalawade commented 6 years ago

Added traversing logic which is model independent. It will gather all dependencies(ref value) from application json.

Used below app for testing.

{ 
   "name":"test",
   "type":"flogo:app",
   "version":"0.0.1",
   "appModel":"1.0.0",
   "description":"My flogo application description",
   "triggers":[ 
      { 
         "id":"my_rest_trigger",
         "ref":"github.com/TIBCOSoftware/flogo-contrib/trigger/rest",
         "settings":{ 
            "port":"9233"
         },
         "handlers":[ 
            { 
               "action": { 
                   "ref":"github.com/TIBCOSoftware/flogo-contrib/action/flow",
                   "data":{ 
                          "flowURI":"res://flow:myflow"
                    },
                   "mappings":{ 
                       "input":[ 
                        ],
                       "output":[ 
                       ]
                   }
                },
               "settings":{ 
                  "method":"GET",
                  "path":"/test"
               }
            }
         ]
      }
   ],
   "resources":[ 
      { 
         "id":"flow:myflow",
         "data": {
            "name": "My Flow",
            "description": "Example description",
            "metadata":{ 
               "input":[ 
                  { "name":"customerId", "type":"string" },
                  { "name":"orderId", "type":"string" }
               ],
               "output":[ 
                  { "name":"value", "type":"string" }
               ]
            },
            "tasks":[ 
               { 
                  "id":"FirstLog",
                  "type":"iterator",
                  "settings":{ 
                     "iterate":"10"
                  },
                  "activity":{ 
                     "ref":"github.com/TIBCOSoftware/flogo-contrib/activity/log",
                     "output":{ },
                     "mappings":{ 
                        "input":[ 
                           { 
                              "type":"assign",
                              "value":"$current.iteration.key",
                              "mapTo":"message"
                           }
                        ]
                     }
                  }
               },
               { 
                  "id":"SecondLog",
                  "activity":{ 
                     "ref":"github.com/TIBCOSoftware/flogo-contrib/activity/log",
                     "input":{ 
                        "message": "test message"
                     },
                     "output":{ },
                     "mappings":{ }
                  }
               }
            ],
            "links":[ 
               { 
                  "from":"FirstLog",
                  "to":"SecondLog",
                  "type":"expression",
                  "value":"$flow.orderId > 1000"
               }
            ]
         },
         "errorHandler": {
           "tasks": [
             { 
                "id":"SecondLog",
                "activity":{ 
                "ref":"github.com/TIBCOSoftware/flogo-contrib/activity/log",
                "input":{ 
                  "message": "log in error handler"
                },
               "output":{ },
               "mappings":{ }
             }
           }
         ]
       }
     }
   ]
}