mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
97414 Advanced workflow actions: refactor for updated rest contract
This commit is contained in:
@@ -10,9 +10,7 @@ package org.dspace.xmlworkflow.state.actions;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
@@ -40,7 +38,7 @@ public abstract class Action {
|
|||||||
private WorkflowActionConfig parent;
|
private WorkflowActionConfig parent;
|
||||||
private static final String ERROR_FIELDS_ATTRIBUTE = "dspace.workflow.error_fields";
|
private static final String ERROR_FIELDS_ATTRIBUTE = "dspace.workflow.error_fields";
|
||||||
private List<String> advancedOptions = new ArrayList<>();
|
private List<String> advancedOptions = new ArrayList<>();
|
||||||
private Map<String, ActionAdvancedInfo> advancedInfo = new HashMap<>();
|
private List<ActionAdvancedInfo> advancedInfo = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a workflow item becomes eligible for this Action.
|
* Called when a workflow item becomes eligible for this Action.
|
||||||
@@ -202,10 +200,10 @@ public abstract class Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAdvanced() {
|
protected boolean isAdvanced() {
|
||||||
return !advancedOptions.isEmpty();
|
return !getAdvancedOptions().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, ActionAdvancedInfo> getAdvancedInfo() {
|
protected List<ActionAdvancedInfo> getAdvancedInfo() {
|
||||||
return advancedInfo;
|
return advancedInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,8 +8,9 @@
|
|||||||
package org.dspace.xmlworkflow.state.actions;
|
package org.dspace.xmlworkflow.state.actions;
|
||||||
|
|
||||||
public interface ActionAdvancedInfo {
|
public interface ActionAdvancedInfo {
|
||||||
boolean isDescriptionRequired();
|
String getType();
|
||||||
void setDescriptionRequired(boolean descriptionRequired);
|
void setType(String type);
|
||||||
int getMaxValue();
|
String getId();
|
||||||
void setMaxValue(int maxValue);
|
void setId(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
package org.dspace.xmlworkflow.state.actions;
|
package org.dspace.xmlworkflow.state.actions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.dspace.xmlworkflow.state.Step;
|
import org.dspace.xmlworkflow.state.Step;
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ public class WorkflowActionConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of advanced options this user has on this action, resulting in the next step of the workflow
|
* Returns a list of advanced options this user has on this action, resulting in the next step of the workflow
|
||||||
* @returnA list of advanced options of this action, resulting in the next step of the workflow
|
* @return A list of advanced options of this action, resulting in the next step of the workflow
|
||||||
*/
|
*/
|
||||||
public List<String> getAdvancedOptions() {
|
public List<String> getAdvancedOptions() {
|
||||||
return this.processingAction.getAdvancedOptions();
|
return this.processingAction.getAdvancedOptions();
|
||||||
@@ -90,7 +89,7 @@ public class WorkflowActionConfig {
|
|||||||
* Returns a Map of info for the advanced options this user has on this action
|
* Returns a Map of info for the advanced options this user has on this action
|
||||||
* @return a Map of info for the advanced options this user has on this action
|
* @return a Map of info for the advanced options this user has on this action
|
||||||
*/
|
*/
|
||||||
public Map<String, ActionAdvancedInfo> getAdvancedInfo() {
|
public List<ActionAdvancedInfo> getAdvancedInfo() {
|
||||||
return this.processingAction.getAdvancedInfo();
|
return this.processingAction.getAdvancedInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
package org.dspace.xmlworkflow.state.actions.processingaction;
|
package org.dspace.xmlworkflow.state.actions.processingaction;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
@@ -49,11 +48,4 @@ public abstract class ProcessingAction extends Action {
|
|||||||
task.getStepID().equals(getParent().getStep().getId()) &&
|
task.getStepID().equals(getParent().getStep().getId()) &&
|
||||||
task.getActionID().equals(getParent().getId());
|
task.getActionID().equals(getParent().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<String> getAdvancedOptions() {
|
|
||||||
List<String> advancedOptions = super.getAdvancedOptions();
|
|
||||||
advancedOptions.add(SUBMIT_EDIT_METADATA);
|
|
||||||
return advancedOptions;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@ import java.io.IOException;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.dspace.app.util.Util;
|
import org.dspace.app.util.Util;
|
||||||
@@ -24,7 +23,7 @@ import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
|
|||||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||||
|
|
||||||
public class RatingReviewAction extends ProcessingAction implements ActionAdvancedInfo {
|
public class RatingReviewAction extends ProcessingAction {
|
||||||
|
|
||||||
private static final String RATING = "rating";
|
private static final String RATING = "rating";
|
||||||
|
|
||||||
@@ -66,35 +65,25 @@ public class RatingReviewAction extends ProcessingAction implements ActionAdvanc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAdvanced() {
|
protected boolean isAdvanced() {
|
||||||
return !getOptions().isEmpty();
|
return !getAdvancedOptions().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ActionAdvancedInfo> getAdvancedInfo() {
|
protected List<ActionAdvancedInfo> getAdvancedInfo() {
|
||||||
Map<String, ActionAdvancedInfo> advancedInfo = super.getAdvancedInfo();
|
List<ActionAdvancedInfo> advancedInfo = super.getAdvancedInfo();
|
||||||
ActionAdvancedInfo scoreReviewActionAdvancedInfo = new ScoreReviewActionAdvancedInfo();
|
RatingReviewActionAdvancedInfo ratingReviewActionAdvancedInfo = new RatingReviewActionAdvancedInfo();
|
||||||
scoreReviewActionAdvancedInfo.setMaxValue(getMaxValue());
|
ratingReviewActionAdvancedInfo.setDescriptionRequired(descriptionRequired);
|
||||||
scoreReviewActionAdvancedInfo.setDescriptionRequired(isDescriptionRequired());
|
ratingReviewActionAdvancedInfo.setMaxValue(maxValue);
|
||||||
advancedInfo.put(RATING, scoreReviewActionAdvancedInfo);
|
ratingReviewActionAdvancedInfo.setType(RATING);
|
||||||
|
ratingReviewActionAdvancedInfo.setId(RATING);
|
||||||
|
advancedInfo.add(ratingReviewActionAdvancedInfo);
|
||||||
return advancedInfo;
|
return advancedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDescriptionRequired() {
|
|
||||||
return descriptionRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDescriptionRequired(boolean descriptionRequired) {
|
public void setDescriptionRequired(boolean descriptionRequired) {
|
||||||
this.descriptionRequired = descriptionRequired;
|
this.descriptionRequired = descriptionRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxValue() {
|
|
||||||
return maxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxValue(int maxValue) {
|
public void setMaxValue(int maxValue) {
|
||||||
this.maxValue = maxValue;
|
this.maxValue = maxValue;
|
||||||
}
|
}
|
||||||
|
@@ -8,10 +8,14 @@
|
|||||||
package org.dspace.xmlworkflow.state.actions.processingaction;
|
package org.dspace.xmlworkflow.state.actions.processingaction;
|
||||||
|
|
||||||
import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
|
import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
|
|
||||||
public class ScoreReviewActionAdvancedInfo implements ActionAdvancedInfo {
|
public class RatingReviewActionAdvancedInfo implements ActionAdvancedInfo {
|
||||||
private boolean descriptionRequired;
|
private boolean descriptionRequired;
|
||||||
private int maxValue;
|
private int maxValue;
|
||||||
|
private String type;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
public boolean isDescriptionRequired() {
|
public boolean isDescriptionRequired() {
|
||||||
return descriptionRequired;
|
return descriptionRequired;
|
||||||
@@ -28,4 +32,27 @@ public class ScoreReviewActionAdvancedInfo implements ActionAdvancedInfo {
|
|||||||
public void setMaxValue(int maxValue) {
|
public void setMaxValue(int maxValue) {
|
||||||
this.maxValue = maxValue;
|
this.maxValue = maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = "action_info_" + type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(String type) {
|
||||||
|
String idString = type
|
||||||
|
+ ";descriptionRequired," + descriptionRequired
|
||||||
|
+ ";maxValue," + maxValue;
|
||||||
|
this.id = DigestUtils.md5DigestAsHex(idString.getBytes());
|
||||||
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* The contents of this file are subject to the license and copyright
|
||||||
|
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||||
|
* tree and available online at
|
||||||
|
*
|
||||||
|
* http://www.dspace.org/license/
|
||||||
|
*/
|
||||||
|
package org.dspace.app.rest.converter;
|
||||||
|
|
||||||
|
import org.dspace.app.rest.model.RatingReviewActionAdvancedInfoRest;
|
||||||
|
import org.dspace.app.rest.projection.Projection;
|
||||||
|
import org.dspace.xmlworkflow.state.actions.processingaction.RatingReviewActionAdvancedInfo;
|
||||||
|
|
||||||
|
public class RatingReviewActionAdvancedInfoConverter
|
||||||
|
implements DSpaceConverter<RatingReviewActionAdvancedInfo, RatingReviewActionAdvancedInfoRest> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RatingReviewActionAdvancedInfoRest convert(RatingReviewActionAdvancedInfo modelObject,
|
||||||
|
Projection projection) {
|
||||||
|
RatingReviewActionAdvancedInfoRest restModel = new RatingReviewActionAdvancedInfoRest();
|
||||||
|
restModel.setProjection(projection);
|
||||||
|
restModel.setDescriptionRequired(modelObject.isDescriptionRequired());
|
||||||
|
restModel.setMaxValue(modelObject.getMaxValue());
|
||||||
|
restModel.setType(modelObject.getType());
|
||||||
|
restModel.setId(modelObject.getId());
|
||||||
|
return restModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<RatingReviewActionAdvancedInfo> getModelClass() {
|
||||||
|
return RatingReviewActionAdvancedInfo.class;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* The contents of this file are subject to the license and copyright
|
|
||||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
|
||||||
* tree and available online at
|
|
||||||
*
|
|
||||||
* http://www.dspace.org/license/
|
|
||||||
*/
|
|
||||||
package org.dspace.app.rest.converter;
|
|
||||||
|
|
||||||
import org.dspace.app.rest.model.ScoreReviewActionAdvancedInfoRest;
|
|
||||||
import org.dspace.app.rest.projection.Projection;
|
|
||||||
import org.dspace.xmlworkflow.state.actions.processingaction.ScoreReviewActionAdvancedInfo;
|
|
||||||
|
|
||||||
public class ScoreReviewActionAdvancedInfoConverter
|
|
||||||
implements DSpaceConverter<ScoreReviewActionAdvancedInfo, ScoreReviewActionAdvancedInfoRest> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ScoreReviewActionAdvancedInfoRest convert(ScoreReviewActionAdvancedInfo modelObject, Projection projection) {
|
|
||||||
ScoreReviewActionAdvancedInfoRest restModel = new ScoreReviewActionAdvancedInfoRest();
|
|
||||||
restModel.setProjection(projection);
|
|
||||||
restModel.setDescriptionRequired(modelObject.isDescriptionRequired());
|
|
||||||
restModel.setMaxValue(modelObject.getMaxValue());
|
|
||||||
return restModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<ScoreReviewActionAdvancedInfo> getModelClass() {
|
|
||||||
return ScoreReviewActionAdvancedInfo.class;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -26,8 +26,10 @@ public class WorkflowActionConverter implements DSpaceConverter<WorkflowActionCo
|
|||||||
restModel.setProjection(projection);
|
restModel.setProjection(projection);
|
||||||
restModel.setId(modelObject.getId());
|
restModel.setId(modelObject.getId());
|
||||||
restModel.setOptions(modelObject.getOptions());
|
restModel.setOptions(modelObject.getOptions());
|
||||||
|
if (modelObject.isAdvanced()) {
|
||||||
restModel.setAdvancedOptions(modelObject.getAdvancedOptions());
|
restModel.setAdvancedOptions(modelObject.getAdvancedOptions());
|
||||||
restModel.setAdvancedInfo(modelObject.getAdvancedInfo());
|
restModel.setAdvancedInfo(modelObject.getAdvancedInfo());
|
||||||
|
}
|
||||||
return restModel;
|
return restModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,10 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.app.rest.model;
|
package org.dspace.app.rest.model;
|
||||||
|
|
||||||
public class ScoreReviewActionAdvancedInfoRest extends WorkflowActionRest {
|
public class RatingReviewActionAdvancedInfoRest extends WorkflowActionRest {
|
||||||
|
|
||||||
private boolean descriptionRequired;
|
private boolean descriptionRequired;
|
||||||
private int maxValue;
|
private int maxValue;
|
||||||
|
private String type;
|
||||||
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic getter for the description required boolean
|
* Generic getter for the description required boolean
|
||||||
@@ -48,6 +50,42 @@ public class ScoreReviewActionAdvancedInfoRest extends WorkflowActionRest {
|
|||||||
this.maxValue = maxValue;
|
this.maxValue = maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic getter for the type
|
||||||
|
*
|
||||||
|
* @return the type of this ScoreReviewActionAdvancedInfoRest
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic setter for the type
|
||||||
|
*
|
||||||
|
* @param type The type to be set on this ScoreReviewActionAdvancedInfoRest
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic getter for the id
|
||||||
|
*
|
||||||
|
* @return the id of this ScoreReviewActionAdvancedInfoRest
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic setter for the id
|
||||||
|
*
|
||||||
|
* @param id The id to be set on this ScoreReviewActionAdvancedInfoRest
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -8,8 +8,9 @@
|
|||||||
package org.dspace.app.rest.model;
|
package org.dspace.app.rest.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dspace.app.rest.RestResourceController;
|
import org.dspace.app.rest.RestResourceController;
|
||||||
import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
|
import org.dspace.xmlworkflow.state.actions.ActionAdvancedInfo;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class WorkflowActionRest extends BaseObjectRest<String> {
|
|||||||
|
|
||||||
private List<String> options;
|
private List<String> options;
|
||||||
private List<String> advancedOptions;
|
private List<String> advancedOptions;
|
||||||
private Map<String, ActionAdvancedInfo> advancedInfo;
|
private List<ActionAdvancedInfo> advancedInfo;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
@@ -66,6 +67,7 @@ public class WorkflowActionRest extends BaseObjectRest<String> {
|
|||||||
*
|
*
|
||||||
* @return the advanced options value of this WorkflowActionRest
|
* @return the advanced options value of this WorkflowActionRest
|
||||||
*/
|
*/
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public List<String> getAdvancedOptions() {
|
public List<String> getAdvancedOptions() {
|
||||||
return advancedOptions;
|
return advancedOptions;
|
||||||
}
|
}
|
||||||
@@ -85,7 +87,7 @@ public class WorkflowActionRest extends BaseObjectRest<String> {
|
|||||||
* @return the advanced boolean value of this WorkflowActionRest
|
* @return the advanced boolean value of this WorkflowActionRest
|
||||||
*/
|
*/
|
||||||
public boolean getAdvanced() {
|
public boolean getAdvanced() {
|
||||||
return !advancedOptions.isEmpty();
|
return CollectionUtils.isNotEmpty(getAdvancedOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +95,8 @@ public class WorkflowActionRest extends BaseObjectRest<String> {
|
|||||||
*
|
*
|
||||||
* @return the advanced info value of this WorkflowActionRest
|
* @return the advanced info value of this WorkflowActionRest
|
||||||
*/
|
*/
|
||||||
public Map<String, ActionAdvancedInfo> getAdvancedInfo() {
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public List<ActionAdvancedInfo> getAdvancedInfo() {
|
||||||
return advancedInfo;
|
return advancedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ public class WorkflowActionRest extends BaseObjectRest<String> {
|
|||||||
*
|
*
|
||||||
* @param advancedInfo The advanced info to be set on this WorkflowActionRest
|
* @param advancedInfo The advanced info to be set on this WorkflowActionRest
|
||||||
*/
|
*/
|
||||||
public void setAdvancedInfo(Map<String, ActionAdvancedInfo> advancedInfo) {
|
public void setAdvancedInfo(List<ActionAdvancedInfo> advancedInfo) {
|
||||||
this.advancedInfo = advancedInfo;
|
this.advancedInfo = advancedInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.dspace.app.rest.matcher.WorkflowActionMatcher;
|
import org.dspace.app.rest.matcher.WorkflowActionMatcher;
|
||||||
import org.dspace.app.rest.model.WorkflowActionRest;
|
import org.dspace.app.rest.model.WorkflowActionRest;
|
||||||
import org.dspace.app.rest.repository.WorkflowActionRestRepository;
|
import org.dspace.app.rest.repository.WorkflowActionRestRepository;
|
||||||
@@ -85,8 +83,7 @@ public class WorkflowActionRestRepositoryIT extends AbstractControllerIntegratio
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
// has options
|
// has options
|
||||||
.andExpect(jsonPath("$.options", not(empty())))
|
.andExpect(jsonPath("$.options", not(empty())))
|
||||||
.andExpect(jsonPath("$.advancedOptions", not(empty())))
|
.andExpect(jsonPath("$.advanced", is(false)))
|
||||||
.andExpect(jsonPath("$.advanced", is(true)))
|
|
||||||
//Matches expected corresponding rest action values
|
//Matches expected corresponding rest action values
|
||||||
.andExpect(jsonPath("$", Matchers.is(
|
.andExpect(jsonPath("$", Matchers.is(
|
||||||
WorkflowActionMatcher.matchWorkflowActionEntry(existentWorkflow)
|
WorkflowActionMatcher.matchWorkflowActionEntry(existentWorkflow)
|
||||||
@@ -104,7 +101,6 @@ public class WorkflowActionRestRepositoryIT extends AbstractControllerIntegratio
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
// has no options
|
// has no options
|
||||||
.andExpect(jsonPath("$.options", empty()))
|
.andExpect(jsonPath("$.options", empty()))
|
||||||
.andExpect(jsonPath("$.advancedOptions", empty()))
|
|
||||||
.andExpect(jsonPath("$.advanced", is(false)))
|
.andExpect(jsonPath("$.advanced", is(false)))
|
||||||
//Matches expected corresponding rest action values
|
//Matches expected corresponding rest action values
|
||||||
.andExpect(jsonPath("$", Matchers.is(
|
.andExpect(jsonPath("$", Matchers.is(
|
||||||
@@ -153,24 +149,4 @@ public class WorkflowActionRestRepositoryIT extends AbstractControllerIntegratio
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWorkflowActionByName_ExistentWithOptions_scorereviewaction() throws Exception {
|
|
||||||
String token = getAuthToken(eperson.getEmail(), password);
|
|
||||||
String nameActionWithOptions = "scorereviewaction";
|
|
||||||
WorkflowActionConfig existentWorkflow = xmlWorkflowFactory.getActionByName(nameActionWithOptions);
|
|
||||||
//When we call this facets endpoint
|
|
||||||
getClient(token).perform(get(WORKFLOW_ACTIONS_ENDPOINT + "/" + nameActionWithOptions))
|
|
||||||
//We expect a 200 is ok status
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
// has options
|
|
||||||
.andExpect(jsonPath("$.options", not(empty())))
|
|
||||||
.andExpect(jsonPath("$.advancedOptions", not(empty())))
|
|
||||||
.andExpect(jsonPath("$.advanced", is(true)))
|
|
||||||
.andExpect(jsonPath("$.advancedInfo", is(Map.of())))
|
|
||||||
//Matches expected corresponding rest action values
|
|
||||||
.andExpect(jsonPath("$", Matchers.is(
|
|
||||||
WorkflowActionMatcher.matchWorkflowActionEntry(existentWorkflow)
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,6 @@ public class WorkflowActionMatcher {
|
|||||||
return allOf(
|
return allOf(
|
||||||
hasJsonPath("$.id", is(workflowAction.getId())),
|
hasJsonPath("$.id", is(workflowAction.getId())),
|
||||||
hasJsonPath("$.options", is(workflowAction.getOptions())),
|
hasJsonPath("$.options", is(workflowAction.getOptions())),
|
||||||
hasJsonPath("$.advancedOptions", is(workflowAction.getAdvancedOptions())),
|
|
||||||
hasJsonPath("$.advanced", is(workflowAction.isAdvanced())),
|
hasJsonPath("$.advanced", is(workflowAction.isAdvanced())),
|
||||||
hasJsonPath("$._links.self.href", containsString(WORKFLOW_ACTIONS_ENDPOINT + workflowAction.getId()))
|
hasJsonPath("$._links.self.href", containsString(WORKFLOW_ACTIONS_ENDPOINT + workflowAction.getId()))
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user