mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
DS-3699 flag the default submission config
This commit is contained in:

committed by
Luigi Andrea Pascarelli

parent
5247bc86e3
commit
d9fc8bea05
@@ -34,6 +34,8 @@ public class SubmissionConfig implements Serializable
|
||||
/** name of the item submission process */
|
||||
private String submissionName = null;
|
||||
|
||||
private boolean defaultConf = false;
|
||||
|
||||
/** the configuration classes for the steps in this submission process */
|
||||
private SubmissionStepConfig[] submissionSteps = null;
|
||||
|
||||
@@ -50,9 +52,10 @@ public class SubmissionConfig implements Serializable
|
||||
* the vector listing of step information to build
|
||||
* SubmissionStepConfig objects for this submission process
|
||||
*/
|
||||
public SubmissionConfig(String submissionName, List<Map<String, String>> steps)
|
||||
public SubmissionConfig(boolean isDefault, String submissionName, List<Map<String, String>> steps)
|
||||
{
|
||||
this.submissionName = submissionName;
|
||||
this.defaultConf = isDefault;
|
||||
|
||||
// initialize a vector of SubmissionStepConfig objects
|
||||
List<SubmissionStepConfig> stepConfigs = new ArrayList<SubmissionStepConfig>();
|
||||
@@ -87,6 +90,10 @@ public class SubmissionConfig implements Serializable
|
||||
return submissionName;
|
||||
}
|
||||
|
||||
public boolean isDefaultConf() {
|
||||
return defaultConf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of steps in this submission process
|
||||
*
|
||||
|
@@ -14,6 +14,7 @@ import org.xml.sax.SAXException;
|
||||
import org.w3c.dom.*;
|
||||
import javax.xml.parsers.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
@@ -95,6 +96,14 @@ public class SubmissionConfigReader
|
||||
buildInputs(configDir + SUBMIT_DEF_FILE_PREFIX + SUBMIT_DEF_FILE_SUFFIX);
|
||||
}
|
||||
|
||||
public void reload() throws ServletException
|
||||
{
|
||||
collectionToSubmissionConfig = null;
|
||||
stepDefns = null;
|
||||
submitDefns = null;
|
||||
buildInputs(configDir + SUBMIT_DEF_FILE_PREFIX + SUBMIT_DEF_FILE_SUFFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an XML encoded item submission configuration file.
|
||||
* <P>
|
||||
@@ -136,6 +145,15 @@ public class SubmissionConfigReader
|
||||
"Error creating Item Submission Configuration: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the name of the default submission configuration
|
||||
*/
|
||||
public String getDefaultSubmissionConfigName()
|
||||
{
|
||||
return collectionToSubmissionConfig.get(DEFAULT_COLLECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the Item Submission process configs with pagination
|
||||
@@ -235,7 +253,8 @@ public class SubmissionConfigReader
|
||||
log.debug("Submission process config '" + submitName
|
||||
+ "' not in cache. Reloading from scratch.");
|
||||
|
||||
lastSubmissionConfig = new SubmissionConfig(submitName, steps);
|
||||
lastSubmissionConfig = new SubmissionConfig(StringUtils.equals(getDefaultSubmissionConfigName(), submitName),
|
||||
submitName, steps);
|
||||
|
||||
log.debug("Submission process config has "
|
||||
+ lastSubmissionConfig.getNumberOfSteps() + " steps listed.");
|
||||
|
@@ -32,6 +32,7 @@ public class SubmissionDefinitionConverter extends DSpaceConverter<SubmissionCon
|
||||
public SubmissionDefinitionRest fromModel(SubmissionConfig obj) {
|
||||
SubmissionDefinitionRest sd = new SubmissionDefinitionRest();
|
||||
sd.setName(obj.getSubmissionName());
|
||||
sd.setDefaultConf(obj.isDefaultConf());
|
||||
List<SubmissionPanelRest> panels = new LinkedList<SubmissionPanelRest>();
|
||||
for (int idx = 0; idx < obj.getNumberOfSteps(); idx++) {
|
||||
SubmissionStepConfig step = obj.getStep(idx);
|
||||
|
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import org.dspace.app.rest.RestResourceController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* The Submission Definition REST Resource
|
||||
@@ -25,6 +26,9 @@ public class SubmissionDefinitionRest extends BaseObjectRest<String> {
|
||||
|
||||
private String name;
|
||||
|
||||
@JsonProperty(value="isDefault")
|
||||
private boolean defaultConf;
|
||||
|
||||
private List<SubmissionPanelRest> panels;
|
||||
|
||||
@Override
|
||||
@@ -52,7 +56,15 @@ public class SubmissionDefinitionRest extends BaseObjectRest<String> {
|
||||
public String getType() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultConf(boolean isDefault) {
|
||||
this.defaultConf = isDefault;
|
||||
}
|
||||
|
||||
public boolean isDefaultConf() {
|
||||
return defaultConf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getController() {
|
||||
return RestResourceController.class;
|
||||
|
Reference in New Issue
Block a user