[DS-3154] Stash more fixes.

This commit is contained in:
Mark H. Wood
2016-05-05 17:18:06 -04:00
parent 8dec6d10ba
commit ebe5e0c791
49 changed files with 976 additions and 593 deletions

View File

@@ -32,115 +32,121 @@ import org.dspace.authorize.AuthorizeException;
/** /**
* Generates the Administrative Curate Form, from which any DSpace object can * Generates the Administrative Curate Form, from which any DSpace object can
* be curated. * be curated.
*
* @author tdonohue * @author tdonohue
*/ */
public class CurateForm extends AbstractDSpaceTransformer public class CurateForm extends AbstractDSpaceTransformer
{ {
private static final Message T_dspace_home = message("xmlui.general.dspace_home"); private static final Message T_dspace_home = message("xmlui.general.dspace_home");
private static final Message T_submit_perform = message("xmlui.general.perform"); private static final Message T_submit_perform = message("xmlui.general.perform");
private static final Message T_submit_queue = message("xmlui.general.queue"); private static final Message T_submit_queue = message("xmlui.general.queue");
private static final Message T_title = message("xmlui.administrative.CurateForm.title"); private static final Message T_title = message("xmlui.administrative.CurateForm.title");
private static final Message T_trail = message("xmlui.administrative.CurateForm.trail"); private static final Message T_trail = message("xmlui.administrative.CurateForm.trail");
private static final Message T_task_label_name = message("xmlui.administrative.CurateForm.task_label_name"); private static final Message T_task_label_name = message("xmlui.administrative.CurateForm.task_label_name");
private static final Message T_taskgroup_label_name = message("xmlui.administrative.CurateForm.taskgroup_label_name"); private static final Message T_taskgroup_label_name = message("xmlui.administrative.CurateForm.taskgroup_label_name");
private static final Message T_object_label_name = message("xmlui.administrative.CurateForm.object_label_name"); private static final Message T_object_label_name = message("xmlui.administrative.CurateForm.object_label_name");
private static final Message T_object_hint = message("xmlui.administrative.CurateForm.object_hint"); private static final Message T_object_hint = message("xmlui.administrative.CurateForm.object_hint");
public void setup(SourceResolver resolver, Map objectModel, String src, @Override
Parameters parameters) throws ProcessingException, SAXException, IOException public void setup(SourceResolver resolver, Map objectModel, String src,
{ Parameters parameters) throws ProcessingException, SAXException, IOException
super.setup(resolver, objectModel, src, parameters); {
FlowCurationUtils.setupCurationTasks(); super.setup(resolver, objectModel, src, parameters);
} FlowCurationUtils.setupCurationTasks();
}
/**
* Initialize the page metadata & breadcrumb trail /**
* * Initialize the page metadata and breadcrumb trail
* @param pageMeta *
* @throws WingException * @param pageMeta
*/ * @throws WingException
@Override */
public void addPageMeta(PageMeta pageMeta) throws WingException @Override
public void addPageMeta(PageMeta pageMeta) throws WingException
{
pageMeta.addMetadata("title").addContent(T_title);
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
pageMeta.addTrail().addContent(T_trail);
}
/**
* Add object curation form
*
* @param body body of the form.
* @throws WingException passed through.
* @throws SQLException passed through.
* @throws AuthorizeException passed through.
* @throws java.io.UnsupportedEncodingException passed through.
*/
@Override
public void addBody(Body body)
throws WingException, SQLException,
AuthorizeException, UnsupportedEncodingException
{
// Get our parameters and state;
String objectID = parameters.getParameter("identifier", null);
String taskSelected = parameters.getParameter("curate_task", null);
// DIVISION: curate
Division div = body.addInteractiveDivision("curate",
contextPath + "/admin/curate",
Division.METHOD_MULTIPART,
"primary administrative curate");
div.setHead(T_title);
// Curate Form
List form = div.addList("curate-form", List.TYPE_FORM);
// Object ID Textbox (required)
Text id = form.addItem().addText("identifier");
id.setAutofocus("autofocus");
id.setLabel(T_object_label_name);
if (objectID != null)
{ {
pageMeta.addMetadata("title").addContent(T_title); id.setValue(objectID);
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
pageMeta.addTrail().addContent(T_trail);
} }
id.setRequired();
/** id.setHelp(T_object_hint);
* Add object curation form
* // Selectbox of Curation Task options (required)
* @param body String curateGroup = "";
* @throws WingException try
* @throws SQLException
* @throws AuthorizeException
*/
@Override
public void addBody(Body body)
throws WingException, SQLException,
AuthorizeException, UnsupportedEncodingException
{ {
// Get our parameters and state; curateGroup = (parameters.getParameter("select_curate_group") != null) ? parameters.getParameter("select_curate_group") : FlowCurationUtils.UNGROUPED_TASKS;
String objectID = parameters.getParameter("identifier", null);
String taskSelected = parameters.getParameter("curate_task", null);
// DIVISION: curate
Division div = body.addInteractiveDivision("curate", contextPath + "/admin/curate", Division.METHOD_MULTIPART,"primary administrative curate");
div.setHead(T_title);
// Curate Form
List form = div.addList("curate-form", List.TYPE_FORM);
// Object ID Textbox (required)
Text id = form.addItem().addText("identifier");
id.setAutofocus("autofocus");
id.setLabel(T_object_label_name);
if (objectID != null)
{
id.setValue(objectID);
}
id.setRequired();
id.setHelp(T_object_hint);
// Selectbox of Curation Task options (required)
String curateGroup = "";
try
{
curateGroup = (parameters.getParameter("select_curate_group") != null) ? parameters.getParameter("select_curate_group") : FlowCurationUtils.UNGROUPED_TASKS;
}
catch (Exception pe)
{
// noop
}
if (!FlowCurationUtils.groups.isEmpty())
{
Select groupSelect = form.addItem().addSelect("select_curate_group");
groupSelect = FlowCurationUtils.getGroupSelectOptions(groupSelect);
groupSelect.setLabel(T_taskgroup_label_name);
groupSelect.setSize(1);
groupSelect.setRequired();
groupSelect.setEvtBehavior("submitOnChange");
if (curateGroup.equals(""))
{
curateGroup = (String) (FlowCurationUtils.groups.keySet().iterator().next());
}
groupSelect.setOptionSelected(curateGroup);
}
Select taskSelect = form.addItem().addSelect("curate_task");
taskSelect = FlowCurationUtils.getTaskSelectOptions(taskSelect, curateGroup);
taskSelect.setLabel(T_task_label_name);
taskSelect.setSize(1);
taskSelect.setRequired();
if(taskSelected!=null)
{
taskSelect.setOptionSelected(taskSelected);
}
// Buttons: 'curate' and 'queue'
Para buttonList = div.addPara();
buttonList.addButton("submit_curate_task").setValue(T_submit_perform);
buttonList.addButton("submit_queue_task").setValue(T_submit_queue);
div.addHidden("administrative-continue").setValue(knot.getId());
} }
catch (Exception pe)
{
// noop
}
if (!FlowCurationUtils.groups.isEmpty())
{
Select groupSelect = form.addItem().addSelect("select_curate_group");
groupSelect = FlowCurationUtils.getGroupSelectOptions(groupSelect);
groupSelect.setLabel(T_taskgroup_label_name);
groupSelect.setSize(1);
groupSelect.setRequired();
groupSelect.setEvtBehavior("submitOnChange");
if (curateGroup.equals(""))
{
curateGroup = (String) (FlowCurationUtils.groups.keySet().iterator().next());
}
groupSelect.setOptionSelected(curateGroup);
}
Select taskSelect = form.addItem().addSelect("curate_task");
taskSelect = FlowCurationUtils.getTaskSelectOptions(taskSelect, curateGroup);
taskSelect.setLabel(T_task_label_name);
taskSelect.setSize(1);
taskSelect.setRequired();
if(taskSelected!=null)
{
taskSelect.setOptionSelected(taskSelected);
}
// Buttons: 'curate' and 'queue'
Para buttonList = div.addPara();
buttonList.addButton("submit_curate_task").setValue(T_submit_perform);
buttonList.addButton("submit_queue_task").setValue(T_submit_queue);
div.addHidden("administrative-continue").setValue(knot.getId());
}
} }

View File

@@ -20,22 +20,22 @@ import org.dspace.app.xmlui.wing.Message;
* and returns an object of type FlowResult, then the flow script can inspect * and returns an object of type FlowResult, then the flow script can inspect
* the results object to determine what the next course of action is. * the results object to determine what the next course of action is.
* *
* Basically, this results object stores all the errors and continuation states * <p>Basically, this results object stores all the errors and continuation states
* that need to be represented. There are four types of information stored: * that need to be represented. There are four types of information stored:
* *
* 1) Continuation, this is a simple boolean variable that indicates whether * <p>1) Continuation, this is a simple boolean variable that indicates whether
* the required operation is complete and the user may continue on to the next step. * the required operation is complete and the user may continue on to the next step.
* *
* 2) Notice information, this is a simple encoding of a notice message to be displayed * <p>2) Notice information, this is a simple encoding of a notice message to be displayed
* to the user on their next step. There are four parts: outcome, header, message, and * to the user on their next step. There are four parts: outcome, header, message, and
* characters. See each field for more description on each part. Note: either a message * characters. See each field for more description on each part. Note: either a message
* or characters are required. * or characters are required.
* *
* 3) Errors, this is a list of errors that were encountered during processing. * <p>3) Errors, this is a list of errors that were encountered during processing.
* Typically, it just consists of a list of errored fields. However occasionally there * Typically, it just consists of a list of errored fields. However occasionally there
* may be other specialized errors listed. * may be other specialized errors listed.
* *
* 4) Parameters, this is a map of attached parameters that may be relevant to the * <p>4) Parameters, this is a map of attached parameters that may be relevant to the
* result. This should be used for things such as generated id's when objects are newly * result. This should be used for things such as generated id's when objects are newly
* created. * created.
* *
@@ -45,7 +45,7 @@ public class FlowResult {
/** /**
* Determine whether the operation has been completed enough that the user * Determine whether the operation has been completed enough that the user
* may successufully continue on to the next step. * may successfully continue on to the next step.
*/ */
private boolean continuep; private boolean continuep;
@@ -73,7 +73,6 @@ public class FlowResult {
*/ */
private List<String> errors; private List<String> errors;
/** /**
* Any parameters that may be attached to this result. * Any parameters that may be attached to this result.
*/ */
@@ -82,6 +81,7 @@ public class FlowResult {
/** /**
* Set the continuation parameter determining if the * Set the continuation parameter determining if the
* user should progress to the next step in the flow. * user should progress to the next step in the flow.
* @param continuep true if should continue.
*/ */
public void setContinue(boolean continuep) public void setContinue(boolean continuep)
{ {
@@ -123,6 +123,7 @@ public class FlowResult {
/** /**
* Get the notice outcome in string form, either success * Get the notice outcome in string form, either success
* or failure. If the outcome is neutral then null is returned. * or failure. If the outcome is neutral then null is returned.
* @return the outcome.
*/ */
public String getOutcome() public String getOutcome()
{ {
@@ -141,6 +142,7 @@ public class FlowResult {
* Set the notice header. * Set the notice header.
* *
* This must be an i18n dictionary key * This must be an i18n dictionary key
* @param header the header.
*/ */
public void setHeader(Message header) public void setHeader(Message header)
{ {
@@ -148,7 +150,8 @@ public class FlowResult {
} }
/** /**
* Return the notice header * Return the notice header.
* @return the header.
*/ */
public String getHeader() public String getHeader()
{ {
@@ -160,9 +163,10 @@ public class FlowResult {
} }
/** /**
* Set the notice message * Set the notice message.
* *
* This must be an i18n dictionary key * This must be an i18n dictionary key.
* @param message the message.
*/ */
public void setMessage(Message message) public void setMessage(Message message)
{ {
@@ -170,7 +174,8 @@ public class FlowResult {
} }
/** /**
* return the notice message * return the notice message.
* @return the notice.
*/ */
public String getMessage() public String getMessage()
{ {
@@ -182,7 +187,8 @@ public class FlowResult {
} }
/** /**
* Set the notice characters * Set the notice characters.
* @param characters the notice.
*/ */
public void setCharacters(String characters) public void setCharacters(String characters)
{ {
@@ -191,6 +197,7 @@ public class FlowResult {
/** /**
* Return the notice characters * Return the notice characters
* @return the notice.
*/ */
public String getCharacters() public String getCharacters()
{ {
@@ -216,7 +223,7 @@ public class FlowResult {
{ {
if (this.errors == null) if (this.errors == null)
{ {
this.errors = new ArrayList<String>(); this.errors = new ArrayList<>();
} }
this.errors.add(newError); this.errors.add(newError);
@@ -224,6 +231,7 @@ public class FlowResult {
/** /**
* Return the current list of errors. * Return the current list of errors.
* @return a list of errors.
*/ */
public List<String> getErrors() public List<String> getErrors()
{ {
@@ -233,10 +241,11 @@ public class FlowResult {
/** /**
* Return the list of errors in string form, i.e. a comma-separated list * Return the list of errors in string form, i.e. a comma-separated list
* of errors. If there are no errors then null is returned. * of errors. If there are no errors then null is returned.
* @return a list of errors.
*/ */
public String getErrorString() public String getErrorString()
{ {
if (errors == null || errors.size() == 0) if (errors == null || errors.isEmpty())
{ {
return null; return null;
} }
@@ -259,8 +268,8 @@ public class FlowResult {
/** /**
* Attach a new parameter to this result object with the specified * Attach a new parameter to this result object with the specified
* name & value. * name and value.
* *
* @param name The parameter's name * @param name The parameter's name
* @param value The parameter's value. * @param value The parameter's value.
*/ */
@@ -268,7 +277,7 @@ public class FlowResult {
{ {
if (this.parameters == null) if (this.parameters == null)
{ {
this.parameters = new HashMap<String, Object>(); this.parameters = new HashMap<>();
} }
this.parameters.put(name, value); this.parameters.put(name, value);

View File

@@ -36,8 +36,9 @@ import org.xml.sax.SAXException;
/** /**
* *
* Show a form allowing the user to edit a bitstream's metadata, the description & format. * Show a form allowing the user to edit a bitstream's metadata, the description
* * and format.
*
* @author Scott Phillips * @author Scott Phillips
*/ */
public class EditBitstreamForm extends AbstractDSpaceTransformer public class EditBitstreamForm extends AbstractDSpaceTransformer
@@ -73,6 +74,7 @@ public class EditBitstreamForm extends AbstractDSpaceTransformer
protected BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); protected BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService(); protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
@Override
public void addPageMeta(PageMeta pageMeta) throws WingException public void addPageMeta(PageMeta pageMeta) throws WingException
{ {
pageMeta.addMetadata("title").addContent(T_title); pageMeta.addMetadata("title").addContent(T_title);
@@ -83,6 +85,7 @@ public class EditBitstreamForm extends AbstractDSpaceTransformer
pageMeta.addMetadata("javascript", "static").addContent("static/js/editItemUtil.js"); pageMeta.addMetadata("javascript", "static").addContent("static/js/editItemUtil.js");
} }
@Override
public void addBody(Body body) throws SAXException, WingException, public void addBody(Body body) throws SAXException, WingException,
UIException, SQLException, IOException, AuthorizeException UIException, SQLException, IOException, AuthorizeException
{ {

View File

@@ -52,13 +52,17 @@ import org.xml.sax.SAXException;
* This item may be configured so that it will only display up to a specific depth, * This item may be configured so that it will only display up to a specific depth,
* and may include or exclude collections from the tree. * and may include or exclude collections from the tree.
* *
* The configuration option available: <depth exclude-collections="true">999</depth> * <p>The configuration option available:
* *
* <pre>
* {@code <depth exclude-collections="true">999</depth>}
* </pre>
*
* @author Scott Phillips * @author Scott Phillips
*/ */
public class CommunityBrowser extends AbstractDSpaceTransformer implements CacheableProcessingComponent public class CommunityBrowser extends AbstractDSpaceTransformer implements CacheableProcessingComponent
{ {
private static Logger log = Logger.getLogger(CommunityBrowser.class); private static final Logger log = Logger.getLogger(CommunityBrowser.class);
/** Language Strings */ /** Language Strings */
public static final Message T_dspace_home = public static final Message T_dspace_home =
@@ -96,10 +100,19 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
/** /**
* Set the component up, pulling any configuration values from the sitemap * Set the component up, pulling any configuration values from the sitemap
* parameters. * parameters.
*
* @param resolver source resolver.
* @param objectModel object model.
* @param src source.
* @param parameters sitemap parameters.
* @throws org.apache.cocoon.ProcessingException passed through.
* @throws org.xml.sax.SAXException passed through.
* @throws java.io.IOException passed through.
*/ */
@Override
public void setup(SourceResolver resolver, Map objectModel, String src, public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters parameters) throws ProcessingException, SAXException, Parameters parameters)
IOException throws ProcessingException, SAXException, IOException
{ {
super.setup(resolver, objectModel, src, parameters); super.setup(resolver, objectModel, src, parameters);
@@ -111,7 +124,9 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
/** /**
* Generate the unique caching key. * Generate the unique caching key.
* This key must be unique within the space of this component. * This key must be unique within the space of this component.
* @return the key.
*/ */
@Override
public Serializable getKey() public Serializable getKey()
{ {
boolean full = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("xmlui.community-list.render.full", true); boolean full = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("xmlui.community-list.render.full", true);
@@ -123,24 +138,26 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
* *
* The validity object will include a list of all communities * The validity object will include a list of all communities
* and collections being browsed along with their logo bitstreams. * and collections being browsed along with their logo bitstreams.
* @return validity.
*/ */
@Override
public SourceValidity getValidity() public SourceValidity getValidity()
{ {
if (validity == null) if (validity == null)
{ {
try { try {
DSpaceValidity validity = new DSpaceValidity(); DSpaceValidity theValidity = new DSpaceValidity();
TreeNode root = buildTree(communityService.findAllTop(context)); TreeNode treeRoot = buildTree(communityService.findAllTop(context));
Stack<TreeNode> stack = new Stack<TreeNode>(); Stack<TreeNode> stack = new Stack<>();
stack.push(root); stack.push(treeRoot);
while (!stack.empty()) while (!stack.empty())
{ {
TreeNode node = stack.pop(); TreeNode node = stack.pop();
validity.add(context, node.getDSO()); theValidity.add(context, node.getDSO());
// If we are configured to use collection strengths (i.e. item counts) then include that number in the validity. // If we are configured to use collection strengths (i.e. item counts) then include that number in the validity.
boolean showCount = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("webui.strengths.show"); boolean showCount = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("webui.strengths.show");
@@ -150,7 +167,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
{ //try to determine Collection size (i.e. # of items) { //try to determine Collection size (i.e. # of items)
int size = new ItemCounter(context).getCount(node.getDSO()); int size = new ItemCounter(context).getCount(node.getDSO());
validity.add("size:"+size); theValidity.add("size:"+size);
} }
catch(ItemCountException e) { /* ignore */ } catch(ItemCountException e) { /* ignore */ }
} }
@@ -166,10 +183,10 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
String assumeCacheValidity = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("xmlui.community-list.cache"); String assumeCacheValidity = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("xmlui.community-list.cache");
if (assumeCacheValidity != null) if (assumeCacheValidity != null)
{ {
validity.setAssumedValidityDelay(assumeCacheValidity); theValidity.setAssumedValidityDelay(assumeCacheValidity);
} }
this.validity = validity.complete(); this.validity = theValidity.complete();
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
@@ -182,7 +199,14 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
/** /**
* Add a page title and trail links. * Add a page title and trail links.
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override
public void addPageMeta(PageMeta pageMeta) throws SAXException, public void addPageMeta(PageMeta pageMeta) throws SAXException,
WingException, UIException, SQLException, IOException, WingException, UIException, SQLException, IOException,
AuthorizeException AuthorizeException
@@ -197,7 +221,14 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
/** /**
* Add a community-browser division that includes references to community and * Add a community-browser division that includes references to community and
* collection metadata. * collection metadata.
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override
public void addBody(Body body) throws SAXException, WingException, public void addBody(Body body) throws SAXException, WingException,
UIException, SQLException, IOException, AuthorizeException UIException, SQLException, IOException, AuthorizeException
{ {
@@ -205,16 +236,16 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
division.setHead(T_head); division.setHead(T_head);
division.addPara(T_select); division.addPara(T_select);
TreeNode root = buildTree(communityService.findAllTop(context)); TreeNode treeRoot = buildTree(communityService.findAllTop(context));
boolean full = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("xmlui.community-list.render.full", true); boolean full = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("xmlui.community-list.render.full", true);
if (full) if (full)
{ {
ReferenceSet referenceSet = division.addReferenceSet("community-browser", ReferenceSet referenceSet = division.addReferenceSet("community-browser",
ReferenceSet.TYPE_SUMMARY_LIST,null,"hierarchy"); ReferenceSet.TYPE_SUMMARY_LIST,null,"hierarchy");
java.util.List<TreeNode> rootNodes = root.getChildrenOfType(Constants.COMMUNITY); java.util.List<TreeNode> rootNodes = treeRoot.getChildrenOfType(Constants.COMMUNITY);
for (TreeNode node : rootNodes) for (TreeNode node : rootNodes)
{ {
@@ -225,7 +256,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
{ {
List list = division.addList("comunity-browser"); List list = division.addList("comunity-browser");
java.util.List<TreeNode> rootNodes = root.getChildrenOfType(Constants.COMMUNITY); java.util.List<TreeNode> rootNodes = treeRoot.getChildrenOfType(Constants.COMMUNITY);
for (TreeNode node : rootNodes) for (TreeNode node : rootNodes)
{ {
@@ -241,6 +272,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
* *
* @param referenceSet The include set * @param referenceSet The include set
* @param node The current node of the hierarchy. * @param node The current node of the hierarchy.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void buildReferenceSet(ReferenceSet referenceSet, TreeNode node) throws WingException public void buildReferenceSet(ReferenceSet referenceSet, TreeNode node) throws WingException
{ {
@@ -279,6 +311,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
* *
* @param list The parent list * @param list The parent list
* @param node The current node of the hierarchy. * @param node The current node of the hierarchy.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void buildList(List list, TreeNode node) throws WingException public void buildList(List list, TreeNode node) throws WingException
{ {
@@ -294,8 +327,8 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
name = ((Collection) dso).getName(); name = ((Collection) dso).getName();
} }
String url = contextPath + "/handle/"+dso.getHandle(); String aURL = contextPath + "/handle/"+dso.getHandle();
list.addItem().addHighlight("bold").addXref(url, name); list.addItem().addHighlight("bold").addXref(aURL, name);
List subList = null; List subList = null;
@@ -312,8 +345,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
subList.addItemXref(collectionUrl, collectionName); subList.addItemXref(collectionUrl, collectionName);
} }
} }
// Add all the sub-communities // Add all the sub-communities
java.util.List<TreeNode> communityNodes = node.getChildrenOfType(Constants.COMMUNITY); java.util.List<TreeNode> communityNodes = node.getChildrenOfType(Constants.COMMUNITY);
if (communityNodes != null && communityNodes.size() > 0) if (communityNodes != null && communityNodes.size() > 0)
@@ -330,9 +362,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
} }
} }
/** @Override
* recycle
*/
public void recycle() public void recycle()
{ {
this.root = null; this.root = null;
@@ -357,7 +387,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
TreeNode newRoot = new TreeNode(); TreeNode newRoot = new TreeNode();
// Setup for breadth-first traversal // Setup for breadth-first traversal
Stack<TreeNode> stack = new Stack<TreeNode>(); Stack<TreeNode> stack = new Stack<>();
for (Community community : communities) for (Community community : communities)
{ {
@@ -397,7 +427,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
} }
/** /**
* Private class to represent the tree structure of communities & collections. * Private class to represent the tree structure of communities and collections.
*/ */
protected static class TreeNode protected static class TreeNode
{ {
@@ -408,7 +438,7 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
private int level; private int level;
/** All children of this node */ /** All children of this node */
private java.util.List<TreeNode> children = new ArrayList<TreeNode>(); private final java.util.List<TreeNode> children = new ArrayList<>();
/** /**
* Construct a new root level node * Construct a new root level node
@@ -459,11 +489,12 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
} }
/** /**
* @param type interesting type.
* @return All children of the given @type. * @return All children of the given @type.
*/ */
public java.util.List<TreeNode> getChildrenOfType(int type) public java.util.List<TreeNode> getChildrenOfType(int type)
{ {
java.util.List<TreeNode> results = new ArrayList<TreeNode>(); java.util.List<TreeNode> results = new ArrayList<>();
for (TreeNode node : children) for (TreeNode node : children)
{ {
if (node.dso.getType() == type) if (node.dso.getType() == type)

View File

@@ -100,6 +100,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
/** /**
* Generate the unique caching key. * Generate the unique caching key.
* This key must be unique inside the space of this component. * This key must be unique inside the space of this component.
* @return the key.
*/ */
@Override @Override
public Serializable getKey() { public Serializable getKey() {
@@ -124,7 +125,8 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
* Generate the cache validity object. * Generate the cache validity object.
* *
* The validity object will include the item being viewed, * The validity object will include the item being viewed,
* along with all bundles & bitstreams. * along with all bundles and bitstreams.
* @return validity.
*/ */
@Override @Override
public SourceValidity getValidity() public SourceValidity getValidity()
@@ -136,9 +138,9 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
try { try {
dso = HandleUtil.obtainHandle(objectModel); dso = HandleUtil.obtainHandle(objectModel);
DSpaceValidity validity = new DSpaceValidity(); DSpaceValidity newValidity = new DSpaceValidity();
validity.add(context, dso); newValidity.add(context, dso);
this.validity = validity.complete(); this.validity = newValidity.complete();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -159,6 +161,12 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
/** /**
* Add the item's title and trail links to the page's metadata. * Add the item's title and trail links to the page's metadata.
* @throws org.xml.sax.SAXException
* @throws org.dspace.app.xmlui.wing.WingException if a crosswalk fails.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override @Override
public void addPageMeta(PageMeta pageMeta) throws SAXException, public void addPageMeta(PageMeta pageMeta) throws SAXException,
@@ -322,6 +330,12 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
/** /**
* Display a single item * Display a single item
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override @Override
public void addBody(Body body) throws SAXException, WingException, public void addBody(Body body) throws SAXException, WingException,
@@ -413,23 +427,17 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
/** /**
* Determine if the full item should be referenced or just a summary. * Determine if the full item should be referenced or just a summary.
* @param objectModel to get the request.
* @return true if the full item should be shown.
*/ */
public static boolean showFullItem(Map objectModel) public static boolean showFullItem(Map objectModel)
{ {
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);
String show = request.getParameter("show"); String show = request.getParameter("show");
if (show != null && show.length() > 0) return show != null && show.length() > 0;
{
return true;
}
return false;
} }
/**
* Recycle
*/
@Override @Override
public void recycle() { public void recycle() {
this.validity = null; this.validity = null;

View File

@@ -50,12 +50,13 @@ import org.dspace.handle.service.HandleService;
*/ */
public class SendItemRequestAction extends AbstractAction public class SendItemRequestAction extends AbstractAction
{ {
private static Logger log = Logger.getLogger(SendItemRequestAction.class); private static final Logger log = Logger.getLogger(SendItemRequestAction.class);
protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService(); protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
protected RequestItemService requestItemService = RequestItemServiceFactory.getInstance().getRequestItemService(); protected RequestItemService requestItemService = RequestItemServiceFactory.getInstance().getRequestItemService();
protected BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); protected BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
String source, Parameters parameters) throws Exception String source, Parameters parameters) throws Exception
{ {
@@ -81,7 +82,7 @@ public class SendItemRequestAction extends AbstractAction
{ {
// Either the user did not fill out the form or this is the // Either the user did not fill out the form or this is the
// first time they are visiting the page. // first time they are visiting the page.
Map<String,String> map = new HashMap<String,String>(); Map<String,String> map = new HashMap<>();
map.put("bitstreamId",bitstreamId); map.put("bitstreamId",bitstreamId);
if (StringUtils.isEmpty(requesterEmail)) if (StringUtils.isEmpty(requesterEmail))
@@ -141,19 +142,21 @@ public class SendItemRequestAction extends AbstractAction
/** /**
* Get the link to the author in RequestLink email. * Get the link to the author in RequestLink email.
* @param context * @param context DSpace session context.
* @param requestItem * @param token token.
* @return * @return the link.
* @throws SQLException * @throws SQLException passed through.
*/ */
protected String getLinkTokenEmail(Context context, String token) protected String getLinkTokenEmail(Context context, String token)
throws SQLException throws SQLException
{ {
String base = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.url"); String base = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.url");
String specialLink = (new StringBuffer()).append(base).append( String specialLink = new StringBuffer()
base.endsWith("/") ? "" : "/").append( .append(base)
"itemRequestResponse/").append(token) .append(base.endsWith("/") ? "" : "/")
.append("itemRequestResponse/")
.append(token)
.toString()+"/"; .toString()+"/";
return specialLink; return specialLink;

View File

@@ -12,11 +12,9 @@ import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Request;
import org.apache.cocoon.util.HashUtil; import org.apache.cocoon.util.HashUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.excalibur.source.SourceValidity; import org.apache.excalibur.source.SourceValidity;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.app.util.MetadataExposureServiceImpl;
import org.dspace.app.util.factory.UtilServiceFactory; import org.dspace.app.util.factory.UtilServiceFactory;
import org.dspace.app.util.service.MetadataExposureService; import org.dspace.app.util.service.MetadataExposureService;
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer; import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
@@ -43,7 +41,6 @@ import org.dspace.discovery.configuration.DiscoveryHitHighlightFieldConfiguratio
import org.dspace.discovery.configuration.DiscoverySortConfiguration; import org.dspace.discovery.configuration.DiscoverySortConfiguration;
import org.dspace.discovery.configuration.DiscoverySortConfiguration.SORT_ORDER; import org.dspace.discovery.configuration.DiscoverySortConfiguration.SORT_ORDER;
import org.dspace.discovery.configuration.DiscoverySortFieldConfiguration; import org.dspace.discovery.configuration.DiscoverySortFieldConfiguration;
import org.dspace.handle.HandleServiceImpl;
import org.dspace.handle.factory.HandleServiceFactory; import org.dspace.handle.factory.HandleServiceFactory;
import org.dspace.handle.service.HandleService; import org.dspace.handle.service.HandleService;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@@ -58,7 +55,7 @@ import java.util.List;
* This is an abstract search page. It is a collection of search methods that * This is an abstract search page. It is a collection of search methods that
* are common between different search implementation. An implementer must * are common between different search implementation. An implementer must
* implement at least three methods: addBody(), getQuery(), and generateURL(). * implement at least three methods: addBody(), getQuery(), and generateURL().
* <p/> * <p>
* See the SimpleSearch implementation. * See the SimpleSearch implementation.
* *
* @author Kevin Van de Velde (kevin at atmire dot com) * @author Kevin Van de Velde (kevin at atmire dot com)
@@ -124,11 +121,12 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
protected MetadataExposureService metadataExposureService = UtilServiceFactory.getInstance().getMetadataExposureService(); protected MetadataExposureService metadataExposureService = UtilServiceFactory.getInstance().getMetadataExposureService();
protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService(); protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
/** /**
* Generate the unique caching key. * Generate the unique caching key.
* This key must be unique inside the space of this component. * This key must be unique inside the space of this component.
* @return the key.
*/ */
@Override
public Serializable getKey() { public Serializable getKey() {
try { try {
String key = ""; String key = "";
@@ -153,7 +151,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
return HashUtil.hash(key); return HashUtil.hash(key);
} catch (RuntimeException re) { } catch (RuntimeException re) {
throw re; throw re;
} catch (Exception e) { } catch (SQLException | UIException e) {
// Ignore all errors and just don't cache. // Ignore all errors and just don't cache.
return "0"; return "0";
} }
@@ -161,30 +159,32 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Generate the cache validity object. * Generate the cache validity object.
* <p/> * <p>
* This validity object should never "over cache" because it will * This validity object should never "over cache" because it will
* perform the search, and serialize the results using the * perform the search, and serialize the results using the
* DSpaceValidity object. * DSpaceValidity object.
* @return the validity.
*/ */
@Override
public SourceValidity getValidity() { public SourceValidity getValidity() {
if (this.validity == null) { if (this.validity == null) {
try { try {
DSpaceValidity validity = new DSpaceValidity(); DSpaceValidity newValidity = new DSpaceValidity();
DSpaceObject scope = getScope(); DSpaceObject scope = getScope();
validity.add(context, scope); newValidity.add(context, scope);
performSearch(scope); performSearch(scope);
List<DSpaceObject> results = this.queryResults.getDspaceObjects(); List<DSpaceObject> results = this.queryResults.getDspaceObjects();
if (results != null) { if (results != null) {
validity.add("total:"+this.queryResults.getTotalSearchResults()); newValidity.add("total:"+this.queryResults.getTotalSearchResults());
validity.add("start:"+this.queryResults.getStart()); newValidity.add("start:"+this.queryResults.getStart());
validity.add("size:" + results.size()); newValidity.add("size:" + results.size());
for (DSpaceObject dso : results) { for (DSpaceObject dso : results) {
validity.add(context, dso); newValidity.add(context, dso);
} }
} }
@@ -193,15 +193,15 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
List<DiscoverResult.FacetResult> facetValues = facetResults.get(facetField); List<DiscoverResult.FacetResult> facetValues = facetResults.get(facetField);
for (DiscoverResult.FacetResult facetResult : facetValues) for (DiscoverResult.FacetResult facetResult : facetValues)
{ {
validity.add(facetField + facetResult.getAsFilterQuery() + facetResult.getCount()); newValidity.add(facetField + facetResult.getAsFilterQuery() + facetResult.getCount());
} }
} }
this.validity = validity.complete(); this.validity = newValidity.complete();
} catch (RuntimeException re) { } catch (RuntimeException re) {
throw re; throw re;
} }
catch (Exception e) { catch (SQLException | UIException | SearchServiceException e) {
this.validity = null; this.validity = null;
} }
@@ -215,7 +215,14 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Build the resulting search DRI document. * Build the resulting search DRI document.
* @throws org.xml.sax.SAXException whenever.
* @throws org.dspace.app.xmlui.wing.WingException whenever.
* @throws org.dspace.app.xmlui.utils.UIException whenever.
* @throws java.sql.SQLException whenever.
* @throws java.io.IOException whenever.
* @throws org.dspace.authorize.AuthorizeException whenever.
*/ */
@Override
public abstract void addBody(Body body) throws SAXException, WingException, public abstract void addBody(Body body) throws SAXException, WingException,
UIException, SQLException, IOException, AuthorizeException; UIException, SQLException, IOException, AuthorizeException;
@@ -224,6 +231,8 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* This form will be used for all discovery queries, filters, .... * This form will be used for all discovery queries, filters, ....
* At the moment however this form is only used to track search result hits * At the moment however this form is only used to track search result hits
* @param searchDiv the division to add the form to * @param searchDiv the division to add the form to
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws java.sql.SQLException passed through.
*/ */
protected void buildMainForm(Division searchDiv) throws WingException, SQLException { protected void buildMainForm(Division searchDiv) throws WingException, SQLException {
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);
@@ -284,6 +293,10 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* which contains results for this search query. * which contains results for this search query.
* *
* @param search The search division to contain the search-results division. * @param search The search division to contain the search-results division.
* @throws java.io.IOException passed through.
* @throws java.sql.SQLException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws org.dspace.discovery.SearchServiceException passed through.
*/ */
protected void buildSearchResultsDivision(Division search) protected void buildSearchResultsDivision(Division search)
throws IOException, SQLException, WingException, SearchServiceException { throws IOException, SQLException, WingException, SearchServiceException {
@@ -299,7 +312,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
queryResults = null; queryResults = null;
} }
catch (Exception e) { catch (SQLException | UIException | SearchServiceException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
queryResults = null; queryResults = null;
} }
@@ -345,9 +358,9 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
// lastItemIndex = itemsTotal; // lastItemIndex = itemsTotal;
int currentPage = this.queryResults.getStart() / this.queryResults.getMaxResults() + 1; int currentPage = this.queryResults.getStart() / this.queryResults.getMaxResults() + 1;
int pagesTotal = (int) ((this.queryResults.getTotalSearchResults() - 1) / this.queryResults.getMaxResults()) + 1; int pagesTotal = (int) ((this.queryResults.getTotalSearchResults() - 1) / this.queryResults.getMaxResults()) + 1;
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> urlParameters = new HashMap<>();
parameters.put("page", "{pageNum}"); urlParameters.put("page", "{pageNum}");
String pageURLMask = generateURL(parameters); String pageURLMask = generateURL(urlParameters);
pageURLMask = addFilterQueriesToUrl(pageURLMask); pageURLMask = addFilterQueriesToUrl(pageURLMask);
results.setMaskedPagination(itemsTotal, firstItemIndex, results.setMaskedPagination(itemsTotal, firstItemIndex,
@@ -360,8 +373,8 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
dspaceObjectsList = results.addList("search-results-repository", dspaceObjectsList = results.addList("search-results-repository",
org.dspace.app.xmlui.wing.element.List.TYPE_DSO_LIST, "repository-search-results"); org.dspace.app.xmlui.wing.element.List.TYPE_DSO_LIST, "repository-search-results");
List<DSpaceObject> commCollList = new ArrayList<DSpaceObject>(); List<DSpaceObject> commCollList = new ArrayList<>();
List<Item> itemList = new ArrayList<Item>(); List<Item> itemList = new ArrayList<>();
for (DSpaceObject resultDso : queryResults.getDspaceObjects()) for (DSpaceObject resultDso : queryResults.getDspaceObjects())
{ {
if(resultDso.getType() == Constants.COMMUNITY || resultDso.getType() == Constants.COLLECTION) if(resultDso.getType() == Constants.COMMUNITY || resultDso.getType() == Constants.COLLECTION)
@@ -509,9 +522,13 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* Render the given collection, all collection metadata is added to the list * Render the given collection, all collection metadata is added to the list
* @param collection the collection to be rendered * @param collection the collection to be rendered
* @param highlightedResults the highlighted results * @param highlightedResults the highlighted results
* @throws WingException * @param collectionMetadata list of metadata values.
* @throws WingException passed through.
*/ */
protected void renderCollection(Collection collection, DiscoverResult.DSpaceObjectHighlightResult highlightedResults, org.dspace.app.xmlui.wing.element.List collectionMetadata) throws WingException { protected void renderCollection(Collection collection,
DiscoverResult.DSpaceObjectHighlightResult highlightedResults,
org.dspace.app.xmlui.wing.element.List collectionMetadata)
throws WingException {
String description = collectionService.getMetadata(collection, "introductory_text"); String description = collectionService.getMetadata(collection, "introductory_text");
String description_abstract = collectionService.getMetadata(collection, "short_description"); String description_abstract = collectionService.getMetadata(collection, "short_description");
@@ -560,10 +577,14 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* Render the given collection, all collection metadata is added to the list * Render the given collection, all collection metadata is added to the list
* @param community the community to be rendered * @param community the community to be rendered
* @param highlightedResults the highlighted results * @param highlightedResults the highlighted results
* @throws WingException * @param communityMetadata list of metadata values.
* @throws WingException passed through.
*/ */
protected void renderCommunity(Community community, DiscoverResult.DSpaceObjectHighlightResult highlightedResults, org.dspace.app.xmlui.wing.element.List communityMetadata) throws WingException { protected void renderCommunity(Community community,
DiscoverResult.DSpaceObjectHighlightResult highlightedResults,
org.dspace.app.xmlui.wing.element.List communityMetadata)
throws WingException {
String description = communityService.getMetadata(community, "introductory_text"); String description = communityService.getMetadata(community, "introductory_text");
String description_abstract = communityService.getMetadata(community, "short_description"); String description_abstract = communityService.getMetadata(community, "short_description");
String description_table = communityService.getMetadata(community, "side_bar_text"); String description_table = communityService.getMetadata(community, "side_bar_text");
@@ -573,27 +594,39 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
if(StringUtils.isNotBlank(description)) if(StringUtils.isNotBlank(description))
{ {
addMetadataField(highlightedResults, "dc.description", communityMetadata.addList(community.getHandle() + ":dc.description"), description); addMetadataField(highlightedResults, "dc.description",
communityMetadata.addList(community.getHandle() + ":dc.description"),
description);
} }
if(StringUtils.isNotBlank(description_abstract)) if(StringUtils.isNotBlank(description_abstract))
{ {
addMetadataField(highlightedResults, "dc.description.abstract", communityMetadata.addList(community.getHandle() + ":dc.description.abstract"), description_abstract); addMetadataField(highlightedResults, "dc.description.abstract",
communityMetadata.addList(community.getHandle() + ":dc.description.abstract"),
description_abstract);
} }
if(StringUtils.isNotBlank(description_table)) if(StringUtils.isNotBlank(description_table))
{ {
addMetadataField(highlightedResults, "dc.description.tableofcontents", communityMetadata.addList(community.getHandle() + ":dc.description.tableofcontents"), description_table); addMetadataField(highlightedResults, "dc.description.tableofcontents",
communityMetadata.addList(community.getHandle() + ":dc.description.tableofcontents"),
description_table);
} }
if(StringUtils.isNotBlank(identifier_uri)) if(StringUtils.isNotBlank(identifier_uri))
{ {
addMetadataField(highlightedResults, "dc.identifier.uri", communityMetadata.addList(community.getHandle() + ":dc.identifier.uri"), identifier_uri); addMetadataField(highlightedResults, "dc.identifier.uri",
communityMetadata.addList(community.getHandle() + ":dc.identifier.uri"),
identifier_uri);
} }
if(StringUtils.isNotBlank(rights)) if(StringUtils.isNotBlank(rights))
{ {
addMetadataField(highlightedResults, "dc.rights", communityMetadata.addList(community.getHandle() + ":dc.rights"), rights); addMetadataField(highlightedResults, "dc.rights",
communityMetadata.addList(community.getHandle() + ":dc.rights"),
rights);
} }
if(StringUtils.isNotBlank(title)) if(StringUtils.isNotBlank(title))
{ {
addMetadataField(highlightedResults, "dc.title", communityMetadata.addList(community.getHandle() + ":dc.title"), title); addMetadataField(highlightedResults, "dc.title",
communityMetadata.addList(community.getHandle() + ":dc.title"),
title);
} }
} }
@@ -605,7 +638,12 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* @param value the metadata value * @param value the metadata value
* @throws WingException * @throws WingException
*/ */
protected void addMetadataField(DiscoverResult.DSpaceObjectHighlightResult highlightedResults, String metadataKey, org.dspace.app.xmlui.wing.element.List metadataFieldList, String value) throws WingException { protected void addMetadataField(
DiscoverResult.DSpaceObjectHighlightResult highlightedResults,
String metadataKey,
org.dspace.app.xmlui.wing.element.List metadataFieldList,
String value)
throws WingException {
if(value == null){ if(value == null){
//In the unlikely event that the value is null, do not attempt to render this //In the unlikely event that the value is null, do not attempt to render this
return; return;
@@ -648,10 +686,12 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
} }
/** /**
* Add our metadata value, this value will might contain the highlight ("<em></em>") tags, these will be removed & rendered as highlight wing fields. * Add our metadata value. This value will might contain the highlight
* @param metadataFieldList the metadata list we need to add the value to * ("{@code <em></em>}") tags. These will be removed and rendered as highlight WING fields.
*
* @param metadataFieldList the metadata list we need to add the value to.
* @param value the metadata value to be rendered * @param value the metadata value to be rendered
* @throws WingException * @throws WingException passed through.
*/ */
protected void addMetadataField(org.dspace.app.xmlui.wing.element.List metadataFieldList, String value) throws WingException { protected void addMetadataField(org.dspace.app.xmlui.wing.element.List metadataFieldList, String value) throws WingException {
//We need to put everything in <em> tags in a highlight ! //We need to put everything in <em> tags in a highlight !
@@ -677,18 +717,19 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Add options to the search scope field. This field determines in which * Add options to the search scope field. This field determines in which
* communities or collections to search for the query. * communities or collections to search for the query.
* <p/> * <p>
* The scope list will depend upon the current search scope. There are three * The scope list will depend upon the current search scope. There are three
* cases: * cases:
* <p/> * <ul>
* No current scope: All top level communities are listed. * <li>No current scope: All top level communities are listed.
* <p/> * <li>The current scope is a community: All collections contained within the
* The current scope is a community: All collections contained within the * community are listed.
* community are listed. * <li>The current scope is a collection: All parent communities are listed.
* <p/> * </ul>
* The current scope is a collection: All parent communities are listed.
* *
* @param scope The current scope field. * @param scope The current scope field.
* @throws java.sql.SQLException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected void buildScopeList(Select scope) throws SQLException, protected void buildScopeList(Select scope) throws SQLException,
WingException { WingException {
@@ -729,10 +770,16 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Prepare DiscoverQuery given the current scope and query string * Prepare DiscoverQuery given the current scope and query string
* *
* @param scope the dspace object parent * @param scope the dspace object parent
* @param query the query.
* @param fqs the filter queries.
* @return the prepared query.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws org.dspace.discovery.SearchServiceException passed through.
*/ */
public DiscoverQuery prepareQuery(DSpaceObject scope, String query, String[] fqs) throws UIException, SearchServiceException { public DiscoverQuery prepareQuery(DSpaceObject scope, String query, String[] fqs)
throws UIException, SearchServiceException {
this.queryArgs = new DiscoverQuery(); this.queryArgs = new DiscoverQuery();
int page = getParameterPage(); int page = getParameterPage();
@@ -740,7 +787,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
// Escape any special characters in this user-entered query // Escape any special characters in this user-entered query
query = DiscoveryUIUtils.escapeQueryChars(query); query = DiscoveryUIUtils.escapeQueryChars(query);
List<String> filterQueries = new ArrayList<String>(); List<String> filterQueries = new ArrayList<>();
if (fqs != null) { if (fqs != null) {
filterQueries.addAll(Arrays.asList(fqs)); filterQueries.addAll(Arrays.asList(fqs));
@@ -835,8 +882,9 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* Query DSpace for a list of all items / collections / or communities that * Query DSpace for a list of all items / collections / or communities that
* match the given search query. * match the given search query.
* *
*
* @param scope the dspace object parent * @param scope the dspace object parent
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws org.dspace.discovery.SearchServiceException passed through.
*/ */
public void performSearch(DSpaceObject scope) throws UIException, SearchServiceException { public void performSearch(DSpaceObject scope) throws UIException, SearchServiceException {
@@ -854,7 +902,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
protected Map<String, String[]> getParameterFilterQueries() protected Map<String, String[]> getParameterFilterQueries()
{ {
try { try {
Map<String, String[]> result = new HashMap<String, String[]>(); Map<String, String[]> result = new HashMap<>();
result.put("fq", ObjectModelHelper.getRequest(objectModel).getParameterValues("fq")); result.put("fq", ObjectModelHelper.getRequest(objectModel).getParameterValues("fq"));
return result; return result;
} }
@@ -934,11 +982,12 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Determine if the scope of the search should fixed or is changeable by the * Determine if the scope of the search should fixed or is changeable by the
* user. * user.
* <p/> * <p>
* The search scope when performed by url, i.e. they are at the url handle/xxxx/xx/search * The search scope when performed by URL, i.e. they are at the URL handle/xxxx/xx/search
* then it is fixed. However at the global level the search is variable. * then it is fixed. However at the global level the search is variable.
* *
* @return true if the scope is variable, false otherwise. * @return true if the scope is variable, false otherwise.
* @throws java.sql.SQLException passed through.
*/ */
protected boolean variableScope() throws SQLException { protected boolean variableScope() throws SQLException {
return (HandleUtil.obtainHandle(objectModel) == null); return (HandleUtil.obtainHandle(objectModel) == null);
@@ -946,26 +995,25 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
/** /**
* Extract the query string. Under most implementations this will be derived * Extract the query string. Under most implementations this will be derived
* from the url parameters. * from the URL parameters.
* *
* @return The query string. * @return The query string.
* @throws org.dspace.app.xmlui.utils.UIException whenever.
*/ */
protected abstract String getQuery() throws UIException; protected abstract String getQuery() throws UIException;
/** /**
* Generate a url to the given search implementation with the associated * Generate a URL to the given search implementation with the associated
* parameters included. * parameters included.
* *
* @param parameters * @param parameters URL query parameters.
* @return The post URL * @return The post URL
* @throws org.dspace.app.xmlui.utils.UIException whenever.
*/ */
protected abstract String generateURL(Map<String, String> parameters) protected abstract String generateURL(Map<String, String> parameters)
throws UIException; throws UIException;
@Override
/**
* Recycle
*/
public void recycle() { public void recycle() {
this.queryArgs = null; this.queryArgs = null;
this.queryResults = null; this.queryResults = null;
@@ -973,7 +1021,6 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
super.recycle(); super.recycle();
} }
protected void buildSearchControls(Division div) protected void buildSearchControls(Division div)
throws WingException, SQLException { throws WingException, SQLException {
@@ -1043,6 +1090,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer implement
* specified then null is returned. * specified then null is returned.
* *
* @return The current scope. * @return The current scope.
* @throws java.sql.SQLException passed through.
*/ */
protected DSpaceObject getScope() throws SQLException { protected DSpaceObject getScope() throws SQLException {
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);

View File

@@ -66,7 +66,7 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
*/ */
protected DiscoverQuery queryArgs; protected DiscoverQuery queryArgs;
private int DEFAULT_PAGE_SIZE = 10; private final int DEFAULT_PAGE_SIZE = 10;
public static final String OFFSET = "offset"; public static final String OFFSET = "offset";
public static final String FACET_FIELD = "field"; public static final String FACET_FIELD = "field";
@@ -85,7 +85,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
/** /**
* Generate the unique caching key. * Generate the unique caching key.
* This key must be unique inside the space of this component. * This key must be unique inside the space of this component.
* @return the key.
*/ */
@Override
public Serializable getKey() { public Serializable getKey() {
try { try {
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
@@ -106,44 +108,46 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
/** /**
* Generate the cache validity object. * Generate the cache validity object.
* <p/> * <p>
* The validity object will include the collection being viewed and * The validity object will include the collection being viewed and
* all recently submitted items. This does not include the community / collection * all recently submitted items. This does not include the community / collection
* hierarchy, when this changes they will not be reflected in the cache. * hierarchy, when this changes they will not be reflected in the cache.
* @return the validity.
*/ */
@Override
public SourceValidity getValidity() { public SourceValidity getValidity() {
if (this.validity == null) { if (this.validity == null) {
try { try {
DSpaceValidity validity = new DSpaceValidity(); DSpaceValidity newValidity = new DSpaceValidity();
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if (dso != null) { if (dso != null) {
// Add the actual collection; // Add the actual collection;
validity.add(context, dso); newValidity.add(context, dso);
} }
// add recently submitted items, serialize solr query contents. // add recently submitted items, serialize solr query contents.
DiscoverResult response = getQueryResponse(dso); DiscoverResult response = getQueryResponse(dso);
validity.add("numFound:" + response.getDspaceObjects().size()); newValidity.add("numFound:" + response.getDspaceObjects().size());
for (DSpaceObject resultDso : response.getDspaceObjects()) { for (DSpaceObject resultDso : response.getDspaceObjects()) {
validity.add(context, resultDso); newValidity.add(context, resultDso);
} }
for (String facetField : response.getFacetResults().keySet()) { for (String facetField : response.getFacetResults().keySet()) {
validity.add(facetField); newValidity.add(facetField);
List<DiscoverResult.FacetResult> facetValues = response.getFacetResults().get(facetField); List<DiscoverResult.FacetResult> facetValues = response.getFacetResults().get(facetField);
for (DiscoverResult.FacetResult facetValue : facetValues) { for (DiscoverResult.FacetResult facetValue : facetValues) {
validity.add(facetValue.getAsFilterQuery() + facetValue.getCount()); newValidity.add(facetValue.getAsFilterQuery() + facetValue.getCount());
} }
} }
this.validity = validity.complete(); this.validity = newValidity.complete();
} }
catch (Exception e) { catch (Exception e) {
// Just ignore all errors and return an invalid cache. // Just ignore all errors and return an invalid cache.
@@ -158,6 +162,7 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
* Get the recently submitted items for the given community or collection. * Get the recently submitted items for the given community or collection.
* *
* @param scope The collection. * @param scope The collection.
* @return recently submitted items.
*/ */
protected DiscoverResult getQueryResponse(DSpaceObject scope) { protected DiscoverResult getQueryResponse(DSpaceObject scope) {
@@ -246,8 +251,16 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
/** /**
* Add a page title and trail links. * Add a page title and trail links.
*
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
public void addPageMeta(PageMeta pageMeta) throws SAXException, WingException, SQLException, IOException, AuthorizeException { @Override
public void addPageMeta(PageMeta pageMeta)
throws SAXException, WingException, SQLException, IOException, AuthorizeException {
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);
String facetField = request.getParameter(FACET_FIELD); String facetField = request.getParameter(FACET_FIELD);
@@ -284,7 +297,7 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
Map<String, List<DiscoverResult.FacetResult>> facetFields = this.queryResults.getFacetResults(); Map<String, List<DiscoverResult.FacetResult>> facetFields = this.queryResults.getFacetResults();
if (facetFields == null) if (facetFields == null)
{ {
facetFields = new LinkedHashMap<String, List<DiscoverResult.FacetResult>>(); facetFields = new LinkedHashMap<>();
} }
// facetFields.addAll(this.queryResults.getFacetDates()); // facetFields.addAll(this.queryResults.getFacetDates());
@@ -320,7 +333,7 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
Table singleTable = results.addTable("browse-by-" + facetField + "-results", (int) (queryResults.getDspaceObjects().size() + 1), 1); Table singleTable = results.addTable("browse-by-" + facetField + "-results", (int) (queryResults.getDspaceObjects().size() + 1), 1);
List<String> filterQueries = new ArrayList<String>(); List<String> filterQueries = new ArrayList<>();
if(request.getParameterValues("fq") != null) if(request.getParameterValues("fq") != null)
{ {
filterQueries = Arrays.asList(request.getParameterValues("fq")); filterQueries = Arrays.asList(request.getParameterValues("fq"));
@@ -379,26 +392,26 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
} }
private String getNextPageURL(Request request) { private String getNextPageURL(Request request) {
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> urlParameters = new HashMap<>();
parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD)); urlParameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
if (queryArgs.getFacetOffset() != -1) if (queryArgs.getFacetOffset() != -1)
{ {
parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() + DEFAULT_PAGE_SIZE)); urlParameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() + DEFAULT_PAGE_SIZE));
} }
// Add the filter queries // Add the filter queries
String url = generateURL("browse-discovery", parameters); String newURL = generateURL("browse-discovery", urlParameters);
String[] fqs = getParameterFacetQueries(); String[] fqs = getParameterFacetQueries();
if (fqs != null) { if (fqs != null) {
StringBuilder urlBuilder = new StringBuilder(url); StringBuilder urlBuilder = new StringBuilder(newURL);
for (String fq : fqs) { for (String fq : fqs) {
urlBuilder.append("&fq=").append(fq); urlBuilder.append("&fq=").append(fq);
} }
url = urlBuilder.toString(); newURL = urlBuilder.toString();
} }
return url; return newURL;
} }
private String getPreviousPageURL(Request request) { private String getPreviousPageURL(Request request) {
@@ -408,32 +421,29 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
return null; return null;
} }
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> urlParameters = new HashMap<>();
parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD)); urlParameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
if (queryArgs.getFacetOffset() != -1) if (queryArgs.getFacetOffset() != -1)
{ {
parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() - DEFAULT_PAGE_SIZE)); urlParameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() - DEFAULT_PAGE_SIZE));
} }
// Add the filter queries // Add the filter queries
String url = generateURL("browse-discovery", parameters); String newURL = generateURL("browse-discovery", urlParameters);
String[] fqs = getParameterFacetQueries(); String[] fqs = getParameterFacetQueries();
if (fqs != null) { if (fqs != null) {
StringBuilder urlBuilder = new StringBuilder(url); StringBuilder urlBuilder = new StringBuilder(newURL);
for (String fq : fqs) { for (String fq : fqs) {
urlBuilder.append("&fq=").append(fq); urlBuilder.append("&fq=").append(fq);
} }
url = urlBuilder.toString(); newURL = urlBuilder.toString();
} }
return url; return newURL;
} }
@Override
/**
* Recycle
*/
public void recycle() { public void recycle() {
// Clear out our item's cache. // Clear out our item's cache.
this.queryResults = null; this.queryResults = null;

View File

@@ -109,7 +109,9 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
/** /**
* Generate the unique caching key. * Generate the unique caching key.
* This key must be unique inside the space of this component. * This key must be unique inside the space of this component.
* @return the key.
*/ */
@Override
public Serializable getKey() { public Serializable getKey() {
try { try {
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
@@ -130,44 +132,46 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
/** /**
* Generate the cache validity object. * Generate the cache validity object.
* <p/> * <p>
* The validity object will include the collection being viewed and * The validity object will include the collection being viewed and
* all recently submitted items. This does not include the community / collection * all recently submitted items. This does not include the community / collection
* hierarchy, when this changes they will not be reflected in the cache. * hierarchy, when this changes they will not be reflected in the cache.
* @return the validity.
*/ */
@Override
public SourceValidity getValidity() { public SourceValidity getValidity() {
if (this.validity == null) { if (this.validity == null) {
try { try {
DSpaceValidity validity = new DSpaceValidity(); DSpaceValidity newValidity = new DSpaceValidity();
DSpaceObject dso = getScope(); DSpaceObject dso = getScope();
if (dso != null) { if (dso != null) {
// Add the actual collection; // Add the actual collection;
validity.add(context, dso); newValidity.add(context, dso);
} }
// add recently submitted items, serialize solr query contents. // add recently submitted items, serialize solr query contents.
DiscoverResult response = getQueryResponse(dso); DiscoverResult response = getQueryResponse(dso);
validity.add("numFound:" + response.getDspaceObjects().size()); newValidity.add("numFound:" + response.getDspaceObjects().size());
for (DSpaceObject resultDso : queryResults.getDspaceObjects()) { for (DSpaceObject resultDso : queryResults.getDspaceObjects()) {
validity.add(context, resultDso); newValidity.add(context, resultDso);
} }
for (String facetField : queryResults.getFacetResults().keySet()) { for (String facetField : queryResults.getFacetResults().keySet()) {
validity.add(facetField); newValidity.add(facetField);
java.util.List<DiscoverResult.FacetResult> facetValues = queryResults.getFacetResults().get(facetField); java.util.List<DiscoverResult.FacetResult> facetValues = queryResults.getFacetResults().get(facetField);
for (DiscoverResult.FacetResult facetValue : facetValues) { for (DiscoverResult.FacetResult facetValue : facetValues) {
validity.add(facetField + facetValue.getAsFilterQuery() + facetValue.getCount()); newValidity.add(facetField + facetValue.getAsFilterQuery() + facetValue.getCount());
} }
} }
this.validity = validity.complete(); this.validity = newValidity.complete();
} }
catch (Exception e) { catch (Exception e) {
// Just ignore all errors and return an invalid cache. // Just ignore all errors and return an invalid cache.
@@ -182,6 +186,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
* Get the recently submitted items for the given community or collection. * Get the recently submitted items for the given community or collection.
* *
* @param scope The collection. * @param scope The collection.
* @return recently submitted items.
*/ */
protected DiscoverResult getQueryResponse(DSpaceObject scope) { protected DiscoverResult getQueryResponse(DSpaceObject scope) {
@@ -227,18 +232,16 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
String facetField = request.getParameter(SearchFilterParam.FACET_FIELD); String facetField = request.getParameter(SearchFilterParam.FACET_FIELD);
DiscoverFacetField discoverFacetField; DiscoverFacetField discoverFacetField;
// Enumerations don't handle mixed cases, setting to uppercase to match convention // Enumerations don't handle mixed cases, setting to uppercase to match convention
SORT sortOrder = getSortOrder(request); SORT requestSortOrder = getSortOrder(request);
if(request.getParameter(SearchFilterParam.STARTS_WITH) != null) if(request.getParameter(SearchFilterParam.STARTS_WITH) != null)
{ {
discoverFacetField = new DiscoverFacetField(facetField, DiscoveryConfigurationParameters.TYPE_TEXT, getPageSize() + 1, sortOrder, request.getParameter(SearchFilterParam.STARTS_WITH).toLowerCase()); discoverFacetField = new DiscoverFacetField(facetField, DiscoveryConfigurationParameters.TYPE_TEXT, getPageSize() + 1, requestSortOrder, request.getParameter(SearchFilterParam.STARTS_WITH).toLowerCase());
}else{ }else{
discoverFacetField = new DiscoverFacetField(facetField, DiscoveryConfigurationParameters.TYPE_TEXT, getPageSize() + 1, sortOrder); discoverFacetField = new DiscoverFacetField(facetField, DiscoveryConfigurationParameters.TYPE_TEXT, getPageSize() + 1, requestSortOrder);
} }
queryArgs.addFacetField(discoverFacetField); queryArgs.addFacetField(discoverFacetField);
try { try {
queryResults = searchService.search(context, scope, queryArgs); queryResults = searchService.search(context, scope, queryArgs);
} catch (SearchServiceException e) { } catch (SearchServiceException e) {
@@ -265,14 +268,19 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
/** /**
* Add a page title and trail links. * Add a page title and trail links.
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws java.io.IOException passed through.
* @throws java.sql.SQLException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override
public void addPageMeta(PageMeta pageMeta) throws SAXException, WingException, SQLException, IOException, AuthorizeException { public void addPageMeta(PageMeta pageMeta) throws SAXException, WingException, SQLException, IOException, AuthorizeException {
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);
String facetField = request.getParameter(SearchFilterParam.FACET_FIELD); String facetField = request.getParameter(SearchFilterParam.FACET_FIELD);
pageMeta.addMetadata("title").addContent(message("xmlui.Discovery.AbstractSearch.type_" + facetField)); pageMeta.addMetadata("title").addContent(message("xmlui.Discovery.AbstractSearch.type_" + facetField));
pageMeta.addTrailLink(contextPath + "/", T_dspace_home); pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
DSpaceObject dso = HandleUtil.obtainHandle(objectModel); DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
@@ -309,7 +317,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
Map<String, List<DiscoverResult.FacetResult>> facetFields = this.queryResults.getFacetResults(); Map<String, List<DiscoverResult.FacetResult>> facetFields = this.queryResults.getFacetResults();
if (facetFields == null) if (facetFields == null)
{ {
facetFields = new LinkedHashMap<String, List<DiscoverResult.FacetResult>>(); facetFields = new LinkedHashMap<>();
} }
// facetFields.addAll(this.queryResults.getFacetDates()); // facetFields.addAll(this.queryResults.getFacetDates());
@@ -397,7 +405,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
Division jump = div.addInteractiveDivision("filter-navigation", action, Division jump = div.addInteractiveDivision("filter-navigation", action,
Division.METHOD_POST, "secondary navigation"); Division.METHOD_POST, "secondary navigation");
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<>();
params.putAll(browseParams.getCommonBrowseParams()); params.putAll(browseParams.getCommonBrowseParams());
// Add all the query parameters as hidden fields on the form // Add all the query parameters as hidden fields on the form
for(Map.Entry<String, String> param : params.entrySet()){ for(Map.Entry<String, String> param : params.entrySet()){
@@ -457,16 +465,16 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
cell.addContent(displayedValue + " (" + value.getCount() + ")"); cell.addContent(displayedValue + " (" + value.getCount() + ")");
} else { } else {
//Add the basics //Add the basics
Map<String, String> urlParams = new HashMap<String, String>(); Map<String, String> urlParams = new HashMap<>();
urlParams.putAll(browseParams.getCommonBrowseParams()); urlParams.putAll(browseParams.getCommonBrowseParams());
String url = generateURL(contextPath + (dso == null ? "" : "/handle/" + dso.getHandle()) + "/discover", urlParams); String xrefURL = generateURL(contextPath + (dso == null ? "" : "/handle/" + dso.getHandle()) + "/discover", urlParams);
//Add already existing filter queries //Add already existing filter queries
url = addFilterQueriesToUrl(url); xrefURL = addFilterQueriesToUrl(xrefURL);
//Last add the current filter query //Last add the current filter query
url += "&filtertype=" + facetField; xrefURL += "&filtertype=" + facetField;
url += "&filter_relational_operator="+value.getFilterType(); xrefURL += "&filter_relational_operator="+value.getFilterType();
url += "&filter=" + URLEncoder.encode(value.getAsFilterQuery(), "UTF-8"); xrefURL += "&filter=" + URLEncoder.encode(value.getAsFilterQuery(), "UTF-8");
cell.addXref(url, displayedValue + " (" + value.getCount() + ")" cell.addXref(xrefURL, displayedValue + " (" + value.getCount() + ")"
); );
} }
} }
@@ -478,17 +486,17 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
offSet = currentOffset; offSet = currentOffset;
} }
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> urlParameters = new HashMap<>();
parameters.putAll(browseParams.getCommonBrowseParams()); urlParameters.putAll(browseParams.getCommonBrowseParams());
parameters.putAll(browseParams.getControlParameters()); urlParameters.putAll(browseParams.getControlParameters());
parameters.put(SearchFilterParam.OFFSET, String.valueOf(offSet + getPageSize())); urlParameters.put(SearchFilterParam.OFFSET, String.valueOf(offSet + getPageSize()));
parameters.put(SearchFilterParam.ORDER, getSortOrder(request).name()); urlParameters.put(SearchFilterParam.ORDER, getSortOrder(request).name());
// Add the filter queries // Add the filter queries
String url = generateURL("search-filter", parameters); String newURL = generateURL("search-filter", urlParameters);
url = addFilterQueriesToUrl(url); newURL = addFilterQueriesToUrl(newURL);
return url; return newURL;
} }
private String getPreviousPageURL(SearchFilterParam browseParams, Request request) throws UnsupportedEncodingException, UIException { private String getPreviousPageURL(SearchFilterParam browseParams, Request request) throws UnsupportedEncodingException, UIException {
@@ -505,23 +513,20 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
return null; return null;
} }
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> urlParameters = new HashMap<>();
parameters.putAll(browseParams.getCommonBrowseParams()); urlParameters.putAll(browseParams.getCommonBrowseParams());
parameters.putAll(browseParams.getControlParameters()); urlParameters.putAll(browseParams.getControlParameters());
parameters.put(SearchFilterParam.ORDER, getSortOrder(request).name()); urlParameters.put(SearchFilterParam.ORDER, getSortOrder(request).name());
String offSet = String.valueOf((currentOffset - getPageSize()<0)? 0:currentOffset - getPageSize()); String offSet = String.valueOf((currentOffset - getPageSize()<0)? 0:currentOffset - getPageSize());
parameters.put(SearchFilterParam.OFFSET, offSet); urlParameters.put(SearchFilterParam.OFFSET, offSet);
// Add the filter queries // Add the filter queries
String url = generateURL("search-filter", parameters); String newURL = generateURL("search-filter", urlParameters);
url = addFilterQueriesToUrl(url); newURL = addFilterQueriesToUrl(newURL);
return url; return newURL;
} }
@Override
/**
* Recycle
*/
public void recycle() { public void recycle() {
// Clear out our item's cache. // Clear out our item's cache.
this.queryResults = null; this.queryResults = null;
@@ -549,7 +554,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
} }
private static class SearchFilterParam { private static class SearchFilterParam {
private Request request; private final Request request;
/** The always present commond params **/ /** The always present commond params **/
public static final String QUERY = "query"; public static final String QUERY = "query";
@@ -570,7 +575,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
} }
public Map<String, String> getCommonBrowseParams(){ public Map<String, String> getCommonBrowseParams(){
Map<String, String> result = new HashMap<String, String>(); Map<String, String> result = new HashMap<>();
result.put(FACET_FIELD, request.getParameter(FACET_FIELD)); result.put(FACET_FIELD, request.getParameter(FACET_FIELD));
if(request.getParameter(QUERY) != null) if(request.getParameter(QUERY) != null)
result.put(QUERY, request.getParameter(QUERY)); result.put(QUERY, request.getParameter(QUERY));
@@ -581,7 +586,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
} }
public Map<String, String> getControlParameters(){ public Map<String, String> getControlParameters(){
Map<String, String> paramMap = new HashMap<String, String>(); Map<String, String> paramMap = new HashMap<>();
paramMap.put(OFFSET, request.getParameter(OFFSET)); paramMap.put(OFFSET, request.getParameter(OFFSET));
if(request.getParameter(STARTS_WITH) != null) if(request.getParameter(STARTS_WITH) != null)
@@ -641,7 +646,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
throws WingException throws WingException
{ {
// Prepare a Map of query parameters required for all links // Prepare a Map of query parameters required for all links
Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> queryParams = new HashMap<>();
queryParams.putAll(params.getCommonBrowseParams()); queryParams.putAll(params.getCommonBrowseParams());
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);

View File

@@ -28,23 +28,27 @@ import org.dspace.eperson.EPerson;
/** /**
* Attempt to authenticate the user based upon their presented credentials. * Attempt to authenticate the user based upon their presented credentials.
* This action uses the http parameters of login_email, login_password, and * This action uses the HTTP parameters of login_email, login_password, and
* login_realm as credentials. * login_realm as credentials.
* *
* If the authentication attempt is successful then an HTTP redirect will be * <p>If the authentication attempt is successful then an HTTP redirect will be
* sent to the browser redirecting them to their original location in the * sent to the browser redirecting them to their original location in the
* system before authenticated or if none is supplied back to the DSpace * system before authenticated or if none is supplied back to the DSpace
* homepage. The action will also return true, thus contents of the action will * home page. The action will also return true, thus contents of the action will
* be excuted. * be executed.
* *
* If the authentication attempt fails, the action returns false. * <p>If the authentication attempt fails, the action returns false.
* *
* Example use: * <p>Example use:
* *
* <pre>
* {@code
* <map:act name="Authenticate"> * <map:act name="Authenticate">
* <map:serialize type="xml"/> * <map:serialize type="xml"/>
* </map:act> * </map:act>
* <map:transform type="try-to-login-again-transformer"> * <map:transform type="try-to-login-again-transformer">
* }
* </pre>
* *
* @author Scott Phillips * @author Scott Phillips
*/ */
@@ -54,7 +58,15 @@ public class AuthenticateAction extends AbstractAction
/** /**
* Attempt to authenticate the user. * Attempt to authenticate the user.
* @param redirector redirector.
* @param resolver source resolver.
* @param objectModel object model.
* @param source source
* @param parameters sitemap parameters.
* @return result of the action.
* @throws java.lang.Exception
*/ */
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
String source, Parameters parameters) throws Exception String source, Parameters parameters) throws Exception
{ {

View File

@@ -28,20 +28,24 @@ import org.dspace.eperson.EPerson;
/** /**
* Attempt to authenticate the user based upon their presented credentials. This * Attempt to authenticate the user based upon their presented credentials. This
* action uses the http parameters of username, ldap_password, and login_realm * action uses the HTTP parameters of username, ldap_password, and login_realm
* as credentials. * as credentials.
* *
* If the authentication attempt is successful then an HTTP redirect will be * <p>If the authentication attempt is successful then an HTTP redirect will be
* sent to the browser redirecting them to their original location in the system * sent to the browser redirecting them to their original location in the system
* before authenticated or if none is supplied back to the DSpace homepage. The * before authenticated or if none is supplied back to the DSpace home page. The
* action will also return true, thus contents of the action will be excuted. * action will also return true, thus contents of the action will be executed.
* *
* If the authentication attempt fails, the action returns false. * <p>If the authentication attempt fails, the action returns false.
*
* Example use:
* *
* <p>Example use:
*
* <pre>
* {@code
* <map:act name="LDAPAuthenticate"> <map:serialize type="xml"/> </map:act> * <map:act name="LDAPAuthenticate"> <map:serialize type="xml"/> </map:act>
* <map:transform type="try-to-login-again-transformer"> * <map:transform type="try-to-login-again-transformer">
* }
* </pre>
* *
* @author Jay Paz * @author Jay Paz
*/ */
@@ -50,10 +54,19 @@ public class LDAPAuthenticateAction extends AbstractAction {
/** /**
* Attempt to authenticate the user. * Attempt to authenticate the user.
* @param redirector redirector.
* @param resolver source resolver.
* @param objectModel object model.
* @param source source.
* @param parameters sitemap parameters.
* @return results of the action.
* @throws org.apache.cocoon.sitemap.PatternException if unable to authenticate.
* @throws java.lang.Exception passed through.
*/ */
@Override
public Map act(Redirector redirector, SourceResolver resolver, public Map act(Redirector redirector, SourceResolver resolver,
Map objectModel, String source, Parameters parameters) Map objectModel, String source, Parameters parameters)
throws Exception { throws PatternException, Exception {
// First check if we are performing a new login // First check if we are performing a new login
Request request = ObjectModelHelper.getRequest(objectModel); Request request = ObjectModelHelper.getRequest(objectModel);
@@ -82,12 +95,12 @@ public class LDAPAuthenticateAction extends AbstractAction {
redirectURL += AuthenticationUtil redirectURL += AuthenticationUtil
.resumeInterruptedRequest(objectModel); .resumeInterruptedRequest(objectModel);
} }
else else
{ {
// Otherwise direct the user to the specified 'loginredirect' page (or homepage by default) // Otherwise direct the user to the specified 'loginredirect' page (or homepage by default)
String loginRedirect = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("xmlui.user.loginredirect"); String loginRedirect = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("xmlui.user.loginredirect");
redirectURL += (loginRedirect != null) ? loginRedirect.trim() : "/"; redirectURL += (loginRedirect != null) ? loginRedirect.trim() : "/";
} }
// Authentication successful send a redirect. // Authentication successful send a redirect.
final HttpServletResponse httpResponse = (HttpServletResponse) objectModel final HttpServletResponse httpResponse = (HttpServletResponse) objectModel

View File

@@ -28,23 +28,27 @@ import org.dspace.eperson.EPerson;
/** /**
* Attempt to authenticate the user based upon their presented shibboleth credentials. * Attempt to authenticate the user based upon their presented shibboleth credentials.
* This action uses the http parameters as supplied by Shibboleth SP. * This action uses the HTTP parameters as supplied by Shibboleth SP.
* Read dspace.cfg for configuration detail. * Read dspace.cfg for configuration detail.
* *
* If the authentication attempt is successful then an HTTP redirect will be * <p>If the authentication attempt is successful then an HTTP redirect will be
* sent to the browser redirecting them to their original location in the * sent to the browser redirecting them to their original location in the
* system before authenticated or if none is supplied back to the DSpace * system before authenticated or if none is supplied back to the DSpace
* homepage. The action will also return true, thus contents of the action will * home page. The action will also return true, thus contents of the action will
* be excuted. * be executed.
* *
* If the authentication attempt fails, the action returns false. * <p>If the authentication attempt fails, the action returns false.
*
* Example use:
* *
* <p>Example use:
*
* <pre>
* {@code
* <map:act name="Shibboleth"> * <map:act name="Shibboleth">
* <map:serialize type="xml"/> * <map:serialize type="xml"/>
* </map:act> * </map:act>
* <map:transform type="try-to-login-again-transformer"> * <map:transform type="try-to-login-again-transformer">
* }
* </pre>
* *
* @author <a href="mailto:bliong@melcoe.mq.edu.au">Bruc Liong, MELCOE</a> * @author <a href="mailto:bliong@melcoe.mq.edu.au">Bruc Liong, MELCOE</a>
*/ */
@@ -53,10 +57,21 @@ public class ShibbolethAction extends AbstractAction
{ {
/** /**
* Attempt to authenticate the user. * Attempt to authenticate the user.
*
* @param redirector redirector.
* @param resolver source resolver.
* @param objectModel object model.
* @param source source.
* @param parameters sitemap parameters.
* @return result of the action.
* @throws org.apache.cocoon.sitemap.PatternException if authentication fails.
* @throws java.lang.Exception passed through.
*/ */
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
String source, Parameters parameters) throws Exception String source, Parameters parameters)
throws PatternException, Exception
{ {
try try
{ {

View File

@@ -23,28 +23,32 @@ import org.dspace.app.xmlui.utils.AuthenticationUtil;
/** /**
* *
* This action will start the necessary steps to authenticate a user. After the user * This action will start the necessary steps to authenticate a user. After the user
* successfuly authenticates, the user will resume this request with all parameters * successfully authenticates, the user will resume this request with all parameters
* and attributes intact. An optional message can be added that will be displayed * and attributes intact. An optional message can be added that will be displayed
* on the login form. This could be used to provide a reason why the user is being * on the login form. This could be used to provide a reason why the user is being
* queried for a user name and password. * queried for a user name and password.
* *
* Possible parameters are: * <p>Possible parameters are:
* *
* header: An i18n message that will be used as the header for the message. * <ul>
* * <li>header: An i18n message that will be used as the header for the message.
* message: An i18n message tag. * <li>message: An i18n message tag.
* * <li>characters: Characters to be displayed, possibly for untranslated error messages
* characters: Characters to be displayed, possibly for untranslated error messages * </ul>
* *
* * <p>Example:
* <pre>
* {@code
* <map:action name="StartAuthenticationAction" src="org.dspace.app.xmlui.eperson.StartAuthenticationAction"/> * <map:action name="StartAuthenticationAction" src="org.dspace.app.xmlui.eperson.StartAuthenticationAction"/>
* *
*
* <map:act type="StartAuthenticationAction"/> * <map:act type="StartAuthenticationAction"/>
* * }
* </pre>
* *
* Typically, this is used in conjunction with the AuthenticatedSelector as: * Typically, this is used in conjunction with the AuthenticatedSelector as:
* *
* <pre>
* {@code
* <map:select type="AuthenticatedSelector"> * <map:select type="AuthenticatedSelector">
* <map:when test="eperson"> * <map:when test="eperson">
* ... * ...
@@ -55,6 +59,8 @@ import org.dspace.app.xmlui.utils.AuthenticationUtil;
* </map:act> * </map:act>
* </map:otherwise> * </map:otherwise>
* </map:select> * </map:select>
* }
* </pre>
* *
* @author Scott Phillips * @author Scott Phillips
*/ */
@@ -63,7 +69,15 @@ public class StartAuthenticationAction extends AbstractAction
{ {
/** /**
* Redirect the user to the login page. * Redirect the user to the login page.
* @param redirector redirector.
* @param resolver source resolver.
* @param objectModel object model.
* @param source source.
* @param parameters sitemap parameters.
* @return result of the action.
* @throws java.lang.Exception passed through.
*/ */
@Override
public Map act(Redirector redirector, SourceResolver resolver, public Map act(Redirector redirector, SourceResolver resolver,
Map objectModel, String source, Parameters parameters) Map objectModel, String source, Parameters parameters)
throws Exception throws Exception

View File

@@ -28,15 +28,19 @@ import org.dspace.eperson.EPerson;
* Unauthenticate the current user. There is no way this action will fail, * Unauthenticate the current user. There is no way this action will fail,
* so any components inside the action will be executed. * so any components inside the action will be executed.
* *
* This action will always send an HTTP redirect to the DSpace homepage. * <p>This action will always send an HTTP redirect to the DSpace home page.
* *
* Example: * <p>Example:
* *
* <pre>
* {@code
* <map:action name="UnAuthenticateAction" src="org.dspace.app.xmlui.eperson.UnAuthenticateAction"/> * <map:action name="UnAuthenticateAction" src="org.dspace.app.xmlui.eperson.UnAuthenticateAction"/>
* *
* <map:act type="UnAuthenticateAction"> * <map:act type="UnAuthenticateAction">
* <map:serialize type="xml"/> * <map:serialize type="xml"/>
* </map:act> * </map:act>
* }
* </pre>
* *
* @author Scott Phillips * @author Scott Phillips
*/ */
@@ -47,13 +51,16 @@ public class UnAuthenticateAction extends AbstractAction
/** /**
* Logout the current user. * Logout the current user.
* *
* @param redirector * @param redirector redirector.
* @param resolver * @param resolver source resolver.
* @param objectModel * @param objectModel
* Cocoon's object model * Cocoon's object model
* @param source * @param source source.
* @param parameters * @param parameters sitemap parameters.
* @return result of the action.
* @throws java.lang.Exception passed through.
*/ */
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
String source, Parameters parameters) throws Exception String source, Parameters parameters) throws Exception
{ {

View File

@@ -14,7 +14,6 @@ import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.selection.Selector; import org.apache.cocoon.selection.Selector;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.app.xmlui.utils.ContextUtil; import org.dspace.app.xmlui.utils.ContextUtil;
import org.dspace.authorize.AuthorizeServiceImpl;
import org.dspace.authorize.factory.AuthorizeServiceFactory; import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService; import org.dspace.authorize.service.AuthorizeService;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -23,11 +22,11 @@ import org.dspace.eperson.EPerson;
/** /**
* This simple selector operates on the authenticated DSpace user and selects * This simple selector operates on the authenticated DSpace user and selects
* between two levels of access. * between two levels of access.
* *
* <pre>
* {@code
* <map:selector name="AuthenticatedSelector" src="org.dspace.app.xmlui.AuthenticatedSelector"/> * <map:selector name="AuthenticatedSelector" src="org.dspace.app.xmlui.AuthenticatedSelector"/>
* *
*
*
* <map:select type="AuthenticatedSelector"> * <map:select type="AuthenticatedSelector">
* <map:when test="administrator"> * <map:when test="administrator">
* ... * ...
@@ -39,11 +38,13 @@ import org.dspace.eperson.EPerson;
* ... * ...
* </map:otherwise> * </map:otherwise>
* </map:select> * </map:select>
* }
* </pre>
* *
* There are only two defined test expressions: "administrator" and "eperson". * There are only two defined test expressions: "administrator" and "eperson".
* Remember an administrator is also an eperson so if you need to check for * Remember that an administrator is also an eperson, so if you need to check for
* administrators distinct from epersons that select must come first. * administrators distinct from epersons that select must come first.
* *
* @author Scott Phillips * @author Scott Phillips
*/ */
@@ -51,9 +52,9 @@ public class AuthenticatedSelector extends AbstractLogEnabled implements
Selector Selector
{ {
private static Logger log = Logger.getLogger(AuthenticatedSelector.class); private static final Logger log = Logger.getLogger(AuthenticatedSelector.class);
/** Test expressiots */ /** Test expressions */
public static final String EPERSON = "eperson"; public static final String EPERSON = "eperson";
public static final String ADMINISTRATOR = "administrator"; public static final String ADMINISTRATOR = "administrator";
@@ -62,7 +63,12 @@ public class AuthenticatedSelector extends AbstractLogEnabled implements
/** /**
* Determine if the authenticated eperson matches the given expression. * Determine if the authenticated eperson matches the given expression.
* @param expression the given expression.
* @param objectModel object model.
* @param parameters sitemap parameters.
* @return
*/ */
@Override
public boolean select(String expression, Map objectModel, public boolean select(String expression, Map objectModel,
Parameters parameters) Parameters parameters)
{ {

View File

@@ -37,29 +37,44 @@ import org.xml.sax.SAXException;
* back to the indicated form fields in the window that launched it. * back to the indicated form fields in the window that launched it.
* Some necessary logic is in JavaScript, see choice-control.js. * Some necessary logic is in JavaScript, see choice-control.js.
* *
* Expected Parameters: * <p>Expected Parameters:
* field - name of metadata field in "_" notation, eg: dc_contributor_author * <dl>
* value - maybe-partial value of field * <dt>field <dd>name of metadata field in "_" notation, eg: dc_contributor_author
* formID - the @id of <form> tag in calling window containing the inputs we are to set. * <dt>value <dd>maybe-partial value of field
* valueInput - @name of input field in DOM for value. * <dt>formID <dd>the @id of {@code <form>} tag in calling window containing the inputs we are to set.
* authorityInput - @name of input field in DOM for authority value * <dt>valueInput <dd>@name of input field in DOM for value.
* isRepeating - true if metadata value can be repeated * <dt>authorityInput <dd>@name of input field in DOM for authority value
* isName - true if this is a name value (i.e. last/first boxes) * <dt>isRepeating <dd>true if metadata value can be repeated
* start - starting index, default 0 * <dt>isName <dd>true if this is a name value (i.e. last/first boxes)
* limit - maximum values to return, default 0 (none) * <dt>start <dd>starting index, default 0
* <dt>limit <dd>maximum values to return, default 0 (none)
* </dl>
* *
* Configuration Properties: * <p>Configuration Properties:
* xmlui.lookup.select.size = 12 (default, entries to show in SELECT widget.) * <ul>
* <li>xmlui.lookup.select.size = 12 (default, entries to show in SELECT widget.)
* </ul>
* *
* For each FIELD, e.g. dc.contributor.author, these message properties * <p>For each FIELD, e.g. dc.contributor.author, these message properties
* will OVERRIDE the corresponding i18n message catalog entries: * will OVERRIDE the corresponding i18n message catalog entries:
* xmlui.lookup.field.FIELD.title = title of lookup page * <dl>
* <dt>xmlui.lookup.field.FIELD.title
* <dd>title of lookup page
* (e.g. xmlui.lookup.field.dc_contributor_author.title = Author..) * (e.g. xmlui.lookup.field.dc_contributor_author.title = Author..)
* xmlui.lookup.field.FIELD.nonauthority = template for "non-authority" label in options *
* xmlui.lookup.field.FIELD.help = help message for single input * <dt>xmlui.lookup.field.FIELD.nonauthority
* <dd>template for "non-authority" label in options
*
* <dt>xmlui.lookup.field.FIELD.help
* <dd>help message for single input
* (NOTE this is still required even for name inputs) * (NOTE this is still required even for name inputs)
* xmlui.lookup.field.FIELD.help.last = help message for last name of Name-oriented input *
* xmlui.lookup.field.FIELD.help.first = help message for first name of Name-oriented input * <dt>xmlui.lookup.field.FIELD.help.last
* <dd>help message for last name of Name-oriented input
*
* <dt>xmlui.lookup.field.FIELD.help.first
* <dd>help message for first name of Name-oriented input
* </dl>
* *
* @author Larry Stone * @author Larry Stone
*/ */
@@ -79,6 +94,7 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
protected ChoiceAuthorityService choicheAuthorityService = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService(); protected ChoiceAuthorityService choicheAuthorityService = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
@Override
public void addBody(Body body) throws SAXException, WingException, public void addBody(Body body) throws SAXException, WingException,
UIException, SQLException, IOException, AuthorizeException UIException, SQLException, IOException, AuthorizeException
{ {
@@ -250,6 +266,7 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
cancel.setValue(T_cancel); cancel.setValue(T_cancel);
} }
@Override
public void addPageMeta(PageMeta pageMeta) throws SAXException, public void addPageMeta(PageMeta pageMeta) throws SAXException,
WingException, UIException, SQLException, IOException, WingException, UIException, SQLException, IOException,
AuthorizeException AuthorizeException

View File

@@ -24,8 +24,10 @@ import org.dspace.core.Constants;
* returns true if the Item in the request has not been modified since that * returns true if the Item in the request has not been modified since that
* date. The expression is ignored since the test is inherent in the request. * date. The expression is ignored since the test is inherent in the request.
* *
* Typical sitemap usage: * <p>Typical sitemap usage:
* *
* <pre>
* {@code
* <map:match type="HandleTypeMatcher" pattern="item"> * <map:match type="HandleTypeMatcher" pattern="item">
* <map:select type="IfModifiedSinceSelector"> * <map:select type="IfModifiedSinceSelector">
* <map:when test="true"> * <map:when test="true">
@@ -38,13 +40,15 @@ import org.dspace.core.Constants;
* </map:otherwise> * </map:otherwise>
* </map:select> * </map:select>
* </map:match> * </map:match>
* }
* </pre>
* *
* @author Larry Stone * @author Larry Stone
*/ */
public class IfModifiedSinceSelector implements Selector public class IfModifiedSinceSelector implements Selector
{ {
private static Logger log = Logger.getLogger(IfModifiedSinceSelector.class); private static final Logger log = Logger.getLogger(IfModifiedSinceSelector.class);
/** /**
* Check for If-Modified-Since header on request, * Check for If-Modified-Since header on request,
@@ -53,9 +57,12 @@ public class IfModifiedSinceSelector implements Selector
* *
* @param expression is ignored * @param expression is ignored
* @param objectModel * @param objectModel
* environment passed through via cocoon * environment passed through via Cocoon.
* @param parameters
* sitemap parameters.
* @return null or map containing value of sitemap parameter 'pattern' * @return null or map containing value of sitemap parameter 'pattern'
*/ */
@Override
public boolean select(String expression, Map objectModel, public boolean select(String expression, Map objectModel,
Parameters parameters) Parameters parameters)
{ {

View File

@@ -21,32 +21,34 @@ import org.dspace.authorize.AuthorizeException;
* this transformer is used after an action has been performed to let the * this transformer is used after an action has been performed to let the
* user know if an operation succeeded or failed. * user know if an operation succeeded or failed.
* *
* The possible paramaters are: * <p>The possible parameters are:
* *
* outcome: The outcome determines whether the notice is positive or negative. * <p>outcome: The outcome determines whether the notice is positive or negative.
* Possible values are: "success", "failure", or "neutral". If no values are * Possible values are: "success", "failure", or "neutral". If no values are
* supplied then neutral is assumed. * supplied then neutral is assumed.
* *
* header: An i18n dictionary key referencing the text that should be used * <p>header: An i18n dictionary key referencing the text that should be used
* as a header for this notice. * as a header for this notice.
* *
* message: An i18n dictionary key referencing the text that should be used as * <p>message: An i18n dictionary key referencing the text that should be used as
* the content for this notice. * the content for this notice.
* *
* characters: Plain text string that should be used as the content for this * <p>characters: Plain text string that should be used as the content for this
* notice. Normally, all messages should be i18n dictionary keys, however this * notice. Normally, all messages should be i18n dictionary keys, however this
* parameter is useful for error messages that are not necessarily translated. * parameter is useful for error messages that are not necessarily translated.
* *
* All parameters are optional but you must supply at least the message or the * <p>All parameters are optional but you must supply at least the message or the
* characters * characters.
* *
* * <p>Example:
* * <pre>
* Example: * {@code
* <map:transformer type="notice"> * <map:transformer type="notice">
* <map:parameter name="outcome" value="success"/> * <map:parameter name="outcome" value="success"/>
* <map:parameter name="message" value="xmlui.<aspect>.<class>.<type>"/> * <map:parameter name="message" value="xmlui.<aspect>.<class>.<type>"/>
* </map:transformer> * </map:transformer>
* }
* </pre>
* *
* @author Scott Phillips * @author Scott Phillips
* @author Alexey Maslov * @author Alexey Maslov
@@ -60,7 +62,11 @@ public class NoticeTransformer extends AbstractDSpaceTransformer
/** /**
* Add the notice div to the body. * Add the notice div to the body.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws java.sql.SQLException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
@Override
public void addBody(Body body) throws WingException, SQLException, AuthorizeException public void addBody(Body body) throws WingException, SQLException, AuthorizeException
{ {
String outcome = parameters.getParameter("outcome",null); String outcome = parameters.getParameter("outcome",null);

View File

@@ -49,7 +49,7 @@ import org.xml.sax.SAXException;
*/ */
public abstract class AbstractStep extends AbstractDSpaceTransformer public abstract class AbstractStep extends AbstractDSpaceTransformer
{ {
private static Logger log = Logger.getLogger(AbstractStep.class); private static final Logger log = Logger.getLogger(AbstractStep.class);
/** General Language Strings */ /** General Language Strings */
protected static final Message T_submission_title = protected static final Message T_submission_title =
@@ -155,7 +155,16 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* *
* If the implementer set any required parameters then ensure that * If the implementer set any required parameters then ensure that
* they are all present. * they are all present.
*
* @param resolver source resolver.
* @param objectModel TBD
* @param src TBD
* @param parameters sitemap parameters.
* @throws org.apache.cocoon.ProcessingException
* @throws org.xml.sax.SAXException passed through.
* @throws java.io.IOException passed through.
*/ */
@Override
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters) public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters)
throws ProcessingException, SAXException, IOException throws ProcessingException, SAXException, IOException
{ {
@@ -217,10 +226,17 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
/** /**
* Base pageMeta that is added to ALL submission stages * Base pageMeta that is added to ALL submission stages
* @throws org.xml.sax.SAXException passed through.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* @throws org.dspace.app.xmlui.utils.UIException passed through.
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/ */
public void addPageMeta(PageMeta pageMeta) throws SAXException, @Override
WingException, UIException, SQLException, IOException, public void addPageMeta(PageMeta pageMeta)
AuthorizeException throws SAXException, WingException, UIException, SQLException,
IOException, AuthorizeException
{ {
if (submission instanceof WorkspaceItem) if (submission instanceof WorkspaceItem)
{ {
@@ -258,6 +274,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* Add a submission progress list to the current div for this step. * Add a submission progress list to the current div for this step.
* *
* @param div The division to add the list to. * @param div The division to add the list to.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addSubmissionProgressList(Division div) throws WingException public void addSubmissionProgressList(Division div) throws WingException
{ {
@@ -303,6 +320,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* @param stepAndPage * @param stepAndPage
* The step and page (a double of the form 'step.page', e.g. 1.2) * The step and page (a double of the form 'step.page', e.g. 1.2)
* which this button will jump back to * which this button will jump back to
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addJumpButton(List list, Message buttonText, StepAndPage stepAndPage) public void addJumpButton(List list, Message buttonText, StepAndPage stepAndPage)
throws WingException throws WingException
@@ -318,9 +336,9 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
} }
/** /**
* Adds the "<-Previous", "Save/Cancel" and "Next->" buttons * Adds the "{@literal <-Previous}", "{@literal Save/Cancel}" and
* to a given form. This method ensures that the same * "{@literal Next->}" buttons to a given form. This method ensures that
* default control/paging buttons appear on each submission page. * the same default control/paging buttons appear on each submission page.
* <P> * <P>
* Note: A given step may define its own buttons as necessary, * Note: A given step may define its own buttons as necessary,
* and not call this method (since it must be explicitly invoked by * and not call this method (since it must be explicitly invoked by
@@ -328,6 +346,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* *
* @param controls * @param controls
* The List which will contain all control buttons * The List which will contain all control buttons
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addControlButtons(List controls) public void addControlButtons(List controls)
throws WingException throws WingException
@@ -430,6 +449,8 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* Find the maximum step and page that the user has * Find the maximum step and page that the user has
* reached in the submission processes. * reached in the submission processes.
* If this submission is a workflow then return max-int. * If this submission is a workflow then return max-int.
* @return the maximum step and page reached.
* @throws java.sql.SQLException passed through.
*/ */
public StepAndPage getMaxStepAndPageReached() throws SQLException { public StepAndPage getMaxStepAndPageReached() throws SQLException {
@@ -460,11 +481,12 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
* Retrieve error fields from the list of parameters * Retrieve error fields from the list of parameters
* and return a List of all fields which had errors * and return a List of all fields which had errors
* *
* @return java.util.List of field names with errors * @param parameters the list to search for error fields.
* @return {@link java.util.List} of field names with errors
*/ */
public java.util.List<String> getErrorFields(Parameters parameters) public java.util.List<String> getErrorFields(Parameters parameters)
{ {
java.util.List<String> fields = new ArrayList<String>(); java.util.List<String> fields = new ArrayList<>();
String errors = parameters.getParameter("error_fields",""); String errors = parameters.getParameter("error_fields","");
@@ -521,10 +543,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
} }
} }
@Override
/**
* Recycle
*/
public void recycle() public void recycle()
{ {
this.id = null; this.id = null;

View File

@@ -224,18 +224,22 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
/** /**
* Generate a URL for the given base URL with the given parameters. This is * Generate a URL for the given base URL with the given parameters. This is
* a convenance method to make it easier to generate URL references with * a convenience method to make it easier to generate URL references with
* parameters. * parameters.
* *
* Example * <p>Example:
*
* <pre>{@code
* Map<String,String> parameters = new Map<String,String>(); * Map<String,String> parameters = new Map<String,String>();
* parameters.put("arg1","value1"); * parameters.put("arg1","value1");
* parameters.put("arg2","value2"); * parameters.put("arg2","value2");
* parameters.put("arg3","value3"); * parameters.put("arg3","value3");
* String url = genrateURL("/my/url",parameters); * String url = genrateURL("/my/url",parameters);
* * }</pre>
*
* would result in the string: * would result in the string:
* url == "/my/url?arg1=value1&arg2=value2&arg3=value3" *
* <pre>{@code url == "/my/url?arg1=value1&arg2=value2&arg3=value3"}</pre>
* *
* @param baseURL The baseURL without any parameters. * @param baseURL The baseURL without any parameters.
* @param parameters The parameters to be encoded on in the URL. * @param parameters The parameters to be encoded on in the URL.

View File

@@ -57,7 +57,7 @@ import org.xml.sax.helpers.NamespaceSupport;
public abstract class AbstractAdapter public abstract class AbstractAdapter
{ {
/** Namespace declaration for METS & XLINK */ /** Namespace declaration for METS and XLINK */
public static final String METS_URI = "http://www.loc.gov/METS/"; public static final String METS_URI = "http://www.loc.gov/METS/";
public static final Namespace METS = new Namespace(METS_URI); public static final Namespace METS = new Namespace(METS_URI);
public static final String XLINK_URI = "http://www.w3.org/TR/xlink/"; public static final String XLINK_URI = "http://www.w3.org/TR/xlink/";

View File

@@ -38,7 +38,7 @@ import org.xml.sax.SAXException;
/** /**
* This is an adapter which translates DSpace containers * This is an adapter which translates DSpace containers
* (communities & collections) into METS documents. This adapter follows * (communities and collections) into METS documents. This adapter follows
* the DSpace METS profile, however that profile does not define how a * the DSpace METS profile, however that profile does not define how a
* community or collection should be described, but we make the obvious * community or collection should be described, but we make the obvious
* decisions to deviate when necessary from the profile. * decisions to deviate when necessary from the profile.

View File

@@ -29,10 +29,10 @@ import org.xml.sax.SAXException;
* document. Unfortunately, there is no real definition of what this is. So * document. Unfortunately, there is no real definition of what this is. So
* we just kind of made it up based upon what we saw for the item profile. * we just kind of made it up based upon what we saw for the item profile.
* *
* The basic structure is simply two parts, the descriptive metadata and a * The basic structure is simply two parts: the descriptive metadata and a
* structural map. The descriptive metadata is a place to put metadata about * structural map. The descriptive metadata is a place to put metadata about
* the whole repository. The structural map is used to map relationships * the whole repository. The structural map is used to map relationships
* between communities & collections in dspace. * between communities and collections in DSpace.
* *
* @author Scott Phillips * @author Scott Phillips
*/ */

View File

@@ -26,10 +26,10 @@ import org.dspace.eperson.Group;
* This is a validity object specifically implemented for the caching * This is a validity object specifically implemented for the caching
* needs of DSpace, Manakin, and Cocoon. * needs of DSpace, Manakin, and Cocoon.
* *
* <p>The basic idea is that each time a DSpace object rendered by a Cocoon * <p>The basic idea is that, each time a DSpace object is rendered by a Cocoon
* component the object and everything about it that makes it unique should * component, the object and everything about it that makes it unique should
* be reflected in the validity object for the component. By following this * be reflected in the validity object for the component. By following this
* principle if the object has been updated externally then the cache will be * principle, if the object has been updated externally then the cache will be
* invalidated. * invalidated.
* *
* <p>This DSpaceValidity object makes this processes easier by abstracting out * <p>This DSpaceValidity object makes this processes easier by abstracting out
@@ -215,14 +215,19 @@ public class DSpaceValidity implements SourceValidity
* validity object is created. * validity object is created.
* *
* Below are the following transitive rules for adding * Below are the following transitive rules for adding
* objects, i.e. if an item is added then all the items * objects, i.e. if an item is added then all the item's
* bundles & bitstreams will also be added. * bundles and bitstreams will also be added.
* *
* Communities -> logo bitstream * <p>
* Collection -> logo bitstream * {@literal Communities -> logo bitstream}
* Item -> bundles -> bitstream * <br>
* Bundles -> bitstreams * {@literal Collection -> logo bitstream}
* EPeople -> groups * <br>
* {@literal Item -> bundles -> bitstream}
* <br>
* {@literal Bundles -> bitstreams}
* <br>
* {@literal EPeople -> groups}
* *
* @param context * @param context
* session context. * session context.
@@ -410,8 +415,9 @@ public class DSpaceValidity implements SourceValidity
/** /**
* Determine if the cache is still valid * Determine if the cache is still valid
* @return {@link SourceValidity.VALID}, {@link SourceValidity.UNKNOWN}, * @return {@link org.apache.excalibur.source.SourceValidity#VALID},
* or {@link SourceValidity.INVALID}. * {@link org.apache.excalibur.source.SourceValidity#UNKNOWN},
* or {@link org.apache.excalibur.source.SourceValidity#INVALID}.
*/ */
@Override @Override
public int isValid() public int isValid()
@@ -446,7 +452,8 @@ public class DSpaceValidity implements SourceValidity
* *
* @param otherObject * @param otherObject
* The other validity object. * The other validity object.
* @return {@link SourceValidity.VALID} or {@link SourceValidity.INVALID}. * @return {@link org.apache.excalibur.source.SourceValidity#VALID}
* or {@link org.apache.excalibur.source.SourceValidity#INVALID}.
*/ */
@Override @Override
public int isValid(SourceValidity otherObject) public int isValid(SourceValidity otherObject)

View File

@@ -71,7 +71,7 @@ public class Data extends AbstractWingElement
* where to route SAX events and what i18n catalogue to use. * where to route SAX events and what i18n catalogue to use.
* @param message * @param message
* (Required) translatable data * (Required) translatable data
* @throws WingException * @throws WingException passed through.
*/ */
protected Data(WingContext context, Message message) protected Data(WingContext context, Message message)
throws WingException throws WingException
@@ -89,7 +89,7 @@ public class Data extends AbstractWingElement
* where to route SAX events and what i18n catalogue to use. * where to route SAX events and what i18n catalogue to use.
* @param characters * @param characters
* (Required) Untranslated character data. * (Required) Untranslated character data.
* @throws WingException * @throws WingException passed through.
*/ */
protected Data(WingContext context, String characters) throws WingException protected Data(WingContext context, String characters) throws WingException
{ {

View File

@@ -164,7 +164,7 @@ public class Division extends AbstractWingElement implements StructuralElement,
public static final String[] METHODS = { METHOD_GET, METHOD_POST, public static final String[] METHODS = { METHOD_GET, METHOD_POST,
METHOD_MULTIPART }; METHOD_MULTIPART };
/** The possible pagination types: simple & masked */ /** The possible pagination types: simple and masked */
public static final String PAGINATION_SIMPLE = "simple"; public static final String PAGINATION_SIMPLE = "simple";
public static final String PAGINATION_MASKED = "masked"; public static final String PAGINATION_MASKED = "masked";

View File

@@ -64,7 +64,7 @@ public class Figure extends TextContainer implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws WingException * @throws WingException passed through.
*/ */
protected Figure(WingContext context, String source, String target, protected Figure(WingContext context, String source, String target,
String rend) throws WingException String rend) throws WingException

View File

@@ -58,11 +58,11 @@ public class Highlight extends RichTextContainer implements StructuralElement
* events should be routed to the contentHandler found in the WingContext. * events should be routed to the contentHandler found in the WingContext.
* *
* @param contentHandler * @param contentHandler
* (Required) The registered contentHandler where SAX events * (Required) The registered contentHandler to which SAX events
* should be routed too. * should be routed.
* @param lexicalHandler * @param lexicalHandler
* (Required) The registered lexicalHandler where lexical * (Required) The registered lexicalHandler to which lexical
* events (such as CDATA, DTD, etc) should be routed too. * events (such as CDATA, DTD, etc) should be routed.
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.

View File

@@ -34,7 +34,8 @@ public class Instance extends Container
* Construct a new field value, when used in a multiple value context * Construct a new field value, when used in a multiple value context
* *
* @param context * @param context
* (Required) The context this element is contained in * (Required) The context this element is contained in.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Instance(WingContext context) throws WingException protected Instance(WingContext context) throws WingException
{ {
@@ -48,6 +49,8 @@ public class Instance extends Container
/** /**
* Set the raw value of the field removing any previous raw values. * Set the raw value of the field removing any previous raw values.
* @return the new Value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setValue() throws WingException public Value setValue() throws WingException
{ {
@@ -62,6 +65,7 @@ public class Instance extends Container
* *
* @param characters * @param characters
* (May be null) Field value as a string * (May be null) Field value as a string
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setValue(String characters) throws WingException public void setValue(String characters) throws WingException
{ {
@@ -75,6 +79,7 @@ public class Instance extends Container
* @param message * @param message
* (Required) A key into the i18n catalogue for translation into * (Required) A key into the i18n catalogue for translation into
* the user's preferred language. * the user's preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setValue(Message message) throws WingException public void setValue(Message message) throws WingException
{ {
@@ -89,6 +94,7 @@ public class Instance extends Container
* *
* @param checked * @param checked
* (Required) Whether the checkbox is checked or not. * (Required) Whether the checkbox is checked or not.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setValue(boolean checked) throws WingException public void setValue(boolean checked) throws WingException
{ {
@@ -100,6 +106,8 @@ public class Instance extends Container
/** /**
* Set the authority value of the field removing any previous authority values. * Set the authority value of the field removing any previous authority values.
* Initialized to an empty value. * Initialized to an empty value.
* @return the new authority Value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setAuthorityValue() throws WingException public Value setAuthorityValue() throws WingException
{ {
@@ -111,6 +119,9 @@ public class Instance extends Container
* *
* @param characters * @param characters
* (May be null) Field value as a string * (May be null) Field value as a string
* @param confidence measure of confidence.
* @return the new Value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setAuthorityValue(String characters, String confidence) throws WingException public Value setAuthorityValue(String characters, String confidence) throws WingException
{ {
@@ -126,6 +137,7 @@ public class Instance extends Container
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(String returnValue) throws WingException public void setOptionSelected(String returnValue) throws WingException
{ {
@@ -138,6 +150,7 @@ public class Instance extends Container
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(int returnValue) throws WingException public void setOptionSelected(int returnValue) throws WingException
{ {
@@ -151,6 +164,8 @@ public class Instance extends Container
/** /**
* Set the interpreted value of the field removing any previous interpreted * Set the interpreted value of the field removing any previous interpreted
* values. * values.
* @return the new Value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setInterpretedValue() throws WingException public Value setInterpretedValue() throws WingException
{ {
@@ -166,6 +181,7 @@ public class Instance extends Container
* *
* @param characters * @param characters
* (May be null) Field value as a string * (May be null) Field value as a string
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setInterpretedValue(String characters) throws WingException public void setInterpretedValue(String characters) throws WingException
{ {
@@ -180,6 +196,7 @@ public class Instance extends Container
* @param message * @param message
* (Required) A key into the i18n catalogue for translation into * (Required) A key into the i18n catalogue for translation into
* the user's preferred language. * the user's preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setInterpretedValue(Message message) throws WingException public void setInterpretedValue(Message message) throws WingException
{ {
@@ -198,6 +215,8 @@ public class Instance extends Container
* *
* @param option * @param option
* (Required) The return value of the selected option. * (Required) The return value of the selected option.
* @return the new Value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value addOptionValue(String option) throws WingException public Value addOptionValue(String option) throws WingException
{ {
@@ -215,6 +234,7 @@ public class Instance extends Container
* (Required) determine if the value is selected or not. * (Required) determine if the value is selected or not.
* @param characters * @param characters
* (may be null) The returned value for this field, if selected. * (may be null) The returned value for this field, if selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setCheckedValue(boolean checked, String characters) throws WingException public void setCheckedValue(boolean checked, String characters) throws WingException
{ {
@@ -238,8 +258,10 @@ public class Instance extends Container
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, public void toSAX(ContentHandler contentHandler,
LexicalHandler lexicalHandler, NamespaceSupport namespaces) LexicalHandler lexicalHandler, NamespaceSupport namespaces)
throws SAXException throws SAXException
@@ -257,7 +279,7 @@ public class Instance extends Container
*/ */
private void removeValueOfType(String removeType) private void removeValueOfType(String removeType)
{ {
List<Value> found = new ArrayList<Value>(); List<Value> found = new ArrayList<>();
for (AbstractWingElement awe : contents) for (AbstractWingElement awe : contents)
{ {
if (awe instanceof Value) if (awe instanceof Value)

View File

@@ -33,10 +33,10 @@ public class Item extends RichTextContainer implements StructuralElement
public static final String E_ITEM = "item"; public static final String E_ITEM = "item";
/** the item's name */ /** the item's name */
private String name; private final String name;
/** Special rendering hints for this item */ /** Special rendering hints for this item */
private String rend; private final String rend;
/** /**
* Construct a new item. * Construct a new item.
@@ -49,6 +49,7 @@ public class Item extends RichTextContainer implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Item(WingContext context, String name, String rend) protected Item(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -72,7 +73,9 @@ public class Item extends RichTextContainer implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {

View File

@@ -29,10 +29,10 @@ public class Label extends TextContainer implements StructuralElement
public static final String E_LABEL = "label"; public static final String E_LABEL = "label";
/** The label's name */ /** The label's name */
private String name; private final String name;
/** Special rendering hints */ /** Special rendering hints */
private String rend; private final String rend;
/** /**
* Construct a new label. * Construct a new label.
@@ -44,7 +44,7 @@ public class Label extends TextContainer implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws WingException * @throws WingException passed through.
*/ */
protected Label(WingContext context, String name, String rend) protected Label(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -67,7 +67,9 @@ public class Label extends TextContainer implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {

View File

@@ -91,19 +91,19 @@ public class List extends AbstractWingElement implements WingMergeableElement,
TYPE_BULLETED, TYPE_GLOSS, TYPE_PROGRESS, TYPE_FORM, TYPE_DSO_LIST }; TYPE_BULLETED, TYPE_GLOSS, TYPE_PROGRESS, TYPE_FORM, TYPE_DSO_LIST };
/** The list's name */ /** The list's name */
private String name; private final String name;
/** The list's type, see types above. * */ /** The list's type, see types above. * */
private String type; private final String type;
/** Any special rendering instructions * */ /** Any special rendering instructions * */
private String rend; private final String rend;
/** The lists head * */ /** The lists head * */
private Head head; private Head head;
/** All content of this container, items & lists */ /** All content of this container, items & lists */
private java.util.List<AbstractWingElement> contents = new ArrayList<AbstractWingElement>(); private java.util.List<AbstractWingElement> contents = new ArrayList<>();
/** /**
* Construct a new list. * Construct a new list.
@@ -123,6 +123,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. There are a set of predefined * display of the element. There are a set of predefined
* rendering values, see the class documentation above. * rendering values, see the class documentation above.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected List(WingContext context, String name, String type, String rend) protected List(WingContext context, String name, String type, String rend)
throws WingException throws WingException
@@ -143,12 +144,14 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* Set the head element which is the label associated with this list. This * Set the head element which is the label associated with this list. This
* method should be called before any other elements have been added to the * method should be called before any other elements have been added to the
* list. * list.
* @return the new Head.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Head setHead() throws WingException public Head setHead() throws WingException
{ {
Head head = new Head(context, null); Head newHead = new Head(context, null);
this.head = head; this.head = newHead;
return head; return newHead;
} }
/** /**
@@ -159,11 +162,12 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param characters * @param characters
* (Required) Untranslated character data to be included as the * (Required) Untranslated character data to be included as the
* list's head. * list's head.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(String characters) throws WingException public void setHead(String characters) throws WingException
{ {
Head head = setHead(); Head newHead = setHead();
head.addContent(characters); newHead.addContent(characters);
} }
/** /**
@@ -174,11 +178,12 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param key * @param key
* (Required) Key to the i18n catalogue to translate the content * (Required) Key to the i18n catalogue to translate the content
* into the language preferred by the user. * into the language preferred by the user.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(Message key) throws WingException public void setHead(Message key) throws WingException
{ {
Head head = setHead(); Head newHead = setHead();
head.addContent(key); newHead.addContent(key);
} }
/** /**
@@ -192,6 +197,8 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @return the new Label.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Label addLabel(String name, String rend) throws WingException public Label addLabel(String name, String rend) throws WingException
{ {
@@ -207,6 +214,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* *
* @param characters * @param characters
* (Required) Untranslated character data to be included. * (Required) Untranslated character data to be included.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addLabel(String characters) throws WingException public void addLabel(String characters) throws WingException
{ {
@@ -224,6 +232,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* bullet. This version of label provides no textual label but may be used * bullet. This version of label provides no textual label but may be used
* to indicate some implicit labeling such as ordered lists. * to indicate some implicit labeling such as ordered lists.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addLabel() throws WingException public void addLabel() throws WingException
{ {
@@ -239,6 +248,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param key * @param key
* (Required) Key to the i18n catalogue to translate the content * (Required) Key to the i18n catalogue to translate the content
* into the language preferred by the user. * into the language preferred by the user.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addLabel(Message key) throws WingException public void addLabel(Message key) throws WingException
{ {
@@ -253,6 +263,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* Add an empty unnamed item. * Add an empty unnamed item.
* *
* @return a new Item * @return a new Item
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Item addItem() throws WingException public Item addItem() throws WingException
{ {
@@ -273,6 +284,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * * display of the element. *
* @return a new Item * @return a new Item
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Item addItem(String name, String rend) throws WingException public Item addItem(String name, String rend) throws WingException
{ {
@@ -286,6 +298,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* *
* @param characters * @param characters
* (Required) Untranslated character data to be included. * (Required) Untranslated character data to be included.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addItem(String characters) throws WingException public void addItem(String characters) throws WingException
{ {
@@ -302,6 +315,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param key * @param key
* (Required) Key to the i18n catalogue to translate the content * (Required) Key to the i18n catalogue to translate the content
* into the language preferred by the user. * into the language preferred by the user.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addItem(Message key) throws WingException public void addItem(Message key) throws WingException
{ {
@@ -320,6 +334,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param characters * @param characters
* (Required) Untranslated character data to be included as the * (Required) Untranslated character data to be included as the
* link's body. * link's body.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addItemXref(String target, String characters) public void addItemXref(String target, String characters)
throws WingException throws WingException
@@ -337,6 +352,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* @param key * @param key
* (Required) i18n key for translating content into the user's * (Required) i18n key for translating content into the user's
* preferred language. * preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addItemXref(String target, Message key) throws WingException public void addItemXref(String target, Message key) throws WingException
{ {
@@ -358,6 +374,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @return A new sub list. * @return A new sub list.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public List addList(String name, String type, String rend) public List addList(String name, String type, String rend)
throws WingException throws WingException
@@ -377,6 +394,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (May be null) determines the list type. If this is blank the * (May be null) determines the list type. If this is blank the
* list type is inferred from the context and use. * list type is inferred from the context and use.
* @return A new sub list. * @return A new sub list.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public List addList(String name, String type) public List addList(String name, String type)
throws WingException throws WingException
@@ -393,14 +411,13 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (Required) a local identifier used to differentiate the * (Required) a local identifier used to differentiate the
* element from its siblings. * element from its siblings.
* @return A new sub list. * @return A new sub list.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public List addList(String name) throws WingException public List addList(String name) throws WingException
{ {
return addList(name, null, null); return addList(name, null, null);
} }
/** /**
* Determine if the given SAX startElement event is equivalent to this list. * Determine if the given SAX startElement event is equivalent to this list.
* *
@@ -414,6 +431,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* The element's attributes * The element's attributes
* @return True if this list is equivalent to the given SAX Event. * @return True if this list is equivalent to the given SAX Event.
*/ */
@Override
public boolean mergeEqual(String namespace, String localName, String qName, public boolean mergeEqual(String namespace, String localName, String qName,
Attributes attributes) Attributes attributes)
{ {
@@ -426,16 +444,12 @@ public class List extends AbstractWingElement implements WingMergeableElement,
{ {
return false; return false;
} }
String name = attributes.getValue(A_NAME); String theName = attributes.getValue(A_NAME);
if (name == null) if (theName == null)
{ {
return false; return false;
} }
if (!name.equals(this.name)) return theName.equals(this.name);
{
return false;
}
return true;
} }
/** /**
@@ -455,6 +469,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* The element's attributes * The element's attributes
* @return The child element * @return The child element
*/ */
@Override
public WingMergeableElement mergeChild(String namespace, String localName, public WingMergeableElement mergeChild(String namespace, String localName,
String qName, Attributes attributes) throws SAXException, String qName, Attributes attributes) throws SAXException,
WingException WingException
@@ -491,6 +506,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* *
* @return The attributes for this merged element * @return The attributes for this merged element
*/ */
@Override
public Attributes merge(Attributes attributes) throws SAXException, public Attributes merge(Attributes attributes) throws SAXException,
WingException WingException
{ {
@@ -512,6 +528,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -550,9 +567,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
} }
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
if (head != null) if (head != null)

View File

@@ -55,6 +55,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* Set a new user oriented metadata set. * Set a new user oriented metadata set.
* *
* @return The user oriented metadata set. * @return The user oriented metadata set.
* @throws org.dspace.app.xmlui.wing.WingException never.
*/ */
public UserMeta setUserMeta() throws WingException public UserMeta setUserMeta() throws WingException
{ {
@@ -65,6 +66,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* Set a new page oriented metadata set. * Set a new page oriented metadata set.
* *
* @return The page oriented metadata set. * @return The page oriented metadata set.
* @throws org.dspace.app.xmlui.wing.WingException never.
*/ */
public PageMeta setPageMeta() throws WingException public PageMeta setPageMeta() throws WingException
{ {
@@ -75,6 +77,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* Set a new repository oriented metadata set. * Set a new repository oriented metadata set.
* *
* @return The repository oriented metadata set. * @return The repository oriented metadata set.
* @throws org.dspace.app.xmlui.wing.WingException never.
*/ */
public RepositoryMeta setRepositoryMeta() throws WingException public RepositoryMeta setRepositoryMeta() throws WingException
{ {
@@ -94,6 +97,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* The element's attributes * The element's attributes
* @return True if this WingElement is equivalent to the given SAX Event. * @return True if this WingElement is equivalent to the given SAX Event.
*/ */
@Override
public boolean mergeEqual(String namespace, String localName, String qName, public boolean mergeEqual(String namespace, String localName, String qName,
Attributes attributes) throws SAXException, WingException Attributes attributes) throws SAXException, WingException
{ {
@@ -102,12 +106,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
return false; return false;
} }
if (!E_META.equals(localName)) return E_META.equals(localName);
{
return false;
}
return true;
} }
/** /**
@@ -123,6 +122,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* The element's attributes * The element's attributes
* @return The child element * @return The child element
*/ */
@Override
public WingMergeableElement mergeChild(String namespace, String localName, public WingMergeableElement mergeChild(String namespace, String localName,
String qName, Attributes attributes) throws SAXException, String qName, Attributes attributes) throws SAXException,
WingException WingException
@@ -132,9 +132,9 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
&& this.userMeta.mergeEqual(namespace, localName, qName, && this.userMeta.mergeEqual(namespace, localName, qName,
attributes)) attributes))
{ {
UserMeta userMeta = this.userMeta; UserMeta thisUserMeta = this.userMeta;
this.userMeta = null; this.userMeta = null;
return userMeta; return thisUserMeta;
} }
// page // page
@@ -142,9 +142,9 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
&& this.pageMeta.mergeEqual(namespace, localName, qName, && this.pageMeta.mergeEqual(namespace, localName, qName,
attributes)) attributes))
{ {
PageMeta pageMeta = this.pageMeta; PageMeta thisPageMeta = this.pageMeta;
this.pageMeta = null; this.pageMeta = null;
return pageMeta; return thisPageMeta;
} }
// repository // repository
@@ -152,9 +152,9 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
&& this.repositoryMeta.mergeEqual(namespace, localName, qName, && this.repositoryMeta.mergeEqual(namespace, localName, qName,
attributes)) attributes))
{ {
RepositoryMeta repositoryMeta = this.repositoryMeta; RepositoryMeta thisRepositoryMeta = this.repositoryMeta;
this.repositoryMeta = null; this.repositoryMeta = null;
return repositoryMeta; return thisRepositoryMeta;
} }
return null; return null;
@@ -165,6 +165,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* *
* @return The attributes for this merged element * @return The attributes for this merged element
*/ */
@Override
public Attributes merge(Attributes attributes) throws SAXException, public Attributes merge(Attributes attributes) throws SAXException,
WingException WingException
{ {
@@ -185,6 +186,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -212,9 +214,7 @@ public class Meta extends AbstractWingElement implements WingMergeableElement
} }
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
if (this.userMeta != null) if (this.userMeta != null)

View File

@@ -38,24 +38,26 @@ public class Metadata extends TextContainer implements MetadataElement
public static final String A_LANGUAGE = "lang"; public static final String A_LANGUAGE = "lang";
/** The metadata's element */ /** The metadata's element */
private String element; private final String element;
/** The metadata's qualifier */ /** The metadata's qualifier */
private String qualifier; private final String qualifier;
/** The metadata's language */ /** The metadata's language */
private String language; private final String language;
/** /**
* Determine the additive model for the metadata, should * Determine the additive model for the metadata, should
* the metadata always be added to the document or only if * the metadata always be added to the document or only if
* it does not already exist? * it does not already exist?
*/ */
private boolean allowMultiple; private final boolean allowMultiple;
/** /**
* Construct a new metadata. * Construct a new metadata.
* *
* @param context
* (Required) The request context.
* @param element * @param element
* (Required) The element of this metadata * (Required) The element of this metadata
* @param qualifier * @param qualifier
@@ -65,6 +67,7 @@ public class Metadata extends TextContainer implements MetadataElement
* @param allowMultiple * @param allowMultiple
* (Required) Are multiple metadata elements with the same element, * (Required) Are multiple metadata elements with the same element,
* qualifier, and language allowed? * qualifier, and language allowed?
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Metadata(WingContext context, String element, String qualifier, protected Metadata(WingContext context, String element, String qualifier,
String language, boolean allowMultiple) throws WingException String language, boolean allowMultiple) throws WingException
@@ -80,6 +83,8 @@ public class Metadata extends TextContainer implements MetadataElement
* If an metadata with the same element, qualifier, and language exist * If an metadata with the same element, qualifier, and language exist
* within the document should this metadata element be added into the * within the document should this metadata element be added into the
* document or should only one metadata be allowed. * document or should only one metadata be allowed.
*
* @return true if multiple values are allowed.
*/ */
protected boolean allowMultiple() protected boolean allowMultiple()
{ {
@@ -162,7 +167,9 @@ public class Metadata extends TextContainer implements MetadataElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {

View File

@@ -27,10 +27,9 @@ public class Option extends TextContainer
/** The name of the return value attribute */ /** The name of the return value attribute */
public static final String A_RETURN_VALUE = "returnValue"; public static final String A_RETURN_VALUE = "returnValue";
/** The submitted value for this option */
/** The submited value for this option */ private final String returnValue;
private String returnValue;
/** /**
* *
@@ -39,6 +38,7 @@ public class Option extends TextContainer
* (Required) The context this element is contained in * (Required) The context this element is contained in
* @param returnValue * @param returnValue
* (may be null) The options return value. * (may be null) The options return value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Option(WingContext context, String returnValue) throws WingException protected Option(WingContext context, String returnValue) throws WingException
{ {
@@ -60,8 +60,9 @@ public class Option extends TextContainer
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, public void toSAX(ContentHandler contentHandler,
LexicalHandler lexicalHandler, NamespaceSupport namespaces) LexicalHandler lexicalHandler, NamespaceSupport namespaces)
throws SAXException throws SAXException

View File

@@ -49,7 +49,7 @@ public class Options extends AbstractWingElement implements
/** /**
* Add a new sublist to this item. Note that an item may contain either * Add a new sublist to this item. Note that an item may contain either
* characters (with formating & fields) or lists but not both. * characters (with formating and fields) or lists but not both.
* *
* @param name * @param name
* (Required) a local identifier used to differentiate the * (Required) a local identifier used to differentiate the
@@ -74,7 +74,7 @@ public class Options extends AbstractWingElement implements
/** /**
* Add a new sublist to this item. Note that an item may contain either * Add a new sublist to this item. Note that an item may contain either
* characters (with formating & fields) or lists but not both. * characters (with formating and fields) or lists but not both.
* *
* @param name * @param name
* (Required) a local identifier used to differentiate the * (Required) a local identifier used to differentiate the

View File

@@ -40,8 +40,8 @@ public class PageMeta extends AbstractWingElement implements
* metadata. Each of these types are separated so that * metadata. Each of these types are separated so that
* we can search through each time as we merge documents. * we can search through each time as we merge documents.
*/ */
private List<Metadata> metadatum = new ArrayList<Metadata>(); private List<Metadata> metadatum = new ArrayList<>();
private List<Trail> trails = new ArrayList<Trail>(); private List<Trail> trails = new ArrayList<>();
/** /**
* Construct a new pageMeta * Construct a new pageMeta
@@ -49,6 +49,7 @@ public class PageMeta extends AbstractWingElement implements
* @param context * @param context
* (Required) The context this element is contained in, such as * (Required) The context this element is contained in, such as
* where to route SAX events and what i18n catalogue to use. * where to route SAX events and what i18n catalogue to use.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected PageMeta(WingContext context) throws WingException protected PageMeta(WingContext context) throws WingException
{ {
@@ -68,6 +69,7 @@ public class PageMeta extends AbstractWingElement implements
* (Required) determine if multiple metadata elements with the same * (Required) determine if multiple metadata elements with the same
* element, qualifier and language are allowed. * element, qualifier and language are allowed.
* @return A new metadata * @return A new metadata
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Metadata addMetadata(String element, String qualifier, public Metadata addMetadata(String element, String qualifier,
String language, boolean allowMultiple) throws WingException String language, boolean allowMultiple) throws WingException
@@ -87,6 +89,7 @@ public class PageMeta extends AbstractWingElement implements
* @param language * @param language
* (May be null) The metadata language * (May be null) The metadata language
* @return A new metadata * @return A new metadata
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Metadata addMetadata(String element, String qualifier, String language) public Metadata addMetadata(String element, String qualifier, String language)
throws WingException throws WingException
@@ -102,6 +105,7 @@ public class PageMeta extends AbstractWingElement implements
* @param qualifier * @param qualifier
* (May be null) The metadata qualifier. * (May be null) The metadata qualifier.
* @return A new metadata * @return A new metadata
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Metadata addMetadata(String element, String qualifier) public Metadata addMetadata(String element, String qualifier)
throws WingException throws WingException
@@ -115,6 +119,7 @@ public class PageMeta extends AbstractWingElement implements
* @param element * @param element
* (Required) The metadata element. * (Required) The metadata element.
* @return A new metadata * @return A new metadata
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Metadata addMetadata(String element) throws WingException public Metadata addMetadata(String element) throws WingException
{ {
@@ -129,6 +134,7 @@ public class PageMeta extends AbstractWingElement implements
* @param rend * @param rend
* (May be null) Special rendering instructions * (May be null) Special rendering instructions
* @return a new trail * @return a new trail
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Trail addTrail(String target, String rend) public Trail addTrail(String target, String rend)
throws WingException throws WingException
@@ -142,6 +148,7 @@ public class PageMeta extends AbstractWingElement implements
* Add a new trail to the page without a link or render attribute. * Add a new trail to the page without a link or render attribute.
* *
* @return a new trail * @return a new trail
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Trail addTrail() public Trail addTrail()
throws WingException throws WingException
@@ -156,6 +163,7 @@ public class PageMeta extends AbstractWingElement implements
* (May be null) The Target URL for this trail item. * (May be null) The Target URL for this trail item.
* @param characters * @param characters
* (May be null) The textual contents of this trail item. * (May be null) The textual contents of this trail item.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addTrailLink(String target, String characters) public void addTrailLink(String target, String characters)
throws WingException throws WingException
@@ -172,6 +180,7 @@ public class PageMeta extends AbstractWingElement implements
* @param message * @param message
* (Required) The textual contents of this trail item to be * (Required) The textual contents of this trail item to be
* translated * translated
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addTrailLink(String target, Message message) public void addTrailLink(String target, Message message)
throws WingException throws WingException
@@ -193,6 +202,7 @@ public class PageMeta extends AbstractWingElement implements
* The element's attributes * The element's attributes
* @return True if this WingElement is equivalent to the given SAX Event. * @return True if this WingElement is equivalent to the given SAX Event.
*/ */
@Override
public boolean mergeEqual(String namespace, String localName, String qName, public boolean mergeEqual(String namespace, String localName, String qName,
Attributes attributes) throws SAXException, WingException Attributes attributes) throws SAXException, WingException
{ {
@@ -202,17 +212,13 @@ public class PageMeta extends AbstractWingElement implements
return false; return false;
} }
if (!E_PAGE_META.equals(localName)) return E_PAGE_META.equals(localName);
{
return false;
}
return true;
} }
/** /**
* Since metadata can not be merged there are no mergeable children. This * Since metadata can not be merged there are no mergeable children. This
* just return's null. * just returns null.
* *
* @param namespace * @param namespace
* The element's name space * The element's name space
* @param localName * @param localName
@@ -223,6 +229,7 @@ public class PageMeta extends AbstractWingElement implements
* The element's attributes * The element's attributes
* @return The child element * @return The child element
*/ */
@Override
public WingMergeableElement mergeChild(String namespace, String localName, public WingMergeableElement mergeChild(String namespace, String localName,
String qName, Attributes attributes) throws SAXException, String qName, Attributes attributes) throws SAXException,
WingException WingException
@@ -245,7 +252,7 @@ public class PageMeta extends AbstractWingElement implements
String qualifier = attributes.getValue(Metadata.A_QUALIFIER); String qualifier = attributes.getValue(Metadata.A_QUALIFIER);
String language = attributes.getValue(Metadata.A_LANGUAGE); String language = attributes.getValue(Metadata.A_LANGUAGE);
List<Metadata> remove = new ArrayList<Metadata>(); List<Metadata> remove = new ArrayList<>();
for (Metadata metadata : metadatum) for (Metadata metadata : metadatum)
{ {
if (metadata.equals(element,qualifier,language) && !metadata.allowMultiple()) if (metadata.equals(element,qualifier,language) && !metadata.allowMultiple())
@@ -268,6 +275,7 @@ public class PageMeta extends AbstractWingElement implements
/** /**
* Inform this element that it is being merged with an existing element. * Inform this element that it is being merged with an existing element.
*/ */
@Override
public Attributes merge(Attributes attributes) throws SAXException, public Attributes merge(Attributes attributes) throws SAXException,
WingException WingException
{ {
@@ -288,6 +296,7 @@ public class PageMeta extends AbstractWingElement implements
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -312,9 +321,7 @@ public class PageMeta extends AbstractWingElement implements
} }
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
for (Metadata metadata : metadatum) for (Metadata metadata : metadatum)

View File

@@ -31,10 +31,10 @@ public class Para extends RichTextContainer implements StructuralElement
public static final String E_PARA = "p"; public static final String E_PARA = "p";
/** The para's name */ /** The para's name */
private String name; private final String name;
/** Any special rendering instructions for the para */ /** Any special rendering instructions for the para */
private String rend; private final String rend;
/** /**
* Construct a new paragraph. Typically names for paragraphs are not * Construct a new paragraph. Typically names for paragraphs are not
@@ -52,6 +52,7 @@ public class Para extends RichTextContainer implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Para(WingContext context, String name, String rend) protected Para(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -75,8 +76,10 @@ public class Para extends RichTextContainer implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {

View File

@@ -139,6 +139,7 @@ public class Params extends AbstractWingElement implements StructuralElement
* @param context * @param context
* (Required) The context this element is contained in, such as * (Required) The context this element is contained in, such as
* where to route SAX events and what i18n catalogue to use. * where to route SAX events and what i18n catalogue to use.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
* *
*/ */
protected Params(WingContext context) throws WingException protected Params(WingContext context) throws WingException
@@ -150,6 +151,7 @@ public class Params extends AbstractWingElement implements StructuralElement
* Enable the add operation for this field set. When this is enabled the * Enable the add operation for this field set. When this is enabled the
* front end will add a button to add more items to the field. * front end will add a button to add more items to the field.
* *
* @throws org.dspace.app.xmlui.wing.WingException never.
*/ */
public void enableAddOperation() throws WingException public void enableAddOperation() throws WingException
{ {
@@ -161,6 +163,7 @@ public class Params extends AbstractWingElement implements StructuralElement
* the front end will provide a way for the user to select fields (probably * the front end will provide a way for the user to select fields (probably
* checkboxes) along with a submit button to delete the selected fields. * checkboxes) along with a submit button to delete the selected fields.
* *
* @throws org.dspace.app.xmlui.wing.WingException never.
*/ */
public void enableDeleteOperation()throws WingException public void enableDeleteOperation()throws WingException
{ {
@@ -301,7 +304,7 @@ public class Params extends AbstractWingElement implements StructuralElement
/** /**
* Set the field's autofocus attribute, an HTML5 feature. * Set the field's autofocus attribute, an HTML5 feature.
* Valid input values to enable autofocus are: autofocus, and empty string. * Valid input values to enable autofocus are: autofocus, and empty string.
* @param value * @param value "autofocus" or empty.
*/ */
public void setAutofocus(String value) public void setAutofocus(String value)
{ {
@@ -322,6 +325,7 @@ public class Params extends AbstractWingElement implements StructuralElement
* select vs. suggest. Value must match one of the PRESENTATIONS. * select vs. suggest. Value must match one of the PRESENTATIONS.
* *
* @param value pre-determined metadata field key * @param value pre-determined metadata field key
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setChoicesPresentation(String value) public void setChoicesPresentation(String value)
throws WingException throws WingException
@@ -364,7 +368,9 @@ public class Params extends AbstractWingElement implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, public void toSAX(ContentHandler contentHandler,
LexicalHandler lexicalHandler, NamespaceSupport namespaces) LexicalHandler lexicalHandler, NamespaceSupport namespaces)
throws SAXException throws SAXException
@@ -400,8 +406,6 @@ public class Params extends AbstractWingElement implements StructuralElement
attributes.put(A_OPERATIONS, operations); attributes.put(A_OPERATIONS, operations);
} }
if (this.returnValue != null) if (this.returnValue != null)
{ {
attributes.put(A_RETURN_VALUE, this.returnValue); attributes.put(A_RETURN_VALUE, this.returnValue);
@@ -412,7 +416,6 @@ public class Params extends AbstractWingElement implements StructuralElement
attributes.put(A_SIZE, this.size); attributes.put(A_SIZE, this.size);
} }
if (!this.evtBehavior.equals("")) if (!this.evtBehavior.equals(""))
{ {
attributes.put(A_EVTBEHAVIOR, this.evtBehavior); attributes.put(A_EVTBEHAVIOR, this.evtBehavior);

View File

@@ -35,6 +35,7 @@ public class Password extends Field
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Password(WingContext context, String name, String rend) protected Password(WingContext context, String name, String rend)
throws WingException throws WingException

View File

@@ -37,6 +37,7 @@ public class Radio extends Field
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Radio(WingContext context, String name, String rend) protected Radio(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -49,6 +50,7 @@ public class Radio extends Field
* Enable the add operation for this field. When this is enabled the * Enable the add operation for this field. When this is enabled the
* front end will add a button to add more items to the field. * front end will add a button to add more items to the field.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableAddOperation() throws WingException public void enableAddOperation() throws WingException
{ {
@@ -60,24 +62,21 @@ public class Radio extends Field
* the front end will provide a way for the user to select fields (probably * the front end will provide a way for the user to select fields (probably
* checkboxes) along with a submit button to delete the selected fields. * checkboxes) along with a submit button to delete the selected fields.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableDeleteOperation()throws WingException public void enableDeleteOperation()throws WingException
{ {
this.params.enableDeleteOperation(); this.params.enableDeleteOperation();
} }
/** /**
* Add an option. * Add an option.
* *
* @param returnValue * @param returnValue
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @return the new option.
* @throws org.dspace.app.xmlui.wing.WingException passed through
*/ */
public Option addOption(String returnValue) public Option addOption(String returnValue)
throws WingException throws WingException
@@ -96,6 +95,8 @@ public class Radio extends Field
* @param returnValue * @param returnValue
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @return the new option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Option addOption(boolean selected, String returnValue) public Option addOption(boolean selected, String returnValue)
throws WingException throws WingException
@@ -115,6 +116,7 @@ public class Radio extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(String returnValue, String characters) throws WingException public void addOption(String returnValue, String characters) throws WingException
{ {
@@ -132,6 +134,7 @@ public class Radio extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected,String returnValue, String characters) throws WingException public void addOption(boolean selected,String returnValue, String characters) throws WingException
{ {
@@ -150,6 +153,7 @@ public class Radio extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(int returnValue, String characters) throws WingException public void addOption(int returnValue, String characters) throws WingException
{ {
@@ -167,6 +171,7 @@ public class Radio extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, int returnValue, String characters) throws WingException public void addOption(boolean selected, int returnValue, String characters) throws WingException
{ {
@@ -184,7 +189,8 @@ public class Radio extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(String returnValue, Message message) throws WingException public void addOption(String returnValue, Message message) throws WingException
{ {
@@ -201,7 +207,8 @@ public class Radio extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, String returnValue, Message message) throws WingException public void addOption(boolean selected, String returnValue, Message message) throws WingException
{ {
@@ -219,7 +226,8 @@ public class Radio extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(int returnValue, Message message) throws WingException public void addOption(int returnValue, Message message) throws WingException
{ {
@@ -236,7 +244,8 @@ public class Radio extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, int returnValue, Message message) throws WingException public void addOption(boolean selected, int returnValue, Message message) throws WingException
{ {
@@ -252,6 +261,7 @@ public class Radio extends Field
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(String returnValue) throws WingException public void setOptionSelected(String returnValue) throws WingException
{ {
@@ -264,20 +274,18 @@ public class Radio extends Field
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(int returnValue) throws WingException public void setOptionSelected(int returnValue) throws WingException
{ {
Value value = new Value(context,Value.TYPE_OPTION,String.valueOf(returnValue)); Value value = new Value(context,Value.TYPE_OPTION,String.valueOf(returnValue));
values.add(value); values.add(value);
} }
/** /**
* Add a field instance * Add a field instance
* @return instance * @return instance
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Instance addInstance() throws WingException public Instance addInstance() throws WingException
{ {

View File

@@ -51,7 +51,7 @@ public class Reference extends AbstractWingElement implements
private String type; private String type;
/** All content of this container */ /** All content of this container */
private java.util.List<AbstractWingElement> contents = new ArrayList<AbstractWingElement>(); private java.util.List<AbstractWingElement> contents = new ArrayList<>();
/** /**
* Construct a new object reference. * Construct a new object reference.
@@ -62,6 +62,8 @@ public class Reference extends AbstractWingElement implements
* *
* @param object * @param object
* (Required) The referenced object. * (Required) The referenced object.
* @throws org.dspace.app.xmlui.wing.WingException
* if the object cannot be managed.
*/ */
protected Reference(WingContext context, Object object) protected Reference(WingContext context, Object object)
throws WingException throws WingException
@@ -98,6 +100,8 @@ public class Reference extends AbstractWingElement implements
* @param render * @param render
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @return the new set.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public ReferenceSet addReferenceSet(String type, String orderBy, String render) public ReferenceSet addReferenceSet(String type, String orderBy, String render)
throws WingException throws WingException
@@ -115,6 +119,8 @@ public class Reference extends AbstractWingElement implements
* (required) The reference type, see referenceSet.TYPES * (required) The reference type, see referenceSet.TYPES
* @param orderBy * @param orderBy
* (May be null) A statement of ordering for reference sets. * (May be null) A statement of ordering for reference sets.
* @return the new set.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public ReferenceSet addReferenceSet(String type, String orderBy) public ReferenceSet addReferenceSet(String type, String orderBy)
throws WingException throws WingException
@@ -127,6 +133,8 @@ public class Reference extends AbstractWingElement implements
* *
* @param type * @param type
* (required) The include type, see includeSet.TYPES * (required) The include type, see includeSet.TYPES
* @return the new set.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public ReferenceSet addReferenceSet(String type) throws WingException public ReferenceSet addReferenceSet(String type) throws WingException
{ {
@@ -145,7 +153,9 @@ public class Reference extends AbstractWingElement implements
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -167,9 +177,7 @@ public class Reference extends AbstractWingElement implements
endElement(contentHandler, namespaces, E_REFERENCE); endElement(contentHandler, namespaces, E_REFERENCE);
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
if (contents != null) if (contents != null)

View File

@@ -49,22 +49,22 @@ public class ReferenceSet extends AbstractWingElement implements
public static final String[] TYPES = { TYPE_SUMMARY_LIST, TYPE_SUMMARY_VIEW, TYPE_DETAIL_LIST, TYPE_DETAIL_VIEW }; public static final String[] TYPES = { TYPE_SUMMARY_LIST, TYPE_SUMMARY_VIEW, TYPE_DETAIL_LIST, TYPE_DETAIL_VIEW };
/** The name assigned to this metadata set */ /** The name assigned to this metadata set */
private String name; private final String name;
/** The ordering mechanism to use. */ /** The ordering mechanism to use. */
private String orderBy; private final String orderBy;
/** The reference type, see TYPES defined above */ /** The reference type, see TYPES defined above */
private String type; private final String type;
/** Special rendering instructions */ /** Special rendering instructions */
private String rend; private final String rend;
/** The head label for this referenceset */ /** The head label for this reference set */
private Head head; private Head head;
/** All content of this container, items & lists */ /** All content of this container, items & lists */
private java.util.List<AbstractWingElement> contents = new ArrayList<AbstractWingElement>(); private java.util.List<AbstractWingElement> contents = new ArrayList<>();
/** /**
* Construct a new referenceSet * Construct a new referenceSet
@@ -86,6 +86,7 @@ public class ReferenceSet extends AbstractWingElement implements
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected ReferenceSet(WingContext context, boolean childreference, String name, String type, String orderBy, String rend) protected ReferenceSet(WingContext context, boolean childreference, String name, String type, String orderBy, String rend)
throws WingException throws WingException
@@ -109,25 +110,26 @@ public class ReferenceSet extends AbstractWingElement implements
/** /**
* Set the head element which is the label associated with this referenceset. * Set the head element which is the label associated with this referenceset.
* @return the new head.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Head setHead() throws WingException public Head setHead() throws WingException
{ {
this.head = new Head(context, null); this.head = new Head(context, null);
return head; return head;
} }
/** /**
* Set the head element which is the label associated with this referenceset. * Set the head element which is the label associated with this reference set.
* *
* @param characters * @param characters
* (May be null) Unprocessed characters to be referenced * (May be null) Unprocessed characters to be referenced
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(String characters) throws WingException public void setHead(String characters) throws WingException
{ {
Head head = this.setHead(); Head newHead = this.setHead();
head.addContent(characters); newHead.addContent(characters);
} }
/** /**
@@ -136,11 +138,12 @@ public class ReferenceSet extends AbstractWingElement implements
* @param message * @param message
* (Required) A key into the i18n catalogue for translation into * (Required) A key into the i18n catalogue for translation into
* the user's preferred language. * the user's preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(Message message) throws WingException public void setHead(Message message) throws WingException
{ {
Head head = this.setHead(); Head newHead = this.setHead();
head.addContent(message); newHead.addContent(message);
} }
/** /**
@@ -148,6 +151,8 @@ public class ReferenceSet extends AbstractWingElement implements
* *
* @param object * @param object
* (Required) The referenced object. * (Required) The referenced object.
* @return the reference.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Reference addReference(Object object) public Reference addReference(Object object)
throws WingException throws WingException
@@ -169,7 +174,9 @@ public class ReferenceSet extends AbstractWingElement implements
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -208,9 +215,7 @@ public class ReferenceSet extends AbstractWingElement implements
endElement(contentHandler, namespaces, E_REFERENCE_SET); endElement(contentHandler, namespaces, E_REFERENCE_SET);
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
if (contents != null) if (contents != null)

View File

@@ -44,7 +44,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
private boolean merged = false; private boolean merged = false;
/** The registered repositories on this page */ /** The registered repositories on this page */
private Map<String,String> repositories = new HashMap<String,String>(); private Map<String,String> repositories = new HashMap<>();
/** /**
* Construct a new RepositoryMeta * Construct a new RepositoryMeta
@@ -52,6 +52,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
* @param context * @param context
* (Required) The context this element is contained in, such as * (Required) The context this element is contained in, such as
* where to route SAX events and what i18n catalogue to use. * where to route SAX events and what i18n catalogue to use.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected RepositoryMeta(WingContext context) throws WingException protected RepositoryMeta(WingContext context) throws WingException
{ {
@@ -78,6 +79,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
* The element's attributes * The element's attributes
* @return True if this WingElement is equivalent to the given SAX Event. * @return True if this WingElement is equivalent to the given SAX Event.
*/ */
@Override
public boolean mergeEqual(String namespace, String localName, String qName, public boolean mergeEqual(String namespace, String localName, String qName,
Attributes attributes) throws SAXException, WingException Attributes attributes) throws SAXException, WingException
{ {
@@ -87,11 +89,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
return false; return false;
} }
if (!E_REPOSITORY_META.equals(localName)) return E_REPOSITORY_META.equals(localName);
{
return false;
}
return true;
} }
/** /**
@@ -111,6 +109,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
* The element's attributes * The element's attributes
* @return The child element * @return The child element
*/ */
@Override
public WingMergeableElement mergeChild(String namespace, String localName, public WingMergeableElement mergeChild(String namespace, String localName,
String qName, Attributes attributes) throws SAXException, String qName, Attributes attributes) throws SAXException,
WingException WingException
@@ -140,6 +139,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
/** /**
* Inform this element that it is being merged with an existing element. * Inform this element that it is being merged with an existing element.
*/ */
@Override
public Attributes merge(Attributes attributes) throws SAXException, public Attributes merge(Attributes attributes) throws SAXException,
WingException WingException
{ {
@@ -161,6 +161,7 @@ public class RepositoryMeta extends AbstractWingElement implements WingMergeable
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, public void toSAX(ContentHandler contentHandler,
LexicalHandler lexicalHandler, NamespaceSupport namespaces) LexicalHandler lexicalHandler, NamespaceSupport namespaces)
throws SAXException throws SAXException

View File

@@ -38,13 +38,13 @@ public class Row extends AbstractWingElement implements StructuralElement
public static final String A_ROLE = "role"; public static final String A_ROLE = "role";
/** The row's name */ /** The row's name */
private String name; private final String name;
/** The row's role, see ROLES below */ /** The row's role, see ROLES below */
private String role; private final String role;
/** Special rendering instructions */ /** Special rendering instructions */
private String rend; private final String rend;
/** The row (and cell) role types: */ /** The row (and cell) role types: */
public static final String ROLE_DATA = "data"; public static final String ROLE_DATA = "data";
@@ -55,7 +55,7 @@ public class Row extends AbstractWingElement implements StructuralElement
public static final String[] ROLES = { ROLE_DATA, ROLE_HEADER }; public static final String[] ROLES = { ROLE_DATA, ROLE_HEADER };
/** The contents of this row */ /** The contents of this row */
List<AbstractWingElement> contents = new ArrayList<AbstractWingElement>(); List<AbstractWingElement> contents = new ArrayList<>();
/** /**
* Construct a new table row. * Construct a new table row.
@@ -72,6 +72,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Row(WingContext context, String name, String role, String rend) protected Row(WingContext context, String name, String role, String rend)
throws WingException throws WingException
@@ -108,6 +109,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @return a new table cell. * @return a new table cell.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Cell addCell(String name, String role, int rows, int cols, public Cell addCell(String name, String role, int rows, int cols,
String rend) throws WingException String rend) throws WingException
@@ -131,6 +133,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* (May be zero for no defined value) determines how many columns * (May be zero for no defined value) determines how many columns
* does this cell span. * does this cell span.
* @return a new table cell. * @return a new table cell.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Cell addCell(int rows, int cols) throws WingException public Cell addCell(int rows, int cols) throws WingException
{ {
@@ -156,6 +159,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @return a new table cell. * @return a new table cell.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Cell addCell(String name, String role, String rend) public Cell addCell(String name, String role, String rend)
throws WingException throws WingException
@@ -174,6 +178,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* (May be null) determines what kind of information the cell * (May be null) determines what kind of information the cell
* carries, either header or data. See cell.ROLES * carries, either header or data. See cell.ROLES
* @return a new table cell. * @return a new table cell.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Cell addCell(String role) throws WingException public Cell addCell(String role) throws WingException
{ {
@@ -188,6 +193,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* form fields. * form fields.
* *
* @return a new table cell. * @return a new table cell.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Cell addCell() throws WingException public Cell addCell() throws WingException
{ {
@@ -206,6 +212,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* *
* @param characters * @param characters
* (Required) Untranslated character data to be included. * (Required) Untranslated character data to be included.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addCellContent(String characters) throws WingException public void addCellContent(String characters) throws WingException
{ {
@@ -226,6 +233,7 @@ public class Row extends AbstractWingElement implements StructuralElement
* @param message * @param message
* (Required) Key to the i18n catalogue to translate the content * (Required) Key to the i18n catalogue to translate the content
* into the language preferred by the user. * into the language preferred by the user.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addCellContent(Message message) throws WingException public void addCellContent(Message message) throws WingException
{ {
@@ -246,7 +254,9 @@ public class Row extends AbstractWingElement implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -275,9 +285,7 @@ public class Row extends AbstractWingElement implements StructuralElement
endElement(contentHandler, namespaces, E_ROW); endElement(contentHandler, namespaces, E_ROW);
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
for (AbstractWingElement content : contents) for (AbstractWingElement content : contents)

View File

@@ -37,6 +37,7 @@ public class Select extends Field
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Select(WingContext context, String name, String rend) protected Select(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -90,6 +91,7 @@ public class Select extends Field
* Enable the add operation for this field. When this is enabled the * Enable the add operation for this field. When this is enabled the
* front end will add a button to add more items to the field. * front end will add a button to add more items to the field.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableAddOperation() throws WingException public void enableAddOperation() throws WingException
{ {
@@ -101,6 +103,7 @@ public class Select extends Field
* the front end will provide a way for the user to select fields (probably * the front end will provide a way for the user to select fields (probably
* checkboxes) along with a submit button to delete the selected fields. * checkboxes) along with a submit button to delete the selected fields.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableDeleteOperation()throws WingException public void enableDeleteOperation()throws WingException
{ {
@@ -114,6 +117,8 @@ public class Select extends Field
* @param returnValue * @param returnValue
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @return the new option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Option addOption(String returnValue) public Option addOption(String returnValue)
throws WingException throws WingException
@@ -132,6 +137,8 @@ public class Select extends Field
* @param returnValue * @param returnValue
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @return the new option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Option addOption(boolean selected, String returnValue) public Option addOption(boolean selected, String returnValue)
throws WingException throws WingException
@@ -151,6 +158,7 @@ public class Select extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(String returnValue, String characters) throws WingException public void addOption(String returnValue, String characters) throws WingException
{ {
@@ -168,6 +176,7 @@ public class Select extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected,String returnValue, String characters) throws WingException public void addOption(boolean selected,String returnValue, String characters) throws WingException
{ {
@@ -186,6 +195,7 @@ public class Select extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(int returnValue, String characters) throws WingException public void addOption(int returnValue, String characters) throws WingException
{ {
@@ -203,6 +213,7 @@ public class Select extends Field
* selected. * selected.
* @param characters * @param characters
* (Required) The text to set as the visible option. * (Required) The text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, int returnValue, String characters) throws WingException public void addOption(boolean selected, int returnValue, String characters) throws WingException
{ {
@@ -220,7 +231,8 @@ public class Select extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(String returnValue, Message message) throws WingException public void addOption(String returnValue, Message message) throws WingException
{ {
@@ -237,7 +249,8 @@ public class Select extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, String returnValue, Message message) throws WingException public void addOption(boolean selected, String returnValue, Message message) throws WingException
{ {
@@ -255,7 +268,8 @@ public class Select extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(int returnValue, Message message) throws WingException public void addOption(int returnValue, Message message) throws WingException
{ {
@@ -272,7 +286,8 @@ public class Select extends Field
* (Required) The value to be passed back if this option is * (Required) The value to be passed back if this option is
* selected. * selected.
* @param message * @param message
* (Required) The transalted text to set as the visible option. * (Required) The translated text to set as the visible option.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void addOption(boolean selected, int returnValue, Message message) throws WingException public void addOption(boolean selected, int returnValue, Message message) throws WingException
{ {
@@ -288,6 +303,7 @@ public class Select extends Field
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(String returnValue) throws WingException public void setOptionSelected(String returnValue) throws WingException
{ {
@@ -300,6 +316,7 @@ public class Select extends Field
* *
* @param returnValue * @param returnValue
* (Required) The return value of the option to be selected. * (Required) The return value of the option to be selected.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setOptionSelected(int returnValue) throws WingException public void setOptionSelected(int returnValue) throws WingException
{ {
@@ -310,6 +327,7 @@ public class Select extends Field
/** /**
* Add a field instance * Add a field instance
* @return instance * @return instance
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Instance addInstance() throws WingException public Instance addInstance() throws WingException
{ {

View File

@@ -68,7 +68,7 @@ public class SimpleHTMLFragment extends AbstractWingElement {
* paragraphs delimeters. * paragraphs delimeters.
* @param fragment * @param fragment
* (Required) The HTML Fragment to be translated into DRI. * (Required) The HTML Fragment to be translated into DRI.
* @throws WingException * @throws WingException passed through.
*/ */
protected SimpleHTMLFragment(WingContext context, boolean blankLines, protected SimpleHTMLFragment(WingContext context, boolean blankLines,
String fragment) throws WingException { String fragment) throws WingException {
@@ -522,7 +522,7 @@ public class SimpleHTMLFragment extends AbstractWingElement {
* following email, point #1: * following email, point #1:
* *
* <a href="http://www.servlets.com/archive/servlet/ReadMsg?msgId=491592&listName=jdom-interest"> * <a href="http://www.servlets.com/archive/servlet/ReadMsg?msgId=491592&listName=jdom-interest">
* http://www.servlets.com/archive/servlet/ReadMsg?msgId=491592&listName=jdom-interest * {@literal http://www.servlets.com/archive/servlet/ReadMsg?msgId=491592&listName=jdom-interest}
* </a> * </a>
* *
* <p>I, Scott Phillips, checked the JDOM CVS source tree on 3-8-2006 and the * <p>I, Scott Phillips, checked the JDOM CVS source tree on 3-8-2006 and the

View File

@@ -40,22 +40,22 @@ public class Table extends AbstractWingElement implements StructuralElement
public static final String A_COLS = "cols"; public static final String A_COLS = "cols";
/** The name assigned to this table */ /** The name assigned to this table */
private String name; private final String name;
/** Special rendering instructions for this table */ /** Special rendering instructions for this table */
private String rend; private final String rend;
/** The number of rows in the table */ /** The number of rows in the table */
private int rows; private final int rows;
/** The number of cols in the table */ /** The number of cols in the table */
private int cols; private final int cols;
/** The table's head */ /** The table's head */
private Head head; private Head head;
/** the rows contained in the table */ /** the rows contained in the table */
private List<AbstractWingElement> contents = new ArrayList<AbstractWingElement>(); private List<AbstractWingElement> contents = new ArrayList<>();
/** /**
* Construct a new row. * Construct a new row.
@@ -75,6 +75,7 @@ public class Table extends AbstractWingElement implements StructuralElement
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Table(WingContext context, String name, int rows, int cols, protected Table(WingContext context, String name, int rows, int cols,
String rend) throws WingException String rend) throws WingException
@@ -92,6 +93,8 @@ public class Table extends AbstractWingElement implements StructuralElement
/** /**
* Set the head element which is the label associated with this table. * Set the head element which is the label associated with this table.
* @return the new head.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Head setHead() throws WingException public Head setHead() throws WingException
{ {
@@ -105,11 +108,12 @@ public class Table extends AbstractWingElement implements StructuralElement
* *
* @param characters * @param characters
* (May be null) Unprocessed characters to be included * (May be null) Unprocessed characters to be included
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(String characters) throws WingException public void setHead(String characters) throws WingException
{ {
Head head = this.setHead(); Head newHead = this.setHead();
head.addContent(characters); newHead.addContent(characters);
} }
@@ -119,11 +123,12 @@ public class Table extends AbstractWingElement implements StructuralElement
* @param message * @param message
* (Required) A key into the i18n catalogue for translation into * (Required) A key into the i18n catalogue for translation into
* the user's preferred language. * the user's preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setHead(Message message) throws WingException public void setHead(Message message) throws WingException
{ {
Head head = this.setHead(); Head newHead = this.setHead();
head.addContent(message); newHead.addContent(message);
} }
/** /**
@@ -143,6 +148,7 @@ public class Table extends AbstractWingElement implements StructuralElement
* display of the element. * display of the element.
* *
* @return a new table row * @return a new table row
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Row addRow(String name, String role, String rend) public Row addRow(String name, String role, String rend)
throws WingException throws WingException
@@ -162,6 +168,7 @@ public class Table extends AbstractWingElement implements StructuralElement
* carries, either header or data. See row.ROLES * carries, either header or data. See row.ROLES
* *
* @return a new table row * @return a new table row
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Row addRow(String role) throws WingException public Row addRow(String role) throws WingException
{ {
@@ -173,6 +180,7 @@ public class Table extends AbstractWingElement implements StructuralElement
* and serves as a container of cell elements. * and serves as a container of cell elements.
* *
* @return a new table row * @return a new table row
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Row addRow() throws WingException public Row addRow() throws WingException
{ {
@@ -192,8 +200,9 @@ public class Table extends AbstractWingElement implements StructuralElement
* @param namespaces * @param namespaces
* (Required) SAX Helper class to keep track of namespaces able * (Required) SAX Helper class to keep track of namespaces able
* to determine the correct prefix for a given namespace URI. * to determine the correct prefix for a given namespace URI.
* @throws org.xml.sax.SAXException passed through.
*/ */
@Override
public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, public void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
@@ -219,9 +228,7 @@ public class Table extends AbstractWingElement implements StructuralElement
endElement(contentHandler, namespaces, E_TABLE); endElement(contentHandler, namespaces, E_TABLE);
} }
/** @Override
* dispose
*/
public void dispose() public void dispose()
{ {
if (head != null) if (head != null)

View File

@@ -35,6 +35,7 @@ public class Text extends Field
* @param rend * @param rend
* (May be null) a rendering hint used to override the default * (May be null) a rendering hint used to override the default
* display of the element. * display of the element.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
protected Text(WingContext context, String name, String rend) protected Text(WingContext context, String name, String rend)
throws WingException throws WingException
@@ -75,6 +76,7 @@ public class Text extends Field
* Enable the add operation for this field. When this is enabled the * Enable the add operation for this field. When this is enabled the
* front end will add a button to add more items to the field. * front end will add a button to add more items to the field.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableAddOperation() throws WingException public void enableAddOperation() throws WingException
{ {
@@ -86,6 +88,7 @@ public class Text extends Field
* the front end will provide a way for the user to select fields (probably * the front end will provide a way for the user to select fields (probably
* checkboxes) along with a submit button to delete the selected fields. * checkboxes) along with a submit button to delete the selected fields.
* *
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void enableDeleteOperation()throws WingException public void enableDeleteOperation()throws WingException
{ {
@@ -99,6 +102,8 @@ public class Text extends Field
/** /**
* Set the raw value of the field removing any previous raw values. * Set the raw value of the field removing any previous raw values.
* @return the new value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setValue() throws WingException public Value setValue() throws WingException
{ {
@@ -113,6 +118,7 @@ public class Text extends Field
* *
* @param characters * @param characters
* (May be null) Field value as a string * (May be null) Field value as a string
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setValue(String characters) throws WingException public void setValue(String characters) throws WingException
{ {
@@ -126,6 +132,7 @@ public class Text extends Field
* @param message * @param message
* (Required) A key into the i18n catalogue for translation into * (Required) A key into the i18n catalogue for translation into
* the user's preferred language. * the user's preferred language.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public void setValue(Message message) throws WingException public void setValue(Message message) throws WingException
{ {
@@ -136,6 +143,8 @@ public class Text extends Field
/** /**
* Set the authority value of the field removing any previous authority values. * Set the authority value of the field removing any previous authority values.
* Initialized to an empty value. * Initialized to an empty value.
* @return the new value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setAuthorityValue() throws WingException public Value setAuthorityValue() throws WingException
{ {
@@ -145,6 +154,10 @@ public class Text extends Field
/** /**
* Set the authority value of the field removing any previous authority values. * Set the authority value of the field removing any previous authority values.
* Initialized to an empty value. * Initialized to an empty value.
* @param characters new value.
* @param confidence confidence in this value
* @return the new value.
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Value setAuthorityValue(String characters, String confidence) throws WingException public Value setAuthorityValue(String characters, String confidence) throws WingException
{ {
@@ -158,6 +171,7 @@ public class Text extends Field
/** /**
* Add a field instance * Add a field instance
* @return instance * @return instance
* @throws org.dspace.app.xmlui.wing.WingException passed through.
*/ */
public Instance addInstance() throws WingException public Instance addInstance() throws WingException
{ {