# Issue DL as Flow

  • Edit DlFlow.kflow and insert the below content to create a DrivingLicence flow.
//Change the DrivingLicence flow as follows,
task IssueDL {
    input(applicantId, firstName, lastName, age)
    realizer flow  IssueDL(Issue)   
  }

  flow IssueDL {
  document(applicationId:String, firstName:String,lastName:String, 
    age:Int,dateIssued:DateTime,licenseNumber:String?
  ) display-id("${firstName} ${lastName}")
  
  task CollectInfo {    
      realizer manual(RTO) distribution(system)
  }
  task MakePayment {
      realizer manual(Applicant) distribution(system)
  }
  
  task ProcessInfo {    
      realizer deferred
  }
  task SendDL {
    output(licenseNumber!)
      realizer auto
  }
  net Issue {
    init-document(applicationId, firstName,lastName,age,dateIssued)
    START out(CollectInfo)
    connector C1 in(CollectInfo) out(MakePayment)
    connector C2 in(MakePayment) out(ProcessInfo)
    END in(SendDL)
  }
}
  • Implement IssueDLTaskMapReduceCode.scala
 def map(input: Input): com.metastay.dlflow.flow.issuedl.IssueDLIssueInitDocument =  {
          new IssueDLIssueInitDocument(applicationId = input.applicantId,firstName = input.firstName, lastName = input.lastName, age = input.age, dateIssued = grab[TimeService].now)
     }
     def reduce(input:Input, doc: com.metastay.dlflow.flow.issuedl.IssueDLDocument): Output = Output()

  • Delete IssueDLTaskCode.scala file

  • to run the project go to command line.

$[drivingLicence] run

# Gompa Setup For SubFlow

Need to set up Gompa for sub flow Issue DL.

# Execute Flow

Now we are ready to add issue Dl as a separate flow,which is an enhancement without altering the existing functionality.