Skip to content

Commit

Permalink
fix: remove rems optional fields in daam specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
admy7 committed Mar 20, 2024
1 parent 7bfb4e0 commit b3f5fda
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
//
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.daam.domain;
package io.github.genomicdatainfrastructure.daam.model;

import io.github.genomicdatainfrastructure.daam.model.*;
import io.github.genomicdatainfrastructure.daam.remote.rems.model.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class ApplicationMapper {
public class RemsApplicationMapper {

public static RetrievedApplication toRetrievedApplication(Application remsApplication) {
return RetrievedApplication
Expand Down Expand Up @@ -85,7 +84,7 @@ private static List<RetrievedApplicationForm> toRetrievedApplicationForms(List<F
toLabelObject(form.getFormExternalTitle()),
form.getFormFields()
.stream()
.map(ApplicationMapper::toRetrievedApplicationFormField)
.map(RemsApplicationMapper::toRetrievedApplicationFormField)
.toList()))
.toList();
}
Expand All @@ -96,8 +95,7 @@ private static RetrievedApplicationFormField toRetrievedApplicationFormField(Fie
remsFormField.getFieldPrivate(),
remsFormField.getFieldVisible(),
toLabelObject(remsFormField.getFieldTitle()),
remsFormField.getFieldType().value(),
remsFormField.getFieldValue().toString());
remsFormField.getFieldType().value());
}


Expand All @@ -119,7 +117,7 @@ private static List<String> toRetrievedApplicationPermissions(Set<Application.Ap
private static List<RetrievedApplicationEvent> toRetrievedApplicationEvents(List<Event> remsApplicationEvents) {
return remsApplicationEvents
.stream()
.map(event -> new RetrievedApplicationEvent(event.getEventId().toString(),
.map(event -> new RetrievedApplicationEvent(
event.getEventActor(),
event.getEventTime(),
event.getEventType()))
Expand All @@ -139,7 +137,6 @@ private static List<RetrievedApplicationLicense> toRetrievedApplicationLicences(
return remsApplicationLicenses
.stream()
.map(license -> new RetrievedApplicationLicense(license.getLicenseType().value(),
toLabelObject(license.getLicenseLink()),
toLabelObject(license.getLicenseTitle()),
license.getLicenseEnabled(),
license.getLicenseArchived()))
Expand All @@ -153,5 +150,4 @@ private static List<Label> toLabelObject(Map<String, String> map) {
.map(entry -> new Label(entry.getKey(), entry.getValue()))
.toList();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

package io.github.genomicdatainfrastructure.daam.services;
import io.github.genomicdatainfrastructure.daam.domain.ApplicationMapper;
import io.github.genomicdatainfrastructure.daam.model.RemsApplicationMapper;
import io.github.genomicdatainfrastructure.daam.model.RetrievedApplication;
import io.github.genomicdatainfrastructure.daam.remote.rems.api.RemsApplicationsApi;
import jakarta.enterprise.context.ApplicationScoped;
Expand All @@ -27,6 +27,6 @@ public RetrieveApplicationService(
}

public RetrievedApplication retrieveApplication(Long applicationId, String userId) {
return ApplicationMapper.toRetrievedApplication(applicationsApi.apiApplicationsApplicationIdGet(applicationId, remsApiKey, userId));
return RemsApplicationMapper.toRetrievedApplication(applicationsApi.apiApplicationsApplicationIdGet(applicationId, remsApiKey, userId));
}
}
13 changes: 2 additions & 11 deletions src/main/openapi/daam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,12 @@ components:
type: array
items:
$ref: "#/components/schemas/Label"
title: Dataset title
url:
type: array
items:
$ref: "#/components/schemas/Label"
title: Dataset URL
RetrievedAcceptedLicense:
properties:
userId:
Expand Down Expand Up @@ -682,9 +684,6 @@ components:
type:
type: string
title: Field type
value:
type: string
title: Field value
Label:
properties:
language:
Expand All @@ -695,9 +694,6 @@ components:
title: Label name
RetrievedApplicationEvent:
properties:
id:
type: string
title: Event id
actorId:
type: string
title: actor id
Expand All @@ -724,11 +720,6 @@ components:
type:
type: string
title: License type
link:
type: array
title: License link
items:
$ref: "#/components/schemas/Label"
title:
type: array
title: License title
Expand Down
7 changes: 0 additions & 7 deletions src/main/openapi/rems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ components:
required:
- license/type
- license/title
- license/link
- license/id
- license/enabled
- license/archived
Expand All @@ -767,8 +766,6 @@ components:
- text
license/title:
$ref: '#/components/schemas/LocalizedString'
license/link:
$ref: '#/components/schemas/LocalizedString'
license/id:
type: integer
format: int64
Expand Down Expand Up @@ -848,16 +845,12 @@ components:
type: boolean
Event:
required:
- event/id
- event/type
- event/time
- event/actor
- application/id
- event/actor-attributes
properties:
event/id:
type: integer
format: int64
event/type:
type: string
event-time:
Expand Down

0 comments on commit b3f5fda

Please sign in to comment.