Skip to content

Commit

Permalink
Fix 9734: Check configured workflow.reviewer.file-edit to show item e…
Browse files Browse the repository at this point in the history
…dit functionality in workflow UI
  • Loading branch information
amgciadev committed Aug 5, 2024
1 parent 02e2e72 commit e8ec0c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.dspace.xmlworkflow.state.actions.processingaction;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand All @@ -20,6 +21,8 @@
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.MetadataFieldName;
import org.dspace.core.Context;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
import org.dspace.xmlworkflow.state.Step;
import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
Expand All @@ -34,6 +37,9 @@
public class ScoreReviewAction extends ProcessingAction {
private static final Logger log = LogManager.getLogger(ScoreReviewAction.class);

private final ConfigurationService configurationService
= DSpaceServicesFactory.getInstance().getConfigurationService();

// Option(s)
public static final String SUBMIT_SCORE = "submit_score";

Expand Down Expand Up @@ -114,7 +120,14 @@ private boolean checkRequestValid(int score, String review) {

@Override
public List<String> getOptions() {
return List.of(SUBMIT_SCORE, RETURN_TO_POOL);
List<String> options = new ArrayList<>();
options.add(SUBMIT_SCORE);
if (configurationService.getBooleanProperty("workflow.reviewer.file-edit", false)) {
options.add(SUBMIT_EDIT_METADATA);
}
options.add(RETURN_TO_POOL);

return options;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
import org.dspace.xmlworkflow.state.Step;
Expand All @@ -40,6 +42,9 @@
public class SingleUserReviewAction extends ProcessingAction {
private static final Logger log = LogManager.getLogger(SingleUserReviewAction.class);

private final ConfigurationService configurationService
= DSpaceServicesFactory.getInstance().getConfigurationService();

public static final int OUTCOME_REJECT = 1;

protected static final String SUBMIT_DECLINE_TASK = "submit_decline_task";
Expand Down Expand Up @@ -95,6 +100,9 @@ public ActionResult processAccept(Context c, XmlWorkflowItem wfi) throws SQLExce
public List<String> getOptions() {
List<String> options = new ArrayList<>();
options.add(SUBMIT_APPROVE);
if (configurationService.getBooleanProperty("workflow.reviewer.file-edit", false)) {
options.add(SUBMIT_EDIT_METADATA);
}
options.add(SUBMIT_REJECT);
options.add(SUBMIT_DECLINE_TASK);
return options;
Expand Down

0 comments on commit e8ec0c1

Please sign in to comment.