Skip to content

Commit

Permalink
MET-6218 Replace unknown with legacy depublication reason (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
stzanakis authored Oct 18, 2024
1 parent c214957 commit 7f3a4df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

/**
* Enum for depublication reason.
* <p>Note: The enum value {@link #UNKNOWN} is to be used for historical depublication workflows(before the reason was
* implemented).
* In other words the historical workflows will be populated by a script once with the {@link #UNKNOWN} reason, and this value
* should never be used during depublication since its release. Therefore the url is an empty string and not meant to be used for
* populating records in the database(e.g. tombstoning)</p>
* <p>Note: The enum value {@link #LEGACY} is to be used for historical depublication workflows(before the reason was
* implemented). In other words the historical workflows will be populated by a script once with the {@link #LEGACY} reason, and
* this value should never be used during depublication since its release. At the time of writing the url String is not meant to
* be used for populating records in the database(e.g. tombstoning)</p>
*/
public enum DepublicationReason {

Expand All @@ -16,7 +15,7 @@ public enum DepublicationReason {
SENSITIVE_CONTENT("Sensitive content", "sensitiveContent"),
REMOVED_DATA_AT_SOURCE("Removed data at source", "sourceRemoval"),
GENERIC("Generic", "generic"),
UNKNOWN("Unknown", "");
LEGACY("Legacy", "legacy");

private static final String BASE_URL = "http://data.europeana.eu/vocabulary/depublicationReason/";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import static eu.europeana.metis.utils.DepublicationReason.PERMISSION_ISSUES;
import static eu.europeana.metis.utils.DepublicationReason.REMOVED_DATA_AT_SOURCE;
import static eu.europeana.metis.utils.DepublicationReason.SENSITIVE_CONTENT;
import static eu.europeana.metis.utils.DepublicationReason.UNKNOWN;
import static eu.europeana.metis.utils.DepublicationReason.LEGACY;
import static eu.europeana.metis.utils.DepublicationReason.values;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -35,7 +35,7 @@ void testToStringMethod() {
assertEquals("Sensitive content", SENSITIVE_CONTENT.toString());
assertEquals("Removed data at source", REMOVED_DATA_AT_SOURCE.toString());
assertEquals("Generic", GENERIC.toString());
assertEquals("Unknown", UNKNOWN.toString());
assertEquals("Legacy", LEGACY.toString());
}

@Test
Expand All @@ -49,6 +49,6 @@ void testEnumValuePresence() {
assertTrue(depublicationReasons.contains(SENSITIVE_CONTENT));
assertTrue(depublicationReasons.contains(REMOVED_DATA_AT_SOURCE));
assertTrue(depublicationReasons.contains(GENERIC));
assertTrue(depublicationReasons.contains(UNKNOWN));
assertTrue(depublicationReasons.contains(LEGACY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public FullBeanImpl getTombstone(String rdfAbout) {

@Override
public boolean indexTombstone(String rdfAbout, DepublicationReason depublicationReason) throws IndexingException {
if (depublicationReason == DepublicationReason.UNKNOWN) {
if (depublicationReason == DepublicationReason.LEGACY) {
throw new IndexerRelatedIndexingException(
format("Depublication reason %s, is not allowed", depublicationReason));
}
Expand Down

0 comments on commit 7f3a4df

Please sign in to comment.