Skip to content

Commit 4ec1964

Browse files
Merge pull request #1060 from eclipse-tractusx/feat/create-master-data-via-ui
feat/create master data via UI
2 parents d6ae7f4 + e24269b commit 4ec1964

48 files changed

Lines changed: 2319 additions & 307 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,71 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v5.0.0
9+
10+
The following Changelog lists the changes. Please refer to the [documentation](docs/README.md) for configuration needs and understanding the concept changes.
11+
12+
The **need for configuration updates** is **marked bold**.
13+
14+
### Added
15+
16+
- added Master data page for viewing all materials and option to add material as an admin ([#1044](https://github.com/eclipse-tractusx/puris/pull/1044))
17+
- added Partner table and creation modal to Master data page ([#1054](https://github.com/eclipse-tractusx/puris/pull/1054))
18+
- added Material-Partner Relation table and creation modal to master data page ([#1059](https://github.com/eclipse-tractusx/puris/pull/1059))
19+
20+
### Changed
21+
22+
- /
23+
24+
### Fixes
25+
26+
- /
27+
28+
### Known Knowns
29+
30+
#### Running With Shared DTR and EDC
31+
32+
PURIS FOSS may not be run on a shared DTR and EDC with full scope. See [Admin Guide](docs/admin/Admin_Guide.md#running-the-puris-foss-application-on-shared-enablement-services) for more information of possible scenarios.
33+
34+
#### Upgradeability
35+
36+
Data base migrations are performed but assets.
37+
38+
#### Data Sovereignty
39+
40+
For productive use the following enhancements are encouraged
41+
42+
* User FrontEnd available: Role Company Admin is able to query catalogue and see negotiations and transfers But company rules / policies need to be configured upfront in backend (via postman) to enable automatic contract negotiations, responsibility lies with Company Admin role
43+
--> add section in the User Manual describing this and the (legal) importance and responsibility behind defining these rules
44+
* Currently only one standard policy per reg. connector / customer instance is supported (more precisely one for DTR, one for all submodels), negotiation happens automatically based on this
45+
--> enhance option to select partner and define specific policies (to be planned in context of BPDM Integration)
46+
--> UI for specific configuration by dedicated role (e.g. Comp Admin) and more flexible policy configuration (withoutv code changes) is needed
47+
* As a non-Admin user I do not have ability to view policies in detail
48+
--> transparency for users when interacting with and requesting / consuming data via dashboard / views on underlying usage policies to be enhanced
49+
* ContractReference Constraint or configuration of policies specific to one partner only has notnot implemented
50+
--> clarification of potential reference to "PURIS standard contract" and enabling of ContractReference for 24.08.
51+
* unclear meaning of different stati in negotations
52+
--> add view of successfull contract agreeements wrt which data have been closed
53+
* current logging only done on info level
54+
--> enhance logging of policies (currently only available at debug level)
55+
* in case of non-matching policies (tested in various scenarios) no negotiation takes place
56+
--> enhance visualization or specific Error message to user
57+
* no validation of the Schema "profile": "cx-policy:profile2405" (required to ensure interop with other PURIS apps)
58+
59+
#### Styleguide
60+
61+
##### Overall
62+
63+
* Brief description at the top of each page describing content would be nice for better user experience.
64+
65+
##### Catalog
66+
67+
* No action possible -> unclear to user when and how user will consume an offer
68+
69+
##### Negotiations
70+
71+
* Add filters for transparency (bpnl, state)
72+
873
## v4.1.1
974

1075
The following Changelog lists the changes. Please refer to the [documentation](docs/README.md) for configuration needs and understanding the concept changes.

DEPENDENCIES_BACKEND

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.19.2, Apache-2.0 AN
66
maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.19.2, Apache-2.0, approved, #21909
77
maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.19.2, Apache-2.0, approved, #21912
88
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jakarta-jsonp/2.19.2, Apache-2.0, approved, #20841
9-
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.19.2, Apache-2.0, approved, clearlydefined
9+
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.19.2, Apache-2.0, approved, #24939
1010
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.19.2, Apache-2.0, approved, #23299
11-
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.19.2, Apache-2.0, approved, clearlydefined
11+
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.19.2, Apache-2.0, approved, #24938
1212
maven/mavencentral/com.fasterxml/classmate/1.7.1, Apache-2.0, approved, #24482
1313
maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949
1414
maven/mavencentral/com.github.virtuald/curvesapi/1.08, BSD-3-Clause AND Apache-2.0, approved, #23170

DEPENDENCIES_FRONTEND

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ npm/npmjs/-/inline-style-parser/0.1.1, MIT, approved, #2971
2929
npm/npmjs/-/is-arrayish/0.2.1, MIT, approved, clearlydefined
3030
npm/npmjs/-/is-buffer/2.0.5, MIT, approved, clearlydefined
3131
npm/npmjs/-/is-core-module/2.15.1, MIT, approved, clearlydefined
32-
npm/npmjs/-/is-number/7.0.0, MIT, approved, clearlydefined
32+
npm/npmjs/-/is-number/7.0.0, MIT, approved, #24836
3333
npm/npmjs/-/is-plain-obj/4.1.0, MIT, approved, clearlydefined
3434
npm/npmjs/-/js-sha256/0.11.0, MIT, approved, clearlydefined
3535
npm/npmjs/-/json-parse-even-better-errors/2.3.1, MIT, approved, clearlydefined
@@ -61,13 +61,13 @@ npm/npmjs/-/micromark-util-subtokenize/1.1.0, MIT, approved, clearlydefined
6161
npm/npmjs/-/micromark-util-symbol/1.1.0, MIT, approved, clearlydefined
6262
npm/npmjs/-/micromark-util-types/1.1.0, MIT, approved, clearlydefined
6363
npm/npmjs/-/micromark/3.2.0, MIT, approved, clearlydefined
64-
npm/npmjs/-/micromatch/4.0.8, MIT, approved, clearlydefined
64+
npm/npmjs/-/micromatch/4.0.8, MIT, approved, #24818
6565
npm/npmjs/-/minimatch/9.0.3, ISC, approved, #9190
6666
npm/npmjs/-/minimatch/9.0.5, ISC, approved, #9190
6767
npm/npmjs/-/mri/1.2.0, MIT, approved, clearlydefined
6868
npm/npmjs/-/parse-json/5.2.0, MIT, approved, clearlydefined
6969
npm/npmjs/-/path-parse/1.0.7, MIT, approved, clearlydefined
70-
npm/npmjs/-/picocolors/1.1.1, ISC, approved, clearlydefined
70+
npm/npmjs/-/picocolors/1.1.1, ISC, approved, #24873
7171
npm/npmjs/-/postcss/8.4.49, MIT, approved, #3545
7272
npm/npmjs/-/property-information/6.5.0, MIT, approved, clearlydefined
7373
npm/npmjs/-/querystringify/2.2.0, MIT, approved, clearlydefined
@@ -88,7 +88,7 @@ npm/npmjs/-/source-map/0.5.7, BSD-3-Clause, approved, #2400
8888
npm/npmjs/-/space-separated-tokens/2.0.2, MIT, approved, clearlydefined
8989
npm/npmjs/-/style-to-object/0.4.4, MIT, approved, #6637
9090
npm/npmjs/-/supports-preserve-symlinks-flag/1.0.0, MIT, approved, clearlydefined
91-
npm/npmjs/-/to-regex-range/5.0.1, MIT, approved, clearlydefined
91+
npm/npmjs/-/to-regex-range/5.0.1, MIT, approved, #24810
9292
npm/npmjs/-/trim-lines/3.0.1, MIT, approved, clearlydefined
9393
npm/npmjs/-/trough/2.2.0, MIT, approved, clearlydefined
9494
npm/npmjs/-/ts-api-utils/1.4.3, MIT, approved, #17411
@@ -106,7 +106,7 @@ npm/npmjs/-/vfile/5.3.7, MIT, approved, clearlydefined
106106
npm/npmjs/-/vite/5.4.11, MIT AND (ISC AND MIT) AND (Apache-2.0 AND BSD-2-Clause AND BlueOak-1.0.0 AND CC0-1.0 AND ISC AND MIT) AND (BSD-3-Clause AND MIT) AND ISC AND (BSD-2-Clause AND BSD-3-Clause), approved, #15844
107107
npm/npmjs/-/websocket-driver/0.7.4, Apache-2.0, approved, clearlydefined
108108
npm/npmjs/-/websocket-extensions/0.1.4, Apache-2.0, approved, CQ23021
109-
npm/npmjs/-/yaml/1.10.2, ISC, approved, clearlydefined
109+
npm/npmjs/-/yaml/1.10.2, ISC, approved, #24847
110110
npm/npmjs/@babel/runtime/7.24.0, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13900
111111
npm/npmjs/@catena-x/portal-shared-components/2.1.31, Apache-2.0 AND CC-BY-4.0, approved, #10502
112112
npm/npmjs/@emotion/babel-plugin/11.13.5, MIT AND (BSD-2-Clause AND MIT), approved, #17718

backend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</parent>
3434
<groupId>org.eclipse.tractusx.puris</groupId>
3535
<artifactId>puris-backend</artifactId>
36-
<version>4.1.1</version>
36+
<version>5.0.0</version>
3737
<name>puris-backend</name>
3838
<description>PURIS Backend</description>
3939
<properties>

backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/controller/MaterialController.java

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,41 @@
2121
*/
2222
package org.eclipse.tractusx.puris.backend.masterdata.controller;
2323

24-
import io.swagger.v3.oas.annotations.Operation;
25-
import io.swagger.v3.oas.annotations.Parameter;
26-
import io.swagger.v3.oas.annotations.media.Content;
27-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
28-
import io.swagger.v3.oas.annotations.responses.ApiResponses;
29-
import jakarta.validation.Validator;
30-
import lombok.extern.slf4j.Slf4j;
24+
import java.util.Base64;
25+
import java.util.List;
26+
import java.util.NoSuchElementException;
27+
import java.util.regex.Pattern;
28+
import java.util.stream.Collectors;
29+
30+
import javax.management.openmbean.KeyAlreadyExistsException;
31+
3132
import org.eclipse.tractusx.puris.backend.common.util.PatternStore;
3233
import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material;
3334
import org.eclipse.tractusx.puris.backend.masterdata.logic.dto.MaterialEntityDto;
3435
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialRefreshService;
3536
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService;
3637
import org.modelmapper.ModelMapper;
3738
import org.springframework.beans.factory.annotation.Autowired;
39+
import org.springframework.http.HttpStatus;
3840
import org.springframework.http.HttpStatusCode;
3941
import org.springframework.http.ResponseEntity;
4042
import org.springframework.security.access.prepost.PreAuthorize;
41-
import org.springframework.web.bind.annotation.*;
43+
import org.springframework.web.bind.annotation.GetMapping;
44+
import org.springframework.web.bind.annotation.PostMapping;
45+
import org.springframework.web.bind.annotation.PutMapping;
46+
import org.springframework.web.bind.annotation.RequestBody;
47+
import org.springframework.web.bind.annotation.RequestMapping;
48+
import org.springframework.web.bind.annotation.RequestParam;
49+
import org.springframework.web.bind.annotation.RestController;
50+
import org.springframework.web.server.ResponseStatusException;
4251

43-
import java.util.Base64;
44-
import java.util.List;
45-
import java.util.regex.Pattern;
46-
import java.util.stream.Collectors;
52+
import io.swagger.v3.oas.annotations.Operation;
53+
import io.swagger.v3.oas.annotations.Parameter;
54+
import io.swagger.v3.oas.annotations.media.Content;
55+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
56+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
57+
import jakarta.validation.Validator;
58+
import lombok.extern.slf4j.Slf4j;
4759

4860
@RestController
4961
@RequestMapping("materials")
@@ -71,31 +83,32 @@ public class MaterialController {
7183
@ApiResponse(responseCode = "409", description = "Material with the given ownMaterialNumber already exists."),
7284
@ApiResponse(responseCode = "500", description = "Internal Server error.")
7385
})
74-
public ResponseEntity<?> createMaterial(@RequestBody MaterialEntityDto materialDto) {
86+
public MaterialEntityDto createMaterial(@RequestBody MaterialEntityDto materialDto) {
7587
if(!validator.validate(materialDto).isEmpty()) {
7688
log.warn("Rejected invalid message body.");
77-
return ResponseEntity.status(400).build();
89+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Material is invalid.");
7890
}
7991
if (materialDto.getOwnMaterialNumber() == null || materialDto.getOwnMaterialNumber().isEmpty()) {
8092
// Cannot create material without ownMaterialNumber
81-
return new ResponseEntity<>(HttpStatusCode.valueOf(400));
93+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Material information misses material identification.");
8294
}
8395
if (materialService.findByOwnMaterialNumber(materialDto.getOwnMaterialNumber()) != null) {
8496
// Cannot create material, ownMaterialNumber is already assigned
85-
return new ResponseEntity<>(HttpStatusCode.valueOf(409));
97+
throw new ResponseStatusException(HttpStatus.CONFLICT, "Material already exists. Use PUT instead.");
8698
}
8799
Material createdMaterial;
88100
try {
89-
createdMaterial = modelMapper.map(materialDto, Material.class);
90-
} catch (Exception e) {
91-
return new ResponseEntity<>(HttpStatusCode.valueOf(400));
101+
Material entity = modelMapper.map(materialDto, Material.class);
102+
createdMaterial = materialService.create(entity);
103+
} catch (KeyAlreadyExistsException e) {
104+
throw new ResponseStatusException(HttpStatus.CONFLICT, "Material already exists. Use PUT instead.");
105+
} catch (IllegalArgumentException e) {
106+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Material is invalid.");
107+
} catch (IllegalStateException e) {
108+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage());
92109
}
93110

94-
createdMaterial = materialService.create(createdMaterial);
95-
if (createdMaterial == null) {
96-
return new ResponseEntity<>(HttpStatusCode.valueOf(500));
97-
}
98-
return new ResponseEntity<>(HttpStatusCode.valueOf(200));
111+
return modelMapper.map(createdMaterial, MaterialEntityDto.class);
99112
}
100113

101114
@PreAuthorize("hasRole('PURIS_ADMIN')")
@@ -107,32 +120,29 @@ public ResponseEntity<?> createMaterial(@RequestBody MaterialEntityDto materialD
107120
@ApiResponse(responseCode = "404", description = "No existing Material Entity found, no update was performed."),
108121
@ApiResponse(responseCode = "500", description = "Internal Server Error.")
109122
})
110-
public ResponseEntity<?> updateMaterial(@RequestBody MaterialEntityDto materialDto) {
123+
public MaterialEntityDto updateMaterial(@RequestBody MaterialEntityDto materialDto) {
111124
if(!validator.validate(materialDto).isEmpty()) {
112125
log.warn("Rejected invalid message body.");
113-
return ResponseEntity.status(400).build();
126+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Material is invalid.");
114127
}
115128
if (materialDto.getOwnMaterialNumber() == null || materialDto.getOwnMaterialNumber().isEmpty()) {
116129
// Cannot update material without ownMaterialNumber
117-
return new ResponseEntity<>(HttpStatusCode.valueOf(400));
118-
}
119-
Material existingMaterial = materialService.findByOwnMaterialNumber(materialDto.getOwnMaterialNumber());
120-
if (existingMaterial == null) {
121-
// Cannot update non-existent Material
122-
return new ResponseEntity<>(HttpStatusCode.valueOf(404));
130+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Material information misses material identification.");
123131
}
124132
Material updatedMaterial;
125133
try {
126-
updatedMaterial = modelMapper.map(materialDto, Material.class);
134+
Material entity = modelMapper.map(materialDto, Material.class);
135+
updatedMaterial = materialService.update(entity);
136+
} catch (NoSuchElementException e) {
137+
throw new ResponseStatusException(HttpStatus.NOT_FOUND, e.getMessage());
138+
} catch (IllegalArgumentException e) {
139+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage());
127140
} catch (Exception e) {
128-
return new ResponseEntity<>(HttpStatusCode.valueOf(400));
129-
}
130-
updatedMaterial = materialService.update(updatedMaterial);
131-
if (updatedMaterial == null) {
132-
return new ResponseEntity<>(HttpStatusCode.valueOf(500));
141+
log.error("Unexpected error while updating material", e);
142+
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Internal Server Error");
133143
}
134144

135-
return new ResponseEntity<>(HttpStatusCode.valueOf(200));
145+
return modelMapper.map(updatedMaterial, MaterialEntityDto.class);
136146
}
137147

138148
@GetMapping

0 commit comments

Comments
 (0)