Skip to content

Commit

Permalink
Merge pull request #2 from europeana/feat/MET-6218_replace_unknown_wi…
Browse files Browse the repository at this point in the history
…th_legacy_depublication_reason

MET-6218 Replace unknown with legacy depublication reason
  • Loading branch information
jeortizquan authored Oct 18, 2024
2 parents d66b7a9 + e4a8a77 commit 192602a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public DepublishRecordIdView(DepublishRecordId depublishRecordId) {
this.depublicationStatus = DepublicationStatus
.convertFromModelToView(depublishRecordId.getDepublicationStatus());
this.depublicationReason =
depublishRecordId.getDepublicationReason() == null ? DepublicationReason.UNKNOWN.toString()
depublishRecordId.getDepublicationReason() == null ? DepublicationReason.LEGACY.toString()
: depublishRecordId.getDepublicationReason().toString();
}

Expand All @@ -50,7 +50,7 @@ public String getDepublicationReason() {
}

/**
* The status of this record with regards to (de)publication.
* The status of this record regarding (de)publication.
*/
public enum DepublicationStatus {
DEPUBLISHED, PENDING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,14 @@ public WorkflowExecution addDepublishWorkflowInQueueOfWorkflowExecutions(
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@ResponseStatus(HttpStatus.OK)
public List<DepublicationReasonView> getAllDepublicationReasons(){
return Arrays.stream(DepublicationReason.values()).filter(value -> value != DepublicationReason.UNKNOWN)
return Arrays.stream(DepublicationReason.values()).filter(value -> value != DepublicationReason.LEGACY)
.map(DepublicationReasonView::new).toList();
}

private static class DepublicationReasonView {
/**
* The view class for a depublication reason
*/
public static class DepublicationReasonView {

@JsonProperty("name")
private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public WorkflowExecution createAndAddInQueueDepublishWorkflowExecution(
// Authorize.
authorizer.authorizeReadExistingDatasetById(metisUserView, datasetId);

if (depublicationReason == DepublicationReason.UNKNOWN) {
if (depublicationReason == DepublicationReason.LEGACY) {
throw new PluginExecutionNotAllowed(
format("Depublication reason %s, is not allowed", depublicationReason));
}
Expand Down

0 comments on commit 192602a

Please sign in to comment.