Skip to content

Commit

Permalink
updated interaction w/ ID&P for SLA DID retrieving #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-no committed Jan 25, 2022
1 parent 17a351b commit 3820e18
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eu._5gzorro.manager.api.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import eu._5gzorro.manager.api.dto.identityPermisssions.CredentialSubjectDto;
import eu._5gzorro.manager.api.dto.identityPermisssions.DIDStateCSDto;
import eu._5gzorro.manager.api.dto.responses.ApiErrorResponse;
import eu._5gzorro.manager.api.dto.responses.PagedSlaResponse;
import eu._5gzorro.manager.api.model.PageableOperation;
Expand Down Expand Up @@ -66,7 +66,7 @@ public interface ServiceLevelAgreementController {
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorResponse.class)))
})
@PostMapping("{slaId}/identity")
ResponseEntity<Void> updateTemplateIdentity(@PathVariable final UUID slaId, @Valid @RequestBody final CredentialSubjectDto state) throws JsonProcessingException;
ResponseEntity<Void> updateTemplateIdentity(@PathVariable final UUID slaId, @Valid @RequestBody final DIDStateCSDto state) throws JsonProcessingException;


@Operation(description = "Delete an SLA definition by DID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ public ResponseEntity<UUID> createServiceLevelAgreement(ServiceLevelAgreement sl
}

@Override
public ResponseEntity<Void> updateTemplateIdentity(UUID slaId, CredentialSubjectDto state) throws JsonProcessingException {
public ResponseEntity<Void> updateTemplateIdentity(UUID slaId, DIDStateCSDto state) throws JsonProcessingException {

String did = state.getId();
CredentialSubjectDto credentialSubjectDto = state.getCredentialSubjectDto();
if(credentialSubjectDto == null)
return ResponseEntity.badRequest().build();

String did = credentialSubjectDto.getId();

if(did == null)
return ResponseEntity.badRequest().build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package eu._5gzorro.manager.api.dto.identityPermisssions;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

public class DIDStateCSDto {

@JsonProperty("credentialSubject")
private CredentialSubjectDto credentialSubjectDto;

public DIDStateCSDto() {}

public CredentialSubjectDto getCredentialSubjectDto() { return credentialSubjectDto; }

public void setCredentialSubjectDto(CredentialSubjectDto credentialSubjectDto) { this.credentialSubjectDto = credentialSubjectDto; }

@Override
public boolean equals(Object o) {
if(this == o)
return true;

if(o == null || getClass() != o.getClass())
return false;

DIDStateCSDto didStateCSDto = (DIDStateCSDto) o;

return Objects.equals(this.credentialSubjectDto, didStateCSDto.credentialSubjectDto);
}

@Override
public int hashCode() { return Objects.hash(credentialSubjectDto); }

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DIDStateCSDto {\n");
sb.append(" credentialSubjectDto: ").append(toIndentedString(credentialSubjectDto)).append("\n");
sb.append("}");

return sb.toString();
}

private String toIndentedString(java.lang.Object o) {
if(o == null)
return "null";

return o.toString().replace("\n", "\n ");
}
}

0 comments on commit 3820e18

Please sign in to comment.