Skip to content

Commit 52ca9f0

Browse files
committed
Documented company/03-api.
1 parent 1f02a62 commit 52ca9f0

File tree

30 files changed

+337
-386
lines changed

30 files changed

+337
-386
lines changed

00-docs/src/docs/company/02-bpmn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Use this to add Company specific BPMN stuff like business objects used in all projects.
44

5-
The following structure is generated by `../helperCompany.scala init`:
5+
The following structure is generated by `./helperCompany.scala init`:
66

77
```bash
88
02-bpmn/src

00-docs/src/docs/company/03-api.md

Lines changed: 166 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 03-api
22
Use this to add Company specific API stuff like the configuration of the projects within the Company.
33

4-
The following structure is generated by `../helperCompany.scala init`:
4+
The following structure is generated by `./helperCompany.scala init`:
55

66
```bash
77
03-api/src
@@ -15,38 +15,193 @@ The following structure is generated by `../helperCompany.scala init`:
1515

1616
The Company's base class to generate the API documentation and API Clients for Postman.
1717

18-
Example:
18+
Example (generated by `./helperCompany.scala init`):
1919

20-
```scala mdoc
20+
```scala
2121
import camundala.api.*
2222

2323
trait CompanyApiCreator extends ApiCreator, ApiDsl, CamundaPostmanApiCreator:
2424

2525
// override the config if needed
2626
protected def apiConfig: ApiConfig = CompanyApiCreator.apiConfig
27-
28-
lazy val companyDescr = ??? //TODO Add your Company Description!
27+
28+
lazy val companyProjectVersion = BuildInfo.version
2929

3030
object CompanyApiCreator:
31-
lazy val apiConfig = ApiConfig(companyId = "mycompany")
31+
lazy val apiConfig = ApiConfig(companyName = "mycompany")
3232
end CompanyApiCreator
3333
```
3434

3535
## ApiConfig
36-
You can define the project structure.
36+
You can customize the API Configuration.
37+
38+
Here an example:
39+
40+
```scala mdoc
41+
import camundala.api.ApiConfig
42+
43+
lazy val apiConfig: ApiConfig =
44+
ApiConfig("mycompany")
45+
.withTenantId("mycompany")
46+
.withDocBaseUrl(s"http://mycompany.ch/bpmnDocs")
47+
.withJiraUrls("COM" -> "https://issue.mycompany.ch/browse")
48+
```
49+
50+
## Default ApiConfig
51+
This is the default Configuration:
52+
```scala
53+
// your company name like 'mycompany'
54+
companyName: String,
55+
// define tenant if you have one - used for the Postman OpenApi
56+
tenantId: Option[String] = None,
57+
// contact email / phone, if there are questions
58+
contact: Option[Contact] = None,
59+
// REST endpoint (for testing API)
60+
endpoint: String = "http://localhost:8080/engine-rest",
61+
// Base Path of your project (if changed - all doc paths will be adjusted)
62+
basePath: os.Path = os.pwd,
63+
// If you work with JIRA, you can add matchers that will create automatically URLs to JIRA Tasks
64+
jiraUrls: Map[String, String] = Map.empty,
65+
// Configure your project setup
66+
projectsConfig: ProjectsConfig = ProjectsConfig(),
67+
// Configure your template generation
68+
modelerTemplateConfig: ModelerTemplateConfig = ModelerTemplateConfig(),
69+
// The URL of your published documentations
70+
// s"http://myCompany/bpmnDocs"
71+
docBaseUrl: Option[String] = None,
72+
// Path, where the Git Projects are cloned - for dependency check.
73+
// the default is for the structure: dev-myCompany/projects/myProject
74+
tempGitDir: os.Path = os.pwd / os.up / os.up / "git-temp"
75+
```
76+
77+
## ProjectsConfig
78+
You can configure your projects.
3779

3880
Here an example:
3981

4082
```scala mdoc
4183
import camundala.api.*
4284

43-
lazy val apiConfig =
44-
ApiConfig(companyId = "mycompany")
45-
85+
lazy val projectsConfig = ProjectsConfig(
86+
// Path to your ApiProjectConf - default is os.pwd / PROJECT.conf
87+
projectConfPath = os.rel / "src" / "main" / "resources" / "myproject.conf",
88+
// grouped configs per GitRepos - so it is possible to use projects from different Repos
89+
perGitRepoConfigs = Seq(myCompanyGitRepoConfig)
90+
)
91+
92+
lazy val myCompanyGitRepoConfig = ProjectsPerGitRepoConfig(
93+
// Base URL for the Git Repos
94+
// The pattern must be $cloneBaseUrl/$projectName.git
95+
cloneBaseUrl = "ssh://git@mycompany.com:2222/myrepo",
96+
// Definition of the projects
97+
projects = myProjects
98+
)
99+
100+
lazy val myProjects = Seq(`mycompany-services`, `mycompany-finances`, `mycompany-employees`)
101+
102+
lazy val `mycompany-services` = ProjectConfig(
103+
// Name of the project
104+
name = "mycompany-services",
105+
// you can group your projects - for better overview
106+
group = services,
107+
// the color of your project - for better overview and visualization in the BPMN diagrams
108+
color = "blue"
109+
)
110+
111+
lazy val `mycompany-finances` = ???
112+
lazy val `mycompany-employees` = ???
113+
lazy val services = ProjectGroup(
114+
name = "services",
115+
// line color
116+
color = "purple",
117+
fill = "#ddd"
118+
)
119+
120+
```
121+
122+
@:callout(info)
123+
All other information is taken automatically from the _ApiProjectConf_.
124+
@:@
125+
126+
## Standard Features:
127+
128+
With the API Creator you get a lot of features out of the box.
129+
130+
#### README
131+
If you have a read me in your base path (`config.basePath / "README.md`),
132+
we integrate it automatically in the documentation - as a visible part.
133+
134+
#### CHANGELOG
135+
If you have a change log in your base path (`config.basePath / "CHANGELOG.md`),
136+
we integrate it automatically in the documentation - as a collapsed part.
137+
138+
#### General Variables
139+
General variables that are supported in any Process- and/or ExternalTask-Worker are documented - in a collapsed part.
140+
By default, the following Variables are supported:
141+
142+
```scala mdoc
143+
enum InputParams:
144+
// mocking
145+
case servicesMocked
146+
case mockedWorkers
147+
case outputMock
148+
case outputServiceMock
149+
// mapping
150+
case manualOutMapping
151+
case outputVariables
152+
case handledErrors
153+
case regexHandledErrors
154+
// authorization
155+
case impersonateUserId
156+
// ..
157+
end InputParams
158+
```
159+
That expects that your implementation can handle these variables.
160+
161+
@:callout(info)
162+
If you are using our Workers they are supported out of the box!
163+
@:@
164+
165+
If you only want to support some of them, you can override them:
166+
167+
```scala
168+
override def supportedVariables: Seq[InputParams] = Seq(
169+
servicesMocked,
170+
outputMock,
171+
outputServiceMock,
172+
handledErrors,
173+
regexHandledErrors,
174+
impersonateUserId
175+
)
176+
```
46177

178+
#### Jira Tickets
179+
We replace configured JIRA Ticket pattern with its URL.
180+
181+
Configuration:
182+
```scala
183+
override protected def apiConfig: ApiConfig =
184+
super.apiConfig
185+
.withJiraUrls(JIRA_PROJECT -> JIRA_URL)
47186
```
48187

188+
- JIRA_PROJECT: The shortcut for the JIRA Project (prefix of jira ticket number).
189+
- JIRA_URL: The base URL to browse JIRA tickets, e.g. `https://issue.mycompany.ch/browse`.
190+
191+
Now in the Change Log all occurrences of the regex `JIRA_PROJECT-(\\d+)` (-> `JIRA_TICKET`)
192+
will be replaced with `[JIRA_TICKET]($url/JIRA_TICKET)`.
193+
In the generated documentation this is a link to the according Jira ticket.
194+
195+
#### BPMN diagrams
196+
BPMN- and DMN diagrams are integrated in the documentation.
197+
198+
They are referenced in the OpenApi.html and can be opened directly from there.
199+
There are 3 ways:
200+
201+
1. As an image in the documentation
202+
2. As a link to download the BPMN-/ DMN-diagram
203+
3. As SVG image to show the diagram in the browser (you can zoom in and out)
49204

50205
@:callout(info)
51-
Documentation of `companyDescr` will be in every API documentation. So ones per project.
206+
This is only working if you upload your BPMN- and DMN-diagrams to a Web server (via WebDAV).
52207
@:@

00-docs/src/docs/company/04-helper.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# 04-helper
1+
# 04-helper
2+
3+
### CompanyDevHelper
4+
With the `CompanyDevHelper` you can customize _Camundala_ for your Company:
5+
6+
```scala mdoc
7+
import camundala.api.*
8+
import camundala.helper.dev.DevHelper
9+
import camundala.helper.util.*
10+
11+
case class CompanyDevHelper(projectName: String, subProjects: Seq[String] = Seq.empty)
12+
extends DevHelper:
13+
14+
lazy val apiConfig: ApiConfig = ApiConfig("mycompany")//.withTenantId("mycompany")...
15+
16+
def deployConfig: Option[DeployConfig] = ???
17+
def devConfig: DevConfig = ???
18+
def dockerConfig: DockerConfig = ???
19+
20+
```

00-docs/src/docs/company/development.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ chmod +x helper.scala
1010
```
1111

1212
@:callout(info)
13-
To update this project, use `../helperCompany init` - see [Init Company].
13+
To update this project, use `cd ..` and then `./helperCompany init` - see [Init Company].
1414
@:@
1515

1616
## publish
17-
17+
TODO
1818
## prepareDocs
19-
19+
TODO
2020
## publishDocs
21+
TODO

0 commit comments

Comments
 (0)