-
Notifications
You must be signed in to change notification settings - Fork 6
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 #35 from catenax-ng/feat/DCMFOSS-113
Feat/dcmfoss 113
- Loading branch information
Showing
8 changed files
with
650 additions
and
183 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
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,7 @@ | ||
BASE_URL= | ||
API_KEY= | ||
|
||
TOKEN_ENDPOINT= | ||
CLIENT_ID= | ||
CLIENT_SECRET= | ||
GRANT_TYPE= |
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
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
82 changes: 82 additions & 0 deletions
82
...ipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/EDCController.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,82 @@ | ||
package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.controllers; | ||
|
||
import eclipse.tractusx.demand_capacity_mgmt_specification.api.EdcApi; | ||
import eclipse.tractusx.demand_capacity_mgmt_specification.model.*; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.EDCService; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Flux; | ||
|
||
@RestController | ||
@AllArgsConstructor | ||
public class EDCController implements EdcApi { | ||
|
||
private final EDCService edcService; | ||
|
||
@Override | ||
public ResponseEntity<List<Asset>> createAssetRequest(QuerySpec querySpec) throws Exception { | ||
return ResponseEntity.ok(edcService.createAssetRequest(querySpec)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<IdResponse> createContract(ContractDefinitionInput contractDefinitionInput) throws Exception { | ||
return ResponseEntity.ok(edcService.createContractDef(contractDefinitionInput).block()); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<List<ContractDefinitionOutput>> createContractRequest(QuerySpec querySpec) throws Exception { | ||
return ResponseEntity.ok(edcService.createContractDefRequest(querySpec)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<IdResponse> createPolicy(PolicyDefinitionInput policyDefinitionInput) throws Exception { | ||
return ResponseEntity.ok(edcService.createPolicy(policyDefinitionInput).block()); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<List<PolicyDefinitionOutput>> createPolicyRequest(QuerySpec querySpec) throws Exception { | ||
return ResponseEntity.ok(edcService.createPolicyRequest(querySpec)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Void> deleteAssetById(String assetId) throws Exception { | ||
return ResponseEntity.ok(edcService.deleteAsset(assetId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Void> deleteContractById(String contractId) throws Exception { | ||
return ResponseEntity.ok(edcService.deleteContractDef(contractId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Void> deletePolicyById(String policyId) throws Exception { | ||
return ResponseEntity.ok(edcService.deletePolicy(policyId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<AccessTokenResponse> getAccessToken() throws Exception { | ||
return ResponseEntity.ok(edcService.getAccessToken().block()); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Asset> getAssetById(String assetId) throws Exception { | ||
return ResponseEntity.ok(edcService.getAsset(assetId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<ContractDefinitionOutput> getContractById(String contractId) throws Exception { | ||
return ResponseEntity.ok(edcService.getContractDef(contractId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<PolicyDefinitionOutput> getPolicyById(String policyId) throws Exception { | ||
return ResponseEntity.ok(edcService.getPolicy(policyId)); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<IdResponse> registerAsset(AssetEntryNewDto assetInput) throws Exception { | ||
return ResponseEntity.ok(edcService.createAsset(assetInput).block()); | ||
} | ||
} |
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
Oops, something went wrong.