|
| 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 |
0 commit comments