Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statuses service for the Material Demand and Capacity Groups - 67 #26

Merged
merged 52 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
56cc6c5
Merge branch 'main' of https://github.com/catenax-ng/tx-demand-capaci…
Sep 6, 2023
d918a1c
Merge branch 'main' of https://github.com/catenax-ng/tx-demand-capaci…
Sep 7, 2023
09cf36a
Merge branch 'main' of https://github.com/catenax-ng/tx-demand-capaci…
Sep 15, 2023
3c43496
Refractoring of UI elements and loading mechanism + retry
Ruskyy Sep 19, 2023
facf8e4
Gathering Data message
Ruskyy Sep 19, 2023
76e6916
CSS and Wizard mockup
Ruskyy Sep 20, 2023
2dfaf31
Capcity Group Wizard structure.
Ruskyy Sep 21, 2023
4567030
Pre load checked demands, and Loading fix
Ruskyy Sep 22, 2023
9d78c05
Merge branch 'catenax-ng-feat/DCMFOSS-53'
Bailonis Sep 25, 2023
0a1a0d9
added the statuses Endpoint
sajaadem Sep 25, 2023
9f2bce2
Added update/get WeekBasedCapacityGroups and WeekBasedMaterialDemands…
sajaadem Sep 25, 2023
e5073de
Merge branch 'main' into feature/DCMFOSS-67-copy2
sajaadem Sep 25, 2023
daaf909
added Licence and copyright header to Statuses repo file
sajaadem Sep 26, 2023
ce04017
update gitignore
OSousa117 Sep 26, 2023
4100c2a
git ignore
OSousa117 Sep 27, 2023
179579d
Units of measure and DB table creation
OSousa117 Sep 27, 2023
a1e6658
refactors
OSousa117 Sep 27, 2023
e81af23
capacity groups
OSousa117 Sep 27, 2023
bc2bcf3
updated flyaway
OSousa117 Sep 27, 2023
c32a7fa
Add TO exisiting done!
Ruskyy Sep 27, 2023
32af0af
Merge branch 'feature/DCMFOSS-74' of https://github.com/catenax-ng/tx…
Ruskyy Sep 27, 2023
3f06705
Merge branch 'eclipse-tractusx:main' into main
Bailonis Sep 28, 2023
f90cab2
Merge branch 'feature/DCMFOSS-75' of https://github.com/catenax-ng/tx…
Bailonis Sep 28, 2023
a41ff7d
Merge branch 'catenax-ng-feat/DCMFOSS-75'
Bailonis Sep 28, 2023
82433e0
Merge branch 'catenax-ng-feat/DCMFOSS-75'
Bailonis Sep 28, 2023
5b28d91
Merge branch 'main' of https://github.com/catenax-ng/tx-demand-capaci…
Bailonis Sep 28, 2023
15f2139
Linked to Backend!
Ruskyy Sep 28, 2023
0579c20
Avoid duplicaiton on the WIzard if already checked
Ruskyy Sep 29, 2023
16c62fd
Bug fizing and UI refinenement
Ruskyy Oct 2, 2023
829a54d
updated logic
OSousa117 Oct 2, 2023
efe8bf9
Merge branch 'feature/DCMFOSS-74' of https://github.com/catenax-ng/tx…
OSousa117 Oct 2, 2023
7c5d394
Loading Messages refractored
Ruskyy Oct 2, 2023
879d778
Merge branch 'feature/DCMFOSS-74' of https://github.com/catenax-ng/tx…
Ruskyy Oct 2, 2023
9cb7884
Code Refractoring and Further UI improvements
Ruskyy Oct 2, 2023
7be0153
Update DEPENDENCIES_FRONTEND
Ruskyy Oct 2, 2023
892f2f7
Better UI
Ruskyy Oct 2, 2023
be3c184
updated endpoint logic
OSousa117 Oct 2, 2023
238de90
unlink endpoint
OSousa117 Oct 3, 2023
4edf3f2
capacity group mat count
OSousa117 Oct 3, 2023
e14c83a
Capacity Group unlink material demand
OSousa117 Oct 3, 2023
b570c2d
Materials Unlink and List
Ruskyy Oct 3, 2023
ce46a88
Merge branch 'feature/DCMFOSS-67-copy2' of https://github.com/catenax…
Ruskyy Oct 4, 2023
e82e658
resolve problems after rebase
sajaadem Oct 4, 2023
743b904
added overall counts
sajaadem Oct 4, 2023
e7c5846
Merge branch 'fix/merge67' into feature/DCMFOSS-67-copy2
Bailonis Oct 4, 2023
caef324
this is the right version
Bailonis Oct 4, 2023
223587b
Merge branch 'feature/DCMFOSS-67-copy2' of https://github.com/catenax…
Bailonis Oct 4, 2023
5c506d1
reuse refactored CapacityGroupServiceImpl file
sajaadem Oct 5, 2023
3ae610d
Merge branch 'main' into feature/DCMFOSS-67-copy2
sajaadem Oct 5, 2023
3a76fb4
Merge branch 'fixing/dcm67pr' into feature/DCMFOSS-67-copy2
Bailonis Oct 9, 2023
dd3bcac
fix: build errors
Bailonis Oct 9, 2023
c9ba278
fix:build errors
Bailonis Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* *******************************************************************************
* Copyright (c) 2023 BMW 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.demandcapacitymgmt.demandcapacitymgmtbackend.controllers;

import eclipse.tractusx.demand_capacity_mgmt_specification.api.StatusesApi;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.StatusRequest;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.StatusesResponse;
import java.util.List;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.DemandService;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.StatusesService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
public class StatusesController implements StatusesApi {

private final StatusesService statusesService;

@Override
public ResponseEntity<StatusesResponse> getStatuses() {
return ResponseEntity.status(HttpStatus.OK).body(statusesService.getAllStatuses());
}

@Override
public ResponseEntity<StatusesResponse> postStatus(StatusRequest statusRequest) {
StatusesResponse responseDto = statusesService.postStatuses(statusRequest);
return ResponseEntity.status(HttpStatus.CREATED).body(responseDto);
}

@Override
public ResponseEntity<StatusesResponse> updateStatusesById(String statusId, StatusRequest statusRequest) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.controllers;

import eclipse.tractusx.demand_capacity_mgmt_specification.api.WeekBasedCapacityGroupApi;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedCapacityGroupRequest;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.*;
import java.util.List;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.WeekBasedCapacityGroupService;
Expand All @@ -37,11 +37,29 @@ public class WeekBasedCapacityGroupController implements WeekBasedCapacityGroupA

private final WeekBasedCapacityGroupService weekBasedCapacityGroupService;

@Override
public ResponseEntity<List<WeekBasedCapacityGroupDtoResponse>> getWeekBasedCapacityGroup() {
List<WeekBasedCapacityGroupDtoResponse> capacityGroupDefaultViewResponseList = weekBasedCapacityGroupService.getWeekBasedCapacityGroups();
return ResponseEntity.status(HttpStatus.OK).body(capacityGroupDefaultViewResponseList);
}

@Override
public ResponseEntity<Void> postWeekBasedCapacityGroup(
List<WeekBasedCapacityGroupRequest> weekBasedCapacityGroupRequest
List<WeekBasedCapacityGroupDtoRequest> weekBasedCapacityGroupRequest
) {
weekBasedCapacityGroupService.createWeekBasedCapacityGroup(weekBasedCapacityGroupRequest);
return ResponseEntity.status(HttpStatus.OK).build();
}

@Override
public ResponseEntity<WeekBasedCapacityGroupDtoResponse> updateWeekBasedCapacityGroupById(
String weekBasedCapacityId,
WeekBasedCapacityGroupDtoRequest weekBasedCapacityGroupRequest
) {
WeekBasedCapacityGroupDtoResponse responseDto = weekBasedCapacityGroupService.updateWeekBasedCapacityGroup(
weekBasedCapacityId,
weekBasedCapacityGroupRequest
);
return ResponseEntity.status(HttpStatus.OK).body(responseDto);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import eclipse.tractusx.demand_capacity_mgmt_specification.api.WeekBasedMaterialDemandApi;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandRequestDto;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandResponseDto;
import java.util.List;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.WeekBasedMaterialService;
Expand All @@ -37,11 +38,29 @@ public class WeekBasedMaterialController implements WeekBasedMaterialDemandApi {

private final WeekBasedMaterialService weekBasedMaterialService;

@Override
public ResponseEntity<List<WeekBasedMaterialDemandResponseDto>> getWeekBasedMaterialDemand() {
List<WeekBasedMaterialDemandResponseDto> capacityGroupDefaultViewResponseList = weekBasedMaterialService.getWeekBasedMaterialDemands();
return ResponseEntity.status(HttpStatus.OK).body(capacityGroupDefaultViewResponseList);
}

@Override
public ResponseEntity<Void> postWeekBasedMaterialDemand(
List<WeekBasedMaterialDemandRequestDto> weekBasedMaterialDemandRequestDto
) {
weekBasedMaterialService.createWeekBasedMaterial(weekBasedMaterialDemandRequestDto);
return ResponseEntity.status(HttpStatus.OK).build();
}

@Override
public ResponseEntity<WeekBasedMaterialDemandResponseDto> updateWeekBasedMaterialDemandById(
String demandId,
WeekBasedMaterialDemandRequestDto weekBasedMaterialDemandRequestDto
) {
WeekBasedMaterialDemandResponseDto responseDto = weekBasedMaterialService.updateWeekBasedMaterial(
demandId,
weekBasedMaterialDemandRequestDto
);
return ResponseEntity.status(HttpStatus.OK).body(responseDto);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* *******************************************************************************
* Copyright (c) 2023 BMW 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.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import java.util.UUID;
import javax.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "status_object")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StatusObjectEntity {

@Id
@Column(columnDefinition = "uuid")
private UUID id;

@Column(name = "count")
private int count;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* *******************************************************************************
* Copyright (c) 2023 BMW 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.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import java.util.UUID;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "statuses")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StatusesEntity {

@Id
// @SequenceGenerator(name = "status_id_sequence", sequenceName = "status_id_sequence")
// @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "status_id_sequence")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
// @Type(type = "uuid-char") // This is important for PostgreSQL
@Column(columnDefinition = "uuid")
private UUID id;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "todos", referencedColumnName = "id")
private StatusObjectEntity todos;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "status_improvment", referencedColumnName = "id")
private StatusObjectEntity statusImprovment;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "status_degredation", referencedColumnName = "id")
private StatusObjectEntity statusDegredation;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "general", referencedColumnName = "id")
private StatusObjectEntity general;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@
package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedCapacityGroupRequest;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.converters.WeekBasedCapacityGroupConverter;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.converters.WeekBasedMaterialConverter;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.jsonEntities.WeekBasedCapacityGroup;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.jsonEntities.WeekBasedMaterialDemand;
import org.hibernate.annotations.ColumnTransformer;

@Entity
Expand All @@ -49,9 +45,8 @@
public class WeekBasedCapacityGroupEntity {

@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(columnDefinition = "uuid", updatable = false, name = "id")
private UUID id;

@Convert(converter = WeekBasedCapacityGroupConverter.class)
@Column(name = "data", columnDefinition = "jsonb")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@

package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandRequestDto;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandRequest;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.converters.WeekBasedMaterialConverter;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.jsonEntities.WeekBasedMaterialDemand;
import org.hibernate.annotations.ColumnTransformer;

@Entity
Expand All @@ -47,14 +45,13 @@
public class WeekBasedMaterialDemandEntity {

@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(columnDefinition = "uuid", updatable = false, name = "id")
private UUID id;

@Convert(converter = WeekBasedMaterialConverter.class)
@Column(name = "data", columnDefinition = "jsonb")
@ColumnTransformer(write = "?::jsonb")
private WeekBasedMaterialDemandRequestDto weekBasedMaterialDemand;
private WeekBasedMaterialDemandRequest weekBasedMaterialDemand;

@Column(name = "viewed")
private Boolean viewed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@
package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.converters;

import com.google.gson.Gson;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandRequestDto;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.WeekBasedMaterialDemandRequest;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.jsonEntities.WeekBasedMaterialDemand;

@Converter(autoApply = true)
public class WeekBasedMaterialConverter implements AttributeConverter<WeekBasedMaterialDemandRequestDto, String> {
public class WeekBasedMaterialConverter implements AttributeConverter<WeekBasedMaterialDemandRequest, String> {

private static final Gson GSON = new Gson();

@Override
public String convertToDatabaseColumn(WeekBasedMaterialDemandRequestDto mjo) {
public String convertToDatabaseColumn(WeekBasedMaterialDemandRequest mjo) {
return GSON.toJson(mjo);
}

@Override
public WeekBasedMaterialDemandRequestDto convertToEntityAttribute(String dbData) {
return GSON.fromJson(dbData, WeekBasedMaterialDemandRequestDto.class);
public WeekBasedMaterialDemandRequest convertToEntityAttribute(String dbData) {
return GSON.fromJson(dbData, WeekBasedMaterialDemandRequest.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* *******************************************************************************
* Copyright (c) 2023 BMW 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.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums;

public enum CapacityDeviation {
BOTTLENECK(StatusColor.RED),
SURPLUS(StatusColor.GREEN),
ZERO(StatusColor.GREEN);

private final StatusColor statusColor;

CapacityDeviation(StatusColor statusColor) {
this.statusColor = statusColor;
}

public StatusColor getStatusColor() {
return statusColor;
}
}
Loading