- if (localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) != null) {
- if (localContext.getAttribute(FlowControllerConstants.GENERATION_NODE) != null) {
- GraphExecutor transactionExecutor = new GraphExecutor();
- Boolean generatorExists = transactionExecutor.hasGraph(
- "APPC_COMMOM",
- localContext.getAttribute(FlowControllerConstants.GENERATION_NODE),
- null,
- "sync");
-
- if (generatorExists) {
- flowSequnce = transactionExecutor.executeGraph(
- "APPC_COMMOM",
- localContext.getAttribute(FlowControllerConstants.GENERATION_NODE),
- null, "sync", null)
- .getProperty(FlowControllerConstants.FLOW_SEQUENCE);
- } else {
- throw new Exception("Can not find Custom defined Flow Generator for "
- + localContext.getAttribute(FlowControllerConstants.GENERATION_NODE));
- }
-
- } else if ((localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE))
- .equalsIgnoreCase(FlowControllerConstants.DESINGTIME)) {
-
- localContext.setAttribute(FlowControllerConstants.VNFC_TYPE,
- ctx.getAttribute(FlowControllerConstants.VNFC_TYPE));
- flowSequnce = dbservice.getDesignTimeFlowModel(localContext);
-
- if (flowSequnce == null) {
- throw new Exception("Flow Sequence is not found User Desinged VNF "
- + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
- }
-
- } else if ((localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE))
- .equalsIgnoreCase(FlowControllerConstants.RUNTIME)) {
-
- Transaction transaction = new Transaction();
- String input = collectInputParams(ctx,transaction);
- log.info("CollectInputParamsData-Input: " + input);
-
- RestExecutor restExe = new RestExecutor();
- Map<String,String> flowSeq = restExe.execute(transaction, localContext);
-
- JSONObject sequence = new JSONObject(flowSeq.get("restResponse"));
- if (sequence.has("output")) {
- flowSequnce = sequence.getJSONObject("output").toString();
- }
- log.info("MultistepSequenceGenerator-Output: " + flowSequnce);
-
- if (flowSequnce == null) {
- throw new Exception("Failed to get the Flow Sequece runtime for VNF type"
- + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
- }
-
- } else if ((localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE))
- .equalsIgnoreCase(FlowControllerConstants.EXTERNAL)) {
- //String input = collectInputParams(localContext);
- // flowSequnce = ""; //get it from the External interface calling the Rest End point - TBD
- //if(flowSequnce == null)
-
- throw new Exception("Flow Sequence not found for "
- + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
-
- } else {
- //No other type of model supported...
- //in Future can get flowModel from other generators which will be included here
- throw new Exception("No information found for sequence Owner Design-Time Vs Run-Time" );
- }