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

[feat|sde-v2.1.0] DDTR update, support for batch model v2.0 ,added external specific asset id and feign Client changes updated for child aspect relationship. #56

Merged
merged 25 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4d4387d
Added external subject in specific asset Ids
sachinargade123 Jul 27, 2023
8f4b45e
A1SDS-2537 : code changes updated
ChetanT-System Jul 28, 2023
8078a52
A1SDS-2549: Update AAS submodel endpoints subprotocolBody
ChetanT-System Jul 28, 2023
c887eb7
- Supported Batch submodel version 2.0.0
ChetanT-System Aug 24, 2023
026a608
- Updated code changes for DTR service API call
ChetanT-System Aug 25, 2023
15af2f1
- Changes updated for batch documents
ChetanT-System Aug 25, 2023
e54e9c9
Merge pull request #180 from catenax-ng/DST_PIP10_Sprint1_batch_2.0.0
adityagajbhiye9 Aug 25, 2023
fbca48b
Added external subject in specific asset Ids
sachinargade123 Jul 27, 2023
ae97da4
A1SDS-2537 : code changes updated
ChetanT-System Jul 28, 2023
c5cf32b
A1SDS-2549: Update AAS submodel endpoints subprotocolBody
ChetanT-System Jul 28, 2023
e3bada6
- Updated code changes for DTR service API call
ChetanT-System Aug 25, 2023
6d3f503
Merge branch 'support_externalsubjectid' of https://github.com/catena…
sachinargade123 Aug 25, 2023
e925908
Update DDTR use of external subject Id
sachinargade123 Aug 25, 2023
3cba158
DDTR update with latest version
sachinargade123 Aug 28, 2023
47ca3c5
revert test commented line
sachinargade123 Aug 28, 2023
1c9d16c
Merge pull request #181 from catenax-ng/support_externalsubjectid
adityagajbhiye9 Aug 28, 2023
b280023
Update shell for reflect specific assets IDs information
sachinargade123 Aug 28, 2023
0da0ffa
Merge pull request #182 from catenax-ng/support_externalsubjectid
adityagajbhiye9 Aug 28, 2023
47b85a2
- Feign Client changes updated for child aspect relationship
ChetanT-System Aug 29, 2023
545bb8f
- changes for bpn String
ChetanT-System Aug 29, 2023
388738a
Merge pull request #183 from catenax-ng/support_externalsubjectid
adityagajbhiye9 Aug 29, 2023
64c5d51
Merge tag 'main' of https://github.com/catenax-ng/tx-managed-simple-d…
adityagajbhiye9 Aug 29, 2023
4e7d77b
Merge pull request #185 from catenax-ng/main
adityagajbhiye9 Aug 29, 2023
0285c5a
Merge pull request #186 from catenax-ng/DST_PIP10_ITR2
adityagajbhiye9 Aug 29, 2023
dc2fa7a
batch-submodel,ddtr version updated.
adityagajbhiye9 Aug 30, 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
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [2.1.0] - 2023-08-30
### Fixed
- Added external subject in specific asset Ids.
- Update AAS submodel endpoints subprotocolBody.
- Supported Batch submodel version 2.0.0.
- DDTR update with latest version.
- Feign Client changes updated for child aspect relationship.

## [2.0.11] - 2023-08-29
### Changed
- Docker image name changed.

## [2.0.10] - 2023-08-23
### Fixed
- Updated openAPI file for kics issue.
Expand Down Expand Up @@ -203,9 +215,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Compliance with Catena-X Guidelines
- Integration with Digital Twin registry service.

[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.10...main
[2.0.10]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.9...dftbackend-2.0.10
[2.0.9]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.8...dftbackend-2.0.9
[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.0...main
[2.1.0]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.11...v2.1.0
[2.0.11]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.10...v2.0.11
[2.0.10]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/sdebackend-2.0.9...v2.0.10
[2.0.9]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/sdebackend-2.0.8...sdebackend-2.0.9
[2.0.8]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.2...dftbackend-2.0.8
[2.0.2]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.1...dftbackend-2.0.2
[2.0.1]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.0...dftbackend-2.0.1
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For more details, please refer configuration section from [README.md](README.md)
- Postgres 11.9.13

#### Steps
1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/dft-backend.
1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend.
2. Get your instance of postgres running (Create **dftdb** new database).
3. Setup your project environment to JDK 18.
4. Provide require application configuration in application.properties as specified in step configuration.properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ private CommonConstants() {
public static final String MANUFACTURER_ID = "manufacturerId";
public static final String CUSTOMER_PART_ID = "customerPartId";
public static final String ASSET_LIFECYCLE_PHASE = "assetLifecyclePhase";
public static final String HTTP = "http";
public static final String HTTP = "HTTP";
public static final String HTTPS = "HTTPS";
public static final String ENDPOINT_PROTOCOL_VERSION = "0.1";
public static final String ENDPOINT_PROTOCOL_VERSION = "1.1";
public static final String PREFIX = "urn:uuid:";

public static final String INTERFACE_EDC = "EDC";
public static final String SUB_PROTOCOL = "IDS";
public static final String SUB_PROTOCOL = "DSP";
public static final String SUBMODEL_CONTEXT_URL = "/submodel";

public static final String AS_PLANNED = "AsPlanned";

public static final String EXTERNAL_REFERENCE = "ExternalReference";
public static final String GLOBAL_REFERENCE = "GlobalReference";
public static final String BODY_ENCODING = "plain";
public static final String INTERFACE = "https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-003";
public static final String INTERFACE = "SUBMODEL-3.0";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* 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.sde.digitaltwins.entities.common;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class ExternalSubjectId {

private String type;

private List<Keys> keys;

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,31 @@

package org.eclipse.tractusx.sde.digitaltwins.entities.common;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;

@Data
@NoArgsConstructor
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class KeyValuePair {

private String name;
private String value;
private ExternalSubjectId externalSubjectId;

@SneakyThrows
public String toJsonString() {
final ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* 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.sde.digitaltwins.entities.common;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class LookupQuery {

private String type;
private List<KeyValuePair> assetIds;
private List<String> semanticIds;



}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ public class ProtocolInformation {
private String subProtocol;
private String subprotocolBody;
private String subprotocolBodyEncoding;
private List<SecurityAttributes> securityAttributes;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* 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.sde.digitaltwins.entities.common;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class SecurityAttributes {


private String type;
private String key;
private String value;

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@

import java.util.List;

import org.eclipse.tractusx.sde.digitaltwins.entities.common.KeyValuePair;
import org.eclipse.tractusx.sde.digitaltwins.entities.common.MultiLanguage;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.AllArgsConstructor;
Expand All @@ -38,13 +40,15 @@
@NoArgsConstructor
@AllArgsConstructor
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_NULL)
public class ShellDescriptorRequest {

private String idShort;
private String id;
private List<MultiLanguage> description;
private String globalAssetId;
private List<KeyValuePair> specificAssetIds;
private List<Object> specificAssetIds;

@SneakyThrows
public String toJsonString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* 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.sde.digitaltwins.entities.request;

import org.eclipse.tractusx.sde.digitaltwins.entities.common.LookupQuery;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Getter
public class ShellLookupQueryRequest {

private LookupQuery query;




}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Base64;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.tractusx.sde.common.exception.ServiceException;
import org.eclipse.tractusx.sde.digitaltwins.entities.request.CreateSubModelRequest;
import org.eclipse.tractusx.sde.digitaltwins.entities.request.ShellDescriptorRequest;
Expand Down Expand Up @@ -55,20 +56,24 @@ public class DigitalTwinsFacilitator {
@Value(value = "${digital-twins.api:/api/v3.0}")
private String dtApiUri;

@Value(value = "${manufacturerId}")
public String manufacturerId;

public List<String> shellLookup(ShellLookupRequest request) throws ServiceException {
return shellLookupFromDDTR(request, null);
return shellLookupFromDDTR(request, null, manufacturerId);
}

@SneakyThrows
public List<String> shellLookupFromDDTR(ShellLookupRequest request, String ddtrUrl) throws ServiceException {
public List<String> shellLookupFromDDTR(ShellLookupRequest request, String ddtrUrl, String edcBpn)
throws ServiceException {

URI dtURL = (ddtrUrl == null || ddtrUrl.length() <= 0) ? getDtURL(digitalTwinsHost) : getDtURL(ddtrUrl);
URI dtURL = StringUtils.isAllEmpty(ddtrUrl) ? getDtURL(digitalTwinsHost) : getDtURL(ddtrUrl);

List<String> shellIds = List.of();

try {
ResponseEntity<ShellLookupResponse> response = digitalTwinsFeignClient.shellLookup(dtURL,
request.toJsonString());
request.toJsonString(), edcBpn);

ShellLookupResponse body = response.getBody();
if (response.getStatusCode() == HttpStatus.OK && body != null) {
Expand Down Expand Up @@ -106,17 +111,17 @@ public List<ShellDescriptorResponse> getShellDescriptorsWithSubmodelDetails(List

List<ShellDescriptorResponse> items = new ArrayList<>();
for (String shellId : shellIds) {
items.add(getShellDetailsById(shellId, ddtrUrl));
items.add(getShellDetailsById(shellId, ddtrUrl, manufacturerId));
}
return items;
}

public ShellDescriptorResponse getShellDetailsById(String shellId, String ddtrUrl) {
public ShellDescriptorResponse getShellDetailsById(String shellId, String ddtrUrl, String edcBpn) {

URI dtURL = (ddtrUrl == null || ddtrUrl.length() <= 0) ? getDtURL(digitalTwinsHost) : getDtURL(ddtrUrl);
URI dtURL = StringUtils.isAllEmpty(ddtrUrl) ? getDtURL(digitalTwinsHost) : getDtURL(ddtrUrl);

ResponseEntity<ShellDescriptorResponse> shellDescriptorResponse = digitalTwinsFeignClient
.getShellDescriptorByShellId(dtURL, encodeShellIdBase64Utf8(shellId));
.getShellDescriptorByShellId(dtURL, encodeShellIdBase64Utf8(shellId), edcBpn);
return shellDescriptorResponse.getBody();
}

Expand All @@ -142,6 +147,18 @@ public ShellDescriptorResponse createShellDescriptor(ShellDescriptorRequest requ
return responseBody;
}

public void updateShellSpecificAssetIdentifiers(String shellId, List<Object> specificAssetIds) {

digitalTwinsFeignClient.deleteShellSpecificAttributes(getDtURL(digitalTwinsHost),
encodeShellIdBase64Utf8(shellId), manufacturerId);

ResponseEntity<List<Object>> registerSubmodel = digitalTwinsFeignClient.createShellSpecificAttributes(
getDtURL(digitalTwinsHost), encodeShellIdBase64Utf8(shellId), manufacturerId, specificAssetIds);
if (registerSubmodel.getStatusCode() != HttpStatus.CREATED) {
log.error("Error in shell SpecificAssetIdentifiers deletion: " + registerSubmodel.toString());
}
}

public void createSubModel(String shellId, CreateSubModelRequest request) {

request.setDescription(List.of());
Expand Down
Loading