Skip to content

Commit e7f4c45

Browse files
committed
docs: add documentation to add policies and attributes
* adjust documentation structure to align with TRG1 * add documentation to add policies and policy attributes Refs: #178 #197
1 parent a3c9d6f commit e7f4c45

21 files changed

+147
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This repository contains the backend code for the Policy-Hub written in C#.
44

5-
For **information about the policy hub**, please refer to the documentation, especially the context and scope section in the [architecture documentation](./docs/technical-documentation/architecture).
5+
For **information about the policy hub**, please refer to the documentation, especially the context and scope section in the [architecture documentation](./docs/architecture).
66

77
For **installation** details, please refer to the [README.md](./charts/policy-hub/README.md) of the provided helm chart.
88

@@ -25,7 +25,7 @@ dotnet run
2525

2626
## Known Issues and Limitations
2727

28-
See [Known Knowns](/docs/technical-documentation/known-knowns/known-issues-and-limitations.md).
28+
See [Known Knowns](/docs/known-knowns/known-issues-and-limitations.md).
2929

3030
## Notice for Docker image
3131

docs/admin/add-data-process/index.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Summary
2+
3+
The following documentation gives an overview of how to add additional data to the Policy Hub.
4+
5+
## Adding new Policies
6+
7+
To add new policies the following steps must be executed:
8+
9+
### Add Policy
10+
11+
To add new Attributes you need to add an entry to the [policies](/src/database/PolicyHub.Migrations/Seeder/Data/policies.json) Seeding file.
12+
13+
The entry should look like the following:
14+
15+
```json
16+
{
17+
"id": "uuid for the policy, this is needed in the process later on",
18+
"kind_id": "one of the policy kinds mentioned below (as number)",
19+
"technical_key": "the technical key which is used to query it later in the process",
20+
"description": "a description of the policy",
21+
"is_active": "either true if the attribute should be active or false if the attribute shouldn't be active",
22+
"attribute_key_id": "one of the attribute keys mentioned below (as number)",
23+
},
24+
```
25+
26+
**PolicyKindId**
27+
28+
```c#
29+
public enum PolicyKindId
30+
{
31+
BusinessPartnerNumber = 1,
32+
Membership = 2,
33+
Framework = 3,
34+
Purpose = 4,
35+
Dismantler = 5,
36+
ContractReference = 6
37+
}
38+
```
39+
40+
**Attribute Keys**
41+
42+
```c#
43+
public enum AttributeKeyId
44+
{
45+
Regex = 1,
46+
Static = 2,
47+
DynamicValue = 3,
48+
Brands = 4,
49+
Version = 5
50+
}
51+
```
52+
53+
### Assign policy to type
54+
55+
The created policy must be assigned to at least one policy type. To assign the policy to a type you need to add an entry to the [policy_assigned_types](/src/database/PolicyHub.Migrations/Seeder/Data/policy_assigned_types.json) Seeding file.
56+
57+
The entry should look like the following:
58+
59+
```json
60+
{
61+
"policy_id": "value of the id column of the newly added policy",
62+
"policy_type_id": "one of the policy type ids mentioned below (as number)",
63+
"is_active": "either true if the attribute should be active or false if the attribute shouldn't be active"
64+
}
65+
```
66+
67+
**PolicyTypeId**
68+
69+
```c#
70+
public enum PolicyTypeId
71+
{
72+
Access = 1,
73+
Usage = 2
74+
}
75+
```
76+
77+
### Assign policy to use case
78+
79+
The created policy must be assigned to at least one use case. To assign the policy to a use case you need to add an entry to the [policy_assigned_use_cases](/src/database/PolicyHub.Migrations/Seeder/Data/policy_assigned_use_cases.json) Seeding file.
80+
81+
The entry should look like the following:
82+
83+
```json
84+
{
85+
"policy_id": "value of the id column of the newly added policy",
86+
"use_case_id": "one of the use case ids mentioned below (as number)",
87+
"is_active": "either true if the attribute should be active or false if the attribute shouldn't be active"
88+
}
89+
```
90+
91+
**UseCaseId**
92+
93+
```c#
94+
public enum UseCaseId
95+
{
96+
Traceability = 1,
97+
Quality = 2,
98+
PCF = 3,
99+
Behavioraltwin = 4,
100+
Businesspartner = 5,
101+
CircularEconomy = 6,
102+
DemandCapacity = 7
103+
}
104+
```
105+
106+
## Adding new Attributes
107+
108+
To add new Attributes you need to add an entry to the [policy_attributes](/src/database/PolicyHub.Migrations/Seeder/Data/policy_attributes.json) Seeding file.
109+
110+
The entry should look like the following:
111+
112+
```json
113+
{
114+
"id": "uuid",
115+
"policy_id": "id of an policy you want to link the attribute to",
116+
"key": "one of the attribute keys mentioned above (as number)",
117+
"attribute_value": "the specific value of the attribute you want to set",
118+
"is_active": "either true if the attribute should be active or false if the attribute shouldn't be active"
119+
}
120+
```
121+
122+
Depending on the attribute key which is set the output will slightly change. A regex Attribute will check the set value of a policy if it matches the regex. A dynamic value will take the user input of the value field. If non is set by the user `{dynamicValue}` is taken. For `Static`, `Brands` and `Version` Attributes the value will just render the content of the `attribute_value` column.
123+
124+
To make a Attribute available it must be set to `is_active` = `true` and a link to a use case must be added. For that a new entry in the [policy_attribute_assigned_use_cases](/src/database/PolicyHub.Migrations/Seeder/Data/policy_attribute_assigned_use_cases.json) must be added. The entry should look like the following:
125+
126+
```json
127+
{
128+
"attribute_id": "value of the id column of the newly added policy_attribute",
129+
"use_case_id": "one of the use case ids mentioned above (as number)",
130+
"is_active": "either true if the attribute should be active or false if the attribute shouldn't be active"
131+
}
132+
```
133+
134+
It is possible to link an attribute to multiple UseCases.
135+
136+
## NOTICE
137+
138+
This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).
139+
140+
- SPDX-License-Identifier: Apache-2.0
141+
- SPDX-FileCopyrightText: 2024 Contributors to the Eclipse Foundation
142+
- Source URL: https://github.com/eclipse-tractusx/policy-hub

docs/technical-documentation/release-process/Release Process.md renamed to docs/admin/release-process/Release Process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Be aware that migrations coming release branches for release candidates or from
3333

3434
The version needs to be updated in the `src` directory within the 'Directory.Build.props' file.
3535

36-
Also, bump the chart and app version in the [Chart.yaml](../../../charts/policy-hub/Chart.yaml) and the version of the images in the [values.yaml](../../../charts/policy-hub/values.yaml).
36+
Also, bump the chart and app version in the [Chart.yaml](../../../charts/policy-hub/Chart.yaml) and the version of the images in the [values.yaml](../../../charts/charts/policy-hub/values.yaml).
3737

3838
_Consortia relevant: Update the version of the targetRevision tag in the [argocd-app-templates](../../../consortia/argocd-app-templates/), used for consortia-environments._
3939

docs/technical-documentation/requests/example-requests.md renamed to docs/api/requests/example-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Multiple constrains example:
217217

218218
```
219219

220-
If you want to try it out, check the [postman collection](/docs/developer/Technical-Documentation/requests/policy-hub.postman_collection.json)
220+
If you want to try it out, check the [postman collection](./policy-hub.postman_collection.json)
221221

222222
## NOTICE
223223

docs/technical-documentation/architecture/Development Concept.md renamed to docs/architecture/Development Concept.md

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

33
## Build, test, deploy
44

5-
Details to the build, test and deploy process can get found under the following md file: [Release Process](/docs/technical-documentation/release-process/Release%20Process.md)
5+
Details to the build, test and deploy process can get found under the following md file: [Release Process](/docs/admin/release-process/Release%20Process.md)
66

77
## Development Guidelines
88

0 commit comments

Comments
 (0)