-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from catenax-ng/release_dt_access_api_support_1
feat | Release dt access api support 1
- Loading branch information
Showing
5 changed files
with
171 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
modules/sde-core/src/main/resources/flyway/V32__Alter_pcf_aspect_Tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 T-Systems International GmbH | ||
* Copyright (c) 2024 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 | ||
********************************************************************************/ | ||
|
||
DO $$ | ||
BEGIN | ||
IF EXISTS (select 1 as foundtable from pg_tables WHERE tablename = 'pcf_aspect') | ||
THEN | ||
DELETE FROM pcf_aspect WHERE id IN (SELECT id FROM (SELECT id, ROW_NUMBER() OVER( PARTITION BY productid ORDER BY id ) AS row_num FROM pcf_aspect ) t WHERE t.row_num > 1); | ||
END IF; | ||
END $$; | ||
|
||
ALTER TABLE IF EXISTS pcf_aspect DROP CONSTRAINT IF EXISTS "pcf_aspect_un"; | ||
|
||
ALTER TABLE IF EXISTS pcf_aspect ADD CONSTRAINT pcf_aspect_un UNIQUE (productid); |
47 changes: 47 additions & 0 deletions
47
modules/sde-core/src/main/resources/flyway/V33__Alter_all_aspect_Tables_fordt_access_ids.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 T-Systems International GmbH | ||
* Copyright (c) 2024 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 | ||
********************************************************************************/ | ||
|
||
ALTER TABLE IF EXISTS aspect ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS aspect_relationship ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS batch ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS batch_v_300 ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS part_as_planned ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS part_site_information_as_planned ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS parttypeinformation_v_100 ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS pcf_aspect ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS serialpart_v_300 ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS single_level_bom_as_planned ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS single_level_bom_as_planned_v_300 ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS single_level_bom_asbuilt_v_300 ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS single_level_usage_as_built ADD IF NOT EXISTS shell_access_rule_ids text NULL; | ||
|
||
ALTER TABLE IF EXISTS single_level_usage_as_built_v_300 ADD IF NOT EXISTS shell_access_rule_ids text NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ava/org/eclipse/tractusx/sde/digitaltwins/gateways/external/IAccessRuleManagementApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 T-Systems International GmbH | ||
* Copyright (c) 2024 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.gateways.external; | ||
|
||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
@FeignClient(value = "IAccessRuleManagementApi", url = "${digital-twins.hostname:default}", configuration = DigitalTwinsFeignClientConfiguration.class) | ||
public interface IAccessRuleManagementApi { | ||
|
||
@GetMapping(path = "${digital-twins.registry.uri:/api/v3}/access-controls/rules") | ||
public JsonNode getAccessControlsRules(@RequestHeader("Edc-Bpn") String edcBpn); | ||
|
||
@PostMapping(path = "${digital-twins.registry.uri:/api/v3}/access-controls/rules") | ||
public JsonNode createAccessControlsRule(@RequestHeader("Edc-Bpn") String edcBpn, @RequestBody JsonNode request); | ||
|
||
@GetMapping(path = "${digital-twins.registry.uri:/api/v3}/access-controls/rules/{ruleId}") | ||
public JsonNode getAccessControlsRuleById(@PathVariable("ruleId") String ruleId, | ||
@RequestHeader("Edc-Bpn") String edcBpn); | ||
|
||
@PutMapping(path = "${digital-twins.registry.uri:/api/v3}/access-controls/rules/{ruleId}") | ||
public JsonNode updateAccessControlsRule(@PathVariable("ruleId") String ruleId, | ||
@RequestHeader("Edc-Bpn") String edcBpn, @RequestBody JsonNode request); | ||
|
||
@DeleteMapping(path = "${digital-twins.registry.uri:/api/v3}/access-controls/rules/{ruleId}") | ||
public void deleteAccessControlsRule(@PathVariable("ruleId") String ruleId, | ||
@RequestHeader("Edc-Bpn") String edcBpn); | ||
|
||
} |