|
1 | 1 | package camundala.helper.dev.company
|
2 | 2 |
|
3 |
| -import camundala.helper.dev.update.createOrUpdate |
| 3 | +import camundala.helper.dev.update.createIfNotExists |
4 | 4 | import camundala.helper.util.*
|
5 | 5 |
|
6 | 6 | case class CompanyWrapperGenerator()(using config: DevConfig):
|
7 | 7 |
|
8 | 8 | lazy val generate: Unit =
|
9 |
| - createOrUpdate(projectDevPath, helperConfig) |
| 9 | + createIfNotExists(projectBpmnPath, bpmnWrapper) |
| 10 | + createIfNotExists(projectApiPath, apiWrapper) |
| 11 | + createIfNotExists(projectDmnPath, dmnWrapper) |
| 12 | + createIfNotExists(projectSimulationPath, simulationWrapper) |
| 13 | + createIfNotExists(projectWorkerPath, workerWrapper) |
| 14 | + createIfNotExists(projectHelperPath, helperWrapper) |
10 | 15 |
|
11 | 16 | private lazy val companyName = config.companyName
|
12 |
| - private lazy val helperPath = |
13 |
| - config.projectDir / ModuleConfig.helperModule.packagePath(config.projectPath) |
14 |
| - private lazy val projectDevPath = helperPath / "CompanyDevHelper.scala" |
15 |
| - |
16 |
| - private lazy val helperConfig = |
17 |
| - objectContent("CompanyDevHelper"): |
18 |
| - s""" |
19 |
| - | def config(projectName: String, subProjects: Seq[String] = Seq.empty): DevConfig = |
20 |
| - | DevConfig.defaultConfig(projectName) //TODO Implement your Config! |
21 |
| - | .copy(subProjects = subProjects) |
22 |
| - |""".stripMargin |
23 |
| - end helperConfig |
24 |
| - |
25 |
| - private def objectContent(objName: String)(body: String) = |
| 17 | + |
| 18 | + private lazy val projectBpmnPath = ModuleConfig.bpmnModule.srcPath / "CompanyBpmnDsl.scala" |
| 19 | + private lazy val projectApiPath = ModuleConfig.apiModule.srcPath / "CompanyApiCreator.scala" |
| 20 | + private lazy val projectDmnPath = ModuleConfig.dmnModule.srcPath / "CompanyDmnTester.scala" |
| 21 | + private lazy val projectSimulationPath = ModuleConfig.simulationModule.testPath / "CompanySimulation.scala" |
| 22 | + private lazy val projectWorkerPath = ModuleConfig.workerModule.srcPath / "CompanyWorkerHandler.scala" |
| 23 | + private lazy val projectHelperPath = ModuleConfig.helperModule.srcPath / "CompanyDevHelper.scala" |
| 24 | + |
| 25 | + private lazy val bpmnWrapper = |
| 26 | + s"""package $companyName.camundala.bpmn |
| 27 | + | |
| 28 | + |import camundala.bpmn.* |
| 29 | + |import camundala.domain.* |
| 30 | + | |
| 31 | + |/** |
| 32 | + | * Add here company specific stuff, like documentation or custom elements. |
| 33 | + | */ |
| 34 | + |trait CompanyBpmnDsl |
| 35 | + | |
| 36 | + |trait CompanyBpmnProcessDsl extends BpmnProcessDsl, CompanyBpmnDsl |
| 37 | + |trait CompanyBpmnServiceTaskDsl extends BpmnServiceTaskDsl, CompanyBpmnDsl |
| 38 | + |trait CompanyBpmnCustomTaskDsl extends BpmnCustomTaskDsl, CompanyBpmnDsl |
| 39 | + |trait CompanyBpmnDecisionDsl extends BpmnDecisionDsl, CompanyBpmnDsl |
| 40 | + |trait CompanyBpmnUserTaskDsl extends BpmnUserTaskDsl, CompanyBpmnDsl |
| 41 | + |trait CompanyBpmnMessageEventDsl extends BpmnMessageEventDsl, CompanyBpmnDsl |
| 42 | + |trait CompanyBpmnSignalEventDsl extends BpmnSignalEventDsl, CompanyBpmnDsl |
| 43 | + |trait CompanyBpmnTimerEventDsl extends BpmnTimerEventDsl, CompanyBpmnDsl |
| 44 | + |""".stripMargin |
| 45 | + |
| 46 | + private lazy val apiWrapper = |
| 47 | + s"""package $companyName.camundala.api |
| 48 | + | |
| 49 | + |import camundala.api.* |
| 50 | + | |
| 51 | + |/** |
| 52 | + | * Add here company specific stuff, to create the Api documentation and the Postman collection. |
| 53 | + | */ |
| 54 | + |trait CompanyApiCreator extends ApiCreator, ApiDsl, CamundaPostmanApiCreator: |
| 55 | + | |
| 56 | + | // override the config if needed |
| 57 | + | //override protected def apiConfig: ApiConfig = ??? |
| 58 | + | |
| 59 | + | lazy val companyDescr = ??? //TODO Add your Company Description! |
| 60 | + |""".stripMargin |
| 61 | + |
| 62 | + private lazy val dmnWrapper = |
| 63 | + s"""package $companyName.camundala.dmn |
| 64 | + | |
| 65 | + |import camundala.dmn.* |
| 66 | + | |
| 67 | + |/** |
| 68 | + | * Add here company specific stuff, to run the DMN Tester. |
| 69 | + | */ |
| 70 | + |trait CompanyDmnTester extends DmnTesterConfigCreator, DmnTesterStarter: |
| 71 | + | |
| 72 | + | def starterConfig: DmnTesterStarterConfig = |
| 73 | + | DmnTesterStarterConfig( // adjust paths if needed |
| 74 | + | companyName = "$companyName", |
| 75 | + | ) |
| 76 | + |""".stripMargin |
| 77 | + |
| 78 | + private lazy val simulationWrapper = |
| 79 | + s"""package $companyName.camundala.simulation |
| 80 | + | |
| 81 | + |import camundala.simulation.custom.* |
| 82 | + | |
| 83 | + |/** |
| 84 | + | * Add here company specific stuff, to run the Simulations. |
| 85 | + | */ |
| 86 | + |trait CompanySimulation extends BasicSimulationDsl: |
| 87 | + | |
| 88 | + | override implicit def config = |
| 89 | + | super.config //TODO Adjust config if needed |
| 90 | + |""".stripMargin |
| 91 | + |
| 92 | + private lazy val workerWrapper = |
| 93 | + s"""package $companyName.camundala.worker |
| 94 | + | |
| 95 | + |import camundala.camunda7.worker.C7WorkerHandler |
| 96 | + |import camundala.worker.* |
| 97 | + | |
| 98 | + |import scala.reflect.ClassTag |
| 99 | + | |
| 100 | + |/** |
| 101 | + | * Add here company specific stuff, to run the Workers. |
| 102 | + | * You also define the implementation of the WorkerHandler here. |
| 103 | + | */ |
| 104 | + |trait CompanyWorkerHandler extends C7WorkerHandler |
| 105 | + | |
| 106 | + |trait CompanyInitWorkerDsl[ |
| 107 | + | In <: Product: InOutCodec, |
| 108 | + | Out <: Product: InOutCodec, |
| 109 | + | InitIn <: Product: InOutCodec, |
| 110 | + | InConfig <: Product: InOutCodec |
| 111 | + |] extends CompanyWorkerHandler, InitWorkerDsl[In, Out, InitIn, InConfig] |
| 112 | + | |
| 113 | + |trait CompanyValidationWorkerDsl[ |
| 114 | + | In <: Product: InOutCodec |
| 115 | + |] extends CompanyWorkerHandler, ValidationWorkerDsl[In] |
| 116 | + | |
| 117 | + |trait CompanyCustomWorkerDsl[ |
| 118 | + | In <: Product: InOutCodec, |
| 119 | + | Out <: Product: InOutCodec |
| 120 | + |] extends CompanyWorkerHandler, CustomWorkerDsl[In, Out] |
| 121 | + | |
| 122 | + |trait CompanyServiceWorkerDsl[ |
| 123 | + | In <: Product: InOutCodec, |
| 124 | + | Out <: Product: InOutCodec, |
| 125 | + | ServiceIn: InOutEncoder, |
| 126 | + | ServiceOut: InOutDecoder: ClassTag |
| 127 | + |] extends CompanyWorkerHandler, ServiceWorkerDsl[In, Out, ServiceIn, ServiceOut] |
| 128 | + |""".stripMargin |
| 129 | + |
| 130 | + private lazy val helperWrapper = |
26 | 131 | s"""package $companyName.camundala.helper
|
27 | 132 | |
|
28 | 133 | |import camundala.helper.dev.*
|
29 | 134 | |import camundala.helper.util.*
|
30 | 135 | |
|
31 |
| - |object $objName: |
| 136 | + |object CompanyDevHelper: |
32 | 137 | |
|
33 |
| - |$body |
34 |
| - |end $objName""".stripMargin |
| 138 | + | def config(projectName: String, subProjects: Seq[String] = Seq.empty): DevConfig = |
| 139 | + | DevConfig.defaultConfig(projectName) //TODO Implement your Config! |
| 140 | + | .copy(subProjects = subProjects) |
| 141 | + |""".stripMargin |
| 142 | + end helperWrapper |
| 143 | + |
| 144 | + extension (module: ModuleConfig) |
| 145 | + def srcPath: os.Path = |
| 146 | + config.projectDir / module.packagePath( |
| 147 | + config.projectPath |
| 148 | + ) |
| 149 | + def testPath: os.Path = |
| 150 | + config.projectDir / module.packagePath( |
| 151 | + config.projectPath, |
| 152 | + mainOrTest = "test" |
| 153 | + ) |
35 | 154 | end CompanyWrapperGenerator
|
0 commit comments