Skip to content

Commit

Permalink
align with fdo 1.0 (#74)
Browse files Browse the repository at this point in the history
* align with fdo 1.0

* align with fdo 1.0
  • Loading branch information
southeo authored Dec 10, 2024
1 parent 0bd4741 commit 4178d84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public enum FdoProfileAttributes {
MEDIA_TYPE("mediaType"),
MIME_TYPE("mimeType"),
LICENSE_NAME("licenseName"),
LICENSE_ID("licenseId"),
RIGHTS_HOLDER_ID("rightsHolderId"),
RIGHTS_HOLDER_NAME("rightsHolderName"),
LICENSE_URL("licenseUrl"),
RIGHTS_HOLDER_PID("rightsHolderPid"),
RIGHTS_HOLDER("rightsHolder"),
DIGITAL_MEDIA_KEY("digitalMediaKey");

private final String attribute;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package eu.dissco.core.digitalspecimenprocessor.service;

import static eu.dissco.core.digitalspecimenprocessor.domain.AgentRoleType.RIGHTS_OWNER;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_ID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_URL;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LINKED_DO_PID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LINKED_DO_TYPE;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LIVING_OR_PRESERVED;
Expand All @@ -15,8 +15,8 @@
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.PRIMARY_MEDIA_ID_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.PRIMARY_MEDIA_ID_TYPE;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.REFERENT_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_ID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_PID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.SPECIMEN_HOST;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.SPECIMEN_HOST_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.TOPIC_DISCIPLINE;
Expand Down Expand Up @@ -64,7 +64,7 @@ private static boolean isEqualString(String currentValue, String newValue) {

private static void setLicense(ObjectNode attributes, DigitalMedia media) {
if (media.getDctermsRights() != null && media.getDctermsRights().matches(URL_PATTERN)) {
attributes.put(LICENSE_ID.getAttribute(), media.getDctermsRights());
attributes.put(LICENSE_URL.getAttribute(), media.getDctermsRights());
} else if (media.getDctermsRights() != null) {
attributes.put(LICENSE_NAME.getAttribute(), media.getDctermsRights());
}
Expand All @@ -74,10 +74,10 @@ private static void setRightsHolder(ObjectNode attributes, DigitalMedia media) {
var rightsHolderId = collectRightsHolder(media, false);
var rightsHolderName = collectRightsHolder(media, true);
if (rightsHolderId != null) {
attributes.put(RIGHTS_HOLDER_ID.getAttribute(), rightsHolderId);
attributes.put(RIGHTS_HOLDER_PID.getAttribute(), rightsHolderId);
}
if (rightsHolderName != null) {
attributes.put(RIGHTS_HOLDER_NAME.getAttribute(), rightsHolderName);
attributes.put(RIGHTS_HOLDER.getAttribute(), rightsHolderName);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package eu.dissco.core.digitalspecimenprocessor.service;

import static eu.dissco.core.digitalspecimenprocessor.domain.AgentRoleType.RIGHTS_OWNER;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_ID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_ID;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_NAME;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.LICENSE_URL;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER;
import static eu.dissco.core.digitalspecimenprocessor.domain.FdoProfileAttributes.RIGHTS_HOLDER_PID;
import static eu.dissco.core.digitalspecimenprocessor.schema.Agent.Type.SCHEMA_ORGANIZATION;
import static eu.dissco.core.digitalspecimenprocessor.util.AgentUtils.createMachineAgent;
import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.CREATED;
Expand Down Expand Up @@ -95,7 +95,7 @@ private static Stream<Arguments> digitalSpecimensNeedToBeChanged() {

static Stream<Arguments> genLicense() {
return Stream.of(
Arguments.of(LICENSE_ID.getAttribute(), "https://spdx.org/licenses/Apache-2.0.html"),
Arguments.of(LICENSE_URL.getAttribute(), "https://spdx.org/licenses/Apache-2.0.html"),
Arguments.of(LICENSE_NAME.getAttribute(), "Apache 2.0"));
}

Expand Down Expand Up @@ -198,10 +198,10 @@ void testGenRequestLicenseAndRightsHolder(List<Agent> rightHolders, String expec
);
var attributes = (ObjectNode) givenHandleMediaRequestAttributes();
if (expectedName != null) {
attributes.put(RIGHTS_HOLDER_NAME.getAttribute(), expectedName);
attributes.put(RIGHTS_HOLDER.getAttribute(), expectedName);
}
if (expectedId != null) {
attributes.put(RIGHTS_HOLDER_ID.getAttribute(), expectedId);
attributes.put(RIGHTS_HOLDER_PID.getAttribute(), expectedId);
}
var expected = List.of(MAPPER.createObjectNode()
.set("data", MAPPER.createObjectNode()
Expand Down

0 comments on commit 4178d84

Please sign in to comment.