From 7279d5aae55cc22018bcf2a8c8db71e0722d5175 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 29 Nov 2023 15:01:03 +0100 Subject: [PATCH 01/24] feat: initial commit --- .../DataInjectionCommandLineRunner.java | 48 ++- .../backend/stock/domain/model/ItemStock.java | 286 ++++++++++++++++++ .../repository/ItemStockRepository.java | 9 + .../stock/logic/service/ItemStockService.java | 81 +++++ 4 files changed, 420 insertions(+), 4 deletions(-) create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index b88edfd6..512c7a2e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -39,10 +39,7 @@ import org.eclipse.tractusx.puris.backend.stock.logic.adapter.ProductStockSammMapper; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.LocationIdTypeEnum; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.ProductStockSammDto; -import org.eclipse.tractusx.puris.backend.stock.logic.service.MaterialStockService; -import org.eclipse.tractusx.puris.backend.stock.logic.service.PartnerProductStockService; -import org.eclipse.tractusx.puris.backend.stock.logic.service.ProductStockRequestService; -import org.eclipse.tractusx.puris.backend.stock.logic.service.ProductStockService; +import org.eclipse.tractusx.puris.backend.stock.logic.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @@ -70,6 +67,9 @@ public class DataInjectionCommandLineRunner implements CommandLineRunner { @Autowired private ProductStockService productStockService; + @Autowired + private ItemStockService itemStockService; + @Autowired private PartnerProductStockService partnerProductStockService; @@ -219,6 +219,26 @@ private void setupCustomerRole() throws JsonProcessingException { log.info("SAMM-DTO:\n" + objectMapper.writeValueAsString(productStockSammDto)); log.info("Own Street and Number: " + variablesService.getOwnDefaultStreetAndNumber()); + + ItemStock.Builder builder = ItemStock.Builder.newInstance(); + var itemStock = builder + .customerOrderId("123") + .supplierOrderId("234") + .customerOrderPositionId("1") + .direction(ItemStock.Direction.INBOUND) + .materialNumberCustomer(semiconductorMatNbrCustomer) + .materialNumberSupplier(semiconductorMatNbrSupplier) + .measurementUnit(MeasurementUnit.piece) + .locationBpns(supplierPartner.getSites().first().getBpns()) + .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) + .partnerBpnl(supplierPartner.getBpnl()) + .quantity(5) + .build(); + itemStock = itemStockService.create(itemStock); + log.info("Created ItemStock: \n" + itemStock); + var foundItemStock = itemStockService.findAll().get(0); + log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); + log.info("\n" + foundItemStock); } /** @@ -264,6 +284,26 @@ private void setupSupplierRole() { findAllByMaterialNumberCustomer(semiconductorMatNbrCustomer, customerPartner); log.info(String.format("Found productStocks by material number and allocated to customer " + "bpnl: %s", foundProductStocks)); + + ItemStock.Builder builder = ItemStock.Builder.newInstance(); + var itemStock = builder + .customerOrderId("123") + .supplierOrderId("234") + .customerOrderPositionId("1") + .direction(ItemStock.Direction.OUTBOUND) + .materialNumberCustomer(semiconductorMatNbrCustomer) + .materialNumberSupplier(semiconductorMatNbrSupplier) + .measurementUnit(MeasurementUnit.piece) + .locationBpns(partnerService.getOwnPartnerEntity().getSites().first().getBpns()) + .locationBpna(partnerService.getOwnPartnerEntity().getSites().first().getAddresses().first().getBpna()) + .partnerBpnl(customerPartner.getBpnl()) + .quantity(10) + .build(); + itemStock = itemStockService.create(itemStock); + log.info("Created ItemStock: \n" + itemStock); + var foundItemStock = itemStockService.findAll().get(0); + log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); + log.info("\n" + foundItemStock); } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java new file mode 100644 index 00000000..f325748e --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -0,0 +1,286 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.model; + +import jakarta.persistence.Embeddable; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import lombok.*; +import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; + +import java.io.Serializable; +import java.util.Date; +import java.util.Objects; + +@NoArgsConstructor +@Entity +@ToString +public class ItemStock { + + + @Getter + @EmbeddedId + private Key key = new Key(); + private Date lastUpdatedOnDateTime; + + private QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); + @Getter + @Setter + private boolean isBlocked; + + public String getPartnerBpnl() { + return key.partnerBpnl; + } + + public String getMaterialNumberCustomer() { + return key.materialNumberCustomer; + } + + public String getMaterialNumberSupplier() { + return key.materialNumberSupplier; + } + + public String getMaterialGlobalAssetId() { + return key.getMaterialGlobalAssetId(); + } + + public Direction getDirection() { + return key.direction; + } + + public String getSupplierOrderId() { + return key.supplierOrderId; + } + + public String getCustomerOrderId() { + return key.customerOrderId; + } + + public String getCustomerOrderPositionId() { + return key.customerOrderPositionId; + } + + public String getLocationBpna() { + return key.locationBpna; + } + + public String getLocationBpns() { + return key.locationBpns; + } + + public Date getLastUpdatedOnDateTime() { + return (Date) lastUpdatedOnDateTime.clone(); + } + + public void setLastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { + this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; + } + + public MeasurementUnit getMeasurementUnit() { + return quantityOnAllocatedStock.getMeasurementUnit(); + } + + public Double getQuantityAmount() { + return quantityOnAllocatedStock.quantity; + } + + public void setQuantityAmount(double quantityAmount) { + quantityOnAllocatedStock.quantity = quantityAmount; + } + + public void setQuantityOnAllocatedStock(QuantityOnAllocatedStock quantityOnAllocatedStock) { + this.quantityOnAllocatedStock = quantityOnAllocatedStock; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ItemStock)) return false; + ItemStock itemStock = (ItemStock) o; + return key.equals(((ItemStock) o).key); + } + + @Override + public int hashCode() { + return key.hashCode(); + } + + + + @Embeddable + @Getter + @Setter + @ToString + public static class Key implements Serializable { + private String partnerBpnl; + private String materialNumberCustomer; + private String materialNumberSupplier; + private String materialGlobalAssetId; + private Direction direction; + private String supplierOrderId; + private String customerOrderId; + private String customerOrderPositionId; + private String locationBpna; + private String locationBpns; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Key)) return false; + Key key = (Key) o; + return Objects.equals(partnerBpnl, key.partnerBpnl) && Objects.equals(materialNumberCustomer, key.materialNumberCustomer) + && Objects.equals(materialNumberSupplier, key.materialNumberSupplier) && Objects.equals(materialGlobalAssetId, + key.materialGlobalAssetId) && direction == key.direction && Objects.equals(supplierOrderId, key.supplierOrderId) + && Objects.equals(customerOrderId, key.customerOrderId) && Objects.equals(customerOrderPositionId, key.customerOrderPositionId) + && Objects.equals(locationBpna, key.locationBpna) && Objects.equals(locationBpns, key.locationBpns); + } + + @Override + public int hashCode() { + return Objects.hash(partnerBpnl, materialNumberCustomer, materialNumberSupplier, materialGlobalAssetId, + direction, supplierOrderId, customerOrderId, customerOrderPositionId, locationBpna, locationBpns); + } + } + + + + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + @Embeddable + @ToString + public static class QuantityOnAllocatedStock { + private Double quantity; + private MeasurementUnit measurementUnit; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof QuantityOnAllocatedStock)) return false; + QuantityOnAllocatedStock that = (QuantityOnAllocatedStock) o; + return Objects.equals(quantity, that.quantity) && measurementUnit == that.measurementUnit; + } + + @Override + public int hashCode() { + return Objects.hash(quantity, measurementUnit); + } + } + + public static enum Direction { + INBOUND, OUTBOUND; + } + + public static class Builder { + + private Builder() { + } + + private String partnerBpnl; + private String materialNumberCustomer; + private String materialNumberSupplier; + private String materialGlobalAssetId; + private Direction direction; + private String supplierOrderId; + private String customerOrderId; + private String customerOrderPositionId; + private String locationBpna; + private String locationBpns; + private Date lastUpdatedOnDateTime; + private final QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); + private boolean isBlocked; + + public Builder partnerBpnl(String partnerBpnl) { + this.partnerBpnl = partnerBpnl; + return this; + } + + public Builder materialNumberCustomer(String materialNumberCustomer) { + this.materialNumberCustomer = materialNumberCustomer; + return this; + } + + public Builder materialNumberSupplier(String materialNumberSupplier) { + this.materialNumberSupplier = materialNumberSupplier; + return this; + } + + public Builder materialGlobalAssetId(String materialGlobalAssetId) { + this.materialGlobalAssetId = materialGlobalAssetId; + return this; + } + + public Builder direction(Direction direction) { + this.direction = direction; + return this; + } + + public Builder supplierOrderId(String supplierOrderId) { + this.supplierOrderId = supplierOrderId; + return this; + } + + public Builder customerOrderId(String customerOrderId) { + this.customerOrderId = customerOrderId; + return this; + } + + public Builder customerOrderPositionId(String customerOrderPositionId) { + this.customerOrderPositionId = customerOrderPositionId; + return this; + } + + public Builder locationBpna(String locationBpna) { + this.locationBpna = locationBpna; + return this; + } + + public Builder locationBpns(String locationBpns) { + this.locationBpns = locationBpns; + return this; + } + + public Builder lastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { + this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; + return this; + } + + + public Builder measurementUnit(MeasurementUnit measurementUnit) { + quantityOnAllocatedStock.measurementUnit = measurementUnit; + return this; + } + + public Builder quantity(double quantityAmount) { + quantityOnAllocatedStock.quantity = quantityAmount; + return this; + } + + public Builder isBlocked(boolean isBlocked) { + this.isBlocked = isBlocked; + return this; + } + + + public ItemStock build() { + ItemStock itemStock = new ItemStock(); + itemStock.key.partnerBpnl = partnerBpnl; + itemStock.key.materialNumberCustomer = materialNumberCustomer; + itemStock.key.materialNumberSupplier = materialNumberSupplier; + itemStock.key.materialGlobalAssetId = materialGlobalAssetId == null ? "" : materialGlobalAssetId; + itemStock.key.direction = direction; + itemStock.key.supplierOrderId = supplierOrderId; + itemStock.key.customerOrderId = customerOrderId; + itemStock.key.customerOrderPositionId = customerOrderPositionId; + itemStock.key.locationBpna = locationBpna; + itemStock.key.locationBpns = locationBpns; + itemStock.quantityOnAllocatedStock = quantityOnAllocatedStock; + itemStock.isBlocked = isBlocked; + itemStock.lastUpdatedOnDateTime = this.lastUpdatedOnDateTime == null ? new Date() : this.lastUpdatedOnDateTime; + return itemStock; + } + + public static Builder newInstance() { + return new Builder(); + } + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java new file mode 100644 index 00000000..55adb75a --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java @@ -0,0 +1,9 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.repository; + +import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ItemStockRepository extends JpaRepository { + + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java new file mode 100644 index 00000000..88a26b22 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -0,0 +1,81 @@ +package org.eclipse.tractusx.puris.backend.stock.logic.service; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +@Service +@RequiredArgsConstructor +@Slf4j +public class ItemStockService { + + private final ItemStockRepository itemStockRepository; + private final PartnerService partnerService; + private final MaterialPartnerRelationService mprService; + + public ItemStock create(ItemStock itemStock) { + if(!validate(itemStock)) { + return null; + } + return itemStockRepository.save(itemStock); + } + + public ItemStock update(ItemStock itemStock) { + if(!validate(itemStock)) { + return null; + } + if(itemStockRepository.findById(itemStock.getKey()).isEmpty()){ + return null; + } + return itemStockRepository.save(itemStock); + } + + public List findAll() { + return itemStockRepository.findAll(); + } + + private boolean validate(ItemStock itemStock) { + var key = itemStock.getKey(); + try { + Objects.requireNonNull(key.getPartnerBpnl(), "Missing PartnerBpnl"); + Objects.requireNonNull(key.getMaterialNumberCustomer(), "Missing materialNumberCustomer"); + Objects.requireNonNull(key.getMaterialNumberSupplier(), "Missing materialNumberSupplier"); + Objects.requireNonNull(key.getMaterialGlobalAssetId(), "Missing materialGlobalAssetId"); + Objects.requireNonNull(key.getDirection(), "Missing direction"); + Objects.requireNonNull(key.getSupplierOrderId(), "Missing supplierOrderId"); + Objects.requireNonNull(key.getCustomerOrderId(), "Missing customerOrderId"); + Objects.requireNonNull(key.getCustomerOrderPositionId(), "Missing customerOrderPositionId"); + Objects.requireNonNull(key.getLocationBpna(), "Missing locationBpna"); + Objects.requireNonNull(key.getLocationBpns(), "Missing locationBpns"); + Objects.requireNonNull(itemStock.getMeasurementUnit(), "Missing measurementUnit"); + Objects.requireNonNull(itemStock.getQuantityAmount(), "Missing quantityAmount"); + Objects.requireNonNull(itemStock.getLastUpdatedOnDateTime(), "Missing lastUpdatedOnTime"); + Partner partner = partnerService.findByBpnl(key.getPartnerBpnl()); + Objects.requireNonNull(partner, "Unknown partner: " + key.getPartnerBpnl()); + Partner mySelf = partnerService.getOwnPartnerEntity(); + Partner customer = key.getDirection() == ItemStock.Direction.INBOUND ? mySelf : partner; + Partner supplier = customer == mySelf ? partner : mySelf; + var stockBpns = supplier.getSites().stream() + .filter(site -> site.getBpns().equals(key.getLocationBpns())).findFirst().orElse(null); + Objects.requireNonNull(stockBpns, "Unknown Bpns: " + key.getLocationBpns()); + var stockBpna = supplier.getSites().stream().flatMap(site -> site.getAddresses().stream()) + .filter(address -> address.getBpna().equals(key.getLocationBpna())).findFirst().orElse(null); + Objects.requireNonNull(stockBpna, "Unknown Bpna: " + key.getLocationBpna()); + String ownMaterialNumber = mySelf == customer ? key.getMaterialNumberCustomer() : key.getMaterialNumberSupplier(); + var materialPartnerRelation = mprService.find(ownMaterialNumber, partner.getUuid()); + Objects.requireNonNull(materialPartnerRelation, "Missing MaterialPartnerRelation"); + } catch (Exception e) { + log.error("Validation failed: " + e.getMessage()); + return false; + } + return true; + } +} From b21077d3833ebf8989843c241448d176077b5684 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Fri, 1 Dec 2023 08:03:39 +0100 Subject: [PATCH 02/24] feat: added itemstocktest --- .../logic/ItemStockServiceTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java new file mode 100644 index 00000000..74a5b1fe --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -0,0 +1,72 @@ +package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; + +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.domain.repository.PartnerRepository; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerServiceImpl; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; +import org.eclipse.tractusx.puris.backend.stock.logic.service.ItemStockService; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; + +@DataJpaTest +public class ItemStockServiceTest { + + @Mock + private ItemStockRepository itemStockRepository; + @Mock + private PartnerRepository partnerRepository; + @InjectMocks + private PartnerServiceImpl partnerService; + @InjectMocks + private ItemStockService itemStockService; + private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; + private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; + + @Test + void storeAndFindItemStock() { + Partner supplierPartner = createAndGetSupplierPartner(); + ItemStock.Builder builder = ItemStock.Builder.newInstance(); + var itemStock = builder + .customerOrderId("123") + .supplierOrderId("234") + .customerOrderPositionId("1") + .direction(ItemStock.Direction.INBOUND) + .materialNumberCustomer(semiconductorMatNbrCustomer) + .materialNumberSupplier(semiconductorMatNbrSupplier) + .measurementUnit(MeasurementUnit.piece) + .locationBpns(supplierPartner.getSites().first().getBpns()) + .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) + .partnerBpnl(supplierPartner.getBpnl()) + .quantity(5) + .build(); + +// when(partnerRepository.) + + itemStock = itemStockService.create(itemStock); + var foundItemStock = itemStockService.findAll().get(0); + Assertions.assertEquals(itemStock, foundItemStock); + + } + + private Partner createAndGetSupplierPartner() { + Partner supplierPartnerEntity = new Partner( + "Scenario Supplier", + "http://supplier-control-plane:9184/api/v1/dsp", + "BPNL1234567890ZZ", + "BPNS1234567890ZZ", + "Konzernzentrale Dudelsdorf", + "BPNA1234567890AA", + "Heinrich-Supplier-Straße 1", + "77785 Dudelsdorf", + "Germany" + ); + supplierPartnerEntity = partnerService.create(supplierPartnerEntity); + supplierPartnerEntity = partnerService.findByUuid(supplierPartnerEntity.getUuid()); + return supplierPartnerEntity; + } +} From be348f6e73996312e033269d386cc692510d6cd5 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 4 Dec 2023 08:05:19 +0100 Subject: [PATCH 03/24] fix: some fixes --- .../DataInjectionCommandLineRunner.java | 4 +- .../stock/logic/service/ItemStockService.java | 4 ++ .../logic/ItemStockServiceTest.java | 32 +++++---- .../resources/application-customer.properties | 64 ------------------ .../resources/application-supplier.properties | 65 ------------------- 5 files changed, 27 insertions(+), 142 deletions(-) delete mode 100755 backend/src/test/resources/application-customer.properties delete mode 100644 backend/src/test/resources/application-supplier.properties diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 512c7a2e..0daf81f1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -236,7 +236,7 @@ private void setupCustomerRole() throws JsonProcessingException { .build(); itemStock = itemStockService.create(itemStock); log.info("Created ItemStock: \n" + itemStock); - var foundItemStock = itemStockService.findAll().get(0); + var foundItemStock = itemStockService.findById(itemStock.getKey()); log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); log.info("\n" + foundItemStock); } @@ -301,7 +301,7 @@ private void setupSupplierRole() { .build(); itemStock = itemStockService.create(itemStock); log.info("Created ItemStock: \n" + itemStock); - var foundItemStock = itemStockService.findAll().get(0); + var foundItemStock = itemStockService.findById(itemStock.getKey()); log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); log.info("\n" + foundItemStock); } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index 88a26b22..5e257a0e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -38,6 +38,10 @@ public ItemStock update(ItemStock itemStock) { return itemStockRepository.save(itemStock); } + public ItemStock findById(ItemStock.Key key) { + return itemStockRepository.findById(key).orElse(null); + } + public List findAll() { return itemStockRepository.findAll(); } diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index 74a5b1fe..a52e7e46 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -11,8 +11,11 @@ import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import static org.mockito.Mockito.when; + @DataJpaTest public class ItemStockServiceTest { @@ -29,7 +32,22 @@ public class ItemStockServiceTest { @Test void storeAndFindItemStock() { - Partner supplierPartner = createAndGetSupplierPartner(); + + Partner supplierPartner = getSupplierPartner(); + final var sp = supplierPartner; + ItemStock itemStock = getItemStock(supplierPartner); + final var is = itemStock; + when(partnerRepository.save(Mockito.any(Partner.class))).thenAnswer(i -> i.getArguments()[0]); + when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); + when(itemStockRepository.findById(Mockito.any(ItemStock.Key.class))).thenAnswer(x -> is); + + itemStock = itemStockService.create(itemStock); + var foundItemStock = itemStockService.findById(itemStock.getKey()); + Assertions.assertEquals(itemStock, foundItemStock); + + } + + private ItemStock getItemStock(Partner supplierPartner) { ItemStock.Builder builder = ItemStock.Builder.newInstance(); var itemStock = builder .customerOrderId("123") @@ -44,16 +62,10 @@ void storeAndFindItemStock() { .partnerBpnl(supplierPartner.getBpnl()) .quantity(5) .build(); - -// when(partnerRepository.) - - itemStock = itemStockService.create(itemStock); - var foundItemStock = itemStockService.findAll().get(0); - Assertions.assertEquals(itemStock, foundItemStock); - + return itemStock; } - private Partner createAndGetSupplierPartner() { + private Partner getSupplierPartner() { Partner supplierPartnerEntity = new Partner( "Scenario Supplier", "http://supplier-control-plane:9184/api/v1/dsp", @@ -65,8 +77,6 @@ private Partner createAndGetSupplierPartner() { "77785 Dudelsdorf", "Germany" ); - supplierPartnerEntity = partnerService.create(supplierPartnerEntity); - supplierPartnerEntity = partnerService.findByUuid(supplierPartnerEntity.getUuid()); return supplierPartnerEntity; } } diff --git a/backend/src/test/resources/application-customer.properties b/backend/src/test/resources/application-customer.properties deleted file mode 100755 index 631e7abf..00000000 --- a/backend/src/test/resources/application-customer.properties +++ /dev/null @@ -1,64 +0,0 @@ -# Server Config -server.port=${SERVER_PORT:8081} -my.base.url=http://host.minikube.internal -request.serverendpoint=${my.base.url}:${server.port}/catena/product-stock/request -request.apiassetid=product-stock-request-api -response.serverendpoint=${my.base.url}:${server.port}/catena/product-stock/response -response.apiassetid=product-stock-response-api -edr.endpoint=${my.base.url}:${server.port}/catena/edrendpoint -# DB Configuration -spring.datasource.driver-class-name=${DATASOURCE_DRIVERCLASSNAME:org.hsqldb.jdbc.JDBCDriver} -spring.datasource.url=${DATASOURCE_URL:jdbc:hsqldb:mem:testdb;DB_CLOSE_DELAY=-1} -spring.datasource.username=${DATASOURCE_USERNAME:sa} -spring.datasource.password=${DATASOURCE_PASSWORD:} -spring.jpa.hibernate.ddl-auto=create -# API Root -server.servlet.context-path=${API_ROOTDIR:/catena} -# EDC Config -edc.controlplane.host=${EDC_CONTROLPLANE_HOST:192.168.49.2} -edc.controlplane.data.path=/api/v1/data -edc.controlplane.data.port=${EDC_CONTROLPLANE_DATA_PORT:31944} -edc.controlplane.key=${EDC_CONTROLPLANE_KEY:password} - -edc.applydataplaneworkaround=true -edc.dataplane.public.port=31944 -minikube.ip=${MINIKUBE_IP:host.minikube.internal} -# Jackson (JSON) -#spring.jackson.default-property-inclusion=non_empty -#logging.level.org.hibernate.SQL=DEBUG -#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true - - -# Own EDC-IDS-URL -edc.idsUrl=${EDC_IDSURL:http://customer-control-plane:8184/api/v1/ids} - -# Own BPNL -own.bpnl=${OWN_BPNL:BPNL4444444444XX} - -# Own name (self-description) -own.name=${OWN_NAME:Scenario Customer} - -# Own BPNS (optional: if this is set, then set own.default.site.name as well) -own.default.bpns=${OWN_BPNS:BPNS4444444444XY} -# Name of Site (see above) -own.default.site.name=${OWN_SITE:Hauptwerk Musterhausen} - -# If a BPNS is set, then this BPNA will be attached to it. -# Otherwise, it will be attached immediately to the BPNL (see above) -own.default.bpna=${OWN_BPNS:BPNA4444444444ZZ} -own.default.streetandnumber=${OWN_STREETANDNUMBER:Musterstrasse 35b} -own.default.zipcodeandcity=${OWN_ZIPCODEANDCITY:77777 Musterhausen} -own.default.country=${OWN_COUNTRY:Germany} - -# The number of minutes before received authentication data -# in the context of a consumer pull is removed from memory -own.edr.deletiontimer=2 - -puris.apiversion=1.0.0 -puris.demonstrator.role=customer -puris.api.key=test -# run with: -# ./mvnw spring-boot:run -Dspring-boot.run.arguments=--spring.profiles.active=customer -# alternatively: -# ./mvnw spring-boot:run -Dspring-boot.run.arguments=--spring.config.location="./src/main/resources/application-customer.properties" diff --git a/backend/src/test/resources/application-supplier.properties b/backend/src/test/resources/application-supplier.properties deleted file mode 100644 index 8329b32f..00000000 --- a/backend/src/test/resources/application-supplier.properties +++ /dev/null @@ -1,65 +0,0 @@ -# Server Config -server.port=${SERVER_PORT:8082} -my.base.url=http://host.minikube.internal -request.serverendpoint=${my.base.url}:${server.port}/catena/product-stock/request -request.apiassetid=product-stock-request-api -response.serverendpoint=${my.base.url}:${server.port}/catena/product-stock/response -response.apiassetid=product-stock-response-api -edr.endpoint=${my.base.url}:${server.port}/catena/edrendpoint -# DB Configuration -spring.datasource.driver-class-name=${DATASOURCE_DRIVERCLASSNAME:org.hsqldb.jdbc.JDBCDriver} -spring.datasource.url=${DATASOURCE_URL:jdbc:hsqldb:mem:testdb;DB_CLOSE_DELAY=-1} -spring.datasource.username=${DATASOURCE_USERNAME:sa} -spring.datasource.password=${DATASOURCE_PASSWORD:} -spring.jpa.hibernate.ddl-auto=create -# API Root -server.servlet.context-path=${API_ROOTDIR:/catena} -# EDC Config -edc.controlplane.host=${EDC_CONTROLPLANE_HOST:192.168.49.2} -edc.controlplane.data.port=${EDC_CONTROLPLANE_DATA_PORT:32272} -edc.controlplane.data.path=/api/v1/data -edc.controlplane.key=${EDC_CONTROLPLANE_KEY:password} - -edc.applydataplaneworkaround=true -edc.dataplane.public.port=31102 -minikube.ip=${MINIKUBE_IP:host.minikube.internal} -# Jackson (JSON) -#spring.jackson.default-property-inclusion=non_empty -#logging.level.org.hibernate.SQL=DEBUG -#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true - - -# Own EDC-IDS-URL -edc.idsUrl=${EDC_IDSURL:http://supplier-control-plane:9184/api/v1/ids} - -# Own BPNL -own.bpnl=${OWN_BPNL:BPNL1234567890ZZ} - -# Own name (self-description) -own.name=${OWN_NAME:Scenario Supplier} - -# Own BPNS (optional: if this is set, then set own.default.site.name as well) -own.default.bpns=${OWN_BPNS:BPNS1234567890ZZ} - -# Name of Site (see above) -own.default.site.name=${OWN_SITE:Konzernzentrale Dudelsdorf} - -# If a BPNS is set, then this BPNA will be attached to it. -# Otherwise, it will be attached immediately to the BPNL (see above) -own.default.bpna=${OWN_BPNS:BPNA1234567890AA} -own.default.streetandnumber=${OWN_STREETANDNUMBER:Heinrich-Supplier-Strasse 1} -own.default.zipcodeandcity=${OWN_ZIPCODEANDCITY:77785 Dudelsdorf} -own.default.country=${OWN_COUNTRY:Germany} - -# The number of minutes before received authentication data -# in the context of a consumer pull is removed from memory -own.edr.deletiontimer=2 - -puris.apiversion=1.0.0 -puris.demonstrator.role=supplier -puris.api.key=test -# run with: -# ./mvnw spring-boot:run -Dspring-boot.run.arguments=--spring.profiles.active=supplier -# alternatively: -# ./mvnw spring-boot:run -Dspring-boot.run.arguments=--spring.config.location="./src/main/resources/application-supplier.properties" From 11840a16c03f4b3f4572c08d3d0dfafe0e57cf42 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 4 Dec 2023 10:13:21 +0100 Subject: [PATCH 04/24] fix: fixed itemstockservicetest --- .../logic/ItemStockServiceTest.java | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index a52e7e46..8bd5bdda 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -1,8 +1,10 @@ package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; -import org.eclipse.tractusx.puris.backend.masterdata.domain.repository.PartnerRepository; -import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerServiceImpl; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; @@ -14,6 +16,9 @@ import org.mockito.Mockito; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import java.util.Optional; +import java.util.UUID; + import static org.mockito.Mockito.when; @DataJpaTest @@ -22,9 +27,9 @@ public class ItemStockServiceTest { @Mock private ItemStockRepository itemStockRepository; @Mock - private PartnerRepository partnerRepository; - @InjectMocks - private PartnerServiceImpl partnerService; + private MaterialPartnerRelationService materialPartnerRelationService; + @Mock + private PartnerService partnerService; @InjectMocks private ItemStockService itemStockService; private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; @@ -32,19 +37,17 @@ public class ItemStockServiceTest { @Test void storeAndFindItemStock() { - Partner supplierPartner = getSupplierPartner(); - final var sp = supplierPartner; ItemStock itemStock = getItemStock(supplierPartner); final var is = itemStock; - when(partnerRepository.save(Mockito.any(Partner.class))).thenAnswer(i -> i.getArguments()[0]); + when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); - when(itemStockRepository.findById(Mockito.any(ItemStock.Key.class))).thenAnswer(x -> is); + when(itemStockRepository.findById(is.getKey())).thenAnswer(x -> Optional.of(is)); + when(materialPartnerRelationService.find(semiconductorMatNbrCustomer, supplierPartner.getUuid())).thenAnswer(x -> getMaterialPartnerRelation()); itemStock = itemStockService.create(itemStock); var foundItemStock = itemStockService.findById(itemStock.getKey()); Assertions.assertEquals(itemStock, foundItemStock); - } private ItemStock getItemStock(Partner supplierPartner) { @@ -77,6 +80,23 @@ private Partner getSupplierPartner() { "77785 Dudelsdorf", "Germany" ); + supplierPartnerEntity.setUuid(UUID.randomUUID()); return supplierPartnerEntity; } + + private MaterialPartnerRelation getMaterialPartnerRelation() { + MaterialPartnerRelation mpr = new MaterialPartnerRelation(); + mpr.setPartnerMaterialNumber(semiconductorMatNbrSupplier); + mpr.setPartnerSuppliesMaterial(true); + mpr.setMaterial(getMaterial()); + return mpr; + } + + private Material getMaterial() { + Material material = new Material(); + material.setOwnMaterialNumber(semiconductorMatNbrCustomer); + material.setMaterialFlag(true); + material.setName("Semiconductor"); + return material; + } } From 825ac78dbecf89d03f3c16aa5460fbfb3785df09 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Dec 2023 16:01:16 +0100 Subject: [PATCH 05/24] feat: added itemstocksamm and tests --- backend/pom.xml | 10 +++ .../DataInjectionCommandLineRunner.java | 40 +++++++++- .../backend/stock/domain/model/ItemStock.java | 25 +++--- .../dto/itemstocksamm/AllocatedStock.java | 77 +++++++++++++++++++ .../DirectionCharacteristic.java | 10 +++ .../dto/itemstocksamm/ItemQuantityEntity.java | 45 +++++++++++ .../dto/itemstocksamm/ItemStockSAMM.java | 76 ++++++++++++++++++ .../itemstocksamm/ItemUnitEnumeration.java | 75 ++++++++++++++++++ .../itemstocksamm/OrderPositionReference.java | 60 +++++++++++++++ .../logic/dto/itemstocksamm/Position.java | 64 +++++++++++++++ .../stock/logic/service/ItemStockService.java | 3 +- .../masterdata/logic/ItemStockSAMMTest.java | 77 +++++++++++++++++++ .../logic/ItemStockServiceTest.java | 7 +- 13 files changed, 547 insertions(+), 22 deletions(-) create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java diff --git a/backend/pom.xml b/backend/pom.xml index ad0667da..11c06466 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -108,6 +108,16 @@ modelmapper 3.1.1 + + org.eclipse.esmf + esmf-aspect-meta-model-java + 2.4.2 + + + org.eclipse.esmf + esmf-aspect-model-java-core + 2.4.2 + diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 0daf81f1..73747d79 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -37,6 +37,7 @@ import org.eclipse.tractusx.puris.backend.stock.domain.model.*; import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; import org.eclipse.tractusx.puris.backend.stock.logic.adapter.ProductStockSammMapper; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.LocationIdTypeEnum; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.ProductStockSammDto; import org.eclipse.tractusx.puris.backend.stock.logic.service.*; @@ -225,10 +226,10 @@ private void setupCustomerRole() throws JsonProcessingException { .customerOrderId("123") .supplierOrderId("234") .customerOrderPositionId("1") - .direction(ItemStock.Direction.INBOUND) + .direction(DirectionCharacteristic.INBOUND) .materialNumberCustomer(semiconductorMatNbrCustomer) .materialNumberSupplier(semiconductorMatNbrSupplier) - .measurementUnit(MeasurementUnit.piece) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) .locationBpns(supplierPartner.getSites().first().getBpns()) .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) .partnerBpnl(supplierPartner.getBpnl()) @@ -239,6 +240,14 @@ private void setupCustomerRole() throws JsonProcessingException { var foundItemStock = itemStockService.findById(itemStock.getKey()); log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); log.info("\n" + foundItemStock); + try { + log.info("Trying to serialize: "); + var json = objectMapper.readTree(objectMapper.writeValueAsString(itemStock)); + log.info("\n" + json.toPrettyString()); + } catch (Exception e) { + log.info("fail"); + log.error(e.getMessage()); + } } /** @@ -290,10 +299,10 @@ private void setupSupplierRole() { .customerOrderId("123") .supplierOrderId("234") .customerOrderPositionId("1") - .direction(ItemStock.Direction.OUTBOUND) + .direction(DirectionCharacteristic.OUTBOUND) .materialNumberCustomer(semiconductorMatNbrCustomer) .materialNumberSupplier(semiconductorMatNbrSupplier) - .measurementUnit(MeasurementUnit.piece) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) .locationBpns(partnerService.getOwnPartnerEntity().getSites().first().getBpns()) .locationBpna(partnerService.getOwnPartnerEntity().getSites().first().getAddresses().first().getBpna()) .partnerBpnl(customerPartner.getBpnl()) @@ -304,6 +313,29 @@ private void setupSupplierRole() { var foundItemStock = itemStockService.findById(itemStock.getKey()); log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); log.info("\n" + foundItemStock); + + ItemStockSAMM samm = new ItemStockSAMM(); + samm.setDirection(DirectionCharacteristic.INBOUND); + samm.setMaterialNumberSupplier(semiconductorMatNbrSupplier); + samm.setMaterialNumberCustomer(semiconductorMatNbrCustomer); + + OrderPositionReference opr = new OrderPositionReference("234", "123", "1"); + ItemQuantityEntity quantity = new ItemQuantityEntity(20.0, ItemUnitEnumeration.UNIT_PIECE); + AllocatedStock allocatedStock = new AllocatedStock(quantity, partnerService.getOwnPartnerEntity().getSites().first().getBpns(), + false, partnerService.getOwnPartnerEntity().getSites().first().getAddresses().first().getBpna()); + Position position = new Position(opr, new Date(), List.of(allocatedStock)); + samm.setPositions(List.of(position)); + try { + var jsonNode = objectMapper.readTree(objectMapper.writeValueAsString(samm)); + log.info("Created ItemStockSamm \n" + jsonNode.toPrettyString()); + var readSamm = objectMapper.readValue(jsonNode.toString(), ItemStockSAMM.class); + log.info("Recreated ItemStockSamm \n" + objectMapper.readTree(objectMapper.writeValueAsString(readSamm))); + log.info("Equal? " + samm.equals(readSamm)); + } catch (Exception e) { + log.error(e.getMessage()); + } + + } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index f325748e..11210ce3 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -4,7 +4,8 @@ import jakarta.persistence.EmbeddedId; import jakarta.persistence.Entity; import lombok.*; -import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; import java.io.Serializable; import java.util.Date; @@ -42,7 +43,7 @@ public String getMaterialGlobalAssetId() { return key.getMaterialGlobalAssetId(); } - public Direction getDirection() { + public DirectionCharacteristic getDirection() { return key.direction; } @@ -74,7 +75,7 @@ public void setLastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; } - public MeasurementUnit getMeasurementUnit() { + public ItemUnitEnumeration getMeasurementUnit() { return quantityOnAllocatedStock.getMeasurementUnit(); } @@ -95,7 +96,7 @@ public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ItemStock)) return false; ItemStock itemStock = (ItemStock) o; - return key.equals(((ItemStock) o).key); + return key.equals(itemStock.key); } @Override @@ -104,17 +105,17 @@ public int hashCode() { } - @Embeddable @Getter @Setter @ToString public static class Key implements Serializable { + private String partnerBpnl; private String materialNumberCustomer; private String materialNumberSupplier; private String materialGlobalAssetId; - private Direction direction; + private DirectionCharacteristic direction; private String supplierOrderId; private String customerOrderId; private String customerOrderPositionId; @@ -150,7 +151,7 @@ public int hashCode() { @ToString public static class QuantityOnAllocatedStock { private Double quantity; - private MeasurementUnit measurementUnit; + private ItemUnitEnumeration measurementUnit; @Override public boolean equals(Object o) { @@ -166,10 +167,6 @@ public int hashCode() { } } - public static enum Direction { - INBOUND, OUTBOUND; - } - public static class Builder { private Builder() { @@ -179,7 +176,7 @@ private Builder() { private String materialNumberCustomer; private String materialNumberSupplier; private String materialGlobalAssetId; - private Direction direction; + private DirectionCharacteristic direction; private String supplierOrderId; private String customerOrderId; private String customerOrderPositionId; @@ -209,7 +206,7 @@ public Builder materialGlobalAssetId(String materialGlobalAssetId) { return this; } - public Builder direction(Direction direction) { + public Builder direction(DirectionCharacteristic direction) { this.direction = direction; return this; } @@ -245,7 +242,7 @@ public Builder lastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { } - public Builder measurementUnit(MeasurementUnit measurementUnit) { + public Builder measurementUnit(ItemUnitEnumeration measurementUnit) { quantityOnAllocatedStock.measurementUnit = measurementUnit; return this; } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java new file mode 100644 index 00000000..18be95b0 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java @@ -0,0 +1,77 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import lombok.Getter; +import lombok.Setter; + +import java.util.Objects; + +/** + * Generated class for Stock Allocated to a Partner. This is the quantity of + * items on stock at a location. A stock can either be - from a certain supplier + * and ready to be consumed by a customer or - from a supplier and ready to be + * shipped to a certain customer. + * + * In case of stocks "from a supplier ready to be shipped to a certain + * customer", the stock may refer to an order position of a customer. This stock + * consists only of the good-finished items. + */ +@Getter +@Setter +public class AllocatedStock { + + @NotNull + private ItemQuantityEntity quantityOnAllocatedStock; + + @NotNull + @Pattern(regexp = "^BPNS[0-9]{8}[a-zA-Z0-9]{4}$") + + private String stockLocationBPNS; + + @NotNull + private Boolean isBlocked; + + @NotNull + @Pattern(regexp = "^BPNA[0-9]{8}[a-zA-Z0-9]{4}$") + + private String stockLocationBPNA; + + @JsonCreator + public AllocatedStock(@JsonProperty(value = "quantityOnAllocatedStock") ItemQuantityEntity quantityOnAllocatedStock, + @JsonProperty(value = "stockLocationBPNS") String stockLocationBPNS, + @JsonProperty(value = "isBlocked") Boolean isBlocked, + @JsonProperty(value = "stockLocationBPNA") String stockLocationBPNA) { + super( + + ); + this.quantityOnAllocatedStock = quantityOnAllocatedStock; + this.stockLocationBPNS = stockLocationBPNS; + this.isBlocked = isBlocked; + this.stockLocationBPNA = stockLocationBPNA; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final AllocatedStock that = (AllocatedStock) o; + return Objects.equals(quantityOnAllocatedStock, that.quantityOnAllocatedStock) + && Objects.equals(stockLocationBPNS, that.stockLocationBPNS) + && Objects.equals(isBlocked, that.isBlocked) + && Objects.equals(stockLocationBPNA, that.stockLocationBPNA); + } + + @Override + public int hashCode() { + return Objects.hash(quantityOnAllocatedStock, stockLocationBPNS, isBlocked, stockLocationBPNA); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java new file mode 100644 index 00000000..9e198c4c --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java @@ -0,0 +1,10 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +/** + * Generated class {@link DirectionCharacteristic}. + */ + +public enum DirectionCharacteristic { + INBOUND, OUTBOUND; +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java new file mode 100644 index 00000000..3008d0f5 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java @@ -0,0 +1,45 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.Objects; + +/** + * Generated class for Item Quantity Entity. Entity for common measurements of + * an item (mass, count, linear, area, volume, misc) with an unit and a value. + */ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class ItemQuantityEntity { + + @NotNull + private Double value; + + @NotNull + private ItemUnitEnumeration unit; + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final ItemQuantityEntity that = (ItemQuantityEntity) o; + return Objects.equals(value, that.value) && Objects.equals(unit, that.unit); + } + + @Override + public int hashCode() { + return Objects.hash(value, unit); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java new file mode 100644 index 00000000..daa4bf82 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java @@ -0,0 +1,76 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.eclipse.esmf.aspectmodel.java.CollectionAspect; + +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +/** + * Semi-Generated class for Stock of Items. This aspect represents the latest + * quantities of a partner's items that are on stock. The stock represent the + * build-to-order (BTO) stocks already available. + */ +@Getter +@Setter +@NoArgsConstructor +public class ItemStockSAMM implements CollectionAspect, Position> { + + @NotNull + private List positions; + + @NotNull + private String materialNumberCustomer; + + @Pattern(regexp = "(^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)") + private String materialGlobalAssetId; + + private String materialNumberSupplier; + + @NotNull + private DirectionCharacteristic direction; + + @JsonCreator + public ItemStockSAMM(@JsonProperty(value = "positions") List positions, + @JsonProperty(value = "materialNumberCustomer") String materialNumberCustomer, + @JsonProperty(value = "materialGlobalAssetId") String materialGlobalAssetId, + @JsonProperty(value = "materialNumberSupplier") String materialNumberSupplier, + @JsonProperty(value = "direction") DirectionCharacteristic direction) { + this.positions = positions; + this.materialNumberCustomer = materialNumberCustomer; + this.materialGlobalAssetId = materialGlobalAssetId; + this.materialNumberSupplier = materialNumberSupplier; + this.direction = direction; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final ItemStockSAMM that = (ItemStockSAMM) o; + return Objects.equals(positions, that.positions) + && Objects.equals(materialNumberCustomer, that.materialNumberCustomer) + && Objects.equals(materialGlobalAssetId, that.materialGlobalAssetId) + && Objects.equals(materialNumberSupplier, that.materialNumberSupplier) + && Objects.equals(direction, that.direction); + } + + @Override + public int hashCode() { + return Objects.hash(positions, materialNumberCustomer, materialGlobalAssetId, materialNumberSupplier, + direction); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java new file mode 100644 index 00000000..5a6ca33d --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -0,0 +1,75 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonValue; +import org.eclipse.esmf.aspectmodel.java.exception.EnumAttributeNotFoundException; +import org.eclipse.esmf.metamodel.datatypes.Curie; + +import java.util.Arrays; +import java.util.Optional; + +/** + * Generated class {@link ItemUnitEnumeration}. + */ +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +public enum ItemUnitEnumeration { + UNIT_PIECE(new Curie("unit:piece")), + UNIT_SET(new Curie("unit:set")), + UNIT_PAIR(new Curie("unit:pair")), + UNIT_PAGE(new Curie("unit:page")), + UNIT_CYCLE(new Curie("unit:cycle")), + UNIT_KILOWATT_HOUR(new Curie("unit:kilowattHour")), + UNIT_GRAM(new Curie("unit:gram")), + UNIT_KILOGRAM(new Curie("unit:kilogram")), + UNIT_TONNE_METRIC_TON(new Curie("unit:tonneMetricTon")), + UNIT_TON_US_OR_SHORT_TON_UKORUS(new Curie("unit:tonUsOrShortTonUkorus")), + UNIT_OUNCE_AVOIRDUPOIS(new Curie("unit:ounceAvoirdupois")), + UNIT_POUND(new Curie("unit:pound")), + UNIT_METRE(new Curie("unit:metre")), + UNIT_CENTIMETRE(new Curie("unit:centimetre")), + UNIT_KILOMETRE(new Curie("unit:kilometre")), + UNIT_INCH(new Curie("unit:inch")), + UNIT_FOOT(new Curie("unit:foot")), + UNIT_YARD(new Curie("unit:yard")), + UNIT_SQUARE_CENTIMETRE(new Curie("unit:squareCentimetre")), + UNIT_SQUARE_METRE(new Curie("unit:squareMetre")), + UNIT_SQUARE_INCH(new Curie("unit:squareInch")), + UNIT_SQUARE_FOOT(new Curie("unit:squareFoot")), + UNIT_SQUARE_YARD(new Curie("unit:squareYard")), + UNIT_CUBIC_CENTIMETRE(new Curie("unit:cubicCentimetre")), + UNIT_CUBIC_METRE(new Curie("unit:cubicMetre")), + UNIT_CUBIC_INCH(new Curie("unit:cubicInch")), + UNIT_CUBIC_FOOT(new Curie("unit:cubicFoot")), + UNIT_CUBIC_YARD(new Curie("unit:cubicYard")), + UNIT_LITRE(new Curie("unit:litre")), + UNIT_MILLILITRE(new Curie("unit:millilitre")), + UNIT_HECTOLITRE(new Curie("unit:hectolitre")), + UNIT_SECOND_UNIT_OF_TIME(new Curie("unit:secondUnitOfTime")), + UNIT_MINUTE_UNIT_OF_TIME(new Curie("unit:minuteUnitOfTime")), + UNIT_HOUR_UNIT_OF_TIME(new Curie("unit:hourUnitOfTime")), + UNIT_DAY(new Curie("unit:day")); + + private Curie value; + + ItemUnitEnumeration(Curie value) { + this.value = value; + } + + @JsonCreator + static ItemUnitEnumeration enumDeserializationConstructor(String value) { + return fromValue(value).orElseThrow(() -> new EnumAttributeNotFoundException( + "Tried to parse value \"" + value + "\", but there is no enum field like that in ItemUnitEnumeration")); + } + + @JsonValue + public String getValue() { + return value.getValue(); + } + + public static Optional fromValue(String value) { + return Arrays.stream(ItemUnitEnumeration.values()).filter(enumValue -> enumValue.getValue().equals(value)).findFirst(); + } + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java new file mode 100644 index 00000000..fad09216 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java @@ -0,0 +1,60 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.Setter; + +import java.util.Objects; + +/** + * Generated class for Reference to Order Position. Encapsulates the references + * to identify a position within an order. + */ + +@Getter +@Setter +public class OrderPositionReference { + + private String supplierOrderId; + + @NotNull + private String customerOrderId; + + @NotNull + private String customerOrderPositionId; + + @JsonCreator + public OrderPositionReference(@JsonProperty(value = "supplierOrderId") String supplierOrderId, + @JsonProperty(value = "customerOrderId") String customerOrderId, + @JsonProperty(value = "customerOrderPositionId") String customerOrderPositionId) { + super( + + ); + this.supplierOrderId = supplierOrderId; + this.customerOrderId = customerOrderId; + this.customerOrderPositionId = customerOrderPositionId; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final OrderPositionReference that = (OrderPositionReference) o; + return Objects.equals(supplierOrderId, that.supplierOrderId) + && Objects.equals(customerOrderId, that.customerOrderId) + && Objects.equals(customerOrderPositionId, that.customerOrderPositionId); + } + + @Override + public int hashCode() { + return Objects.hash(supplierOrderId, customerOrderId, customerOrderPositionId); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java new file mode 100644 index 00000000..d75ba8df --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java @@ -0,0 +1,64 @@ + +package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + * Generated class for Position. The Position can be located at several stocks. + * In case of a supplier's stock for a customer, a position may be either + * anonymous or reference a position within a customer order. In case of a + * customer's stock for a supplier, the order position reference MUST NOT be + * set. + */ + +@Getter +@Setter +@NoArgsConstructor +public class Position { + private OrderPositionReference orderPositionReference; + + @NotNull + private Date lastUpdatedOnDateTime; + + @NotNull + private List allocatedStocks; + + @JsonCreator + public Position( + @JsonProperty(value = "orderPositionReference") OrderPositionReference orderPositionReference, + @JsonProperty(value = "lastUpdatedOnDateTime") Date lastUpdatedOnDateTime, + @JsonProperty(value = "allocatedStocks") List allocatedStocks) { + this.orderPositionReference = orderPositionReference; + this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; + this.allocatedStocks = allocatedStocks; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final Position that = (Position) o; + return Objects.equals(orderPositionReference, that.orderPositionReference) + && Objects.equals(lastUpdatedOnDateTime, that.lastUpdatedOnDateTime) + && Objects.equals(allocatedStocks, that.allocatedStocks); + } + + @Override + public int hashCode() { + return Objects.hash(orderPositionReference, lastUpdatedOnDateTime, allocatedStocks); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index 5e257a0e..c4cd0ab2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -7,6 +7,7 @@ import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; import org.springframework.stereotype.Service; import java.util.List; @@ -65,7 +66,7 @@ private boolean validate(ItemStock itemStock) { Partner partner = partnerService.findByBpnl(key.getPartnerBpnl()); Objects.requireNonNull(partner, "Unknown partner: " + key.getPartnerBpnl()); Partner mySelf = partnerService.getOwnPartnerEntity(); - Partner customer = key.getDirection() == ItemStock.Direction.INBOUND ? mySelf : partner; + Partner customer = key.getDirection() == DirectionCharacteristic.INBOUND ? mySelf : partner; Partner supplier = customer == mySelf ? partner : mySelf; var stockBpns = supplier.getSites().stream() .filter(site -> site.getBpns().equals(key.getLocationBpns())).findFirst().orElse(null); diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java new file mode 100644 index 00000000..2b019ff1 --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java @@ -0,0 +1,77 @@ +package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Date; +import java.util.List; + +public class ItemStockSAMMTest { + + private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; + private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; + + + @Test + void parseSampleData() throws Exception { + String sample = "{\n" + + " \"positions\": [\n" + + " {\n" + + " \"lastUpdatedOnDateTime\": \"2023-04-01T14:23:00\",\n" + + " \"orderPositionReference\": {\n" + + " \"supplierOrderId\": \"M-Nbr-4711\",\n" + + " \"customerOrderId\": \"C-Nbr-4711\",\n" + + " \"customerOrderPositionId\": \"PositionId-01\"\n" + + " },\n" + + " \"allocatedStocks\": [\n" + + " {\n" + + " \"isBlocked\": false,\n" + + " \"stockLocationBPNA\": \"BPNA1234567890\",\n" + + " \"quantityOnAllocatedStock\": {\n" + + " \"value\": 20.0,\n" + + " \"unit\": \"unit:piece\"\n" + + " },\n" + + " \"stockLocationBPNS\": \"BPNS1234567890ZZ\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"materialGlobalAssetId\": \"urn:uuid:48878d48-6f1d-47f5-8ded-a441d0d879df\",\n" + + " \"materialNumberCustomer\": \"MNR-7307-AU340474.002\",\n" + + " \"materialNumberSupplier\": \"MNR-8101-ID146955.001\",\n" + + " \"direction\": \"INBOUND\"\n" + + "}"; + + ObjectMapper objectMapper = new ObjectMapper(); + ItemStockSAMM samm = objectMapper.readValue(sample, ItemStockSAMM.class); + Assertions.assertEquals(samm.getDirection(), DirectionCharacteristic.INBOUND); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getIsBlocked(), false); + Assertions.assertEquals(samm.getPositions().get(0).getOrderPositionReference().getSupplierOrderId(),"M-Nbr-4711"); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getValue(), 20.0); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getUnit().getValue(), "unit:piece"); + } + + @Test + void serializeAndDeserializeSamm() throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + ItemStockSAMM samm = new ItemStockSAMM(); + samm.setDirection(DirectionCharacteristic.INBOUND); + samm.setMaterialNumberSupplier(semiconductorMatNbrSupplier); + samm.setMaterialNumberCustomer(semiconductorMatNbrCustomer); + + OrderPositionReference opr = new OrderPositionReference("234", "123", "1"); + ItemQuantityEntity quantity = new ItemQuantityEntity(20.0, ItemUnitEnumeration.UNIT_PIECE); + AllocatedStock allocatedStock = new AllocatedStock(quantity, "BPNS1234567890ZZ", + false, "BPNA1234567890AA"); + Position position = new Position(opr, new Date(), List.of(allocatedStock)); + samm.setPositions(List.of(position)); + var jsonNode = objectMapper.readTree(objectMapper.writeValueAsString(samm)); + + var readSamm = objectMapper.readValue(jsonNode.toString(), ItemStockSAMM.class); + Assertions.assertEquals(samm, readSamm); + } + + +} diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index 8bd5bdda..d21e8c95 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -6,8 +6,9 @@ import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; -import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; import org.eclipse.tractusx.puris.backend.stock.logic.service.ItemStockService; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -56,10 +57,10 @@ private ItemStock getItemStock(Partner supplierPartner) { .customerOrderId("123") .supplierOrderId("234") .customerOrderPositionId("1") - .direction(ItemStock.Direction.INBOUND) + .direction(DirectionCharacteristic.INBOUND) .materialNumberCustomer(semiconductorMatNbrCustomer) .materialNumberSupplier(semiconductorMatNbrSupplier) - .measurementUnit(MeasurementUnit.piece) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) .locationBpns(supplierPartner.getSites().first().getBpns()) .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) .partnerBpnl(supplierPartner.getBpnl()) From 5ceb42957996e9bfe7d65611df372ffeff2082ec Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Dec 2023 16:15:44 +0100 Subject: [PATCH 06/24] chore: added license headers --- .../DataInjectionCommandLineRunner.java | 42 ------------------- .../backend/stock/domain/model/ItemStock.java | 28 ++++++++++--- .../dto/itemstocksamm/AllocatedStock.java | 22 +++++++++- .../DirectionCharacteristic.java | 22 +++++++++- .../dto/itemstocksamm/ItemQuantityEntity.java | 22 +++++++++- .../dto/itemstocksamm/ItemStockSAMM.java | 22 +++++++++- .../itemstocksamm/ItemUnitEnumeration.java | 22 +++++++++- .../itemstocksamm/OrderPositionReference.java | 22 +++++++++- .../logic/dto/itemstocksamm/Position.java | 22 +++++++++- .../stock/logic/service/ItemStockService.java | 21 ++++++++++ .../masterdata/logic/ItemStockSAMMTest.java | 21 ++++++++++ .../logic/ItemStockServiceTest.java | 21 ++++++++++ 12 files changed, 232 insertions(+), 55 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 73747d79..ade3ce99 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -294,48 +294,6 @@ private void setupSupplierRole() { log.info(String.format("Found productStocks by material number and allocated to customer " + "bpnl: %s", foundProductStocks)); - ItemStock.Builder builder = ItemStock.Builder.newInstance(); - var itemStock = builder - .customerOrderId("123") - .supplierOrderId("234") - .customerOrderPositionId("1") - .direction(DirectionCharacteristic.OUTBOUND) - .materialNumberCustomer(semiconductorMatNbrCustomer) - .materialNumberSupplier(semiconductorMatNbrSupplier) - .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .locationBpns(partnerService.getOwnPartnerEntity().getSites().first().getBpns()) - .locationBpna(partnerService.getOwnPartnerEntity().getSites().first().getAddresses().first().getBpna()) - .partnerBpnl(customerPartner.getBpnl()) - .quantity(10) - .build(); - itemStock = itemStockService.create(itemStock); - log.info("Created ItemStock: \n" + itemStock); - var foundItemStock = itemStockService.findById(itemStock.getKey()); - log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); - log.info("\n" + foundItemStock); - - ItemStockSAMM samm = new ItemStockSAMM(); - samm.setDirection(DirectionCharacteristic.INBOUND); - samm.setMaterialNumberSupplier(semiconductorMatNbrSupplier); - samm.setMaterialNumberCustomer(semiconductorMatNbrCustomer); - - OrderPositionReference opr = new OrderPositionReference("234", "123", "1"); - ItemQuantityEntity quantity = new ItemQuantityEntity(20.0, ItemUnitEnumeration.UNIT_PIECE); - AllocatedStock allocatedStock = new AllocatedStock(quantity, partnerService.getOwnPartnerEntity().getSites().first().getBpns(), - false, partnerService.getOwnPartnerEntity().getSites().first().getAddresses().first().getBpna()); - Position position = new Position(opr, new Date(), List.of(allocatedStock)); - samm.setPositions(List.of(position)); - try { - var jsonNode = objectMapper.readTree(objectMapper.writeValueAsString(samm)); - log.info("Created ItemStockSamm \n" + jsonNode.toPrettyString()); - var readSamm = objectMapper.readValue(jsonNode.toString(), ItemStockSAMM.class); - log.info("Recreated ItemStockSamm \n" + objectMapper.readTree(objectMapper.writeValueAsString(readSamm))); - log.info("Equal? " + samm.equals(readSamm)); - } catch (Exception e) { - log.error(e.getMessage()); - } - - } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index 11210ce3..5d442d18 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.model; import jakarta.persistence.Embeddable; @@ -16,7 +38,6 @@ @ToString public class ItemStock { - @Getter @EmbeddedId private Key key = new Key(); @@ -104,7 +125,6 @@ public int hashCode() { return key.hashCode(); } - @Embeddable @Getter @Setter @@ -141,8 +161,6 @@ public int hashCode() { } } - - @Getter @Setter @NoArgsConstructor @@ -241,7 +259,6 @@ public Builder lastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { return this; } - public Builder measurementUnit(ItemUnitEnumeration measurementUnit) { quantityOnAllocatedStock.measurementUnit = measurementUnit; return this; @@ -257,7 +274,6 @@ public Builder isBlocked(boolean isBlocked) { return this; } - public ItemStock build() { ItemStock itemStock = new ItemStock(); itemStock.key.partnerBpnl = partnerBpnl; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java index 18be95b0..9be70d73 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java index 9e198c4c..ae43708c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; /** diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java index 3008d0f5..e156c937 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import jakarta.validation.constraints.NotNull; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java index daa4bf82..43d926b9 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java index 5a6ca33d..dfa85617 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java index fad09216..bae07265 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java index d75ba8df..a700f7f0 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java @@ -1,4 +1,24 @@ - +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index c4cd0ab2..3d2576d6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.logic.service; import lombok.RequiredArgsConstructor; diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java index 2b019ff1..49fad57d 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index d21e8c95..a4cd9cc1 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; From 65144e1c87250e95b2082c72ddccb0c5c4291706 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Dec 2023 16:18:43 +0100 Subject: [PATCH 07/24] chore: edited commandlinerunner --- .../tractusx/puris/backend/DataInjectionCommandLineRunner.java | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index ade3ce99..67f817cb 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -293,7 +293,6 @@ private void setupSupplierRole() { findAllByMaterialNumberCustomer(semiconductorMatNbrCustomer, customerPartner); log.info(String.format("Found productStocks by material number and allocated to customer " + "bpnl: %s", foundProductStocks)); - } From 9f2147fb9bd44d275eb61165127dd52c9e261a5c Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Dec 2023 16:46:34 +0100 Subject: [PATCH 08/24] chore: updated dependencies --- DEPENDENCIES_BACKEND | 42 ++++++++++++++++++++++++++++++++++++++++++ backend/DEPENDENCIES | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index 67c90818..ae618d6c 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -1,5 +1,6 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -8,18 +9,35 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 +maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 +maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 +maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 +maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 +maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 +maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 +maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 +maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 +maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 +maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -32,19 +50,41 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 +maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 +maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 +maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 +maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 +maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 +maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 +maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -64,6 +104,8 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 diff --git a/backend/DEPENDENCIES b/backend/DEPENDENCIES index 67c90818..ae618d6c 100644 --- a/backend/DEPENDENCIES +++ b/backend/DEPENDENCIES @@ -1,5 +1,6 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -8,18 +9,35 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 +maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 +maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 +maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 +maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 +maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 +maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 +maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 +maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 +maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 +maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -32,19 +50,41 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 +maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 +maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 +maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 +maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 +maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 +maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 +maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -64,6 +104,8 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 From 76eaff823e8befb3ffa63347a9ccd58178ce9754 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 5 Dec 2023 16:48:16 +0100 Subject: [PATCH 09/24] chore: updated dependencies --- DEPENDENCIES_BACKEND | 42 ++++++++++++++++++++++++++++++++++++++++++ backend/DEPENDENCIES | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index 67c90818..ae618d6c 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -1,5 +1,6 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -8,18 +9,35 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 +maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 +maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 +maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 +maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 +maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 +maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 +maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 +maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 +maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 +maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -32,19 +50,41 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 +maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 +maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 +maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 +maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 +maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 +maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 +maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -64,6 +104,8 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 diff --git a/backend/DEPENDENCIES b/backend/DEPENDENCIES index 67c90818..ae618d6c 100644 --- a/backend/DEPENDENCIES +++ b/backend/DEPENDENCIES @@ -1,5 +1,6 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -8,18 +9,35 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 +maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 +maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 +maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 +maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 +maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 +maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 +maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 +maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 +maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 +maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -32,19 +50,41 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 +maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 +maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 +maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 +maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 +maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined +maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 +maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 +maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf +maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -64,6 +104,8 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 From 6074394c6fec67b91c3b6d55eb00327812bb9623 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:02:01 +0100 Subject: [PATCH 10/24] fix: removed esmf dependencies --- DEPENDENCIES_BACKEND | 42 ---------- backend/DEPENDENCIES | 42 ---------- backend/pom.xml | 10 --- .../dto/itemstocksamm/ItemStockSAMM.java | 4 +- .../itemstocksamm/ItemUnitEnumeration.java | 80 +++++++++---------- 5 files changed, 40 insertions(+), 138 deletions(-) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index ae618d6c..67c90818 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -1,6 +1,5 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 -maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -9,35 +8,18 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 -maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 -maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 -maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 -maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 -maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 -maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 -maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 -maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 -maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -50,41 +32,19 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 -maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 -maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 -maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 -maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 -maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 -maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 -maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -104,8 +64,6 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 diff --git a/backend/DEPENDENCIES b/backend/DEPENDENCIES index ae618d6c..67c90818 100644 --- a/backend/DEPENDENCIES +++ b/backend/DEPENDENCIES @@ -1,6 +1,5 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 -maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -9,35 +8,18 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 -maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 -maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 -maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 -maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 -maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 -maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 -maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 -maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 -maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -50,41 +32,19 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 -maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 -maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 -maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 -maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 -maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 -maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 -maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -104,8 +64,6 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 diff --git a/backend/pom.xml b/backend/pom.xml index 6442d530..d5775a1f 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -108,16 +108,6 @@ modelmapper 3.1.1 - - org.eclipse.esmf - esmf-aspect-meta-model-java - 2.4.2 - - - org.eclipse.esmf - esmf-aspect-model-java-core - 2.4.2 - diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java index 43d926b9..a44c2104 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java @@ -28,9 +28,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.eclipse.esmf.aspectmodel.java.CollectionAspect; -import java.util.Collection; import java.util.List; import java.util.Objects; @@ -42,7 +40,7 @@ @Getter @Setter @NoArgsConstructor -public class ItemStockSAMM implements CollectionAspect, Position> { +public class ItemStockSAMM { @NotNull private List positions; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java index dfa85617..9c0f7ec1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -24,8 +24,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; -import org.eclipse.esmf.aspectmodel.java.exception.EnumAttributeNotFoundException; -import org.eclipse.esmf.metamodel.datatypes.Curie; import java.util.Arrays; import java.util.Optional; @@ -35,57 +33,57 @@ */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum ItemUnitEnumeration { - UNIT_PIECE(new Curie("unit:piece")), - UNIT_SET(new Curie("unit:set")), - UNIT_PAIR(new Curie("unit:pair")), - UNIT_PAGE(new Curie("unit:page")), - UNIT_CYCLE(new Curie("unit:cycle")), - UNIT_KILOWATT_HOUR(new Curie("unit:kilowattHour")), - UNIT_GRAM(new Curie("unit:gram")), - UNIT_KILOGRAM(new Curie("unit:kilogram")), - UNIT_TONNE_METRIC_TON(new Curie("unit:tonneMetricTon")), - UNIT_TON_US_OR_SHORT_TON_UKORUS(new Curie("unit:tonUsOrShortTonUkorus")), - UNIT_OUNCE_AVOIRDUPOIS(new Curie("unit:ounceAvoirdupois")), - UNIT_POUND(new Curie("unit:pound")), - UNIT_METRE(new Curie("unit:metre")), - UNIT_CENTIMETRE(new Curie("unit:centimetre")), - UNIT_KILOMETRE(new Curie("unit:kilometre")), - UNIT_INCH(new Curie("unit:inch")), - UNIT_FOOT(new Curie("unit:foot")), - UNIT_YARD(new Curie("unit:yard")), - UNIT_SQUARE_CENTIMETRE(new Curie("unit:squareCentimetre")), - UNIT_SQUARE_METRE(new Curie("unit:squareMetre")), - UNIT_SQUARE_INCH(new Curie("unit:squareInch")), - UNIT_SQUARE_FOOT(new Curie("unit:squareFoot")), - UNIT_SQUARE_YARD(new Curie("unit:squareYard")), - UNIT_CUBIC_CENTIMETRE(new Curie("unit:cubicCentimetre")), - UNIT_CUBIC_METRE(new Curie("unit:cubicMetre")), - UNIT_CUBIC_INCH(new Curie("unit:cubicInch")), - UNIT_CUBIC_FOOT(new Curie("unit:cubicFoot")), - UNIT_CUBIC_YARD(new Curie("unit:cubicYard")), - UNIT_LITRE(new Curie("unit:litre")), - UNIT_MILLILITRE(new Curie("unit:millilitre")), - UNIT_HECTOLITRE(new Curie("unit:hectolitre")), - UNIT_SECOND_UNIT_OF_TIME(new Curie("unit:secondUnitOfTime")), - UNIT_MINUTE_UNIT_OF_TIME(new Curie("unit:minuteUnitOfTime")), - UNIT_HOUR_UNIT_OF_TIME(new Curie("unit:hourUnitOfTime")), - UNIT_DAY(new Curie("unit:day")); + UNIT_PIECE("unit:piece"), + UNIT_SET("unit:set"), + UNIT_PAIR("unit:pair"), + UNIT_PAGE("unit:page"), + UNIT_CYCLE("unit:cycle"), + UNIT_KILOWATT_HOUR("unit:kilowattHour"), + UNIT_GRAM("unit:gram"), + UNIT_KILOGRAM("unit:kilogram"), + UNIT_TONNE_METRIC_TON("unit:tonneMetricTon"), + UNIT_TON_US_OR_SHORT_TON_UKORUS("unit:tonUsOrShortTonUkorus"), + UNIT_OUNCE_AVOIRDUPOIS("unit:ounceAvoirdupois"), + UNIT_POUND("unit:pound"), + UNIT_METRE("unit:metre"), + UNIT_CENTIMETRE("unit:centimetre"), + UNIT_KILOMETRE("unit:kilometre"), + UNIT_INCH("unit:inch"), + UNIT_FOOT("unit:foot"), + UNIT_YARD("unit:yard"), + UNIT_SQUARE_CENTIMETRE("unit:squareCentimetre"), + UNIT_SQUARE_METRE("unit:squareMetre"), + UNIT_SQUARE_INCH("unit:squareInch"), + UNIT_SQUARE_FOOT("unit:squareFoot"), + UNIT_SQUARE_YARD("unit:squareYard"), + UNIT_CUBIC_CENTIMETRE("unit:cubicCentimetre"), + UNIT_CUBIC_METRE("unit:cubicMetre"), + UNIT_CUBIC_INCH("unit:cubicInch"), + UNIT_CUBIC_FOOT("unit:cubicFoot"), + UNIT_CUBIC_YARD("unit:cubicYard"), + UNIT_LITRE("unit:litre"), + UNIT_MILLILITRE("unit:millilitre"), + UNIT_HECTOLITRE("unit:hectolitre"), + UNIT_SECOND_UNIT_OF_TIME("unit:secondUnitOfTime"), + UNIT_MINUTE_UNIT_OF_TIME("unit:minuteUnitOfTime"), + UNIT_HOUR_UNIT_OF_TIME("unit:hourUnitOfTime"), + UNIT_DAY("unit:day"); - private Curie value; + private String value; - ItemUnitEnumeration(Curie value) { + ItemUnitEnumeration(String value) { this.value = value; } @JsonCreator static ItemUnitEnumeration enumDeserializationConstructor(String value) { - return fromValue(value).orElseThrow(() -> new EnumAttributeNotFoundException( + return fromValue(value).orElseThrow(() -> new IllegalArgumentException( "Tried to parse value \"" + value + "\", but there is no enum field like that in ItemUnitEnumeration")); } @JsonValue public String getValue() { - return value.getValue(); + return value; } public static Optional fromValue(String value) { From 0046fa12ea2b08a7613d35f50615a027261b61b7 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:12:10 +0100 Subject: [PATCH 11/24] fix: some cleanup --- .../logic/dto/itemstocksamm/ItemUnitEnumeration.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java index 9c0f7ec1..592ce5b5 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Arrays; import java.util.Optional; /** @@ -77,7 +76,8 @@ public enum ItemUnitEnumeration { @JsonCreator static ItemUnitEnumeration enumDeserializationConstructor(String value) { - return fromValue(value).orElseThrow(() -> new IllegalArgumentException( + return Optional.of(ItemUnitEnumeration.valueOf(ItemUnitEnumeration.class, value)).orElseThrow( + () -> new IllegalArgumentException( "Tried to parse value \"" + value + "\", but there is no enum field like that in ItemUnitEnumeration")); } @@ -86,8 +86,4 @@ public String getValue() { return value; } - public static Optional fromValue(String value) { - return Arrays.stream(ItemUnitEnumeration.values()).filter(enumValue -> enumValue.getValue().equals(value)).findFirst(); - } - } From 7b7b56106a5eb19d878eba29fec66c7663e5793c Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:30:09 +0100 Subject: [PATCH 12/24] fix: removed jsoncreator --- .../logic/dto/itemstocksamm/ItemUnitEnumeration.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java index 592ce5b5..0b35c94c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -21,16 +21,11 @@ */ package org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Optional; - /** * Generated class {@link ItemUnitEnumeration}. */ -@JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum ItemUnitEnumeration { UNIT_PIECE("unit:piece"), UNIT_SET("unit:set"), @@ -74,13 +69,6 @@ public enum ItemUnitEnumeration { this.value = value; } - @JsonCreator - static ItemUnitEnumeration enumDeserializationConstructor(String value) { - return Optional.of(ItemUnitEnumeration.valueOf(ItemUnitEnumeration.class, value)).orElseThrow( - () -> new IllegalArgumentException( - "Tried to parse value \"" + value + "\", but there is no enum field like that in ItemUnitEnumeration")); - } - @JsonValue public String getValue() { return value; From e75617c9a29bca739a9d6e12d17c4e9b93ded762 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:34:26 +0100 Subject: [PATCH 13/24] chore: removed tests --- .../masterdata/logic/ItemStockSAMMTest.java | 98 -------------- .../logic/ItemStockServiceTest.java | 124 ------------------ 2 files changed, 222 deletions(-) delete mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java delete mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java deleted file mode 100644 index 49fad57d..00000000 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -public class ItemStockSAMMTest { - - private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; - private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; - - - @Test - void parseSampleData() throws Exception { - String sample = "{\n" + - " \"positions\": [\n" + - " {\n" + - " \"lastUpdatedOnDateTime\": \"2023-04-01T14:23:00\",\n" + - " \"orderPositionReference\": {\n" + - " \"supplierOrderId\": \"M-Nbr-4711\",\n" + - " \"customerOrderId\": \"C-Nbr-4711\",\n" + - " \"customerOrderPositionId\": \"PositionId-01\"\n" + - " },\n" + - " \"allocatedStocks\": [\n" + - " {\n" + - " \"isBlocked\": false,\n" + - " \"stockLocationBPNA\": \"BPNA1234567890\",\n" + - " \"quantityOnAllocatedStock\": {\n" + - " \"value\": 20.0,\n" + - " \"unit\": \"unit:piece\"\n" + - " },\n" + - " \"stockLocationBPNS\": \"BPNS1234567890ZZ\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ],\n" + - " \"materialGlobalAssetId\": \"urn:uuid:48878d48-6f1d-47f5-8ded-a441d0d879df\",\n" + - " \"materialNumberCustomer\": \"MNR-7307-AU340474.002\",\n" + - " \"materialNumberSupplier\": \"MNR-8101-ID146955.001\",\n" + - " \"direction\": \"INBOUND\"\n" + - "}"; - - ObjectMapper objectMapper = new ObjectMapper(); - ItemStockSAMM samm = objectMapper.readValue(sample, ItemStockSAMM.class); - Assertions.assertEquals(samm.getDirection(), DirectionCharacteristic.INBOUND); - Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getIsBlocked(), false); - Assertions.assertEquals(samm.getPositions().get(0).getOrderPositionReference().getSupplierOrderId(),"M-Nbr-4711"); - Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getValue(), 20.0); - Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getUnit().getValue(), "unit:piece"); - } - - @Test - void serializeAndDeserializeSamm() throws Exception { - ObjectMapper objectMapper = new ObjectMapper(); - ItemStockSAMM samm = new ItemStockSAMM(); - samm.setDirection(DirectionCharacteristic.INBOUND); - samm.setMaterialNumberSupplier(semiconductorMatNbrSupplier); - samm.setMaterialNumberCustomer(semiconductorMatNbrCustomer); - - OrderPositionReference opr = new OrderPositionReference("234", "123", "1"); - ItemQuantityEntity quantity = new ItemQuantityEntity(20.0, ItemUnitEnumeration.UNIT_PIECE); - AllocatedStock allocatedStock = new AllocatedStock(quantity, "BPNS1234567890ZZ", - false, "BPNA1234567890AA"); - Position position = new Position(opr, new Date(), List.of(allocatedStock)); - samm.setPositions(List.of(position)); - var jsonNode = objectMapper.readTree(objectMapper.writeValueAsString(samm)); - - var readSamm = objectMapper.readValue(jsonNode.toString(), ItemStockSAMM.class); - Assertions.assertEquals(samm, readSamm); - } - - -} diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java deleted file mode 100644 index a4cd9cc1..00000000 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; - -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; -import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; -import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; -import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; -import org.eclipse.tractusx.puris.backend.stock.logic.service.ItemStockService; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; - -import java.util.Optional; -import java.util.UUID; - -import static org.mockito.Mockito.when; - -@DataJpaTest -public class ItemStockServiceTest { - - @Mock - private ItemStockRepository itemStockRepository; - @Mock - private MaterialPartnerRelationService materialPartnerRelationService; - @Mock - private PartnerService partnerService; - @InjectMocks - private ItemStockService itemStockService; - private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; - private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; - - @Test - void storeAndFindItemStock() { - Partner supplierPartner = getSupplierPartner(); - ItemStock itemStock = getItemStock(supplierPartner); - final var is = itemStock; - when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); - when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); - when(itemStockRepository.findById(is.getKey())).thenAnswer(x -> Optional.of(is)); - when(materialPartnerRelationService.find(semiconductorMatNbrCustomer, supplierPartner.getUuid())).thenAnswer(x -> getMaterialPartnerRelation()); - - itemStock = itemStockService.create(itemStock); - var foundItemStock = itemStockService.findById(itemStock.getKey()); - Assertions.assertEquals(itemStock, foundItemStock); - } - - private ItemStock getItemStock(Partner supplierPartner) { - ItemStock.Builder builder = ItemStock.Builder.newInstance(); - var itemStock = builder - .customerOrderId("123") - .supplierOrderId("234") - .customerOrderPositionId("1") - .direction(DirectionCharacteristic.INBOUND) - .materialNumberCustomer(semiconductorMatNbrCustomer) - .materialNumberSupplier(semiconductorMatNbrSupplier) - .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .locationBpns(supplierPartner.getSites().first().getBpns()) - .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) - .partnerBpnl(supplierPartner.getBpnl()) - .quantity(5) - .build(); - return itemStock; - } - - private Partner getSupplierPartner() { - Partner supplierPartnerEntity = new Partner( - "Scenario Supplier", - "http://supplier-control-plane:9184/api/v1/dsp", - "BPNL1234567890ZZ", - "BPNS1234567890ZZ", - "Konzernzentrale Dudelsdorf", - "BPNA1234567890AA", - "Heinrich-Supplier-Straße 1", - "77785 Dudelsdorf", - "Germany" - ); - supplierPartnerEntity.setUuid(UUID.randomUUID()); - return supplierPartnerEntity; - } - - private MaterialPartnerRelation getMaterialPartnerRelation() { - MaterialPartnerRelation mpr = new MaterialPartnerRelation(); - mpr.setPartnerMaterialNumber(semiconductorMatNbrSupplier); - mpr.setPartnerSuppliesMaterial(true); - mpr.setMaterial(getMaterial()); - return mpr; - } - - private Material getMaterial() { - Material material = new Material(); - material.setOwnMaterialNumber(semiconductorMatNbrCustomer); - material.setMaterialFlag(true); - material.setName("Semiconductor"); - return material; - } -} From dcc7e4bf51f7497005dd6dfdb95f3c86624a6492 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:47:04 +0100 Subject: [PATCH 14/24] feat: added tests --- .../masterdata/logic/ItemStockSAMMTest.java | 98 ++++++++++++++ .../logic/ItemStockServiceTest.java | 124 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java new file mode 100644 index 00000000..49fad57d --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Date; +import java.util.List; + +public class ItemStockSAMMTest { + + private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; + private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; + + + @Test + void parseSampleData() throws Exception { + String sample = "{\n" + + " \"positions\": [\n" + + " {\n" + + " \"lastUpdatedOnDateTime\": \"2023-04-01T14:23:00\",\n" + + " \"orderPositionReference\": {\n" + + " \"supplierOrderId\": \"M-Nbr-4711\",\n" + + " \"customerOrderId\": \"C-Nbr-4711\",\n" + + " \"customerOrderPositionId\": \"PositionId-01\"\n" + + " },\n" + + " \"allocatedStocks\": [\n" + + " {\n" + + " \"isBlocked\": false,\n" + + " \"stockLocationBPNA\": \"BPNA1234567890\",\n" + + " \"quantityOnAllocatedStock\": {\n" + + " \"value\": 20.0,\n" + + " \"unit\": \"unit:piece\"\n" + + " },\n" + + " \"stockLocationBPNS\": \"BPNS1234567890ZZ\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"materialGlobalAssetId\": \"urn:uuid:48878d48-6f1d-47f5-8ded-a441d0d879df\",\n" + + " \"materialNumberCustomer\": \"MNR-7307-AU340474.002\",\n" + + " \"materialNumberSupplier\": \"MNR-8101-ID146955.001\",\n" + + " \"direction\": \"INBOUND\"\n" + + "}"; + + ObjectMapper objectMapper = new ObjectMapper(); + ItemStockSAMM samm = objectMapper.readValue(sample, ItemStockSAMM.class); + Assertions.assertEquals(samm.getDirection(), DirectionCharacteristic.INBOUND); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getIsBlocked(), false); + Assertions.assertEquals(samm.getPositions().get(0).getOrderPositionReference().getSupplierOrderId(),"M-Nbr-4711"); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getValue(), 20.0); + Assertions.assertEquals(samm.getPositions().get(0).getAllocatedStocks().get(0).getQuantityOnAllocatedStock().getUnit().getValue(), "unit:piece"); + } + + @Test + void serializeAndDeserializeSamm() throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + ItemStockSAMM samm = new ItemStockSAMM(); + samm.setDirection(DirectionCharacteristic.INBOUND); + samm.setMaterialNumberSupplier(semiconductorMatNbrSupplier); + samm.setMaterialNumberCustomer(semiconductorMatNbrCustomer); + + OrderPositionReference opr = new OrderPositionReference("234", "123", "1"); + ItemQuantityEntity quantity = new ItemQuantityEntity(20.0, ItemUnitEnumeration.UNIT_PIECE); + AllocatedStock allocatedStock = new AllocatedStock(quantity, "BPNS1234567890ZZ", + false, "BPNA1234567890AA"); + Position position = new Position(opr, new Date(), List.of(allocatedStock)); + samm.setPositions(List.of(position)); + var jsonNode = objectMapper.readTree(objectMapper.writeValueAsString(samm)); + + var readSamm = objectMapper.readValue(jsonNode.toString(), ItemStockSAMM.class); + Assertions.assertEquals(samm, readSamm); + } + + +} diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java new file mode 100644 index 00000000..a4cd9cc1 --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + * (represented by Fraunhofer ISST) + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; + +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; +import org.eclipse.tractusx.puris.backend.stock.logic.service.ItemStockService; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; + +import java.util.Optional; +import java.util.UUID; + +import static org.mockito.Mockito.when; + +@DataJpaTest +public class ItemStockServiceTest { + + @Mock + private ItemStockRepository itemStockRepository; + @Mock + private MaterialPartnerRelationService materialPartnerRelationService; + @Mock + private PartnerService partnerService; + @InjectMocks + private ItemStockService itemStockService; + private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; + private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; + + @Test + void storeAndFindItemStock() { + Partner supplierPartner = getSupplierPartner(); + ItemStock itemStock = getItemStock(supplierPartner); + final var is = itemStock; + when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); + when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); + when(itemStockRepository.findById(is.getKey())).thenAnswer(x -> Optional.of(is)); + when(materialPartnerRelationService.find(semiconductorMatNbrCustomer, supplierPartner.getUuid())).thenAnswer(x -> getMaterialPartnerRelation()); + + itemStock = itemStockService.create(itemStock); + var foundItemStock = itemStockService.findById(itemStock.getKey()); + Assertions.assertEquals(itemStock, foundItemStock); + } + + private ItemStock getItemStock(Partner supplierPartner) { + ItemStock.Builder builder = ItemStock.Builder.newInstance(); + var itemStock = builder + .customerOrderId("123") + .supplierOrderId("234") + .customerOrderPositionId("1") + .direction(DirectionCharacteristic.INBOUND) + .materialNumberCustomer(semiconductorMatNbrCustomer) + .materialNumberSupplier(semiconductorMatNbrSupplier) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) + .locationBpns(supplierPartner.getSites().first().getBpns()) + .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) + .partnerBpnl(supplierPartner.getBpnl()) + .quantity(5) + .build(); + return itemStock; + } + + private Partner getSupplierPartner() { + Partner supplierPartnerEntity = new Partner( + "Scenario Supplier", + "http://supplier-control-plane:9184/api/v1/dsp", + "BPNL1234567890ZZ", + "BPNS1234567890ZZ", + "Konzernzentrale Dudelsdorf", + "BPNA1234567890AA", + "Heinrich-Supplier-Straße 1", + "77785 Dudelsdorf", + "Germany" + ); + supplierPartnerEntity.setUuid(UUID.randomUUID()); + return supplierPartnerEntity; + } + + private MaterialPartnerRelation getMaterialPartnerRelation() { + MaterialPartnerRelation mpr = new MaterialPartnerRelation(); + mpr.setPartnerMaterialNumber(semiconductorMatNbrSupplier); + mpr.setPartnerSuppliesMaterial(true); + mpr.setMaterial(getMaterial()); + return mpr; + } + + private Material getMaterial() { + Material material = new Material(); + material.setOwnMaterialNumber(semiconductorMatNbrCustomer); + material.setMaterialFlag(true); + material.setName("Semiconductor"); + return material; + } +} From 3f44f45f15c1daeedccb04ab0afb3e69b7b11f44 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 08:50:53 +0100 Subject: [PATCH 15/24] chore: updated dependencies --- DEPENDENCIES_BACKEND | 42 ------------------------------------------ backend/DEPENDENCIES | 42 ------------------------------------------ 2 files changed, 84 deletions(-) diff --git a/DEPENDENCIES_BACKEND b/DEPENDENCIES_BACKEND index ae618d6c..67c90818 100644 --- a/DEPENDENCIES_BACKEND +++ b/DEPENDENCIES_BACKEND @@ -1,6 +1,5 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 -maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -9,35 +8,18 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 -maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 -maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 -maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 -maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 -maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 -maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 -maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 -maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 -maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -50,41 +32,19 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 -maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 -maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 -maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 -maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 -maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 -maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 -maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -104,8 +64,6 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 diff --git a/backend/DEPENDENCIES b/backend/DEPENDENCIES index ae618d6c..67c90818 100644 --- a/backend/DEPENDENCIES +++ b/backend/DEPENDENCIES @@ -1,6 +1,5 @@ maven/mavencentral/ch.qos.logback/logback-classic/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3435 maven/mavencentral/ch.qos.logback/logback-core/1.4.11, EPL-1.0 OR LGPL-2.1-only, approved, #3373 -maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.2, Apache-2.0, approved, #8912 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.2, Apache-2.0, approved, #7947 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.2, MIT AND Apache-2.0, approved, #7932 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.2, Apache-2.0, approved, #7934 @@ -9,35 +8,18 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.2, maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.2, Apache-2.0, approved, #7930 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.2, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.andrewoma.dexx/collection/0.7, MIT, approved, CQ22160 -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.jsonld-java/jsonld-java/0.13.4, BSD-3-Clause, approved, CQ22136 -maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20 -maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 -maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654 -maven/mavencentral/com.google.guava/guava/32.1.2-jre, Apache-2.0 AND CC0-1.0 AND LicenseRef-Public-Domain, approved, #9229 -maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 -maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.google.protobuf/protobuf-java/3.23.3, BSD-3-Clause, approved, #8634 maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okhttp/okhttp/2.7.5, Apache-2.0, approved, clearlydefined maven/mavencentral/com.squareup.okio/okio/1.6.0, Apache-2.0, approved, CQ11382 maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.2, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-cli/commons-cli/1.5.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 -maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 -maven/mavencentral/io.github.classgraph/classgraph/4.8.162, MIT, approved, CQ22530 maven/mavencentral/io.micrometer/micrometer-commons/1.11.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243 maven/mavencentral/io.micrometer/micrometer-observation/1.11.4, Apache-2.0, approved, #9242 maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.15, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.15, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.15, Apache-2.0, approved, #5919 -maven/mavencentral/io.vavr/vavr-match/0.10.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.vavr/vavr/0.10.4, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined @@ -50,41 +32,19 @@ maven/mavencentral/net.bytebuddy/byte-buddy/1.14.8, Apache-2.0 AND BSD-3-Clause, maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.11, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 -maven/mavencentral/org.apache.commons/commons-collections4/4.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.commons/commons-compress/1.23.0, Apache-2.0 AND BSD-3-Clause, approved, #7506 -maven/mavencentral/org.apache.commons/commons-csv/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.httpcomponents/httpclient-cache/4.5.14, Apache-2.0, approved, CQ11714 -maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ23527 -maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 -maven/mavencentral/org.apache.jena/jena-arq/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-base/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-core/4.9.0, , restricted, clearlydefined -maven/mavencentral/org.apache.jena/jena-iri/4.9.0, , restricted, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.20.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.20.0, Apache-2.0, approved, #8799 -maven/mavencentral/org.apache.thrift/libthrift/0.18.1, Apache-2.0, approved, #8911 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.13, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.13, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.13, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.20, Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND BSD-3-Clause AND Apache-1.1, approved, #7695 maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 -maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-interface/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-java/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-types/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-meta-model-version-migrator/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-java-core/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-resolver/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-aspect-model-urn/2.4.2, MPL-2.0, approved, dt.esmf -maven/mavencentral/org.eclipse.esmf/esmf-semantic-aspect-meta-model/2.1.0, MPL-2.0, approved, dt.esmf maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.9.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 @@ -104,8 +64,6 @@ maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydef maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.projectlombok/lombok/1.18.30, MIT AND LicenseRef-Public-Domain, approved, CQ23907 -maven/mavencentral/org.roaringbitmap/RoaringBitmap/0.9.45, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.roaringbitmap/shims/0.9.45, Apache-2.0, approved, clearlydefined maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.9, MIT, approved, #7698 maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 From e6d7156c1217d42a0da1a6a5e477586ead82a90e Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 16:47:04 +0100 Subject: [PATCH 16/24] fix: itemstock now contains partner and material --- .../DataInjectionCommandLineRunner.java | 9 +- .../backend/stock/domain/model/ItemStock.java | 96 +++++++++---------- .../stock/logic/service/ItemStockService.java | 12 +-- .../logic/ItemStockServiceTest.java | 9 +- 4 files changed, 56 insertions(+), 70 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 67f817cb..4915af61 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -37,7 +37,8 @@ import org.eclipse.tractusx.puris.backend.stock.domain.model.*; import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; import org.eclipse.tractusx.puris.backend.stock.logic.adapter.ProductStockSammMapper; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.LocationIdTypeEnum; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.ProductStockSammDto; import org.eclipse.tractusx.puris.backend.stock.logic.service.*; @@ -227,12 +228,11 @@ private void setupCustomerRole() throws JsonProcessingException { .supplierOrderId("234") .customerOrderPositionId("1") .direction(DirectionCharacteristic.INBOUND) - .materialNumberCustomer(semiconductorMatNbrCustomer) - .materialNumberSupplier(semiconductorMatNbrSupplier) + .material(semiconductorMaterial) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) .locationBpns(supplierPartner.getSites().first().getBpns()) .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) - .partnerBpnl(supplierPartner.getBpnl()) + .partner(supplierPartner) .quantity(5) .build(); itemStock = itemStockService.create(itemStock); @@ -295,7 +295,6 @@ private void setupSupplierRole() { "bpnl: %s", foundProductStocks)); } - /** * creates a new customer Partner entity, stores it to * the database and returns this entity. diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index 5d442d18..a0b108c2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -22,10 +22,11 @@ package org.eclipse.tractusx.puris.backend.stock.domain.model; -import jakarta.persistence.Embeddable; -import jakarta.persistence.EmbeddedId; -import jakarta.persistence.Entity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; import lombok.*; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; @@ -35,59 +36,61 @@ @NoArgsConstructor @Entity -@ToString +@ToString(onlyExplicitlyIncluded = true) public class ItemStock { @Getter @EmbeddedId + @JsonIgnore private Key key = new Key(); private Date lastUpdatedOnDateTime; - private QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); @Getter @Setter private boolean isBlocked; - public String getPartnerBpnl() { - return key.partnerBpnl; + @JsonIgnore + public Partner getPartner() { + return key.partner; } - - public String getMaterialNumberCustomer() { - return key.materialNumberCustomer; + @ToString.Include + public String getPartnerBpnl(){ + return key.partner.getBpnl(); } - - public String getMaterialNumberSupplier() { - return key.materialNumberSupplier; + @JsonIgnore + public Material getMaterial() { + return key.material; } - - public String getMaterialGlobalAssetId() { - return key.getMaterialGlobalAssetId(); + @ToString.Include + public String getOwnMaterialNumber() { + return key.material.getOwnMaterialNumber(); } + @ToString.Include public DirectionCharacteristic getDirection() { return key.direction; } - + @ToString.Include public String getSupplierOrderId() { return key.supplierOrderId; } - + @ToString.Include public String getCustomerOrderId() { return key.customerOrderId; } - + @ToString.Include public String getCustomerOrderPositionId() { return key.customerOrderPositionId; } - + @ToString.Include public String getLocationBpna() { return key.locationBpna; } - + @ToString.Include public String getLocationBpns() { return key.locationBpns; } - + @ToString.Include public Date getLastUpdatedOnDateTime() { return (Date) lastUpdatedOnDateTime.clone(); } @@ -131,10 +134,14 @@ public int hashCode() { @ToString public static class Key implements Serializable { - private String partnerBpnl; - private String materialNumberCustomer; - private String materialNumberSupplier; - private String materialGlobalAssetId; + @ManyToOne + @MapsId("uuid") + @JoinColumn(name = "partner_uuid") + private Partner partner; + @ManyToOne + @MapsId("ownMaterialNumber") + @JoinColumn(name = "material_ownMaterialNumber") + private Material material; private DirectionCharacteristic direction; private String supplierOrderId; private String customerOrderId; @@ -147,16 +154,15 @@ public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Key)) return false; Key key = (Key) o; - return Objects.equals(partnerBpnl, key.partnerBpnl) && Objects.equals(materialNumberCustomer, key.materialNumberCustomer) - && Objects.equals(materialNumberSupplier, key.materialNumberSupplier) && Objects.equals(materialGlobalAssetId, - key.materialGlobalAssetId) && direction == key.direction && Objects.equals(supplierOrderId, key.supplierOrderId) + return Objects.equals(partner, key.partner) && Objects.equals(material, key.material) + && direction == key.direction && Objects.equals(supplierOrderId, key.supplierOrderId) && Objects.equals(customerOrderId, key.customerOrderId) && Objects.equals(customerOrderPositionId, key.customerOrderPositionId) && Objects.equals(locationBpna, key.locationBpna) && Objects.equals(locationBpns, key.locationBpns); } @Override public int hashCode() { - return Objects.hash(partnerBpnl, materialNumberCustomer, materialNumberSupplier, materialGlobalAssetId, + return Objects.hash(partner, material, direction, supplierOrderId, customerOrderId, customerOrderPositionId, locationBpna, locationBpns); } } @@ -190,10 +196,8 @@ public static class Builder { private Builder() { } - private String partnerBpnl; - private String materialNumberCustomer; - private String materialNumberSupplier; - private String materialGlobalAssetId; + private Partner partner; + private Material material; private DirectionCharacteristic direction; private String supplierOrderId; private String customerOrderId; @@ -204,23 +208,13 @@ private Builder() { private final QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); private boolean isBlocked; - public Builder partnerBpnl(String partnerBpnl) { - this.partnerBpnl = partnerBpnl; - return this; - } - - public Builder materialNumberCustomer(String materialNumberCustomer) { - this.materialNumberCustomer = materialNumberCustomer; - return this; - } - - public Builder materialNumberSupplier(String materialNumberSupplier) { - this.materialNumberSupplier = materialNumberSupplier; + public Builder partner(Partner partner) { + this.partner = partner; return this; } - public Builder materialGlobalAssetId(String materialGlobalAssetId) { - this.materialGlobalAssetId = materialGlobalAssetId; + public Builder material(Material material) { + this.material = material; return this; } @@ -276,10 +270,8 @@ public Builder isBlocked(boolean isBlocked) { public ItemStock build() { ItemStock itemStock = new ItemStock(); - itemStock.key.partnerBpnl = partnerBpnl; - itemStock.key.materialNumberCustomer = materialNumberCustomer; - itemStock.key.materialNumberSupplier = materialNumberSupplier; - itemStock.key.materialGlobalAssetId = materialGlobalAssetId == null ? "" : materialGlobalAssetId; + itemStock.key.partner = partner; + itemStock.key.material = material; itemStock.key.direction = direction; itemStock.key.supplierOrderId = supplierOrderId; itemStock.key.customerOrderId = customerOrderId; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index 3d2576d6..7aa750e2 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -71,10 +71,9 @@ public List findAll() { private boolean validate(ItemStock itemStock) { var key = itemStock.getKey(); try { - Objects.requireNonNull(key.getPartnerBpnl(), "Missing PartnerBpnl"); - Objects.requireNonNull(key.getMaterialNumberCustomer(), "Missing materialNumberCustomer"); - Objects.requireNonNull(key.getMaterialNumberSupplier(), "Missing materialNumberSupplier"); - Objects.requireNonNull(key.getMaterialGlobalAssetId(), "Missing materialGlobalAssetId"); + Partner partner = key.getPartner(); + Objects.requireNonNull(partner, "Missing Partner"); + Objects.requireNonNull(key.getMaterial(), "Missing Material"); Objects.requireNonNull(key.getDirection(), "Missing direction"); Objects.requireNonNull(key.getSupplierOrderId(), "Missing supplierOrderId"); Objects.requireNonNull(key.getCustomerOrderId(), "Missing customerOrderId"); @@ -84,8 +83,6 @@ private boolean validate(ItemStock itemStock) { Objects.requireNonNull(itemStock.getMeasurementUnit(), "Missing measurementUnit"); Objects.requireNonNull(itemStock.getQuantityAmount(), "Missing quantityAmount"); Objects.requireNonNull(itemStock.getLastUpdatedOnDateTime(), "Missing lastUpdatedOnTime"); - Partner partner = partnerService.findByBpnl(key.getPartnerBpnl()); - Objects.requireNonNull(partner, "Unknown partner: " + key.getPartnerBpnl()); Partner mySelf = partnerService.getOwnPartnerEntity(); Partner customer = key.getDirection() == DirectionCharacteristic.INBOUND ? mySelf : partner; Partner supplier = customer == mySelf ? partner : mySelf; @@ -95,8 +92,7 @@ private boolean validate(ItemStock itemStock) { var stockBpna = supplier.getSites().stream().flatMap(site -> site.getAddresses().stream()) .filter(address -> address.getBpna().equals(key.getLocationBpna())).findFirst().orElse(null); Objects.requireNonNull(stockBpna, "Unknown Bpna: " + key.getLocationBpna()); - String ownMaterialNumber = mySelf == customer ? key.getMaterialNumberCustomer() : key.getMaterialNumberSupplier(); - var materialPartnerRelation = mprService.find(ownMaterialNumber, partner.getUuid()); + var materialPartnerRelation = mprService.find(key.getMaterial(), partner); Objects.requireNonNull(materialPartnerRelation, "Missing MaterialPartnerRelation"); } catch (Exception e) { log.error("Validation failed: " + e.getMessage()); diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index a4cd9cc1..ca7e8ba7 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -60,7 +60,7 @@ public class ItemStockServiceTest { @Test void storeAndFindItemStock() { Partner supplierPartner = getSupplierPartner(); - ItemStock itemStock = getItemStock(supplierPartner); + ItemStock itemStock = getItemStock(supplierPartner, getMaterial()); final var is = itemStock; when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); @@ -72,19 +72,18 @@ void storeAndFindItemStock() { Assertions.assertEquals(itemStock, foundItemStock); } - private ItemStock getItemStock(Partner supplierPartner) { + private ItemStock getItemStock(Partner supplierPartner, Material material) { ItemStock.Builder builder = ItemStock.Builder.newInstance(); var itemStock = builder .customerOrderId("123") .supplierOrderId("234") .customerOrderPositionId("1") .direction(DirectionCharacteristic.INBOUND) - .materialNumberCustomer(semiconductorMatNbrCustomer) - .materialNumberSupplier(semiconductorMatNbrSupplier) + .material(material) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) .locationBpns(supplierPartner.getSites().first().getBpns()) .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) - .partnerBpnl(supplierPartner.getBpnl()) + .partner(supplierPartner) .quantity(5) .build(); return itemStock; From d17746963501bed9dd5d6e7f3d5993c39e2bb848 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 17:05:26 +0100 Subject: [PATCH 17/24] fix: edited license headers as ordered --- .../backend/stock/domain/model/ItemStock.java | 2 -- .../repository/ItemStockRepository.java | 19 +++++++++++++++++++ .../dto/itemstocksamm/AllocatedStock.java | 2 -- .../DirectionCharacteristic.java | 2 -- .../dto/itemstocksamm/ItemQuantityEntity.java | 2 -- .../dto/itemstocksamm/ItemStockSAMM.java | 2 -- .../itemstocksamm/ItemUnitEnumeration.java | 2 -- .../itemstocksamm/OrderPositionReference.java | 2 -- .../logic/dto/itemstocksamm/Position.java | 2 -- .../stock/logic/service/ItemStockService.java | 2 -- .../masterdata/logic/ItemStockSAMMTest.java | 2 -- .../logic/ItemStockServiceTest.java | 2 -- 12 files changed, 19 insertions(+), 22 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index a0b108c2..9a9f877e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java index 55adb75a..57094830 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ package org.eclipse.tractusx.puris.backend.stock.domain.repository; import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java index 9be70d73..d6045d7f 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java index ae43708c..b3770a83 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/DirectionCharacteristic.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java index e156c937..9eea3c45 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java index a44c2104..92a6f1c8 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemStockSAMM.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java index 0b35c94c..3e36a2ac 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemUnitEnumeration.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java index bae07265..898932e1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java index a700f7f0..4d4f0cd1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/Position.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index 7aa750e2..ffe892a1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java index 49fad57d..e1b56275 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockSAMMTest.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index ca7e8ba7..79306ee5 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -1,7 +1,5 @@ /* * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. - * (represented by Fraunhofer ISST) * Copyright (c) 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional From 726d28f4fdb0347a3ef9e9a9ed1c191313655539 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 6 Dec 2023 17:33:51 +0100 Subject: [PATCH 18/24] fix: validation check generates more verbose output --- .../backend/stock/logic/service/ItemStockService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index ffe892a1..c110e2da 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -68,8 +68,8 @@ public List findAll() { private boolean validate(ItemStock itemStock) { var key = itemStock.getKey(); + Partner partner = key.getPartner(); try { - Partner partner = key.getPartner(); Objects.requireNonNull(partner, "Missing Partner"); Objects.requireNonNull(key.getMaterial(), "Missing Material"); Objects.requireNonNull(key.getDirection(), "Missing direction"); @@ -91,9 +91,10 @@ private boolean validate(ItemStock itemStock) { .filter(address -> address.getBpna().equals(key.getLocationBpna())).findFirst().orElse(null); Objects.requireNonNull(stockBpna, "Unknown Bpna: " + key.getLocationBpna()); var materialPartnerRelation = mprService.find(key.getMaterial(), partner); - Objects.requireNonNull(materialPartnerRelation, "Missing MaterialPartnerRelation"); + Objects.requireNonNull(materialPartnerRelation, "Missing MaterialPartnerRelation between Partner " + + partner.getBpnl() + " and " + itemStock.getOwnMaterialNumber()); } catch (Exception e) { - log.error("Validation failed: " + e.getMessage()); + log.error("Validation failed: " + itemStock + "\n" + e.getMessage()); return false; } return true; From 5a2fd2eaad4869712600d462527981043a02f125 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Wed, 13 Dec 2023 08:31:09 +0100 Subject: [PATCH 19/24] feat: current working status --- .../DataInjectionCommandLineRunner.java | 3 -- .../backend/stock/domain/model/ItemStock.java | 26 +++++------ .../dto/itemstocksamm/ItemQuantityEntity.java | 44 +++++++++---------- .../stock/logic/service/ItemStockService.java | 3 -- 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 4915af61..d4b52235 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -224,9 +224,6 @@ private void setupCustomerRole() throws JsonProcessingException { ItemStock.Builder builder = ItemStock.Builder.newInstance(); var itemStock = builder - .customerOrderId("123") - .supplierOrderId("234") - .customerOrderPositionId("1") .direction(DirectionCharacteristic.INBOUND) .material(semiconductorMaterial) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index 9a9f877e..0f013ad5 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -45,7 +45,11 @@ public class ItemStock { private QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); @Getter @Setter + @ToString.Include private boolean isBlocked; + private String supplierOrderId; + private String customerOrderId; + private String customerOrderPositionId; @JsonIgnore public Partner getPartner() { @@ -70,15 +74,15 @@ public DirectionCharacteristic getDirection() { } @ToString.Include public String getSupplierOrderId() { - return key.supplierOrderId; + return supplierOrderId; } @ToString.Include public String getCustomerOrderId() { - return key.customerOrderId; + return customerOrderId; } @ToString.Include public String getCustomerOrderPositionId() { - return key.customerOrderPositionId; + return customerOrderPositionId; } @ToString.Include public String getLocationBpna() { @@ -141,9 +145,6 @@ public static class Key implements Serializable { @JoinColumn(name = "material_ownMaterialNumber") private Material material; private DirectionCharacteristic direction; - private String supplierOrderId; - private String customerOrderId; - private String customerOrderPositionId; private String locationBpna; private String locationBpns; @@ -153,15 +154,14 @@ public boolean equals(Object o) { if (!(o instanceof Key)) return false; Key key = (Key) o; return Objects.equals(partner, key.partner) && Objects.equals(material, key.material) - && direction == key.direction && Objects.equals(supplierOrderId, key.supplierOrderId) - && Objects.equals(customerOrderId, key.customerOrderId) && Objects.equals(customerOrderPositionId, key.customerOrderPositionId) - && Objects.equals(locationBpna, key.locationBpna) && Objects.equals(locationBpns, key.locationBpns); + && direction == key.direction && Objects.equals(locationBpna, key.locationBpna) && + Objects.equals(locationBpns, key.locationBpns); } @Override public int hashCode() { return Objects.hash(partner, material, - direction, supplierOrderId, customerOrderId, customerOrderPositionId, locationBpna, locationBpns); + direction, locationBpna, locationBpns); } } @@ -271,9 +271,9 @@ public ItemStock build() { itemStock.key.partner = partner; itemStock.key.material = material; itemStock.key.direction = direction; - itemStock.key.supplierOrderId = supplierOrderId; - itemStock.key.customerOrderId = customerOrderId; - itemStock.key.customerOrderPositionId = customerOrderPositionId; + itemStock.supplierOrderId = supplierOrderId; + itemStock.customerOrderId = customerOrderId; + itemStock.customerOrderPositionId = customerOrderPositionId; itemStock.key.locationBpna = locationBpna; itemStock.key.locationBpns = locationBpns; itemStock.quantityOnAllocatedStock = quantityOnAllocatedStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java index 9eea3c45..54747708 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/ItemQuantityEntity.java @@ -38,26 +38,26 @@ public class ItemQuantityEntity { @NotNull - private Double value; - - @NotNull - private ItemUnitEnumeration unit; - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - final ItemQuantityEntity that = (ItemQuantityEntity) o; - return Objects.equals(value, that.value) && Objects.equals(unit, that.unit); - } - - @Override - public int hashCode() { - return Objects.hash(value, unit); - } + private Double value; + + @NotNull + private ItemUnitEnumeration unit; + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final ItemQuantityEntity that = (ItemQuantityEntity) o; + return Objects.equals(value, that.value) && Objects.equals(unit, that.unit); + } + + @Override + public int hashCode() { + return Objects.hash(value, unit); + } } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index c110e2da..8ab08bdf 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -73,9 +73,6 @@ private boolean validate(ItemStock itemStock) { Objects.requireNonNull(partner, "Missing Partner"); Objects.requireNonNull(key.getMaterial(), "Missing Material"); Objects.requireNonNull(key.getDirection(), "Missing direction"); - Objects.requireNonNull(key.getSupplierOrderId(), "Missing supplierOrderId"); - Objects.requireNonNull(key.getCustomerOrderId(), "Missing customerOrderId"); - Objects.requireNonNull(key.getCustomerOrderPositionId(), "Missing customerOrderPositionId"); Objects.requireNonNull(key.getLocationBpna(), "Missing locationBpna"); Objects.requireNonNull(key.getLocationBpns(), "Missing locationBpns"); Objects.requireNonNull(itemStock.getMeasurementUnit(), "Missing measurementUnit"); From 23c66edba90ecb681095b2e79fa0386bca274519 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Mon, 18 Dec 2023 11:29:56 +0100 Subject: [PATCH 20/24] refactor: refactored itemstock and its variants --- .../DataInjectionCommandLineRunner.java | 55 ++-- .../backend/stock/domain/model/ItemStock.java | 298 +++--------------- .../stock/domain/model/MaterialItemStock.java | 13 + .../stock/domain/model/ProductItemStock.java | 14 + .../model/ReportedMaterialItemStock.java | 13 + .../model/ReportedProductItemStock.java | 13 + .../repository/ItemStockRepository.java | 28 -- .../MaterialItemStockRepository.java | 10 + .../ProductItemStockRepository.java | 10 + .../ReportedMaterialItemStockRepository.java | 10 + .../ReportedProductItemStockRepository.java | 10 + .../stock/logic/service/ItemStockService.java | 158 +++++++--- .../service/MaterialItemStockService.java | 27 ++ .../service/ProductItemStockService.java | 28 ++ .../ReportedMaterialItemStockService.java | 23 ++ .../ReportedProductItemStockService.java | 23 ++ .../logic/ItemStockServiceTest.java | 169 +++++----- 17 files changed, 462 insertions(+), 440 deletions(-) create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java delete mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index d4b52235..11b98b29 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -37,7 +37,6 @@ import org.eclipse.tractusx.puris.backend.stock.domain.model.*; import org.eclipse.tractusx.puris.backend.stock.domain.model.measurement.MeasurementUnit; import org.eclipse.tractusx.puris.backend.stock.logic.adapter.ProductStockSammMapper; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.LocationIdTypeEnum; import org.eclipse.tractusx.puris.backend.stock.logic.dto.samm.ProductStockSammDto; @@ -70,7 +69,9 @@ public class DataInjectionCommandLineRunner implements CommandLineRunner { private ProductStockService productStockService; @Autowired - private ItemStockService itemStockService; + private MaterialItemStockService materialItemStockService; + @Autowired + private ReportedMaterialItemStockService reportedMaterialItemStockService; @Autowired private PartnerProductStockService partnerProductStockService; @@ -115,7 +116,7 @@ public void run(String... args) throws Exception { */ private void createOwnPartnerEntity() { Partner mySelf; - if(variablesService.getOwnDefaultBpns()!= null && variablesService.getOwnDefaultBpns().length()!=0) { + if (variablesService.getOwnDefaultBpns() != null && variablesService.getOwnDefaultBpns().length() != 0) { mySelf = new Partner(variablesService.getOwnName(), variablesService.getEdcProtocolUrl(), variablesService.getOwnBpnl(), @@ -137,7 +138,7 @@ private void createOwnPartnerEntity() { } mySelf = partnerService.create(mySelf); log.info("Successfully created own Partner Entity: " + (partnerService.findByBpnl(mySelf.getBpnl()) != null)); - if(mySelf != null) { + if (mySelf != null) { log.info(mySelf.toString()); } } @@ -221,30 +222,34 @@ private void setupCustomerRole() throws JsonProcessingException { log.info("SAMM-DTO:\n" + objectMapper.writeValueAsString(productStockSammDto)); log.info("Own Street and Number: " + variablesService.getOwnDefaultStreetAndNumber()); - - ItemStock.Builder builder = ItemStock.Builder.newInstance(); - var itemStock = builder - .direction(DirectionCharacteristic.INBOUND) + Partner mySelf = partnerService.getOwnPartnerEntity(); + var builder = MaterialItemStock.builder(); + var materialItemStock = builder.partner(supplierPartner) .material(semiconductorMaterial) + .lastUpdatedOnDateTime(new Date()) + .locationBpna(mySelf.getSites().first().getAddresses().first().getBpna()) + .locationBpns(mySelf.getSites().first().getBpns()) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .locationBpns(supplierPartner.getSites().first().getBpns()) - .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) - .partner(supplierPartner) - .quantity(5) + .quantity(20) .build(); - itemStock = itemStockService.create(itemStock); - log.info("Created ItemStock: \n" + itemStock); - var foundItemStock = itemStockService.findById(itemStock.getKey()); - log.info("Found ItemStock: " + foundItemStock.equals(itemStock)); - log.info("\n" + foundItemStock); - try { - log.info("Trying to serialize: "); - var json = objectMapper.readTree(objectMapper.writeValueAsString(itemStock)); - log.info("\n" + json.toPrettyString()); - } catch (Exception e) { - log.info("fail"); - log.error(e.getMessage()); - } + var createdMaterialItemStock = materialItemStockService.create(materialItemStock); + log.info("Created MaterialItemStock: \n" + createdMaterialItemStock.toString()); + + var builder2 = ReportedMaterialItemStock.builder(); + var reportedMaterialItemStock = + builder2 + .material(semiconductorMaterial) + .partner(supplierPartner) + .lastUpdatedOnDateTime(new Date()) + .locationBpns(supplierPartner.getSites().first().getBpns()) + .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) + .quantity(50) + .build(); + + var createdReportedMaterialItemStock = reportedMaterialItemStockService.create(reportedMaterialItemStock); + log.info("Created ReportedMaterialItemStock: \n" + createdReportedMaterialItemStock); + } /** diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index 0f013ad5..d3250bcc 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -20,270 +20,74 @@ package org.eclipse.tractusx.puris.backend.stock.domain.model; -import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; import lombok.*; +import lombok.experimental.SuperBuilder; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; -import java.io.Serializable; import java.util.Date; -import java.util.Objects; +import java.util.UUID; @NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@SuperBuilder +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Entity -@ToString(onlyExplicitlyIncluded = true) -public class ItemStock { +@ToString +public abstract class ItemStock { + + static final String ORDER_ID_REGEX = "^[a-zA-Z0-9\\-\\.]{1,255}$"; + + @Id + @GeneratedValue + protected UUID uuid; + + @ManyToOne() + @JoinColumn(name = "partner_uuid") + @ToString.Exclude + @NotNull + protected Partner partner; + @ManyToOne() + @JoinColumn(name = "material_ownMaterialNumber") + @ToString.Exclude + @NotNull + protected Material material; + + protected double quantity; + @NotNull + protected ItemUnitEnumeration measurementUnit; + @NotNull + protected String locationBpna; + @NotNull + protected String locationBpns; + @NotNull + protected Date lastUpdatedOnDateTime; + + protected boolean isBlocked; + @Pattern(regexp = ORDER_ID_REGEX) + protected String supplierOrderId; + @Pattern(regexp = ORDER_ID_REGEX) + protected String customerOrderId; + @Pattern(regexp = ORDER_ID_REGEX) + protected String customerOrderPositionId; - @Getter - @EmbeddedId - @JsonIgnore - private Key key = new Key(); - private Date lastUpdatedOnDateTime; - private QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); - @Getter - @Setter @ToString.Include - private boolean isBlocked; - private String supplierOrderId; - private String customerOrderId; - private String customerOrderPositionId; - - @JsonIgnore - public Partner getPartner() { - return key.partner; - } - @ToString.Include - public String getPartnerBpnl(){ - return key.partner.getBpnl(); - } - @JsonIgnore - public Material getMaterial() { - return key.material; - } - @ToString.Include - public String getOwnMaterialNumber() { - return key.material.getOwnMaterialNumber(); + private String material_ownMaterialNumber(){ + return material.getOwnMaterialNumber(); } @ToString.Include - public DirectionCharacteristic getDirection() { - return key.direction; - } - @ToString.Include - public String getSupplierOrderId() { - return supplierOrderId; - } - @ToString.Include - public String getCustomerOrderId() { - return customerOrderId; - } - @ToString.Include - public String getCustomerOrderPositionId() { - return customerOrderPositionId; - } - @ToString.Include - public String getLocationBpna() { - return key.locationBpna; - } - @ToString.Include - public String getLocationBpns() { - return key.locationBpns; - } - @ToString.Include - public Date getLastUpdatedOnDateTime() { - return (Date) lastUpdatedOnDateTime.clone(); - } - - public void setLastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { - this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; - } - - public ItemUnitEnumeration getMeasurementUnit() { - return quantityOnAllocatedStock.getMeasurementUnit(); + private String partner_partnerBpnl(){ + return partner.getBpnl(); } - public Double getQuantityAmount() { - return quantityOnAllocatedStock.quantity; - } - - public void setQuantityAmount(double quantityAmount) { - quantityOnAllocatedStock.quantity = quantityAmount; - } - - public void setQuantityOnAllocatedStock(QuantityOnAllocatedStock quantityOnAllocatedStock) { - this.quantityOnAllocatedStock = quantityOnAllocatedStock; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof ItemStock)) return false; - ItemStock itemStock = (ItemStock) o; - return key.equals(itemStock.key); - } - - @Override - public int hashCode() { - return key.hashCode(); - } - - @Embeddable - @Getter - @Setter - @ToString - public static class Key implements Serializable { - - @ManyToOne - @MapsId("uuid") - @JoinColumn(name = "partner_uuid") - private Partner partner; - @ManyToOne - @MapsId("ownMaterialNumber") - @JoinColumn(name = "material_ownMaterialNumber") - private Material material; - private DirectionCharacteristic direction; - private String locationBpna; - private String locationBpns; - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof Key)) return false; - Key key = (Key) o; - return Objects.equals(partner, key.partner) && Objects.equals(material, key.material) - && direction == key.direction && Objects.equals(locationBpna, key.locationBpna) && - Objects.equals(locationBpns, key.locationBpns); - } - - @Override - public int hashCode() { - return Objects.hash(partner, material, - direction, locationBpna, locationBpns); - } - } - - @Getter - @Setter - @NoArgsConstructor - @AllArgsConstructor - @Embeddable - @ToString - public static class QuantityOnAllocatedStock { - private Double quantity; - private ItemUnitEnumeration measurementUnit; - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof QuantityOnAllocatedStock)) return false; - QuantityOnAllocatedStock that = (QuantityOnAllocatedStock) o; - return Objects.equals(quantity, that.quantity) && measurementUnit == that.measurementUnit; - } - - @Override - public int hashCode() { - return Objects.hash(quantity, measurementUnit); - } - } - - public static class Builder { - - private Builder() { - } - - private Partner partner; - private Material material; - private DirectionCharacteristic direction; - private String supplierOrderId; - private String customerOrderId; - private String customerOrderPositionId; - private String locationBpna; - private String locationBpns; - private Date lastUpdatedOnDateTime; - private final QuantityOnAllocatedStock quantityOnAllocatedStock = new QuantityOnAllocatedStock(); - private boolean isBlocked; - - public Builder partner(Partner partner) { - this.partner = partner; - return this; - } - - public Builder material(Material material) { - this.material = material; - return this; - } - - public Builder direction(DirectionCharacteristic direction) { - this.direction = direction; - return this; - } - - public Builder supplierOrderId(String supplierOrderId) { - this.supplierOrderId = supplierOrderId; - return this; - } - - public Builder customerOrderId(String customerOrderId) { - this.customerOrderId = customerOrderId; - return this; - } - - public Builder customerOrderPositionId(String customerOrderPositionId) { - this.customerOrderPositionId = customerOrderPositionId; - return this; - } - - public Builder locationBpna(String locationBpna) { - this.locationBpna = locationBpna; - return this; - } - - public Builder locationBpns(String locationBpns) { - this.locationBpns = locationBpns; - return this; - } - - public Builder lastUpdatedOnDateTime(Date lastUpdatedOnDateTime) { - this.lastUpdatedOnDateTime = lastUpdatedOnDateTime; - return this; - } - - public Builder measurementUnit(ItemUnitEnumeration measurementUnit) { - quantityOnAllocatedStock.measurementUnit = measurementUnit; - return this; - } - - public Builder quantity(double quantityAmount) { - quantityOnAllocatedStock.quantity = quantityAmount; - return this; - } +} - public Builder isBlocked(boolean isBlocked) { - this.isBlocked = isBlocked; - return this; - } - public ItemStock build() { - ItemStock itemStock = new ItemStock(); - itemStock.key.partner = partner; - itemStock.key.material = material; - itemStock.key.direction = direction; - itemStock.supplierOrderId = supplierOrderId; - itemStock.customerOrderId = customerOrderId; - itemStock.customerOrderPositionId = customerOrderPositionId; - itemStock.key.locationBpna = locationBpna; - itemStock.key.locationBpns = locationBpns; - itemStock.quantityOnAllocatedStock = quantityOnAllocatedStock; - itemStock.isBlocked = isBlocked; - itemStock.lastUpdatedOnDateTime = this.lastUpdatedOnDateTime == null ? new Date() : this.lastUpdatedOnDateTime; - return itemStock; - } - public static Builder newInstance() { - return new Builder(); - } - } -} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java new file mode 100644 index 00000000..a4e755cb --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java @@ -0,0 +1,13 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class MaterialItemStock extends ItemStock { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java new file mode 100644 index 00000000..60adde77 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java @@ -0,0 +1,14 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class ProductItemStock extends ItemStock { + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java new file mode 100644 index 00000000..77c71908 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java @@ -0,0 +1,13 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class ReportedMaterialItemStock extends ItemStock { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java new file mode 100644 index 00000000..69717c09 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java @@ -0,0 +1,13 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.model; + +import jakarta.persistence.Entity; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.SuperBuilder; + +@Entity +@SuperBuilder +@NoArgsConstructor +@ToString(callSuper = true) +public class ReportedProductItemStock extends ItemStock { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java deleted file mode 100644 index 57094830..00000000 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ItemStockRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2023 Volkswagen AG - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.tractusx.puris.backend.stock.domain.repository; - -import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface ItemStockRepository extends JpaRepository { - - -} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java new file mode 100644 index 00000000..cab46151 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java @@ -0,0 +1,10 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.repository; + +import org.eclipse.tractusx.puris.backend.stock.domain.model.MaterialItemStock; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.UUID; +@Repository +public interface MaterialItemStockRepository extends JpaRepository { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java new file mode 100644 index 00000000..8e7445ab --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java @@ -0,0 +1,10 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.repository; + +import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductItemStock; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.UUID; +@Repository +public interface ProductItemStockRepository extends JpaRepository { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java new file mode 100644 index 00000000..751f0471 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java @@ -0,0 +1,10 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.repository; + +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedMaterialItemStock; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.UUID; +@Repository +public interface ReportedMaterialItemStockRepository extends JpaRepository { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java new file mode 100644 index 00000000..0fa0fa44 --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java @@ -0,0 +1,10 @@ +package org.eclipse.tractusx.puris.backend.stock.domain.repository; + +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedProductItemStock; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.UUID; +@Repository +public interface ReportedProductItemStockRepository extends JpaRepository { +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java index 8ab08bdf..0666c19e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ItemStockService.java @@ -19,81 +19,149 @@ */ package org.eclipse.tractusx.puris.backend.stock.logic.service; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; -import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; -import org.springframework.stereotype.Service; +import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; import java.util.Objects; +import java.util.UUID; +import java.util.function.Function; + -@Service -@RequiredArgsConstructor @Slf4j -public class ItemStockService { - private final ItemStockRepository itemStockRepository; - private final PartnerService partnerService; - private final MaterialPartnerRelationService mprService; +public abstract class ItemStockService { - public ItemStock create(ItemStock itemStock) { - if(!validate(itemStock)) { - return null; - } - return itemStockRepository.save(itemStock); + protected final PartnerService partnerService; + + protected final MaterialPartnerRelationService mprService; + + protected final JpaRepository repository; + + protected final Function validator; + + public ItemStockService(PartnerService partnerService, MaterialPartnerRelationService mprService, JpaRepository repository) { + this.partnerService = partnerService; + this.mprService = mprService; + this.repository = repository; + this.validator = this::validate; } - public ItemStock update(ItemStock itemStock) { - if(!validate(itemStock)) { + + + public final T create(T itemStock) { + if(itemStock.getUuid() != null && repository.findById(itemStock.getUuid()).isPresent()) { return null; } - if(itemStockRepository.findById(itemStock.getKey()).isEmpty()){ + if(!validator.apply(itemStock)) { return null; } - return itemStockRepository.save(itemStock); + return repository.save(itemStock); } - public ItemStock findById(ItemStock.Key key) { - return itemStockRepository.findById(key).orElse(null); + public final T update(T itemStock) { + if(itemStock.getUuid() == null || repository.findById(itemStock.getUuid()).isEmpty()) { + return null; + } + return repository.save(itemStock); } - public List findAll() { - return itemStockRepository.findAll(); + public final T findById(UUID uuid) { + return repository.findById(uuid).orElse(null); } - private boolean validate(ItemStock itemStock) { - var key = itemStock.getKey(); - Partner partner = key.getPartner(); + public final void delete(UUID uuid) { + repository.deleteById(uuid); + } + + public final List findAll() { + return repository.findAll(); + } + + public abstract boolean validate(T itemStock); + + protected boolean basicValidation(ItemStock itemStock) { try { - Objects.requireNonNull(partner, "Missing Partner"); - Objects.requireNonNull(key.getMaterial(), "Missing Material"); - Objects.requireNonNull(key.getDirection(), "Missing direction"); - Objects.requireNonNull(key.getLocationBpna(), "Missing locationBpna"); - Objects.requireNonNull(key.getLocationBpns(), "Missing locationBpns"); + Objects.requireNonNull(itemStock.getPartner(), "Missing Partner"); + Objects.requireNonNull(itemStock.getMaterial(), "Missing Material"); + Objects.requireNonNull(itemStock.getLocationBpna(), "Missing locationBpna"); + Objects.requireNonNull(itemStock.getLocationBpns(), "Missing locationBpns"); Objects.requireNonNull(itemStock.getMeasurementUnit(), "Missing measurementUnit"); - Objects.requireNonNull(itemStock.getQuantityAmount(), "Missing quantityAmount"); Objects.requireNonNull(itemStock.getLastUpdatedOnDateTime(), "Missing lastUpdatedOnTime"); - Partner mySelf = partnerService.getOwnPartnerEntity(); - Partner customer = key.getDirection() == DirectionCharacteristic.INBOUND ? mySelf : partner; - Partner supplier = customer == mySelf ? partner : mySelf; - var stockBpns = supplier.getSites().stream() - .filter(site -> site.getBpns().equals(key.getLocationBpns())).findFirst().orElse(null); - Objects.requireNonNull(stockBpns, "Unknown Bpns: " + key.getLocationBpns()); - var stockBpna = supplier.getSites().stream().flatMap(site -> site.getAddresses().stream()) - .filter(address -> address.getBpna().equals(key.getLocationBpna())).findFirst().orElse(null); - Objects.requireNonNull(stockBpna, "Unknown Bpna: " + key.getLocationBpna()); - var materialPartnerRelation = mprService.find(key.getMaterial(), partner); - Objects.requireNonNull(materialPartnerRelation, "Missing MaterialPartnerRelation between Partner " + - partner.getBpnl() + " and " + itemStock.getOwnMaterialNumber()); } catch (Exception e) { - log.error("Validation failed: " + itemStock + "\n" + e.getMessage()); + log.error("Basic Validation failed: " + itemStock + "\n" + e.getMessage()); + return false; + } + return true; + } + + protected boolean validateLocalStock(ItemStock itemStock) { + return validateLocation(itemStock, partnerService.getOwnPartnerEntity()); + } + + protected boolean validateRemoteStock(ItemStock itemStock) { + return validateLocation(itemStock, itemStock.getPartner()); + } + + protected final boolean validateMaterialItemStock(ItemStock itemStock) { + try { + Partner partner = itemStock.getPartner(); + Material material = itemStock.getMaterial(); + MaterialPartnerRelation relation = mprService.find(material, partner); + Objects.requireNonNull(relation, "Missing MaterialPartnerRelation"); + if(!material.isMaterialFlag()) { + throw new IllegalArgumentException("Material flag is missing"); + } + if(!relation.isPartnerSuppliesMaterial()) { + throw new IllegalArgumentException("Partner does not supply material"); + } + } catch (Exception e) { + log.error("MaterialItemStock Validation failed: " + itemStock + "\n" + e.getMessage()); return false; } return true; } + + protected final boolean validateProductItemStock(ItemStock itemStock) { + try { + Partner partner = itemStock.getPartner(); + Material material = itemStock.getMaterial(); + MaterialPartnerRelation relation = mprService.find(material, partner); + Objects.requireNonNull(relation, "Missing MaterialPartnerRelation"); + if (!material.isProductFlag()) { + throw new IllegalArgumentException("Product flag is missing"); + } + if (!relation.isPartnerBuysMaterial()) { + throw new IllegalArgumentException("Partner does not buy material"); + } + } catch (Exception e) { + log.error("ProductItemStock Validation failed: " + itemStock + "\n" + e.getMessage()); + return false; + } + return true; + } + + protected boolean validateLocation(ItemStock itemStock, Partner partner) { + try { + var stockSite = partner.getSites().stream() + .filter(site -> site.getBpns().equals(itemStock.getLocationBpns())) + .findFirst().orElse(null); + Objects.requireNonNull(stockSite, "Site not found"); + var stockAddress = stockSite.getAddresses().stream() + .filter(addr -> addr.getBpna().equals(itemStock.getLocationBpna())) + .findFirst().orElse(null); + Objects.requireNonNull(stockAddress, "Address not found"); + } catch (Exception e) { + log.error("Location Validation failed: " + itemStock + "\n" + e.getMessage()); + return false; + } + return true; + } + } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java new file mode 100644 index 00000000..bab0be8e --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java @@ -0,0 +1,27 @@ +package org.eclipse.tractusx.puris.backend.stock.logic.service; + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.MaterialItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.MaterialItemStockRepository; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class MaterialItemStockService extends ItemStockService { + + + public MaterialItemStockService(PartnerService partnerService, MaterialPartnerRelationService mprService, + MaterialItemStockRepository repository) { + super(partnerService, mprService, repository); + } + + @Override + public boolean validate(MaterialItemStock materialItemStock) { + return basicValidation(materialItemStock) && validateLocalStock(materialItemStock) + && validateMaterialItemStock(materialItemStock); + } + + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java new file mode 100644 index 00000000..2f3caf6d --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java @@ -0,0 +1,28 @@ +package org.eclipse.tractusx.puris.backend.stock.logic.service; + + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ProductItemStockRepository; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class ProductItemStockService extends ItemStockService { + + + public ProductItemStockService(PartnerService partnerService, MaterialPartnerRelationService mprService, + ProductItemStockRepository repository) { + super(partnerService, mprService, repository); + } + + + public boolean validate(ProductItemStock productItemStock) { + return basicValidation(productItemStock) && validateLocalStock(productItemStock) + && validateProductItemStock(productItemStock); + } + + +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java new file mode 100644 index 00000000..83c8d40d --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java @@ -0,0 +1,23 @@ +package org.eclipse.tractusx.puris.backend.stock.logic.service; + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedMaterialItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ReportedMaterialItemStockRepository; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class ReportedMaterialItemStockService extends ItemStockService { + + + public ReportedMaterialItemStockService(PartnerService partnerService, MaterialPartnerRelationService mprService, ReportedMaterialItemStockRepository repository) { + super(partnerService, mprService, repository); + } + + @Override + public boolean validate(ReportedMaterialItemStock itemStock) { + return basicValidation(itemStock) && validateMaterialItemStock(itemStock) && validateRemoteStock(itemStock); + } +} diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java new file mode 100644 index 00000000..7fc7c80f --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java @@ -0,0 +1,23 @@ +package org.eclipse.tractusx.puris.backend.stock.logic.service; + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedProductItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.repository.ReportedProductItemStockRepository; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class ReportedProductItemStockService extends ItemStockService { + public ReportedProductItemStockService(PartnerService partnerService, MaterialPartnerRelationService mprService, + ReportedProductItemStockRepository repository) { + super(partnerService, mprService, repository); + } + + + @Override + public boolean validate(ReportedProductItemStock itemStock) { + return basicValidation(itemStock) && validateProductItemStock(itemStock) && validateRemoteStock(itemStock); + } +} diff --git a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java index 79306ee5..99843770 100644 --- a/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java +++ b/backend/src/test/java/org/eclipse/tractusx/puris/backend/stock/masterdata/logic/ItemStockServiceTest.java @@ -19,103 +19,82 @@ */ package org.eclipse.tractusx.puris.backend.stock.masterdata.logic; -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; -import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; -import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; -import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; -import org.eclipse.tractusx.puris.backend.stock.domain.model.ItemStock; -import org.eclipse.tractusx.puris.backend.stock.domain.repository.ItemStockRepository; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.DirectionCharacteristic; -import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; -import org.eclipse.tractusx.puris.backend.stock.logic.service.ItemStockService; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import java.util.Optional; -import java.util.UUID; - -import static org.mockito.Mockito.when; - @DataJpaTest public class ItemStockServiceTest { - - @Mock - private ItemStockRepository itemStockRepository; - @Mock - private MaterialPartnerRelationService materialPartnerRelationService; - @Mock - private PartnerService partnerService; - @InjectMocks - private ItemStockService itemStockService; - private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; - private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; - - @Test - void storeAndFindItemStock() { - Partner supplierPartner = getSupplierPartner(); - ItemStock itemStock = getItemStock(supplierPartner, getMaterial()); - final var is = itemStock; - when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); - when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); - when(itemStockRepository.findById(is.getKey())).thenAnswer(x -> Optional.of(is)); - when(materialPartnerRelationService.find(semiconductorMatNbrCustomer, supplierPartner.getUuid())).thenAnswer(x -> getMaterialPartnerRelation()); - - itemStock = itemStockService.create(itemStock); - var foundItemStock = itemStockService.findById(itemStock.getKey()); - Assertions.assertEquals(itemStock, foundItemStock); - } - - private ItemStock getItemStock(Partner supplierPartner, Material material) { - ItemStock.Builder builder = ItemStock.Builder.newInstance(); - var itemStock = builder - .customerOrderId("123") - .supplierOrderId("234") - .customerOrderPositionId("1") - .direction(DirectionCharacteristic.INBOUND) - .material(material) - .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .locationBpns(supplierPartner.getSites().first().getBpns()) - .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) - .partner(supplierPartner) - .quantity(5) - .build(); - return itemStock; - } - - private Partner getSupplierPartner() { - Partner supplierPartnerEntity = new Partner( - "Scenario Supplier", - "http://supplier-control-plane:9184/api/v1/dsp", - "BPNL1234567890ZZ", - "BPNS1234567890ZZ", - "Konzernzentrale Dudelsdorf", - "BPNA1234567890AA", - "Heinrich-Supplier-Straße 1", - "77785 Dudelsdorf", - "Germany" - ); - supplierPartnerEntity.setUuid(UUID.randomUUID()); - return supplierPartnerEntity; - } - - private MaterialPartnerRelation getMaterialPartnerRelation() { - MaterialPartnerRelation mpr = new MaterialPartnerRelation(); - mpr.setPartnerMaterialNumber(semiconductorMatNbrSupplier); - mpr.setPartnerSuppliesMaterial(true); - mpr.setMaterial(getMaterial()); - return mpr; - } - - private Material getMaterial() { - Material material = new Material(); - material.setOwnMaterialNumber(semiconductorMatNbrCustomer); - material.setMaterialFlag(true); - material.setName("Semiconductor"); - return material; - } +// +// @Mock +// private ItemStockRepository itemStockRepository; +// @Mock +// private MaterialPartnerRelationService materialPartnerRelationService; +// @Mock +// private PartnerService partnerService; +// @InjectMocks +// private ItemStockService itemStockService; +// private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; +// private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; +// +// @Test +// void storeAndFindItemStock() { +// Partner supplierPartner = getSupplierPartner(); +// ItemStock itemStock = getItemStock(supplierPartner, getMaterial()); +// final var is = itemStock; +// when(partnerService.findByBpnl(supplierPartner.getBpnl())).thenAnswer(x -> supplierPartner); +// when(itemStockRepository.save(Mockito.any(ItemStock.class))).thenAnswer(i -> i.getArguments()[0]); +// when(itemStockRepository.findById(is.getUuid())).thenAnswer(x -> Optional.of(is)); +// when(materialPartnerRelationService.find(semiconductorMatNbrCustomer, supplierPartner.getUuid())).thenAnswer(x -> getMaterialPartnerRelation()); +// +// itemStock = itemStockService.create(itemStock); +// var foundItemStock = itemStockService.findById(itemStock.getUuid()); +// Assertions.assertEquals(itemStock, foundItemStock); +// } +// +// private ItemStock getItemStock(Partner supplierPartner, Material material) { +// ItemStock.ItemStockBuilder builder = ItemStock.builder(); +// var itemStock = builder +// .customerOrderId("123") +// .supplierOrderId("234") +// .customerOrderPositionId("1") +// .material(material) +// .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) +// .locationBpns(supplierPartner.getSites().first().getBpns()) +// .locationBpna(supplierPartner.getSites().first().getAddresses().first().getBpna()) +// .partner(supplierPartner) +// .quantity(5.0) +// .build(); +// return itemStock; +// } +// +// private Partner getSupplierPartner() { +// Partner supplierPartnerEntity = new Partner( +// "Scenario Supplier", +// "http://supplier-control-plane:9184/api/v1/dsp", +// "BPNL1234567890ZZ", +// "BPNS1234567890ZZ", +// "Konzernzentrale Dudelsdorf", +// "BPNA1234567890AA", +// "Heinrich-Supplier-Straße 1", +// "77785 Dudelsdorf", +// "Germany" +// ); +// supplierPartnerEntity.setUuid(UUID.randomUUID()); +// return supplierPartnerEntity; +// } +// +// private MaterialPartnerRelation getMaterialPartnerRelation() { +// MaterialPartnerRelation mpr = new MaterialPartnerRelation(); +// mpr.setPartnerMaterialNumber(semiconductorMatNbrSupplier); +// mpr.setPartnerSuppliesMaterial(true); +// mpr.setMaterial(getMaterial()); +// return mpr; +// } +// +// private Material getMaterial() { +// Material material = new Material(); +// material.setOwnMaterialNumber(semiconductorMatNbrCustomer); +// material.setMaterialFlag(true); +// material.setName("Semiconductor"); +// return material; +// } } From 847ac7b31a1e5ed500377c538047b0eeec896446 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 19 Dec 2023 13:53:16 +0100 Subject: [PATCH 21/24] chore: added license headers --- .../stock/domain/model/MaterialItemStock.java | 20 +++++++++++++++++++ .../stock/domain/model/ProductItemStock.java | 20 +++++++++++++++++++ .../model/ReportedMaterialItemStock.java | 20 +++++++++++++++++++ .../model/ReportedProductItemStock.java | 20 +++++++++++++++++++ .../MaterialItemStockRepository.java | 20 +++++++++++++++++++ .../ProductItemStockRepository.java | 20 +++++++++++++++++++ .../ReportedMaterialItemStockRepository.java | 20 +++++++++++++++++++ .../ReportedProductItemStockRepository.java | 20 +++++++++++++++++++ .../service/MaterialItemStockService.java | 20 +++++++++++++++++++ .../service/ProductItemStockService.java | 20 +++++++++++++++++++ .../ReportedMaterialItemStockService.java | 20 +++++++++++++++++++ .../ReportedProductItemStockService.java | 20 +++++++++++++++++++ 12 files changed, 240 insertions(+) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java index a4e755cb..79df5fca 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/MaterialItemStock.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.model; import jakarta.persistence.Entity; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java index 60adde77..e13474cc 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ProductItemStock.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.model; import jakarta.persistence.Entity; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java index 77c71908..76e21b51 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedMaterialItemStock.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.model; import jakarta.persistence.Entity; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java index 69717c09..ab3ce4bb 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ReportedProductItemStock.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.model; import jakarta.persistence.Entity; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java index cab46151..7b6b79cb 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/MaterialItemStockRepository.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.repository; import org.eclipse.tractusx.puris.backend.stock.domain.model.MaterialItemStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java index 8e7445ab..67036837 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ProductItemStockRepository.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.repository; import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductItemStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java index 751f0471..6b3de4cf 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedMaterialItemStockRepository.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.repository; import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedMaterialItemStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java index 0fa0fa44..c8d2be47 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/repository/ReportedProductItemStockRepository.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.domain.repository; import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedProductItemStock; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java index bab0be8e..2f93e5a0 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/MaterialItemStockService.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.logic.service; import lombok.extern.slf4j.Slf4j; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java index 2f3caf6d..1008b05c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductItemStockService.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.logic.service; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java index 83c8d40d..2c284aa1 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedMaterialItemStockService.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.logic.service; import lombok.extern.slf4j.Slf4j; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java index 7fc7c80f..4f954fe6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ReportedProductItemStockService.java @@ -1,3 +1,23 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + package org.eclipse.tractusx.puris.backend.stock.logic.service; import lombok.extern.slf4j.Slf4j; From d64008edebd2003c566063bb97eb8ff481309ab6 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 19 Dec 2023 14:02:22 +0100 Subject: [PATCH 22/24] feat: added regex check for bpns/bpna --- .../puris/backend/masterdata/domain/model/Address.java | 3 ++- .../tractusx/puris/backend/masterdata/domain/model/Site.java | 4 ++-- .../tractusx/puris/backend/stock/domain/model/ItemStock.java | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Address.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Address.java index 51285148..35b0a217 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Address.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Address.java @@ -41,10 +41,11 @@ @ToString public class Address implements Comparable
{ + public static final String BPNA_REGEX = "^BPNA[0-9a-zA-Z]{12}$"; /** * The BPNA of this Address. */ - @Pattern(regexp = "^BPNA[0-9a-zA-Z]{12}$") + @Pattern(regexp = BPNA_REGEX) private String bpna; /** diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Site.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Site.java index 8227fffd..a54f39a3 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Site.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/masterdata/domain/model/Site.java @@ -45,13 +45,13 @@ @Setter @ToString public class Site implements Comparable { - + public static final String BPNS_REGEX = "^BPNS[0-9a-zA-Z]{12}$"; @Id @NotNull /** * The BPNS of this Site. */ - @Pattern(regexp = "^BPNS[0-9a-zA-Z]{12}$") + @Pattern(regexp = BPNS_REGEX) private String bpns; /** * A human-readable, distinctive name of this site. diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java index d3250bcc..e699fb6f 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/domain/model/ItemStock.java @@ -25,8 +25,10 @@ import jakarta.validation.constraints.Pattern; import lombok.*; import lombok.experimental.SuperBuilder; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Address; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.ItemUnitEnumeration; import java.util.Date; @@ -63,8 +65,10 @@ public abstract class ItemStock { @NotNull protected ItemUnitEnumeration measurementUnit; @NotNull + @Pattern(regexp = Address.BPNA_REGEX) protected String locationBpna; @NotNull + @Pattern(regexp = Site.BPNS_REGEX) protected String locationBpns; @NotNull protected Date lastUpdatedOnDateTime; From 3ddc489d3653a20664959449118f14801f94e9c2 Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 19 Dec 2023 15:46:36 +0100 Subject: [PATCH 23/24] feat: added itemstocksamm mapper --- .../logic/adapter/ItemStockSammMapper.java | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java new file mode 100644 index 00000000..d1a1817a --- /dev/null +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2023 Volkswagen AG + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.eclipse.tractusx.puris.backend.stock.logic.adapter; + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; +import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService; +import org.eclipse.tractusx.puris.backend.stock.domain.model.MaterialItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedMaterialItemStock; +import org.eclipse.tractusx.puris.backend.stock.domain.model.ReportedProductItemStock; +import org.eclipse.tractusx.puris.backend.stock.logic.dto.itemstocksamm.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class ItemStockSammMapper { + + @Autowired + private MaterialService materialService; + @Autowired + private MaterialPartnerRelationService mprService; + + public ItemStockSAMM itemStockSAMM(MaterialItemStock materialItemStock) { + ItemStockSAMM samm = new ItemStockSAMM(); + samm.setDirection(DirectionCharacteristic.INBOUND); + samm.setPositions(new ArrayList<>()); + samm.setMaterialGlobalAssetId(materialItemStock.getMaterial().getMaterialNumberCx()); + samm.setMaterialNumberCustomer(materialItemStock.getMaterial().getOwnMaterialNumber()); + samm.setMaterialNumberSupplier(mprService.find(materialItemStock.getMaterial(), + materialItemStock.getPartner()).getPartnerMaterialNumber()); + var posList = new ArrayList(); + samm.setPositions(posList); + Position position = new Position(); + if (materialItemStock.getCustomerOrderId() != null || materialItemStock.getCustomerOrderPositionId() != null + || materialItemStock.getSupplierOrderId() != null) { + OrderPositionReference opr = new OrderPositionReference(materialItemStock.getSupplierOrderId(), + materialItemStock.getCustomerOrderId(), materialItemStock.getCustomerOrderPositionId()); + position.setOrderPositionReference(opr); + } + ItemQuantityEntity itemQuantityEntity = new ItemQuantityEntity(materialItemStock.getQuantity(), + materialItemStock.getMeasurementUnit()); + AllocatedStock allocatedStock = new AllocatedStock(itemQuantityEntity, materialItemStock.getLocationBpns(), + materialItemStock.isBlocked(), materialItemStock.getLocationBpna()); + var allocatedStocksList = new ArrayList(); + allocatedStocksList.add(allocatedStock); + position.setAllocatedStocks(allocatedStocksList); + return samm; + } + + public ItemStockSAMM toItemStockSamm(ProductItemStock productItemStock) { + ItemStockSAMM samm = new ItemStockSAMM(); + samm.setDirection(DirectionCharacteristic.OUTBOUND); + samm.setPositions(new ArrayList<>()); + samm.setMaterialGlobalAssetId(productItemStock.getMaterial().getMaterialNumberCx()); + samm.setMaterialNumberSupplier(productItemStock.getMaterial().getOwnMaterialNumber()); + samm.setMaterialNumberCustomer(mprService.find(productItemStock.getMaterial(), + productItemStock.getPartner()).getPartnerMaterialNumber()); + var posList = new ArrayList(); + samm.setPositions(posList); + Position position = new Position(); + if (productItemStock.getCustomerOrderId() != null || productItemStock.getCustomerOrderPositionId() != null + || productItemStock.getSupplierOrderId() != null) { + OrderPositionReference opr = new OrderPositionReference(productItemStock.getSupplierOrderId(), + productItemStock.getCustomerOrderId(), productItemStock.getCustomerOrderPositionId()); + position.setOrderPositionReference(opr); + } + ItemQuantityEntity itemQuantityEntity = new ItemQuantityEntity(productItemStock.getQuantity(), + productItemStock.getMeasurementUnit()); + AllocatedStock allocatedStock = new AllocatedStock(itemQuantityEntity, productItemStock.getLocationBpns(), + productItemStock.isBlocked(), productItemStock.getLocationBpna()); + var allocatedStocksList = new ArrayList(); + allocatedStocksList.add(allocatedStock); + position.setAllocatedStocks(allocatedStocksList); + return samm; + } + + public List sammToReportedProductItemStock(ItemStockSAMM samm, Partner partner) { + String matNbrCustomer = samm.getMaterialNumberCustomer(); + String matNbrSupplier = samm.getMaterialNumberSupplier(); + String matNbrCatenaX = samm.getMaterialGlobalAssetId(); + ArrayList outputList = new ArrayList<>(); + Material material = null; + if (matNbrCatenaX != null) { + material = materialService.findByMaterialNumberCx(matNbrCatenaX); + if (material != null) { + if (!material.getOwnMaterialNumber().equals(matNbrSupplier)) { + log.warn("Mismatch between CatenaX Number " + matNbrCatenaX + " and ownMaterialNumber " + matNbrSupplier); + } + var mpr = mprService.find(material, partner); + if (mpr == null) { + log.warn("Missing MaterialPartnerRelation for " + material.getOwnMaterialNumber() + " and Partner " + partner.getBpnl()); + } else { + if (!mpr.getPartnerMaterialNumber().equals(matNbrCustomer)) { + log.warn("Mismatch for MaterialNumberCustomer " + matNbrCustomer + " and " + material.getOwnMaterialNumber()); + } + } + } + } + if (material == null) { + material = materialService.findByOwnMaterialNumber(matNbrSupplier); + if (matNbrCatenaX != null) { + log.warn("Unknown CatenaXNumber for Material " + material.getOwnMaterialNumber()); + } + var mpr = mprService.find(material, partner); + if (mpr != null) { + if (!mpr.getPartnerMaterialNumber().equals(matNbrCustomer)) { + log.warn("Unknown MaterialNumberCustomer " + matNbrCustomer + " for Material " + material.getOwnMaterialNumber()); + } + } + } + if (material == null) { + var list = mprService.findAllByPartnerMaterialNumber(matNbrCustomer) + .stream() + .filter(m -> { + var mpr = mprService.find(m, partner); + return mpr != null && mpr.isPartnerBuysMaterial(); + }) + .toList(); + if (!list.isEmpty()) { + material = list.get(0); + if (list.size() > 1) { + log.warn("CustomerMaterialNumber " + matNbrCustomer + " is ambiguous, arbitrarily choosing " + material.getOwnMaterialNumber()); + } + } + } + if(material == null) { + material = materialService.findByOwnMaterialNumber(matNbrSupplier); + } + if (material == null) { + log.warn("Could not identify material with CatenaXNbr " + matNbrCatenaX + " ,CustomerMaterialNbr " + matNbrCustomer + " and SupplierMaterialNbr " + matNbrSupplier); + return outputList; + } + for (var position : samm.getPositions()) { + Date lastUpdated = position.getLastUpdatedOnDateTime(); + String supplierOrderId = null, customerOrderPositionId = null, customerOrderId = null; + if (position.getOrderPositionReference() != null) { + supplierOrderId = position.getOrderPositionReference().getSupplierOrderId(); + customerOrderId = position.getOrderPositionReference().getCustomerOrderId(); + customerOrderPositionId = position.getOrderPositionReference().getCustomerOrderPositionId(); + } + for (var allocatedStock : position.getAllocatedStocks()) { + var builder = ReportedProductItemStock.builder(); + var itemStock = builder + .partner(partner) + .material(material) + .isBlocked(allocatedStock.getIsBlocked()) + .locationBpna(allocatedStock.getStockLocationBPNA()) + .locationBpns(allocatedStock.getStockLocationBPNS()) + .lastUpdatedOnDateTime(lastUpdated) + .customerOrderId(customerOrderId) + .supplierOrderId(supplierOrderId) + .customerOrderPositionId(customerOrderPositionId) + .measurementUnit(allocatedStock.getQuantityOnAllocatedStock().getUnit()) + .quantity(allocatedStock.getQuantityOnAllocatedStock().getValue()) + .build(); + outputList.add(itemStock); + } + } + return outputList; + } + + public List sammToReportedMaterialItemStock(ItemStockSAMM samm, Partner partner) { + String matNbrCustomer = samm.getMaterialNumberCustomer(); + String matNbrSupplier = samm.getMaterialNumberSupplier(); + String matNbrCatenaX = samm.getMaterialGlobalAssetId(); + ArrayList outputList = new ArrayList<>(); + Material material = null; + if (matNbrCatenaX != null) { + material = materialService.findByMaterialNumberCx(matNbrCatenaX); + if (material != null) { + if (!material.getOwnMaterialNumber().equals(matNbrCustomer)) { + log.warn("Mismatch between CatenaX Number " + matNbrCatenaX + " and ownMaterialNumber " + matNbrCustomer); + } + var mpr = mprService.find(material, partner); + if (mpr == null) { + log.warn("Missing MaterialPartnerRelation for " + material.getOwnMaterialNumber() + " and Partner " + partner.getBpnl()); + } else { + if (!mpr.getPartnerMaterialNumber().equals(matNbrSupplier)) { + log.warn("Mismatch for MaterialNumberSupplier " + matNbrSupplier + " and " + material.getOwnMaterialNumber()); + } + } + } + } + if (material == null) { + material = materialService.findByOwnMaterialNumber(matNbrCustomer); + if (matNbrCatenaX != null) { + log.warn("Unknown CatenaXNumber for Material " + material.getOwnMaterialNumber()); + } + var mpr = mprService.find(material, partner); + if (mpr != null) { + if (!mpr.getPartnerMaterialNumber().equals(matNbrSupplier)) { + log.warn("Unknown MaterialNumberSupplier " + matNbrSupplier + " for Material " + material.getOwnMaterialNumber()); + } + } + } + if (material == null) { + var list = mprService.findAllByPartnerMaterialNumber(matNbrSupplier) + .stream() + .filter(m -> { + var mpr = mprService.find(m, partner); + return mpr != null && mpr.isPartnerSuppliesMaterial(); + }) + .toList(); + if (!list.isEmpty()) { + material = list.get(0); + if (list.size() > 1) { + log.warn("SupplierMaterialNumber " + matNbrSupplier + " is ambiguous, arbitrarily choosing " + material.getOwnMaterialNumber()); + } + } + } + if(material == null) { + material = materialService.findByOwnMaterialNumber(matNbrCustomer); + } + if (material == null) { + log.warn("Could not identify material with CatenaXNbr " + matNbrCatenaX + " ,CustomerMaterialNbr " + matNbrCustomer + " and SupplierMaterialNbr " + matNbrSupplier); + return outputList; + } + for (var position : samm.getPositions()) { + Date lastUpdated = position.getLastUpdatedOnDateTime(); + String supplierOrderId = null, customerOrderPositionId = null, customerOrderId = null; + if (position.getOrderPositionReference() != null) { + supplierOrderId = position.getOrderPositionReference().getSupplierOrderId(); + customerOrderId = position.getOrderPositionReference().getCustomerOrderId(); + customerOrderPositionId = position.getOrderPositionReference().getCustomerOrderPositionId(); + } + for (var allocatedStock : position.getAllocatedStocks()) { + var builder = ReportedMaterialItemStock.builder(); + var itemStock = builder + .partner(partner) + .material(material) + .isBlocked(allocatedStock.getIsBlocked()) + .locationBpna(allocatedStock.getStockLocationBPNA()) + .locationBpns(allocatedStock.getStockLocationBPNS()) + .lastUpdatedOnDateTime(lastUpdated) + .customerOrderId(customerOrderId) + .supplierOrderId(supplierOrderId) + .customerOrderPositionId(customerOrderPositionId) + .measurementUnit(allocatedStock.getQuantityOnAllocatedStock().getUnit()) + .quantity(allocatedStock.getQuantityOnAllocatedStock().getValue()) + .build(); + outputList.add(itemStock); + } + } + return outputList; + } +} From 903b2a955110bc2b1d378ceee1074a9312d606ac Mon Sep 17 00:00:00 2001 From: Ernst-Christoph Schrewe Date: Tue, 19 Dec 2023 16:23:49 +0100 Subject: [PATCH 24/24] fix: fixed material identification logic and minor other fixes --- .../logic/adapter/ItemStockSammMapper.java | 59 ++++++++++--------- .../dto/itemstocksamm/AllocatedStock.java | 11 ++-- .../itemstocksamm/OrderPositionReference.java | 3 - 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java index d1a1817a..ad4828e6 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/adapter/ItemStockSammMapper.java @@ -46,7 +46,7 @@ public class ItemStockSammMapper { @Autowired private MaterialPartnerRelationService mprService; - public ItemStockSAMM itemStockSAMM(MaterialItemStock materialItemStock) { + public ItemStockSAMM toItemStockSAMM(MaterialItemStock materialItemStock) { ItemStockSAMM samm = new ItemStockSAMM(); samm.setDirection(DirectionCharacteristic.INBOUND); samm.setPositions(new ArrayList<>()); @@ -102,10 +102,15 @@ public ItemStockSAMM toItemStockSamm(ProductItemStock productItemStock) { public List sammToReportedProductItemStock(ItemStockSAMM samm, Partner partner) { String matNbrCustomer = samm.getMaterialNumberCustomer(); - String matNbrSupplier = samm.getMaterialNumberSupplier(); + String matNbrSupplier = samm.getMaterialNumberSupplier(); // should be ownMaterialNumber String matNbrCatenaX = samm.getMaterialGlobalAssetId(); ArrayList outputList = new ArrayList<>(); + if(samm.getDirection() != DirectionCharacteristic.INBOUND) { + log.warn("Direction should be INBOUND, aborting"); + return outputList; + } Material material = null; + // Use CatenaXNbr if (matNbrCatenaX != null) { material = materialService.findByMaterialNumberCx(matNbrCatenaX); if (material != null) { @@ -122,7 +127,21 @@ public List sammToReportedProductItemStock(ItemStockSA } } } - if (material == null) { + // Use MatNbrCustomer + if (material == null && matNbrCustomer != null) { + var list = mprService.findAllByPartnerMaterialNumber(matNbrCustomer).stream().filter(m -> { + var mpr = mprService.find(m, partner); + return mpr != null && mpr.isPartnerBuysMaterial(); + }).toList(); + if (!list.isEmpty()) { + material = list.get(0); + if (list.size() > 1) { + log.warn("CustomerMaterialNumber " + matNbrCustomer + " is ambiguous, arbitrarily choosing " + material.getOwnMaterialNumber()); + } + } + } + // Use MatNbrSupplier + if (material == null && matNbrSupplier != null) { material = materialService.findByOwnMaterialNumber(matNbrSupplier); if (matNbrCatenaX != null) { log.warn("Unknown CatenaXNumber for Material " + material.getOwnMaterialNumber()); @@ -134,24 +153,6 @@ public List sammToReportedProductItemStock(ItemStockSA } } } - if (material == null) { - var list = mprService.findAllByPartnerMaterialNumber(matNbrCustomer) - .stream() - .filter(m -> { - var mpr = mprService.find(m, partner); - return mpr != null && mpr.isPartnerBuysMaterial(); - }) - .toList(); - if (!list.isEmpty()) { - material = list.get(0); - if (list.size() > 1) { - log.warn("CustomerMaterialNumber " + matNbrCustomer + " is ambiguous, arbitrarily choosing " + material.getOwnMaterialNumber()); - } - } - } - if(material == null) { - material = materialService.findByOwnMaterialNumber(matNbrSupplier); - } if (material == null) { log.warn("Could not identify material with CatenaXNbr " + matNbrCatenaX + " ,CustomerMaterialNbr " + matNbrCustomer + " and SupplierMaterialNbr " + matNbrSupplier); return outputList; @@ -186,11 +187,16 @@ public List sammToReportedProductItemStock(ItemStockSA } public List sammToReportedMaterialItemStock(ItemStockSAMM samm, Partner partner) { - String matNbrCustomer = samm.getMaterialNumberCustomer(); + String matNbrCustomer = samm.getMaterialNumberCustomer(); // should be ownMaterialNumber String matNbrSupplier = samm.getMaterialNumberSupplier(); String matNbrCatenaX = samm.getMaterialGlobalAssetId(); ArrayList outputList = new ArrayList<>(); + if(samm.getDirection() != DirectionCharacteristic.OUTBOUND) { + log.warn("Direction should be OUTBOUND, aborting"); + return outputList; + } Material material = null; + // Use MatNbrCatenaX if (matNbrCatenaX != null) { material = materialService.findByMaterialNumberCx(matNbrCatenaX); if (material != null) { @@ -207,7 +213,8 @@ public List sammToReportedMaterialItemStock(ItemStock } } } - if (material == null) { + // Use MatNbrCustomer + if (material == null && matNbrCustomer != null) { material = materialService.findByOwnMaterialNumber(matNbrCustomer); if (matNbrCatenaX != null) { log.warn("Unknown CatenaXNumber for Material " + material.getOwnMaterialNumber()); @@ -219,7 +226,8 @@ public List sammToReportedMaterialItemStock(ItemStock } } } - if (material == null) { + //Use MatNbrSupplier + if (material == null && matNbrSupplier != null) { var list = mprService.findAllByPartnerMaterialNumber(matNbrSupplier) .stream() .filter(m -> { @@ -234,9 +242,6 @@ public List sammToReportedMaterialItemStock(ItemStock } } } - if(material == null) { - material = materialService.findByOwnMaterialNumber(matNbrCustomer); - } if (material == null) { log.warn("Could not identify material with CatenaXNbr " + matNbrCatenaX + " ,CustomerMaterialNbr " + matNbrCustomer + " and SupplierMaterialNbr " + matNbrSupplier); return outputList; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java index d6045d7f..83789396 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/AllocatedStock.java @@ -25,6 +25,8 @@ import jakarta.validation.constraints.Pattern; import lombok.Getter; import lombok.Setter; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Address; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import java.util.Objects; @@ -46,16 +48,14 @@ public class AllocatedStock { private ItemQuantityEntity quantityOnAllocatedStock; @NotNull - @Pattern(regexp = "^BPNS[0-9]{8}[a-zA-Z0-9]{4}$") - + @Pattern(regexp = Site.BPNS_REGEX) private String stockLocationBPNS; @NotNull private Boolean isBlocked; @NotNull - @Pattern(regexp = "^BPNA[0-9]{8}[a-zA-Z0-9]{4}$") - + @Pattern(regexp = Address.BPNA_REGEX) private String stockLocationBPNA; @JsonCreator @@ -63,9 +63,6 @@ public AllocatedStock(@JsonProperty(value = "quantityOnAllocatedStock") ItemQuan @JsonProperty(value = "stockLocationBPNS") String stockLocationBPNS, @JsonProperty(value = "isBlocked") Boolean isBlocked, @JsonProperty(value = "stockLocationBPNA") String stockLocationBPNA) { - super( - - ); this.quantityOnAllocatedStock = quantityOnAllocatedStock; this.stockLocationBPNS = stockLocationBPNS; this.isBlocked = isBlocked; diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java index 898932e1..d5ce9774 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/dto/itemstocksamm/OrderPositionReference.java @@ -48,9 +48,6 @@ public class OrderPositionReference { public OrderPositionReference(@JsonProperty(value = "supplierOrderId") String supplierOrderId, @JsonProperty(value = "customerOrderId") String customerOrderId, @JsonProperty(value = "customerOrderPositionId") String customerOrderPositionId) { - super( - - ); this.supplierOrderId = supplierOrderId; this.customerOrderId = customerOrderId; this.customerOrderPositionId = customerOrderPositionId;