[DS-2763] Clean up JSPUI while I'm at it

This commit is contained in:
Mark H. Wood
2015-11-18 14:55:38 -05:00
parent 5033b69c5c
commit acdb1ae63b
61 changed files with 587 additions and 731 deletions

View File

@@ -42,7 +42,7 @@ import org.dspace.eperson.service.GroupService;
public class AccessSettingTag extends TagSupport public class AccessSettingTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(AccessSettingTag.class); private static final Logger log = Logger.getLogger(AccessSettingTag.class);
/** is advanced form enabled? */ /** is advanced form enabled? */
private static final boolean advanced = ConfigurationManager.getBooleanProperty("webui.submission.restrictstep.enableAdvancedForm", false); private static final boolean advanced = ConfigurationManager.getBooleanProperty("webui.submission.restrictstep.enableAdvancedForm", false);
@@ -50,7 +50,7 @@ public class AccessSettingTag extends TagSupport
/** Name of the restricted group */ /** Name of the restricted group */
private static final String restrictedGroup = ConfigurationManager.getProperty("webui.submission.restrictstep.groups"); private static final String restrictedGroup = ConfigurationManager.getProperty("webui.submission.restrictstep.groups");
/** the SubmittionInfo */ /** the SubmissionInfo */
private transient SubmissionInfo subInfo = null; private transient SubmissionInfo subInfo = null;
/** the target DSpaceObject */ /** the target DSpaceObject */
@@ -68,15 +68,18 @@ public class AccessSettingTag extends TagSupport
/** add the policy button */ /** add the policy button */
private boolean addpolicy = false; private boolean addpolicy = false;
private AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService(); private final transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
private GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
public AccessSettingTag() public AccessSettingTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
String legend = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.legend"); String legend = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.legend");
@@ -109,7 +112,7 @@ public class AccessSettingTag extends TagSupport
} }
else if (rp != null) else if (rp != null)
{ {
policies = new ArrayList<ResourcePolicy>(); policies = new ArrayList<>();
policies.add(rp); policies.add(rp);
} }
@@ -186,7 +189,7 @@ public class AccessSettingTag extends TagSupport
// Embargo Date // Embargo Date
if (hidden) if (hidden)
{ {
sb.append("<input name=\"embargo_until_date\" id=\"embargo_until_date_hidden\" type=\"hidden\" value=\"").append(startDate).append("\" />\n");; sb.append("<input name=\"embargo_until_date\" id=\"embargo_until_date_hidden\" type=\"hidden\" value=\"").append(startDate).append("\" />\n");
sb.append("<input name=\"reason\" id=\"reason_hidden\" type=\"hidden\" value=\"").append(reason).append("\" />\n"); sb.append("<input name=\"reason\" id=\"reason_hidden\" type=\"hidden\" value=\"").append(reason).append("\" />\n");
} }
else else
@@ -365,6 +368,7 @@ public class AccessSettingTag extends TagSupport
return addpolicy; return addpolicy;
} }
@Override
public void release() public void release()
{ {
dso = null; dso = null;

View File

@@ -57,10 +57,10 @@ import org.dspace.sort.SortOption;
public class BrowseListTag extends TagSupport public class BrowseListTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BrowseListTag.class); private static final Logger log = Logger.getLogger(BrowseListTag.class);
/** Items to display */ /** Items to display */
private transient List<Item> items; private List<Item> items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -105,11 +105,14 @@ public class BrowseListTag extends TagSupport
private static final long serialVersionUID = 8091584920304256107L; private static final long serialVersionUID = 8091584920304256107L;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); transient private final ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); transient private final MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); transient private final BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
static static
{ {
@@ -152,6 +155,7 @@ public class BrowseListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -477,7 +481,7 @@ public class BrowseListTag extends TagSupport
// save on a null check which would make the code untidy // save on a null check which would make the code untidy
if (metadataArray == null) if (metadataArray == null)
{ {
metadataArray = new ArrayList<MetadataValue>(); metadataArray = new ArrayList<>();
} }
// now prepare the content of the table division // now prepare the content of the table division
@@ -758,6 +762,7 @@ public class BrowseListTag extends TagSupport
emphColumn = emphColumnIn; emphColumn = emphColumnIn;
} }
@Override
public void release() public void release()
{ {
highlightRow = -1; highlightRow = -1;
@@ -885,12 +890,12 @@ public class BrowseListTag extends TagSupport
Bitstream original = thumbnail.getOriginal(); Bitstream original = thumbnail.getOriginal();
String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" + String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" +
UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING); UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING);
thumbFrag.append("<a target=\"_blank\" href=\"" + link + "\" />"); thumbFrag.append("<a target=\"_blank\" href=\"").append(link).append("\" />");
} }
else else
{ {
String link = hrq.getContextPath() + "/handle/" + item.getHandle(); String link = hrq.getContextPath() + "/handle/" + item.getHandle();
thumbFrag.append("<a href=\"" + link + "\" />"); thumbFrag.append("<a href=\"").append(link).append("\" />");
} }
Bitstream thumb = thumbnail.getThumb(); Bitstream thumb = thumbnail.getThumb();

View File

@@ -27,7 +27,7 @@ import org.dspace.content.Collection;
public class CollectionListTag extends TagSupport public class CollectionListTag extends TagSupport
{ {
/** Collections to display */ /** Collections to display */
private transient List<Collection> collections; private List<Collection> collections;
private static final long serialVersionUID = -9040013543196580904L; private static final long serialVersionUID = -9040013543196580904L;
@@ -36,6 +36,7 @@ public class CollectionListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -106,6 +107,7 @@ public class CollectionListTag extends TagSupport
collections = collectionsIn; collections = collectionsIn;
} }
@Override
public void release() public void release()
{ {
collections = null; collections = null;

View File

@@ -27,7 +27,7 @@ import org.dspace.content.Community;
public class CommunityListTag extends TagSupport public class CommunityListTag extends TagSupport
{ {
/** Communities to display */ /** Communities to display */
private transient List<Community> communities; private List<Community> communities;
private static final long serialVersionUID = 5788338729470292501L; private static final long serialVersionUID = 5788338729470292501L;
@@ -36,6 +36,7 @@ public class CommunityListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -106,6 +107,7 @@ public class CommunityListTag extends TagSupport
communities = communitiesIn; communities = communitiesIn;
} }
@Override
public void release() public void release()
{ {
communities = null; communities = null;

View File

@@ -32,10 +32,11 @@ import org.w3c.dom.Document;
public class ControlledVocabularyTag extends TagSupport public class ControlledVocabularyTag extends TagSupport
{ {
// path to the jsp that outputs the results of this tag // path to the jsp that outputs the results of this tag
private static final String CONTROLLEDVOCABULARY_JSPTAG = "/controlledvocabulary/controlledvocabularyTag.jsp"; private static final String CONTROLLEDVOCABULARY_JSPTAG
= "/controlledvocabulary/controlledvocabularyTag.jsp";
// the log // the log
private static Logger log = Logger.getLogger(ControlledVocabularyTag.class); private static final Logger log = Logger.getLogger(ControlledVocabularyTag.class);
// a tag attribute that contains the words used to trim the vocabulary tree // a tag attribute that contains the words used to trim the vocabulary tree
private String filter; private String filter;
@@ -46,12 +47,10 @@ public class ControlledVocabularyTag extends TagSupport
// a tag attribute that specifies the vocabulary to be displayed // a tag attribute that specifies the vocabulary to be displayed
private String vocabulary; private String vocabulary;
// an hashtable containing all the loaded vocabularies
public Map<String, Document> controlledVocabularies;
/** /**
* Process tag * Process tag
*/ */
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
HttpServletRequest request = (HttpServletRequest) pageContext HttpServletRequest request = (HttpServletRequest) pageContext
@@ -69,7 +68,9 @@ public class ControlledVocabularyTag extends TagSupport
+ "vocabulary2html.xsl"; + "vocabulary2html.xsl";
// Load vocabularies on startup // Load vocabularies on startup
controlledVocabularies = (Map<String, Document>) pageContext.getServletContext().getAttribute("controlledvocabulary.controlledVocabularies"); Map<String, Document> controlledVocabularies
= (Map<String, Document>) pageContext.getServletContext()
.getAttribute("controlledvocabulary.controlledVocabularies");
if (controlledVocabularies == null) if (controlledVocabularies == null)
{ {
controlledVocabularies = loadControlledVocabularies(vocabulariesPath); controlledVocabularies = loadControlledVocabularies(vocabulariesPath);
@@ -112,6 +113,7 @@ public class ControlledVocabularyTag extends TagSupport
/** /**
* End processing tag * End processing tag
*/ */
@Override
public int doEndTag() public int doEndTag()
{ {
return EVAL_PAGE; return EVAL_PAGE;
@@ -168,7 +170,7 @@ public class ControlledVocabularyTag extends TagSupport
*/ */
private Map<String, Document> filterVocabularies(Map<String, Document> vocabularies, String vocabularyPrunningXSLT) private Map<String, Document> filterVocabularies(Map<String, Document> vocabularies, String vocabularyPrunningXSLT)
{ {
Map<String, Document> prunnedVocabularies = new HashMap<String, Document>(); Map<String, Document> prunnedVocabularies = new HashMap<>();
for (Map.Entry<String, Document> entry : vocabularies.entrySet()) for (Map.Entry<String, Document> entry : vocabularies.entrySet())
{ {
prunnedVocabularies.put(entry.getKey(), filterVocabulary(entry.getValue(), vocabularyPrunningXSLT, getFilter())); prunnedVocabularies.put(entry.getKey(), filterVocabulary(entry.getValue(), vocabularyPrunningXSLT, getFilter()));
@@ -203,7 +205,7 @@ public class ControlledVocabularyTag extends TagSupport
try try
{ {
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> parameters = new HashMap<>();
parameters.put("allowMultipleSelection", allowMultipleSelection ? "yes" : "no"); parameters.put("allowMultipleSelection", allowMultipleSelection ? "yes" : "no");
parameters.put("contextPath", contextPath); parameters.put("contextPath", contextPath);
result = XMLUtil.transformDocumentAsString(vocabulary, parameters, controlledVocabulary2HtmlXSLT); result = XMLUtil.transformDocumentAsString(vocabulary, parameters, controlledVocabulary2HtmlXSLT);
@@ -236,7 +238,7 @@ public class ControlledVocabularyTag extends TagSupport
try try
{ {
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> parameters = new HashMap<>();
parameters.put("filter", filter); parameters.put("filter", filter);
return XMLUtil.transformDocument(vocabulary, parameters, vocabularyPrunningXSLT); return XMLUtil.transformDocument(vocabulary, parameters, vocabularyPrunningXSLT);
} }
@@ -259,11 +261,12 @@ public class ControlledVocabularyTag extends TagSupport
*/ */
private static Map<String, Document> loadControlledVocabularies(String directory) private static Map<String, Document> loadControlledVocabularies(String directory)
{ {
Map<String, Document> controlledVocabularies = new HashMap<String, Document>(); Map<String, Document> controlledVocabularies = new HashMap<>();
File dir = new File(directory); File dir = new File(directory);
FilenameFilter filter = new FilenameFilter() FilenameFilter filter = new FilenameFilter()
{ {
@Override
public boolean accept(File dir, String name) public boolean accept(File dir, String name)
{ {
return name.endsWith(".xml"); return name.endsWith(".xml");

View File

@@ -55,10 +55,10 @@ import org.dspace.sort.SortOption;
*/ */
public class ItemListTag extends TagSupport public class ItemListTag extends TagSupport
{ {
private static Logger log = Logger.getLogger(ItemListTag.class); private static final Logger log = Logger.getLogger(ItemListTag.class);
/** Items to display */ /** Items to display */
private transient List<Item> items; private List<Item> items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -101,13 +101,16 @@ public class ItemListTag extends TagSupport
private transient SortOption sortOption = null; private transient SortOption sortOption = null;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private static final long serialVersionUID = 348762897199116432L; private static final long serialVersionUID = 348762897199116432L;
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); private final transient MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
static static
{ {
@@ -149,6 +152,7 @@ public class ItemListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -430,7 +434,7 @@ public class ItemListTag extends TagSupport
// save on a null check which would make the code untidy // save on a null check which would make the code untidy
if (metadataArray == null) if (metadataArray == null)
{ {
metadataArray = new ArrayList<MetadataValue>(); metadataArray = new ArrayList<>();
} }
// now prepare the content of the table division // now prepare the content of the table division
@@ -726,6 +730,7 @@ public class ItemListTag extends TagSupport
emphColumn = emphColumnIn; emphColumn = emphColumnIn;
} }
@Override
public void release() public void release()
{ {
highlightRow = -1; highlightRow = -1;

View File

@@ -37,17 +37,19 @@ import org.dspace.core.Constants;
public class ItemPreviewTag extends TagSupport public class ItemPreviewTag extends TagSupport
{ {
/** Item to display */ /** Item to display */
private transient Item item; private Item item;
private static final long serialVersionUID = -5535762797556685631L; private static final long serialVersionUID = -5535762797556685631L;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
public ItemPreviewTag() public ItemPreviewTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
if (!ConfigurationManager.getBooleanProperty("webui.preview.enabled")) if (!ConfigurationManager.getBooleanProperty("webui.preview.enabled"))
@@ -124,6 +126,7 @@ public class ItemPreviewTag extends TagSupport
} }
} }
@Override
public void release() public void release()
{ {
item = null; item = null;

View File

@@ -26,7 +26,6 @@ import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.jstl.fmt.LocaleSupport; import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import javax.servlet.jsp.tagext.TagSupport; import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.app.util.DCInputsReaderException; import org.dspace.app.util.DCInputsReaderException;
import org.dspace.app.util.Util; import org.dspace.app.util.Util;
@@ -194,10 +193,10 @@ public class ItemTag extends TagSupport
private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/"; private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/";
/** Item to display */ /** Item to display */
private transient Item item; private Item item;
/** Collections this item appears in */ /** Collections this item appears in */
private transient List<Collection> collections; private List<Collection> collections;
/** The style to use - "default" or "full" */ /** The style to use - "default" or "full" */
private String style; private String style;
@@ -206,38 +205,45 @@ public class ItemTag extends TagSupport
private boolean showThumbs; private boolean showThumbs;
/** Default DC fields to display, in absence of configuration */ /** Default DC fields to display, in absence of configuration */
private static String defaultFields = "dc.title, dc.title.alternative, dc.contributor.*, dc.subject, dc.date.issued(date), dc.publisher, dc.identifier.citation, dc.relation.ispartofseries, dc.description.abstract, dc.description, dc.identifier.govdoc, dc.identifier.uri(link), dc.identifier.isbn, dc.identifier.issn, dc.identifier.ismn, dc.identifier"; private static final String defaultFields
= "dc.title, dc.title.alternative, dc.contributor.*, dc.subject, dc.date.issued(date), dc.publisher, dc.identifier.citation, dc.relation.ispartofseries, dc.description.abstract, dc.description, dc.identifier.govdoc, dc.identifier.uri(link), dc.identifier.isbn, dc.identifier.issn, dc.identifier.ismn, dc.identifier";
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(ItemTag.class); private static final Logger log = Logger.getLogger(ItemTag.class);
private StyleSelection styleSelection = (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class); private final transient StyleSelection styleSelection
= (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class);
/** Hashmap of linked metadata to browse, from dspace.cfg */ /** Hashmap of linked metadata to browse, from dspace.cfg */
private static Map<String,String> linkedMetadata; private static final Map<String,String> linkedMetadata;
/** Hashmap of urn base url resolver, from dspace.cfg */ /** Hashmap of urn base url resolver, from dspace.cfg */
private static Map<String,String> urn2baseurl; private static final Map<String,String> urn2baseurl;
/** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */ /** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)"); private final Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L; private static final long serialVersionUID = -3841266490729417240L;
private MetadataExposureService metadataExposureService = UtilServiceFactory.getInstance().getMetadataExposureService(); private final transient MetadataExposureService metadataExposureService
= UtilServiceFactory.getInstance().getMetadataExposureService();
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); private final transient MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private BundleService bundleService = ContentServiceFactory.getInstance().getBundleService(); private final transient BundleService bundleService
= ContentServiceFactory.getInstance().getBundleService();
private AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService(); private final transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
static { static {
int i; int i;
linkedMetadata = new HashMap<String, String>(); linkedMetadata = new HashMap<>();
String linkMetadata; String linkMetadata;
i = 1; i = 1;
@@ -253,7 +259,7 @@ public class ItemTag extends TagSupport
i++; i++;
} while (linkMetadata != null); } while (linkMetadata != null);
urn2baseurl = new HashMap<String, String>(); urn2baseurl = new HashMap<>();
String urn; String urn;
i = 1; i = 1;
@@ -287,6 +293,7 @@ public class ItemTag extends TagSupport
getThumbSettings(); getThumbSettings();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
try try
@@ -385,6 +392,7 @@ public class ItemTag extends TagSupport
style = styleIn; style = styleIn;
} }
@Override
public void release() public void release()
{ {
style = "default"; style = "default";
@@ -517,7 +525,7 @@ public class ItemTag extends TagSupport
//If the values are in controlled vocabulary and the display value should be shown //If the values are in controlled vocabulary and the display value should be shown
if (isDisplay){ if (isDisplay){
List<String> displayValues = new ArrayList<String>(); List<String> displayValues = new ArrayList<>();
displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale); displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale);
@@ -585,7 +593,7 @@ public class ItemTag extends TagSupport
else else
{ {
String foundUrn = null; String foundUrn = null;
if (!style.equals("resolver")) if (!"resolver".equals(style))
{ {
foundUrn = style; foundUrn = style;
} }

View File

@@ -30,19 +30,21 @@ import org.dspace.authorize.service.ResourcePolicyService;
public class PoliciesListTag extends TagSupport public class PoliciesListTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(PoliciesListTag.class); private static final Logger log = Logger.getLogger(PoliciesListTag.class);
/** Groups to make options list */ /** Groups to make options list */
private transient List<ResourcePolicy> policies = null; private transient List<ResourcePolicy> policies = null;
private transient boolean showButton = true; private boolean showButton = true;
private ResourcePolicyService policyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService(); private final transient ResourcePolicyService policyService
= AuthorizeServiceFactory.getInstance().getResourcePolicyService();
public PoliciesListTag() public PoliciesListTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.policies-list.label_name"); String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.policies-list.label_name");
@@ -137,6 +139,7 @@ public class PoliciesListTag extends TagSupport
} }
@Override
public void release() public void release()
{ {
policies = null; policies = null;

View File

@@ -30,21 +30,23 @@ public class SFXLinkTag extends TagSupport
{ {
/** Item to display SFX link for */ /** Item to display SFX link for */
private transient Item item; private Item item;
/** The fully qualified pathname of the SFX XML file */ /** The fully qualified pathname of the SFX XML file */
private String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator private final String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator
+ "config" + File.separator + "sfx.xml"; + "config" + File.separator + "sfx.xml";
private static final long serialVersionUID = 7028793612957710128L; private static final long serialVersionUID = 7028793612957710128L;
private SFXFileReaderService sfxFileReaderService = SfxServiceFactory.getInstance().getSfxFileReaderService(); private final transient SFXFileReaderService sfxFileReaderService
= SfxServiceFactory.getInstance().getSfxFileReaderService();
public SFXLinkTag() public SFXLinkTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
try try

View File

@@ -47,7 +47,7 @@ public class SelectEPersonTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which eperson/epeople are initially in the list? */ /** Which eperson/epeople are initially in the list? */
private transient EPerson[] epeople; private EPerson[] epeople;
private static final long serialVersionUID = -7323789442034590853L; private static final long serialVersionUID = -7323789442034590853L;

View File

@@ -42,7 +42,7 @@ public class SelectGroupTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which groups are initially in the list? */ /** Which groups are initially in the list? */
private transient Group[] groups; private Group[] groups;
private static final long serialVersionUID = -3330389128849427302L; private static final long serialVersionUID = -3330389128849427302L;
@@ -89,6 +89,7 @@ public class SelectGroupTag extends TagSupport
} }
@Override
public void release() public void release()
{ {
multiple = false; multiple = false;
@@ -96,6 +97,7 @@ public class SelectGroupTag extends TagSupport
} }
@Override
public int doStartTag() public int doStartTag()
throws JspException throws JspException
{ {

View File

@@ -29,12 +29,12 @@ import org.dspace.core.PluginManager;
*/ */
public class AdvancedSearchServlet extends DSpaceServlet public class AdvancedSearchServlet extends DSpaceServlet
{ {
private SearchRequestProcessor internalLogic; private transient SearchRequestProcessor internalLogic;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(AdvancedSearchServlet.class); private static final Logger log = Logger.getLogger(AdvancedSearchServlet.class);
public void init() public AdvancedSearchServlet()
{ {
try try
{ {
@@ -44,7 +44,7 @@ public class AdvancedSearchServlet extends DSpaceServlet
catch (PluginConfigurationError e) catch (PluginConfigurationError e)
{ {
log.warn( log.warn(
"AdvancedSearchServlet not properly configurated, please configure the SearchRequestProcessor plugin", "AdvancedSearchServlet not properly configured -- please configure the SearchRequestProcessor plugin",
e); e);
} }
if (internalLogic == null) if (internalLogic == null)
@@ -53,6 +53,7 @@ public class AdvancedSearchServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -5,9 +5,6 @@
* *
* http://www.dspace.org/license/ * http://www.dspace.org/license/
*/ */
/*
*
*/
package org.dspace.app.webui.servlet; package org.dspace.app.webui.servlet;
@@ -28,7 +25,6 @@ import org.dspace.content.authority.Choices;
import org.dspace.content.authority.ChoicesXMLGenerator; import org.dspace.content.authority.ChoicesXMLGenerator;
import org.dspace.content.authority.factory.ContentAuthorityServiceFactory; import org.dspace.content.authority.factory.ContentAuthorityServiceFactory;
import org.dspace.content.authority.service.ChoiceAuthorityService; import org.dspace.content.authority.service.ChoiceAuthorityService;
import org.dspace.content.authority.service.MetadataAuthorityService;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService; import org.dspace.content.service.CollectionService;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -38,23 +34,17 @@ import org.apache.xml.serializer.Serializer;
import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.OutputPropertiesFactory;
import org.apache.xml.serializer.Method; import org.apache.xml.serializer.Method;
/** /**
* *
* @author bollini * @author bollini
*/ */
public class AuthorityChooseServlet extends DSpaceServlet { public class AuthorityChooseServlet extends DSpaceServlet {
private ChoiceAuthorityService choiceAuthorityService; private final transient ChoiceAuthorityService choiceAuthorityService
= ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
public void init() throws ServletException {
super.init();
choiceAuthorityService = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
@Override @Override
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
process(context, request, response); process(context, request, response);

View File

@@ -43,19 +43,14 @@ import org.dspace.utils.DSpace;
public class BatchImportServlet extends DSpaceServlet public class BatchImportServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BatchImportServlet.class); private static final Logger log = Logger.getLogger(BatchImportServlet.class);
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemImportService itemImportService; private final transient ItemImportService itemImportService
= ItemImportServiceFactory.getInstance().getItemImportService();
@Override
public void init() throws ServletException {
super.init();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
itemImportService = ItemImportServiceFactory.getInstance().getItemImportService();
}
/** /**
* Respond to a post request for metadata bulk importing via csv * Respond to a post request for metadata bulk importing via csv
* *
@@ -68,6 +63,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -93,7 +89,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null; List<Collection> collections = null;
String colIdS = wrapper.getParameter("colId"); String colIdS = wrapper.getParameter("colId");
if (colIdS!=null){ if (colIdS!=null){
collections = new ArrayList<Collection>(); collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS)); collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
} }
@@ -257,6 +253,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -265,7 +262,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null; List<Collection> collections = null;
String colIdS = request.getParameter("colId"); String colIdS = request.getParameter("colId");
if (colIdS!=null){ if (colIdS!=null){
collections = new ArrayList<Collection>(); collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS)); collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
} }
@@ -305,7 +302,7 @@ public class BatchImportServlet extends DSpaceServlet
protected List<String> getRepeatedParameter(HttpServletRequest request, protected List<String> getRepeatedParameter(HttpServletRequest request,
String metadataField, String param) String metadataField, String param)
{ {
List<String> vals = new LinkedList<String>(); List<String> vals = new LinkedList<>();
int i = 1; //start index at the first of the previously entered values int i = 1; //start index at the first of the previously entered values
boolean foundLast = false; boolean foundLast = false;

View File

@@ -32,7 +32,6 @@ import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.core.Utils; import org.dspace.core.Utils;
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.dspace.usage.UsageEvent; import org.dspace.usage.UsageEvent;
@@ -51,7 +50,7 @@ import org.dspace.utils.DSpace;
public class BitstreamServlet extends DSpaceServlet public class BitstreamServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BitstreamServlet.class); private static final Logger log = Logger.getLogger(BitstreamServlet.class);
/** /**
* Threshold on Bitstream size before content-disposition will be set. * Threshold on Bitstream size before content-disposition will be set.
@@ -59,17 +58,17 @@ public class BitstreamServlet extends DSpaceServlet
private int threshold; private int threshold;
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
@Override @Override
public void init(ServletConfig arg0) throws ServletException { public void init(ServletConfig arg0) throws ServletException {
super.init(arg0); super.init(arg0);
threshold = ConfigurationManager threshold = ConfigurationManager
.getIntProperty("webui.content_disposition_threshold"); .getIntProperty("webui.content_disposition_threshold");
handleService = HandleServiceFactory.getInstance().getHandleService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
} }
@Override @Override

View File

@@ -23,13 +23,9 @@ import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.service.SubscribeService;
import org.dspace.handle.service.HandleService;
/** /**
* Servlet for listing communities (and collections within them) * Servlet for listing communities (and collections within them)
@@ -40,20 +36,13 @@ import org.dspace.handle.service.HandleService;
public class CommunityListServlet extends DSpaceServlet public class CommunityListServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(CommunityListServlet.class); private static final Logger log = Logger.getLogger(CommunityListServlet.class);
// services API // services API
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private CollectionService collectionService;
@Override @Override
public void init() throws ServletException {
super.init();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -64,8 +53,8 @@ public class CommunityListServlet extends DSpaceServlet
// This will map communityIDs to arrays of sub-communities // This will map communityIDs to arrays of sub-communities
Map<String, List<Community>> commMap; Map<String, List<Community>> commMap;
colMap = new HashMap<String, List<Collection>>(); colMap = new HashMap<>();
commMap = new HashMap<String, List<Community>>(); commMap = new HashMap<>();
log.info(LogManager.getHeader(context, "view_community_list", "")); log.info(LogManager.getHeader(context, "view_community_list", ""));

View File

@@ -45,7 +45,7 @@ import org.dspace.search.QueryResults;
public class ControlledVocabularySearchServlet extends DSpaceServlet public class ControlledVocabularySearchServlet extends DSpaceServlet
{ {
// the log // the log
private static Logger log = Logger private static final Logger log = Logger
.getLogger(ControlledVocabularySearchServlet.class); .getLogger(ControlledVocabularySearchServlet.class);
// the jsp that displays the HTML version of controlled-vocabulary // the jsp that displays the HTML version of controlled-vocabulary
@@ -54,19 +54,16 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
// the jsp that will show the search results // the jsp that will show the search results
private static final String RESULTS_JSP = "/controlledvocabulary/results.jsp"; private static final String RESULTS_JSP = "/controlledvocabulary/results.jsp";
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
@Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
}
/** /**
* Handles requests * Handles requests
*/ */
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -104,7 +101,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
*/ */
private List<String> extractKeywords(HttpServletRequest request) private List<String> extractKeywords(HttpServletRequest request)
{ {
List<String> keywords = new ArrayList<String>(); List<String> keywords = new ArrayList<>();
Enumeration enumeration = request.getParameterNames(); Enumeration enumeration = request.getParameterNames();
while (enumeration.hasMoreElements()) while (enumeration.hasMoreElements())
{ {
@@ -143,9 +140,9 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
start = 0; start = 0;
} }
List<String> itemHandles = new ArrayList<String>(); List<String> itemHandles = new ArrayList<>();
List<String> collectionHandles = new ArrayList<String>(); List<String> collectionHandles = new ArrayList<>();
List<String> communityHandles = new ArrayList<String>(); List<String> communityHandles = new ArrayList<>();
Item[] resultsItems; Item[] resultsItems;
Collection[] resultsCollections; Collection[] resultsCollections;
@@ -219,7 +216,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
Integer myType = qResults.getHitTypes().get(i); Integer myType = qResults.getHitTypes().get(i);
// add the handle to the appropriate lists // add the handle to the appropriate lists
switch (myType.intValue()) switch (myType)
{ {
case Constants.ITEM: case Constants.ITEM:
itemHandles.add(myHandle); itemHandles.add(myHandle);
@@ -317,10 +314,10 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
request.setAttribute("communities", resultsCommunities); request.setAttribute("communities", resultsCommunities);
request.setAttribute("collections", resultsCollections); request.setAttribute("collections", resultsCollections);
request.setAttribute("pagetotal", Integer.valueOf(pageTotal)); request.setAttribute("pagetotal", pageTotal);
request.setAttribute("pagecurrent", Integer.valueOf(pageCurrent)); request.setAttribute("pagecurrent", pageCurrent);
request.setAttribute("pagelast", Integer.valueOf(pageLast)); request.setAttribute("pagelast", pageLast);
request.setAttribute("pagefirst", Integer.valueOf(pageFirst)); request.setAttribute("pagefirst", pageFirst);
request.setAttribute("queryresults", qResults); request.setAttribute("queryresults", qResults);
@@ -358,6 +355,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
/** /**
* Handle posts * Handle posts
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -61,22 +61,19 @@ public class DSpaceServlet extends HttpServlet
*/ */
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(DSpaceServlet.class); private static final Logger log = Logger.getLogger(DSpaceServlet.class);
protected AuthorizeService authorizeService; protected transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
}
protected void doGet(HttpServletRequest request, protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException HttpServletResponse response) throws ServletException, IOException
{ {
processRequest(request, response); processRequest(request, response);
} }
@Override
protected void doPost(HttpServletRequest request, protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException HttpServletResponse response) throws ServletException, IOException
{ {

View File

@@ -43,16 +43,12 @@ import org.dspace.statistics.content.StatisticsTable;
public class DisplayStatisticsServlet extends DSpaceServlet public class DisplayStatisticsServlet extends DSpaceServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(DisplayStatisticsServlet.class); private static final Logger log = Logger.getLogger(DisplayStatisticsServlet.class);
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
@Override @Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -157,7 +153,6 @@ public class DisplayStatisticsServlet extends DSpaceServlet
try try
{ {
StatisticsTable statisticsTable = new StatisticsTable(new StatisticsDataVisits(dso)); StatisticsTable statisticsTable = new StatisticsTable(new StatisticsDataVisits(dso));
statisticsTable.setTitle("Total Visits Per Month"); statisticsTable.setTitle("Total Visits Per Month");

View File

@@ -33,17 +33,12 @@ import org.dspace.eperson.service.EPersonService;
public class EditProfileServlet extends DSpaceServlet public class EditProfileServlet extends DSpaceServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(EditProfileServlet.class); private static final Logger log = Logger.getLogger(EditProfileServlet.class);
protected EPersonService personService; protected transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override @Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -57,6 +52,7 @@ public class EditProfileServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/register/edit-profile.jsp"); JSPManager.showJSP(request, response, "/register/edit-profile.jsp");
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -99,7 +95,7 @@ public class EditProfileServlet extends DSpaceServlet
personService.update(context, eperson); personService.update(context, eperson);
// Show confirmation // Show confirmation
request.setAttribute("password.updated", Boolean.valueOf(settingPassword)); request.setAttribute("password.updated", settingPassword);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/register/profile-updated.jsp"); "/register/profile-updated.jsp");

View File

@@ -28,8 +28,6 @@ import org.apache.log4j.Logger;
import org.dspace.app.util.SyndicationFeed; import org.dspace.app.util.SyndicationFeed;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.browse.BrowseEngine; import org.dspace.browse.BrowseEngine;
import org.dspace.browse.BrowseException; import org.dspace.browse.BrowseException;
import org.dspace.browse.BrowseIndex; import org.dspace.browse.BrowseIndex;
@@ -43,15 +41,11 @@ import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService; import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.GroupService;
import org.dspace.eperson.service.SubscribeService;
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.dspace.search.Harvest; import org.dspace.search.Harvest;
@@ -66,7 +60,6 @@ import com.sun.syndication.io.FeedException;
* Currently supports only RSS feed formats. * Currently supports only RSS feed formats.
* *
* @author Ben Bosman, Richard Rodgers * @author Ben Bosman, Richard Rodgers
* @version $Revision$
*/ */
public class FeedServlet extends DSpaceServlet public class FeedServlet extends DSpaceServlet
{ {
@@ -76,9 +69,9 @@ public class FeedServlet extends DSpaceServlet
// one hour in milliseconds // one hour in milliseconds
private static final long HOUR_MSECS = 60 * 60 * 1000; private static final long HOUR_MSECS = 60 * 60 * 1000;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(FeedServlet.class); private static final Logger log = Logger.getLogger(FeedServlet.class);
private String clazz = "org.dspace.app.webui.servlet.FeedServlet";
private static final String clazz = "org.dspace.app.webui.servlet.FeedServlet";
// are syndication feeds enabled? // are syndication feeds enabled?
private static boolean enabled = false; private static boolean enabled = false;
@@ -96,17 +89,14 @@ public class FeedServlet extends DSpaceServlet
private static boolean includeAll = true; private static boolean includeAll = true;
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private AuthorizeService authorizeService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private SubscribeService subscribeService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemService itemService;
private CommunityService communityService;
private CollectionService collectionService;
static static
{ {
@@ -118,7 +108,7 @@ public class FeedServlet extends DSpaceServlet
String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats"); String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats");
if ( fmtsStr != null ) if ( fmtsStr != null )
{ {
formats = new ArrayList<String>(); formats = new ArrayList<>();
String[] fmts = fmtsStr.split(","); String[] fmts = fmtsStr.split(",");
for (int i = 0; i < fmts.length; i++) for (int i = 0; i < fmts.length; i++)
{ {
@@ -130,22 +120,13 @@ public class FeedServlet extends DSpaceServlet
cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size"); cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size");
if (cacheSize > 0) if (cacheSize > 0)
{ {
feedCache = new HashMap<String, CacheFeed>(); feedCache = new HashMap<>();
cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age"); cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age");
} }
} }
} }
@Override @Override
public void init() throws ServletException {
handleService = HandleServiceFactory.getInstance().getHandleService();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
itemService = ContentServiceFactory.getInstance().getItemService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -158,7 +139,7 @@ public class FeedServlet extends DSpaceServlet
// build label map from localized Messages resource bundle // build label map from localized Messages resource bundle
Locale locale = request.getLocale(); Locale locale = request.getLocale();
ResourceBundle msgs = ResourceBundle.getBundle("Messages", locale); ResourceBundle msgs = ResourceBundle.getBundle("Messages", locale);
Map<String, String> labelMap = new HashMap<String, String>(); Map<String, String> labelMap = new HashMap<>();
labelMap.put(SyndicationFeed.MSG_UNTITLED, msgs.getString(clazz + ".notitle")); labelMap.put(SyndicationFeed.MSG_UNTITLED, msgs.getString(clazz + ".notitle"));
labelMap.put(SyndicationFeed.MSG_LOGO_TITLE, msgs.getString(clazz + ".logo.title")); labelMap.put(SyndicationFeed.MSG_LOGO_TITLE, msgs.getString(clazz + ".logo.title"));
labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, msgs.getString(clazz + ".general-feed.description")); labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, msgs.getString(clazz + ".general-feed.description"));
@@ -354,7 +335,7 @@ public class FeedServlet extends DSpaceServlet
// Check to see if we can include this item // Check to see if we can include this item
//Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, results[i], Constants.READ); //Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, results[i], Constants.READ);
//boolean added = false; //boolean added = false;
List<Item> items = new ArrayList<Item>(); List<Item> items = new ArrayList<>();
for (Item result : results) for (Item result : results)
{ {
checkAccess: checkAccess:

View File

@@ -59,20 +59,20 @@ import org.dspace.utils.DSpace;
public class HTMLServlet extends DSpaceServlet public class HTMLServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(HTMLServlet.class); private static final Logger log = Logger.getLogger(HTMLServlet.class);
/** /**
* Default maximum number of path elements to strip when testing if a * Default maximum number of path elements to strip when testing if a
* bitstream called "foo.html" should be served when "xxx/yyy/zzz/foo.html" * bitstream called "foo.html" should be served when "xxx/yyy/zzz/foo.html"
* is requested. * is requested.
*/ */
private int maxDepthGuess; private final int maxDepthGuess;
private ItemService itemService; private final transient ItemService itemService;
private HandleService handleService; private final transient HandleService handleService;
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService;
/** /**
* Create an HTML Servlet * Create an HTML Servlet
@@ -122,6 +122,7 @@ public class HTMLServlet extends DSpaceServlet
// On the surface it doesn't make much sense for this servlet to // On the surface it doesn't make much sense for this servlet to
// handle POST requests, but in practice some HTML pages which // handle POST requests, but in practice some HTML pages which
// are actually JSP get called on with a POST, so it's needed. // are actually JSP get called on with a POST, so it's needed.
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -129,6 +130,7 @@ public class HTMLServlet extends DSpaceServlet
doDSGet(context, request, response); doDSGet(context, request, response);
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -27,8 +27,6 @@ import org.dspace.app.webui.util.Authenticate;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.DSpaceObject; import org.dspace.content.DSpaceObject;
@@ -77,38 +75,30 @@ import org.jdom.output.XMLOutputter;
public class HandleServlet extends DSpaceServlet public class HandleServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(HandleServlet.class); private static final Logger log = Logger.getLogger(HandleServlet.class);
/** For obtaining &lt;meta&gt; elements to put in the &lt;head&gt; */ /** For obtaining &lt;meta&gt; elements to put in the &lt;head&gt; */
private DisseminationCrosswalk xHTMLHeadCrosswalk; private final transient DisseminationCrosswalk xHTMLHeadCrosswalk
= (DisseminationCrosswalk) PluginManager
.getNamedPlugin(DisseminationCrosswalk.class, "XHTML_HEAD_ITEM");
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private SubscribeService subscribeService; private final transient SubscribeService subscribeService
= EPersonServiceFactory.getInstance().getSubscribeService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
public HandleServlet()
{
super();
xHTMLHeadCrosswalk = (DisseminationCrosswalk) PluginManager
.getNamedPlugin(DisseminationCrosswalk.class, "XHTML_HEAD_ITEM");
}
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
itemService = ContentServiceFactory.getInstance().getItemService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -469,7 +459,7 @@ public class HandleServlet extends DSpaceServlet
else else
{ {
// check whether there is a logged in user // check whether there is a logged in user
suggestEnable = (context.getCurrentUser() == null ? false : true); suggestEnable = (context.getCurrentUser() != null);
} }
} }
@@ -482,8 +472,8 @@ public class HandleServlet extends DSpaceServlet
item)); item));
// Set attributes and display // Set attributes and display
request.setAttribute("suggest.enable", Boolean.valueOf(suggestEnable)); request.setAttribute("suggest.enable", suggestEnable);
request.setAttribute("display.all", Boolean.valueOf(displayAll)); request.setAttribute("display.all", displayAll);
request.setAttribute("item", item); request.setAttribute("item", item);
request.setAttribute("collections", collections); request.setAttribute("collections", collections);
request.setAttribute("dspace.layout.head", headMetadata); request.setAttribute("dspace.layout.head", headMetadata);
@@ -716,8 +706,8 @@ public class HandleServlet extends DSpaceServlet
// Forward to collection home page // Forward to collection home page
request.setAttribute("collection", collection); request.setAttribute("collection", collection);
request.setAttribute("community", community); request.setAttribute("community", community);
request.setAttribute("logged.in", Boolean.valueOf(e != null)); request.setAttribute("logged.in", e != null);
request.setAttribute("subscribed", Boolean.valueOf(subscribed)); request.setAttribute("subscribed", subscribed);
JSPManager.showJSP(request, response, "/collection-home.jsp"); JSPManager.showJSP(request, response, "/collection-home.jsp");
if (updated) if (updated)
@@ -823,7 +813,7 @@ public class HandleServlet extends DSpaceServlet
List<Community> parents = communityService.getAllParents(context, c); List<Community> parents = communityService.getAllParents(context, c);
// put into an array in reverse order // put into an array in reverse order
List<Community> reversedParents = new ArrayList<Community>(); List<Community> reversedParents = new ArrayList<>();
int index = parents.size() - 1; int index = parents.size() - 1;
for (int i = 0; i < parents.size(); i++) for (int i = 0; i < parents.size(); i++)

View File

@@ -38,15 +38,10 @@ import org.dspace.core.Utils;
*/ */
public class ItemExportArchiveServlet extends DSpaceServlet { public class ItemExportArchiveServlet extends DSpaceServlet {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(ItemExportArchiveServlet.class); private static final Logger log = Logger.getLogger(ItemExportArchiveServlet.class);
private ItemExportService itemExportService; private final transient ItemExportService itemExportService
= ItemExportServiceFactory.getInstance().getItemExportService();
@Override
public void init() throws ServletException {
super.init();
itemExportService = ItemExportServiceFactory.getInstance().getItemExportService();
}
@Override @Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,

View File

@@ -20,6 +20,7 @@ import org.apache.log4j.Logger;
import org.dspace.app.webui.util.Authenticate; import org.dspace.app.webui.util.Authenticate;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.authenticate.AuthenticationMethod; import org.dspace.authenticate.AuthenticationMethod;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.authenticate.service.AuthenticationService; import org.dspace.authenticate.service.AuthenticationService;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
@@ -38,16 +39,12 @@ import org.dspace.core.LogManager;
public class LDAPServlet extends DSpaceServlet public class LDAPServlet extends DSpaceServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(LDAPServlet.class); private static final Logger log = Logger.getLogger(LDAPServlet.class);
private AuthenticationService authenticationService; private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
@Override @Override
public void init() throws ServletException {
super.init();
}
protected void doDSGet(Context context, protected void doDSGet(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
@@ -66,6 +63,7 @@ public class LDAPServlet extends DSpaceServlet
} }
@Override
protected void doDSPost(Context context, protected void doDSPost(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)

View File

@@ -43,18 +43,13 @@ import org.dspace.handle.service.HandleService;
public class MetadataExportServlet extends DSpaceServlet public class MetadataExportServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(MetadataExportServlet.class); private static final Logger log = Logger.getLogger(MetadataExportServlet.class);
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
@Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
itemService = ContentServiceFactory.getInstance().getItemService();
}
/** /**
* Respond to a post request * Respond to a post request
@@ -68,6 +63,7 @@ public class MetadataExportServlet extends DSpaceServlet
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -83,7 +79,7 @@ public class MetadataExportServlet extends DSpaceServlet
{ {
if (thing.getType() == Constants.ITEM) if (thing.getType() == Constants.ITEM)
{ {
List<Item> item = new ArrayList<Item>(); List<Item> item = new ArrayList<>();
item.add((Item) thing); item.add((Item) thing);
exporter = new MetadataExport(context, item.iterator(), false); exporter = new MetadataExport(context, item.iterator(), false);
} }

View File

@@ -71,7 +71,7 @@ import org.dspace.workflowbasic.service.BasicWorkflowService;
public class MyDSpaceServlet extends DSpaceServlet public class MyDSpaceServlet extends DSpaceServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(MyDSpaceServlet.class); private static final Logger log = Logger.getLogger(MyDSpaceServlet.class);
/** The main screen */ /** The main screen */
public static final int MAIN_PAGE = 0; public static final int MAIN_PAGE = 0;
@@ -96,44 +96,40 @@ public class MyDSpaceServlet extends DSpaceServlet
public static final int REQUEST_BATCH_IMPORT_ACTION = 7; public static final int REQUEST_BATCH_IMPORT_ACTION = 7;
private WorkspaceItemService workspaceItemService; private final transient WorkspaceItemService workspaceItemService
= ContentServiceFactory.getInstance().getWorkspaceItemService();
private BasicWorkflowService workflowService; private final transient BasicWorkflowService workflowService
= BasicWorkflowServiceFactory.getInstance().getBasicWorkflowService();
private BasicWorkflowItemService workflowItemService; private final transient BasicWorkflowItemService workflowItemService
= BasicWorkflowServiceFactory.getInstance().getBasicWorkflowItemService();
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private ItemExportService itemExportService; private final transient ItemExportService itemExportService
= ItemExportServiceFactory.getInstance().getItemExportService();
private ItemImportService itemImportService; private final transient ItemImportService itemImportService
= ItemImportServiceFactory.getInstance().getItemImportService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private SupervisedItemService supervisedItemService; private final transient SupervisedItemService supervisedItemService
= ContentServiceFactory.getInstance().getSupervisedItemService();
@Override @Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
itemService = ContentServiceFactory.getInstance().getItemService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
workflowService = BasicWorkflowServiceFactory.getInstance().getBasicWorkflowService();
workflowItemService = BasicWorkflowServiceFactory.getInstance().getBasicWorkflowItemService();
itemExportService = ItemExportServiceFactory.getInstance().getItemExportService();
itemImportService = ItemImportServiceFactory.getInstance().getItemImportService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
supervisedItemService = ContentServiceFactory.getInstance().getSupervisedItemService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -142,6 +138,7 @@ public class MyDSpaceServlet extends DSpaceServlet
showMainPage(context, request, response); showMainPage(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -886,7 +883,7 @@ public class MyDSpaceServlet extends DSpaceServlet
request.setAttribute("workflow.owned", ownedList); request.setAttribute("workflow.owned", ownedList);
request.setAttribute("workflow.pooled", pooledList); request.setAttribute("workflow.pooled", pooledList);
request.setAttribute("group.memberships", memberships); request.setAttribute("group.memberships", memberships);
request.setAttribute("display.groupmemberships", Boolean.valueOf(displayMemberships)); request.setAttribute("display.groupmemberships", displayMemberships);
request.setAttribute("supervised.items", supervisedItems); request.setAttribute("supervised.items", supervisedItems);
request.setAttribute("export.archives", exportArchives); request.setAttribute("export.archives", exportArchives);
request.setAttribute("import.uploads", importUploads); request.setAttribute("import.uploads", importUploads);
@@ -911,7 +908,7 @@ public class MyDSpaceServlet extends DSpaceServlet
AuthorizeException AuthorizeException
{ {
// Turn the iterator into a list // Turn the iterator into a list
List<Item> subList = new LinkedList<Item>(); List<Item> subList = new LinkedList<>();
Iterator<Item> subs = itemService.findBySubmitter(context, context Iterator<Item> subs = itemService.findBySubmitter(context, context
.getCurrentUser()); .getCurrentUser());

View File

@@ -38,13 +38,15 @@ public class OpenSearchServlet extends DSpaceServlet
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private SearchRequestProcessor internalLogic; private transient SearchRequestProcessor internalLogic;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(OpenSearchServlet.class); private static final Logger log = Logger.getLogger(OpenSearchServlet.class);
public void init() public OpenSearchServlet()
{ {
super();
try try
{ {
internalLogic = (SearchRequestProcessor) PluginManager internalLogic = (SearchRequestProcessor) PluginManager
@@ -62,6 +64,7 @@ public class OpenSearchServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -41,16 +41,12 @@ import org.dspace.core.LogManager;
public class PasswordServlet extends DSpaceServlet public class PasswordServlet extends DSpaceServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(PasswordServlet.class); private static final Logger log = Logger.getLogger(PasswordServlet.class);
private AuthenticationService authenticationService; private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
@Override @Override
public void init() throws ServletException {
super.init();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -59,6 +55,7 @@ public class PasswordServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/login/password.jsp"); JSPManager.showJSP(request, response, "/login/password.jsp");
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -57,7 +57,7 @@ import com.sun.mail.smtp.SMTPAddressFailedException;
public class RegisterServlet extends EditProfileServlet public class RegisterServlet extends EditProfileServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(RegisterServlet.class); private static final Logger log = Logger.getLogger(RegisterServlet.class);
/** The "enter e-mail" step */ /** The "enter e-mail" step */
public static final int ENTER_EMAIL_PAGE = 1; public static final int ENTER_EMAIL_PAGE = 1;
@@ -71,22 +71,24 @@ public class RegisterServlet extends EditProfileServlet
/** true = registering users, false = forgotten passwords */ /** true = registering users, false = forgotten passwords */
private boolean registering; private boolean registering;
/** ldap is enabled */ /** LDAP is enabled */
private boolean ldap_enabled; private boolean ldap_enabled;
private AuthenticationService authenticationService; private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
private AccountService accountService; private final transient AccountService accountService
= EPersonServiceFactory.getInstance().getAccountService();
@Override
public void init() throws ServletException public void init() throws ServletException
{ {
super.init(); super.init();
registering = getInitParameter("register").equalsIgnoreCase("true"); registering = getInitParameter("register").equalsIgnoreCase("true");
ldap_enabled = ConfigurationManager.getBooleanProperty("authentication-ldap", "enable"); ldap_enabled = ConfigurationManager.getBooleanProperty("authentication-ldap", "enable");
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
accountService = EPersonServiceFactory.getInstance().getAccountService();
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -143,7 +145,7 @@ public class RegisterServlet extends EditProfileServlet
// Indicate if user can set password // Indicate if user can set password
boolean setPassword = boolean setPassword =
authenticationService.allowSetPassword(context, request, email); authenticationService.allowSetPassword(context, request, email);
request.setAttribute("set.password", Boolean.valueOf(setPassword)); request.setAttribute("set.password", setPassword);
// Forward to "personal info page" // Forward to "personal info page"
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
@@ -166,6 +168,7 @@ public class RegisterServlet extends EditProfileServlet
} }
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -544,13 +547,13 @@ public class RegisterServlet extends EditProfileServlet
request.setAttribute("token", token); request.setAttribute("token", token);
request.setAttribute("eperson", eperson); request.setAttribute("eperson", eperson);
request.setAttribute("netid", netid); request.setAttribute("netid", netid);
request.setAttribute("missing.fields", Boolean.valueOf(!infoOK)); request.setAttribute("missing.fields", !infoOK);
request.setAttribute("password.problem", Boolean.valueOf(!passwordOK)); request.setAttribute("password.problem", !passwordOK);
// Indicate if user can set password // Indicate if user can set password
boolean setPassword = authenticationService.allowSetPassword( boolean setPassword = authenticationService.allowSetPassword(
context, request, email); context, request, email);
request.setAttribute("set.password", Boolean.valueOf(setPassword)); request.setAttribute("set.password", setPassword);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/register/registration-form.jsp"); "/register/registration-form.jsp");

View File

@@ -55,15 +55,15 @@ import org.dspace.utils.DSpace;
public class RequestItemServlet extends DSpaceServlet public class RequestItemServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(RequestItemServlet.class); private static final Logger log = Logger.getLogger(RequestItemServlet.class);
/** The information get by form step */ /** The information get by form step */
public static final int ENTER_FORM_PAGE = 1; public static final int ENTER_FORM_PAGE = 1;
/** The link by submmiter email step*/ /** The link by submitter email step*/
public static final int ENTER_TOKEN = 2; public static final int ENTER_TOKEN = 2;
/** The link Aproved genarate letter step*/ /** The link Approved generate letter step*/
public static final int APROVE_TOKEN = 3; public static final int APROVE_TOKEN = 3;
/* resume leter for request user*/ /* resume leter for request user*/
@@ -72,23 +72,19 @@ public class RequestItemServlet extends DSpaceServlet
/* resume leter for request dspace administrator*/ /* resume leter for request dspace administrator*/
public static final int RESUME_FREEACESS = 5; public static final int RESUME_FREEACESS = 5;
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private RequestItemService requestItemService; private final transient RequestItemService requestItemService
= RequestItemServiceFactory.getInstance().getRequestItemService();
@Override @Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
handleService = HandleServiceFactory.getInstance().getHandleService();
requestItemService = RequestItemServiceFactory.getInstance().getRequestItemService();
}
protected void doDSGet(Context context, protected void doDSGet(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
@@ -132,6 +128,7 @@ public class RequestItemServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSPost(Context context, protected void doDSPost(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
@@ -213,7 +210,7 @@ public class RequestItemServlet extends DSpaceServlet
request.setAttribute("title", title); request.setAttribute("title", title);
request.setAttribute("allfiles", allfiles?"true":null); request.setAttribute("allfiles", allfiles?"true":null);
request.setAttribute("requestItem.problem", new Boolean(true)); request.setAttribute("requestItem.problem", Boolean.TRUE);
JSPManager.showJSP(request, response, "/requestItem/request-form.jsp"); JSPManager.showJSP(request, response, "/requestItem/request-form.jsp");
return; return;
} }
@@ -550,9 +547,11 @@ public class RequestItemServlet extends DSpaceServlet
{ {
String base = ConfigurationManager.getProperty("dspace.url"); String base = ConfigurationManager.getProperty("dspace.url");
String specialLink = (new StringBuffer()).append(base).append( String specialLink = (new StringBuffer()).append(base)
base.endsWith("/") ? "" : "/").append( .append(base.endsWith("/") ? "" : "/")
"request-item").append("?step=" + RequestItemServlet.ENTER_TOKEN) .append("request-item")
.append("?step=")
.append(RequestItemServlet.ENTER_TOKEN)
.append("&token=") .append("&token=")
.append(token) .append(token)
.toString(); .toString();

View File

@@ -43,14 +43,15 @@ import org.dspace.utils.DSpace;
public class RetrieveServlet extends DSpaceServlet public class RetrieveServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(RetrieveServlet.class); private static final Logger log = Logger.getLogger(RetrieveServlet.class);
/** /**
* Threshold on Bitstream size before content-disposition will be set. * Threshold on Bitstream size before content-disposition will be set.
*/ */
private int threshold; private int threshold;
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
@Override @Override
public void init(ServletConfig arg0) throws ServletException { public void init(ServletConfig arg0) throws ServletException {
@@ -58,9 +59,9 @@ public class RetrieveServlet extends DSpaceServlet
super.init(arg0); super.init(arg0);
threshold = ConfigurationManager threshold = ConfigurationManager
.getIntProperty("webui.content_disposition_threshold"); .getIntProperty("webui.content_disposition_threshold");
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -32,7 +32,7 @@ import org.dspace.core.Context;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
/** /**
* This servlet use the SHERPASubmitService to build an html page with the * This servlet uses the SHERPASubmitService to build an html page with the
* publisher policy for the journal referred in the specified Item * publisher policy for the journal referred in the specified Item
* *
* @author Andrea Bollini * @author Andrea Bollini
@@ -40,23 +40,19 @@ import org.dspace.utils.DSpace;
*/ */
public class SHERPAPublisherPolicyServlet extends DSpaceServlet public class SHERPAPublisherPolicyServlet extends DSpaceServlet
{ {
private SHERPASubmitService sherpaSubmitService = new DSpace() private final transient SHERPASubmitService sherpaSubmitService
.getServiceManager().getServiceByName( = new DSpace().getServiceManager().getServiceByName(
SHERPASubmitService.class.getCanonicalName(), SHERPASubmitService.class.getCanonicalName(),
SHERPASubmitService.class); SHERPASubmitService.class);
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
/** log4j logger */ /** log4j logger */
private static Logger log = Logger private static final Logger log = Logger
.getLogger(SHERPAPublisherPolicyServlet.class); .getLogger(SHERPAPublisherPolicyServlet.class);
@Override @Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -71,7 +67,7 @@ public class SHERPAPublisherPolicyServlet extends DSpaceServlet
context, item); context, item);
if (shresp.isError()) if (shresp.isError())
{ {
request.setAttribute("error", new Boolean(true)); request.setAttribute("error", Boolean.TRUE);
} }
else else
{ {
@@ -103,6 +99,7 @@ public class SHERPAPublisherPolicyServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/sherpa/sherpa-policy.jsp"); JSPManager.showJSP(request, response, "/sherpa/sherpa-policy.jsp");
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -35,17 +35,14 @@ import org.dspace.utils.DSpace;
* @author Ben Bosman (ben at atmire dot com) * @author Ben Bosman (ben at atmire dot com)
* @author Mark Diggory (markd at atmire dot com) * @author Mark Diggory (markd at atmire dot com)
*/ */
public class SearchResultLogServlet extends DSpaceServlet{ public class SearchResultLogServlet extends DSpaceServlet
private HandleService handleService; {
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
@Override @Override
public void init() throws ServletException { protected void doDSPost(Context context, HttpServletRequest request, HttpServletResponse response)
super.init(); throws ServletException, IOException, SQLException, AuthorizeException {
handleService = HandleServiceFactory.getInstance().getHandleService();
}
@Override
protected void doDSPost(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
String redirectUrl = request.getParameter("redirectUrl"); String redirectUrl = request.getParameter("redirectUrl");
String scopeHandle = request.getParameter("scope"); String scopeHandle = request.getParameter("scope");
DSpaceObject scope = handleService.resolveToObject(context, scopeHandle); DSpaceObject scope = handleService.resolveToObject(context, scopeHandle);

View File

@@ -25,7 +25,7 @@ import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
/** /**
* Shibbolize dspace. Follow instruction at * Shibbolize DSpace. Follow instruction at
* http://mams.melcoe.mq.edu.au/zope/mams/pubs/Installation/dspace15 * http://mams.melcoe.mq.edu.au/zope/mams/pubs/Installation/dspace15
* *
* Pull information from the header as released by Shibboleth target. * Pull information from the header as released by Shibboleth target.
@@ -44,16 +44,12 @@ import org.dspace.core.LogManager;
*/ */
public class ShibbolethServlet extends DSpaceServlet { public class ShibbolethServlet extends DSpaceServlet {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(ShibbolethServlet.class); private static final Logger log = Logger.getLogger(ShibbolethServlet.class);
private AuthenticationService authenticationService; private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
@Override @Override
public void init() throws ServletException {
super.init();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
}
protected void doDSGet(Context context, protected void doDSGet(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)

View File

@@ -29,12 +29,12 @@ import org.dspace.core.PluginManager;
*/ */
public class SimpleSearchServlet extends DSpaceServlet public class SimpleSearchServlet extends DSpaceServlet
{ {
private SearchRequestProcessor internalLogic; private transient SearchRequestProcessor internalLogic;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(SimpleSearchServlet.class); private static final Logger log = Logger.getLogger(SimpleSearchServlet.class);
public void init() public SimpleSearchServlet()
{ {
try try
{ {
@@ -53,6 +53,7 @@ public class SimpleSearchServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -42,13 +40,7 @@ import org.dspace.core.Context;
*/ */
public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServlet public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServlet
{ {
private AuthorizeService authorizeService;
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
}
protected void doDSGet(Context c, protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -57,6 +49,7 @@ public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServle
doDSPost(c, request, response); doDSPost(c, request, response);
} }
@Override
protected void doDSPost(Context c, protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -109,7 +102,7 @@ public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServle
try try
{ {
List<Date> monthsList = new ArrayList<Date>(); List<Date> monthsList = new ArrayList<>();
Pattern monthly = Pattern.compile("report-([0-9][0-9][0-9][0-9]-[0-9]+)\\.html"); Pattern monthly = Pattern.compile("report-([0-9][0-9][0-9][0-9]-[0-9]+)\\.html");
Pattern general = Pattern.compile("report-general-([0-9]+-[0-9]+-[0-9]+)\\.html"); Pattern general = Pattern.compile("report-general-([0-9]+-[0-9]+-[0-9]+)\\.html");

View File

@@ -36,17 +36,13 @@ import org.dspace.eperson.service.SubscribeService;
*/ */
public class SubscribeServlet extends DSpaceServlet public class SubscribeServlet extends DSpaceServlet
{ {
private SubscribeService subscribeService; private final transient SubscribeService subscribeService
= EPersonServiceFactory.getInstance().getSubscribeService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override @Override
public void init() throws ServletException {
super.init();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -55,6 +51,7 @@ public class SubscribeServlet extends DSpaceServlet
showSubscriptions(context, request, response, false); showSubscriptions(context, request, response, false);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -144,7 +141,7 @@ public class SubscribeServlet extends DSpaceServlet
request.setAttribute("availableSubscriptions", avail); request.setAttribute("availableSubscriptions", avail);
request.setAttribute("subscriptions", subs); request.setAttribute("subscriptions", subs);
request.setAttribute("updated", Boolean.valueOf(updated)); request.setAttribute("updated", updated);
JSPManager.showJSP(request, response, "/mydspace/subscriptions.jsp"); JSPManager.showJSP(request, response, "/mydspace/subscriptions.jsp");
} }

View File

@@ -45,19 +45,15 @@ import org.dspace.handle.service.HandleService;
public class SuggestServlet extends DSpaceServlet public class SuggestServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(SuggestServlet.class); private static final Logger log = Logger.getLogger(SuggestServlet.class);
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
@Override @Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
itemService = ContentServiceFactory.getInstance().getItemService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -239,6 +235,7 @@ public class SuggestServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException

View File

@@ -20,8 +20,6 @@ import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.app.webui.util.VersionUtil; import org.dspace.app.webui.util.VersionUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService; import org.dspace.content.service.ItemService;
@@ -31,7 +29,6 @@ import org.dspace.versioning.Version;
import org.dspace.versioning.VersionHistory; import org.dspace.versioning.VersionHistory;
import org.dspace.versioning.factory.VersionServiceFactory; import org.dspace.versioning.factory.VersionServiceFactory;
import org.dspace.versioning.service.VersionHistoryService; import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService;
/** /**
* Servlet for handling the operations in the version history page * Servlet for handling the operations in the version history page
@@ -43,26 +40,15 @@ public class VersionHistoryServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(VersionHistoryServlet.class); private static final Logger log = Logger.getLogger(VersionHistoryServlet.class);
private AuthorizeService authorizeService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private ItemService itemService; private final transient VersionHistoryService versionHistoryService
= VersionServiceFactory.getInstance().getVersionHistoryService();
private VersionHistoryService versionHistoryService;
private VersioningService versioningService;
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
itemService = ContentServiceFactory.getInstance().getItemService();
versionHistoryService = VersionServiceFactory.getInstance().getVersionHistoryService();
versioningService = VersionServiceFactory.getInstance().getVersionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -147,6 +133,7 @@ public class VersionHistoryServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/version-history.jsp"); JSPManager.showJSP(request, response, "/tools/version-history.jsp");
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -35,16 +35,12 @@ public class VersionItemServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(VersionItemServlet.class); private static final Logger log = Logger.getLogger(VersionItemServlet.class);
private ItemService itemService; private final transient ItemService itemService =
ContentServiceFactory.getInstance().getItemService();
@Override @Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
}
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, throws ServletException, IOException, SQLException,
AuthorizeException AuthorizeException
@@ -81,7 +77,7 @@ public class VersionItemServlet extends DSpaceServlet
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -18,8 +18,6 @@ import org.apache.log4j.Logger;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
@@ -41,19 +39,12 @@ public class ViewWorkspaceItemServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(ViewWorkspaceItemServlet.class); private static final Logger log = Logger.getLogger(ViewWorkspaceItemServlet.class);
private AuthorizeService authorizeService; private final transient WorkspaceItemService workspaceItemService
= ContentServiceFactory.getInstance().getWorkspaceItemService();
private WorkspaceItemService workspaceItemService;
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
}
protected void doDSGet(Context c, protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -62,6 +53,7 @@ public class ViewWorkspaceItemServlet
doDSPost(c, request, response); doDSPost(c, request, response);
} }
@Override
protected void doDSPost(Context c, protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -118,10 +110,10 @@ public class ViewWorkspaceItemServlet
// display item JSP for both handled and un-handled items // display item JSP for both handled and un-handled items
// Set attributes and display // Set attributes and display
// request.setAttribute("wsItem", wsItem); // request.setAttribute("wsItem", wsItem);
request.setAttribute("display.all", Boolean.valueOf(displayAll)); request.setAttribute("display.all", displayAll);
request.setAttribute("item", item); request.setAttribute("item", item);
request.setAttribute("collections", collections); request.setAttribute("collections", collections);
request.setAttribute("workspace_id", Integer.valueOf(wsItem.getID())); request.setAttribute("workspace_id", wsItem.getID());
JSPManager.showJSP(request, response, "/display-item.jsp"); JSPManager.showJSP(request, response, "/display-item.jsp");
} }

View File

@@ -18,8 +18,6 @@ import org.apache.log4j.Logger;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
@@ -36,21 +34,13 @@ import org.dspace.core.LogManager;
*/ */
public class WorkspaceServlet extends DSpaceServlet public class WorkspaceServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(WorkspaceServlet.class); private static final Logger log = Logger.getLogger(WorkspaceServlet.class);
private AuthorizeService authorizeService; private final transient WorkspaceItemService workspaceItemService
= ContentServiceFactory.getInstance().getWorkspaceItemService();
private WorkspaceItemService workspaceItemService;
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
}
protected void doDSGet(Context c, protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -59,6 +49,7 @@ public class WorkspaceServlet extends DSpaceServlet
doDSPost(c, request, response); doDSPost(c, request, response);
} }
@Override
protected void doDSPost(Context c, protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException

View File

@@ -59,30 +59,26 @@ import org.dspace.handle.service.HandleService;
*/ */
public class AuthorizeAdminServlet extends DSpaceServlet public class AuthorizeAdminServlet extends DSpaceServlet
{ {
private ItemService itemService; private final transient ItemService itemService
private CollectionService collectionService; = ContentServiceFactory.getInstance().getItemService();
private CommunityService communityService; private final transient CollectionService collectionService
private BundleService bundleService; = ContentServiceFactory.getInstance().getCollectionService();
private BitstreamService bitstreamService; private final transient CommunityService communityService
private GroupService groupService; = ContentServiceFactory.getInstance().getCommunityService();
private EPersonService personService; private final transient BundleService bundleService
private HandleService handleService; = ContentServiceFactory.getInstance().getBundleService();
private ResourcePolicyService resourcePolicyService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private final transient ResourcePolicyService resourcePolicyService
= AuthorizeServiceFactory.getInstance().getResourcePolicyService();
@Override @Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
bundleService = ContentServiceFactory.getInstance().getBundleService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
personService = EPersonServiceFactory.getInstance().getEPersonService();
handleService = HandleServiceFactory.getInstance().getHandleService();
resourcePolicyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService();
}
protected void doDSGet(Context c, HttpServletRequest request, protected void doDSGet(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -94,6 +90,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
// showMainPage(c, request, response); // showMainPage(c, request, response);
} }
@Override
protected void doDSPost(Context c, HttpServletRequest request, protected void doDSPost(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -298,7 +295,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
AuthorizeUtil.authorizeManageItemPolicy(c, item); AuthorizeUtil.authorizeManageItemPolicy(c, item);
// do the remove // do the remove
resourcePolicyService.delete(c, policy);; resourcePolicyService.delete(c, policy);
// show edit form! // show edit form!
prepItemEditForm(c, request, item); prepItemEditForm(c, request, item);
@@ -765,8 +762,8 @@ public class AuthorizeAdminServlet extends DSpaceServlet
List<ResourcePolicy> itemPolicies = authorizeService.getPolicies(c, item); List<ResourcePolicy> itemPolicies = authorizeService.getPolicies(c, item);
// Put bundle and bitstream policies in their own hashes // Put bundle and bitstream policies in their own hashes
Map<UUID, List<ResourcePolicy>> bundlePolicies = new HashMap<UUID, List<ResourcePolicy>>(); Map<UUID, List<ResourcePolicy>> bundlePolicies = new HashMap<>();
Map<UUID, List<ResourcePolicy>> bitstreamPolicies = new HashMap<UUID, List<ResourcePolicy>>(); Map<UUID, List<ResourcePolicy>> bitstreamPolicies = new HashMap<>();
List<Bundle> bundles = item.getBundles(); List<Bundle> bundles = item.getBundles();

View File

@@ -48,14 +48,10 @@ public class BitstreamFormatRegistry extends DSpaceServlet
/** User wants to create a new format */ /** User wants to create a new format */
public static final int CREATE = 4; public static final int CREATE = 4;
private BitstreamFormatService bitstreamFormatService; private final transient BitstreamFormatService bitstreamFormatService
= ContentServiceFactory.getInstance().getBitstreamFormatService();
@Override @Override
public void init() throws ServletException {
super.init();
bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -64,6 +60,7 @@ public class BitstreamFormatRegistry extends DSpaceServlet
showFormats(context, request, response); showFormats(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -86,7 +83,7 @@ public class BitstreamFormatRegistry extends DSpaceServlet
&& request.getParameter("internal").equals("true")); && request.getParameter("internal").equals("true"));
// Separate comma-separated extensions // Separate comma-separated extensions
List<String> extensions = new LinkedList<String>(); List<String> extensions = new LinkedList<>();
String extParam = request.getParameter("extensions"); String extParam = request.getParameter("extensions");
while (extParam.length() > 0) while (extParam.length() > 0)

View File

@@ -44,7 +44,6 @@ import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService; import org.dspace.content.service.ItemService;
import org.dspace.content.service.MetadataFieldService; import org.dspace.content.service.MetadataFieldService;
import org.dspace.content.service.MetadataSchemaService;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
@@ -96,40 +95,33 @@ public class CollectionWizardServlet extends DSpaceServlet
public static final int PERM_ADMIN = 15; public static final int PERM_ADMIN = 15;
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(CollectionWizardServlet.class); private static final Logger log = Logger.getLogger(CollectionWizardServlet.class);
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private EPersonService personService; private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private BitstreamFormatService bitstreamFormatService; private final transient BitstreamFormatService bitstreamFormatService
= ContentServiceFactory.getInstance().getBitstreamFormatService();
private MetadataFieldService metadataFieldService; private final transient MetadataFieldService metadataFieldService
= ContentServiceFactory.getInstance().getMetadataFieldService();
private MetadataSchemaService metadataSchemaService;
@Override @Override
public void init() throws ServletException {
super.init();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
itemService = ContentServiceFactory.getInstance().getItemService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
personService = EPersonServiceFactory.getInstance().getEPersonService();
metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -141,6 +133,7 @@ public class CollectionWizardServlet extends DSpaceServlet
doDSPost(context, request, response); doDSPost(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -664,7 +657,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// be an anonymous one. // be an anonymous one.
if (anonReadPols.size() == 0) if (anonReadPols.size() == 0)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_READ)); request.setAttribute("permission", PERM_READ);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");
@@ -677,7 +670,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined // defined
if (collection.getSubmitters() != null) if (collection.getSubmitters() != null)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_SUBMIT)); request.setAttribute("permission", PERM_SUBMIT);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");
@@ -690,7 +683,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined // defined
if (collection.getWorkflowStep1() != null) if (collection.getWorkflowStep1() != null)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_WF1)); request.setAttribute("permission", PERM_WF1);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");
@@ -703,7 +696,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined // defined
if (collection.getWorkflowStep2() != null) if (collection.getWorkflowStep2() != null)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_WF2)); request.setAttribute("permission", PERM_WF2);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");
@@ -716,7 +709,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined // defined
if (collection.getWorkflowStep3() != null) if (collection.getWorkflowStep3() != null)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_WF3)); request.setAttribute("permission", PERM_WF3);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");
@@ -729,7 +722,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// administrator group // administrator group
if (collection.getAdministrators() != null) if (collection.getAdministrators() != null)
{ {
request.setAttribute("permission", Integer.valueOf(PERM_ADMIN)); request.setAttribute("permission", PERM_ADMIN);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp"); "/dspace-admin/wizard-permissions.jsp");

View File

@@ -52,16 +52,16 @@ public class CurateServlet extends DSpaceServlet
private static final String TASK_QUEUE_NAME = ConfigurationManager.getProperty("curate", "ui.queuename"); private static final String TASK_QUEUE_NAME = ConfigurationManager.getProperty("curate", "ui.queuename");
// curation status codes in Admin UI: key=status code, value=localized name // curation status codes in Admin UI: key=status code, value=localized name
private static final Map<String, String> statusMessages = new HashMap<String, String>(); private static final Map<String, String> statusMessages = new HashMap<>();
// curation tasks to appear in admin UI: key=taskID, value=friendly name // curation tasks to appear in admin UI: key=taskID, value=friendly name
private static Map<String, String> allTasks = new LinkedHashMap<String, String>(); private static Map<String, String> allTasks = new LinkedHashMap<>();
// named groups which display together in admin UI: key=groupID, value=friendly group name // named groups which display together in admin UI: key=groupID, value=friendly group name
private static Map<String, String> taskGroups = new LinkedHashMap<String, String>(); private static Map<String, String> taskGroups = new LinkedHashMap<>();
// group membership: key=groupID, value=array of taskID // group membership: key=groupID, value=array of taskID
private static Map<String, String[]> groupedTasks = new LinkedHashMap<String, String[]>(); private static Map<String, String[]> groupedTasks = new LinkedHashMap<>();
static static
{ {
@@ -79,25 +79,21 @@ public class CurateServlet extends DSpaceServlet
} }
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(CurateServlet.class); private static final Logger log = Logger.getLogger(CurateServlet.class);
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
@Override @Override
public void init() throws ServletException {
super.init();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
itemService = ContentServiceFactory.getInstance().getItemService();
handleService = HandleServiceFactory.getInstance().getHandleService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -105,6 +101,7 @@ public class CurateServlet extends DSpaceServlet
doDSPost(context, request, response); doDSPost(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -47,26 +47,22 @@ import org.dspace.eperson.service.GroupService;
*/ */
public class EPersonAdminServlet extends DSpaceServlet public class EPersonAdminServlet extends DSpaceServlet
{ {
private EPersonService personService; private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private AuthenticationService authenticationService; private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
private AccountService accountService; private final transient AccountService accountService
= EPersonServiceFactory.getInstance().getAccountService();
@Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
accountService = EPersonServiceFactory.getInstance().getAccountService();
}
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(EPersonAdminServlet.class); private static final Logger log = Logger.getLogger(EPersonAdminServlet.class);
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -74,6 +70,7 @@ public class EPersonAdminServlet extends DSpaceServlet
showMain(context, request, response); showMain(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -321,7 +318,7 @@ public class EPersonAdminServlet extends DSpaceServlet
// Check the EPerson exists // Check the EPerson exists
if (e == null) if (e == null)
{ {
request.setAttribute("no_eperson_selected", new Boolean(true)); request.setAttribute("no_eperson_selected", Boolean.TRUE);
showMain(context, request, response); showMain(context, request, response);
} }
// Only super administrators can login as someone else. // Only super administrators can login as someone else.

View File

@@ -32,14 +32,10 @@ import org.dspace.eperson.service.EPersonService;
*/ */
public class EPersonListServlet extends DSpaceServlet public class EPersonListServlet extends DSpaceServlet
{ {
private EPersonService personService; private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override @Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -47,6 +43,7 @@ public class EPersonListServlet extends DSpaceServlet
doDSGet(context, request, response); doDSGet(context, request, response);
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -94,18 +91,18 @@ public class EPersonListServlet extends DSpaceServlet
if (search != null && !search.equals("")) if (search != null && !search.equals(""))
{ {
epeople = personService.search(context, search); epeople = personService.search(context, search);
request.setAttribute("offset", Integer.valueOf(offset)); request.setAttribute("offset", offset);
} }
else else
{ {
// Retrieve the e-people in the specified order // Retrieve the e-people in the specified order
epeople = personService.findAll(context, sortBy); epeople = personService.findAll(context, sortBy);
request.setAttribute("offset", Integer.valueOf(0)); request.setAttribute("offset", 0);
} }
// Set attributes for JSP // Set attributes for JSP
request.setAttribute("sortby", Integer.valueOf(sortBy)); request.setAttribute("sortby", sortBy);
request.setAttribute("first", Integer.valueOf(first)); request.setAttribute("first", first);
request.setAttribute("epeople", epeople); request.setAttribute("epeople", epeople);
request.setAttribute("search", search); request.setAttribute("search", search);

View File

@@ -77,47 +77,43 @@ public class EditCommunitiesServlet extends DSpaceServlet
/** User wants to create a collection */ /** User wants to create a collection */
public static final int START_CREATE_COLLECTION = 6; public static final int START_CREATE_COLLECTION = 6;
/** User commited community edit or creation */ /** User committed community edit or creation */
public static final int CONFIRM_EDIT_COMMUNITY = 7; public static final int CONFIRM_EDIT_COMMUNITY = 7;
/** User confirmed community deletion */ /** User confirmed community deletion */
public static final int CONFIRM_DELETE_COMMUNITY = 8; public static final int CONFIRM_DELETE_COMMUNITY = 8;
/** User commited collection edit or creation */ /** User committed collection edit or creation */
public static final int CONFIRM_EDIT_COLLECTION = 9; public static final int CONFIRM_EDIT_COLLECTION = 9;
/** User wants to delete a collection */ /** User wants to delete a collection */
public static final int CONFIRM_DELETE_COLLECTION = 10; public static final int CONFIRM_DELETE_COLLECTION = 10;
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(EditCommunitiesServlet.class); private static final Logger log = Logger.getLogger(EditCommunitiesServlet.class);
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private static CollectionService collectionService; private static final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private BitstreamFormatService bitstreamFormatService; private final transient BitstreamFormatService bitstreamFormatService
= ContentServiceFactory.getInstance().getBitstreamFormatService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private HarvestedCollectionService harvestedCollectionService; private final transient HarvestedCollectionService harvestedCollectionService
= HarvestServiceFactory.getInstance().getHarvestedCollectionService();
private static AuthorizeService authorizeService; private static final transient AuthorizeService myAuthorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
@Override @Override
public void init() throws ServletException {
super.init();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
harvestedCollectionService = HarvestServiceFactory.getInstance().getHarvestedCollectionService();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -126,6 +122,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
showControls(context, request, response); showControls(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -333,7 +330,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
request.setAttribute("admin_remove_button", Boolean.FALSE); request.setAttribute("admin_remove_button", Boolean.FALSE);
} }
if (authorizeService.authorizeActionBoolean(context, community, Constants.DELETE)) if (myAuthorizeService.authorizeActionBoolean(context, community, Constants.DELETE))
{ {
request.setAttribute("delete_button", Boolean.TRUE); request.setAttribute("delete_button", Boolean.TRUE);
} }
@@ -350,7 +347,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
catch (AuthorizeException authex) { catch (AuthorizeException authex) {
request.setAttribute("policy_button", Boolean.FALSE); request.setAttribute("policy_button", Boolean.FALSE);
} }
if (authorizeService.isAdmin(context, community)) if (myAuthorizeService.isAdmin(context, community))
{ {
request.setAttribute("admin_community", Boolean.TRUE); request.setAttribute("admin_community", Boolean.TRUE);
} }
@@ -373,7 +370,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
static void storeAuthorizeAttributeCollectionEdit(Context context, static void storeAuthorizeAttributeCollectionEdit(Context context,
HttpServletRequest request, Collection collection) throws SQLException HttpServletRequest request, Collection collection) throws SQLException
{ {
if (authorizeService.isAdmin(context, collection)) if (myAuthorizeService.isAdmin(context, collection))
{ {
request.setAttribute("admin_collection", Boolean.TRUE); request.setAttribute("admin_collection", Boolean.TRUE);
} }
@@ -427,7 +424,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
request.setAttribute("template_button", Boolean.FALSE); request.setAttribute("template_button", Boolean.FALSE);
} }
if (authorizeService.authorizeActionBoolean(context, collectionService.getParentObject(context, collection), Constants.REMOVE)) if (myAuthorizeService.authorizeActionBoolean(context, collectionService.getParentObject(context, collection), Constants.REMOVE))
{ {
request.setAttribute("delete_button", Boolean.TRUE); request.setAttribute("delete_button", Boolean.TRUE);
} }
@@ -993,7 +990,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Identify the format // Identify the format
BitstreamFormat bf = bitstreamFormatService.guessFormat(context, logoBS); BitstreamFormat bf = bitstreamFormatService.guessFormat(context, logoBS);
logoBS.setFormat(context, bf); logoBS.setFormat(context, bf);
authorizeService.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser()); myAuthorizeService.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser());
bitstreamService.update(context, logoBS); bitstreamService.update(context, logoBS);
String jsp; String jsp;
@@ -1020,7 +1017,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
jsp = "/tools/edit-collection.jsp"; jsp = "/tools/edit-collection.jsp";
} }
if (authorizeService.isAdmin(context, dso)) if (myAuthorizeService.isAdmin(context, dso))
{ {
// set a variable to show all buttons // set a variable to show all buttons
request.setAttribute("admin_button", Boolean.TRUE); request.setAttribute("admin_button", Boolean.TRUE);

View File

@@ -104,40 +104,36 @@ public class EditItemServlet extends DSpaceServlet
public static final int PUBLICIZE = 11; public static final int PUBLICIZE = 11;
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(EditCommunitiesServlet.class); private static final Logger log = Logger.getLogger(EditCommunitiesServlet.class);
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private BitstreamFormatService bitstreamFormatService; private final transient BitstreamFormatService bitstreamFormatService
= ContentServiceFactory.getInstance().getBitstreamFormatService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private BundleService bundleService; private final transient BundleService bundleService
= ContentServiceFactory.getInstance().getBundleService();
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private MetadataFieldService metadataFieldService; private final transient MetadataFieldService metadataFieldService
= ContentServiceFactory.getInstance().getMetadataFieldService();
private MetadataSchemaService metadataSchemaService; private final transient MetadataSchemaService metadataSchemaService
= ContentServiceFactory.getInstance().getMetadataSchemaService();
private CreativeCommonsService creativeCommonsService; private final transient CreativeCommonsService creativeCommonsService
= LicenseServiceFactory.getInstance().getCreativeCommonsService();
@Override @Override
public void init() throws ServletException {
super.init();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
itemService = ContentServiceFactory.getInstance().getItemService();
bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
bundleService = ContentServiceFactory.getInstance().getBundleService();
handleService = HandleServiceFactory.getInstance().getHandleService();
metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
creativeCommonsService = LicenseServiceFactory.getInstance().getCreativeCommonsService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -197,6 +193,7 @@ public class EditItemServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -308,7 +305,7 @@ public class EditItemServlet extends DSpaceServlet
List<Collection> allLinkedCollections = item.getCollections(); List<Collection> allLinkedCollections = item.getCollections();
// get only the collection where the current user has the right permission // get only the collection where the current user has the right permission
List<Collection> authNotLinkedCollections = new ArrayList<Collection>(); List<Collection> authNotLinkedCollections = new ArrayList<>();
for (Collection c : allNotLinkedCollections) for (Collection c : allNotLinkedCollections)
{ {
if (authorizeService.authorizeActionBoolean(context, c, Constants.ADD)) if (authorizeService.authorizeActionBoolean(context, c, Constants.ADD))
@@ -317,7 +314,7 @@ public class EditItemServlet extends DSpaceServlet
} }
} }
List<Collection> authLinkedCollections = new ArrayList<Collection>(); List<Collection> authLinkedCollections = new ArrayList<>();
for (Collection c : allLinkedCollections) for (Collection c : allLinkedCollections)
{ {
if (authorizeService.authorizeActionBoolean(context, c, Constants.REMOVE)) if (authorizeService.authorizeActionBoolean(context, c, Constants.REMOVE))
@@ -466,7 +463,7 @@ public class EditItemServlet extends DSpaceServlet
List<MetadataField> types = metadataFieldService.findAll(context); List<MetadataField> types = metadataFieldService.findAll(context);
// Get a HashMap of metadata field ids and a field name to display // Get a HashMap of metadata field ids and a field name to display
Map<Integer, String> metadataFields = new HashMap<Integer, String>(); Map<Integer, String> metadataFields = new HashMap<>();
// Get all existing Schemas // Get all existing Schemas
List<MetadataSchema> schemas = metadataSchemaService.findAll(context); List<MetadataSchema> schemas = metadataSchemaService.findAll(context);
@@ -620,7 +617,7 @@ public class EditItemServlet extends DSpaceServlet
Enumeration unsortedParamNames = request.getParameterNames(); Enumeration unsortedParamNames = request.getParameterNames();
// Put them in a list // Put them in a list
List<String> sortedParamNames = new LinkedList<String>(); List<String> sortedParamNames = new LinkedList<>();
while (unsortedParamNames.hasMoreElements()) while (unsortedParamNames.hasMoreElements())
{ {

View File

@@ -38,17 +38,13 @@ import org.dspace.eperson.service.GroupService;
*/ */
public class GroupEditServlet extends DSpaceServlet public class GroupEditServlet extends DSpaceServlet
{ {
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private EPersonService personService; private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override @Override
public void init() throws ServletException {
super.init();
groupService = EPersonServiceFactory.getInstance().getGroupService();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
protected void doDSGet(Context c, HttpServletRequest request, protected void doDSGet(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -56,6 +52,7 @@ public class GroupEditServlet extends DSpaceServlet
doDSPost(c, request, response); doDSPost(c, request, response);
} }
@Override
protected void doDSPost(Context c, HttpServletRequest request, protected void doDSPost(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -116,8 +113,8 @@ public class GroupEditServlet extends DSpaceServlet
{ {
// some epeople were listed, now make group's epeople match // some epeople were listed, now make group's epeople match
// given epeople // given epeople
Set<UUID> memberSet = new HashSet<UUID>(); Set<UUID> memberSet = new HashSet<>();
Set<UUID> epersonIDSet = new HashSet<UUID>(); Set<UUID> epersonIDSet = new HashSet<>();
// add all members to a set // add all members to a set
for (EPerson m : members) for (EPerson m : members)
@@ -164,8 +161,8 @@ public class GroupEditServlet extends DSpaceServlet
{ {
// some groups were listed, now make group's member groups // some groups were listed, now make group's member groups
// match given group IDs // match given group IDs
Set<UUID> memberSet = new HashSet<UUID>(); Set<UUID> memberSet = new HashSet<>();
Set<UUID> groupIDSet = new HashSet<UUID>(); Set<UUID> groupIDSet = new HashSet<>();
// add all members to a set // add all members to a set
for (Group g : membergroups) for (Group g : membergroups)

View File

@@ -31,14 +31,10 @@ import org.dspace.eperson.service.GroupService;
*/ */
public class GroupListServlet extends DSpaceServlet public class GroupListServlet extends DSpaceServlet
{ {
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
@Override @Override
public void init() throws ServletException {
super.init();
groupService = EPersonServiceFactory.getInstance().getGroupService();
}
protected void doDSGet(Context context, protected void doDSGet(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
@@ -61,8 +57,8 @@ public class GroupListServlet extends DSpaceServlet
List<Group> groups = groupService.findAll(context, sortBy); List<Group> groups = groupService.findAll(context, sortBy);
// Set attributes for JSP // Set attributes for JSP
request.setAttribute("sortby", Integer.valueOf(sortBy)); request.setAttribute("sortby", sortBy);
request.setAttribute("first", Integer.valueOf(first)); request.setAttribute("first", first);
request.setAttribute("groups", groups); request.setAttribute("groups", groups);
if (multiple) if (multiple)
{ {

View File

@@ -46,20 +46,19 @@ import org.dspace.core.PluginManager;
*/ */
public class ItemMapServlet extends DSpaceServlet public class ItemMapServlet extends DSpaceServlet
{ {
private SearchRequestProcessor internalLogic; private transient SearchRequestProcessor internalLogic;
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemService itemService; private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(ItemMapServlet.class); private static final Logger log = Logger.getLogger(ItemMapServlet.class);
public void init() throws ServletException public ItemMapServlet()
{ {
super.init();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
itemService = ContentServiceFactory.getInstance().getItemService();
try try
{ {
internalLogic = (SearchRequestProcessor) PluginManager internalLogic = (SearchRequestProcessor) PluginManager
@@ -68,7 +67,7 @@ public class ItemMapServlet extends DSpaceServlet
catch (PluginConfigurationError e) catch (PluginConfigurationError e)
{ {
log.warn( log.warn(
"ItemMapServlet not properly configurated, please configure the SearchRequestProcessor plugin", "ItemMapServlet not properly configured -- please configure the SearchRequestProcessor plugin",
e); e);
} }
if (internalLogic == null) if (internalLogic == null)
@@ -77,6 +76,7 @@ public class ItemMapServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws java.sql.SQLException, HttpServletResponse response) throws java.sql.SQLException,
javax.servlet.ServletException, java.io.IOException, javax.servlet.ServletException, java.io.IOException,
@@ -85,6 +85,7 @@ public class ItemMapServlet extends DSpaceServlet
doDSPost(context, request, response); doDSPost(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws java.sql.SQLException, HttpServletResponse response) throws java.sql.SQLException,
javax.servlet.ServletException, java.io.IOException, javax.servlet.ServletException, java.io.IOException,
@@ -125,9 +126,9 @@ public class ItemMapServlet extends DSpaceServlet
// also holds for interruption by pressing 'Cancel' // also holds for interruption by pressing 'Cancel'
int count_native = 0; // # of items owned by this collection int count_native = 0; // # of items owned by this collection
int count_import = 0; // # of virtual items int count_import = 0; // # of virtual items
Map<UUID, Item> myItems = new HashMap<UUID, Item>(); // # for the browser Map<UUID, Item> myItems = new HashMap<>(); // # for the browser
Map<UUID, Collection> myCollections = new HashMap<UUID, Collection>(); // collections for list Map<UUID, Collection> myCollections = new HashMap<>(); // collections for list
Map<UUID, Integer> myCounts = new HashMap<UUID, Integer>(); // counts for each collection Map<UUID, Integer> myCounts = new HashMap<>(); // counts for each collection
// get all items from that collection, add them to a hash // get all items from that collection, add them to a hash
Iterator<Item> i = itemService.findAllByCollection(context, myCollection); Iterator<Item> i = itemService.findAllByCollection(context, myCollection);
@@ -157,16 +158,16 @@ public class ItemMapServlet extends DSpaceServlet
if (myCollections.containsKey(cKey)) if (myCollections.containsKey(cKey))
{ {
Integer x = myCounts.get(cKey); Integer x = myCounts.get(cKey);
int myCount = x.intValue() + 1; int myCount = x + 1;
// increment count for that collection // increment count for that collection
myCounts.put(cKey, Integer.valueOf(myCount)); myCounts.put(cKey, myCount);
} }
else else
{ {
// store and initialize count // store and initialize count
myCollections.put(cKey, owningCollection); myCollections.put(cKey, owningCollection);
myCounts.put(cKey, Integer.valueOf(1)); myCounts.put(cKey, 1);
} }
// store the item // store the item
@@ -180,8 +181,8 @@ public class ItemMapServlet extends DSpaceServlet
// sort items - later // sort items - later
// show page // show page
request.setAttribute("collection", myCollection); request.setAttribute("collection", myCollection);
request.setAttribute("count_native", Integer.valueOf(count_native)); request.setAttribute("count_native", count_native);
request.setAttribute("count_import", Integer.valueOf(count_import)); request.setAttribute("count_import", count_import);
request.setAttribute("items", myItems); request.setAttribute("items", myItems);
request.setAttribute("collections", myCollections); request.setAttribute("collections", myCollections);
request.setAttribute("collection_counts", myCounts); request.setAttribute("collection_counts", myCounts);
@@ -203,7 +204,7 @@ public class ItemMapServlet extends DSpaceServlet
// get item IDs to remove // get item IDs to remove
List<UUID> itemIDs = Util.getUUIDParameters(request, "item_ids"); List<UUID> itemIDs = Util.getUUIDParameters(request, "item_ids");
String message = "remove"; String message = "remove";
LinkedList<UUID> removedItems = new LinkedList<UUID>(); LinkedList<UUID> removedItems = new LinkedList<>();
if (itemIDs == null) if (itemIDs == null)
{ {
@@ -250,7 +251,7 @@ public class ItemMapServlet extends DSpaceServlet
// get item IDs to add // get item IDs to add
List<UUID> itemIDs = Util.getUUIDParameters(request, "item_ids"); List<UUID> itemIDs = Util.getUUIDParameters(request, "item_ids");
String message = "added"; String message = "added";
LinkedList<UUID> addedItems = new LinkedList<UUID>(); LinkedList<UUID> addedItems = new LinkedList<>();
if (itemIDs == null) if (itemIDs == null)
@@ -317,7 +318,7 @@ public class ItemMapServlet extends DSpaceServlet
// now find all imported items from that collection // now find all imported items from that collection
// seemingly inefficient, but database should have this query cached // seemingly inefficient, but database should have this query cached
Map<UUID, Item> items = new HashMap<UUID, Item>(); Map<UUID, Item> items = new HashMap<>();
Iterator<Item> i = itemService.findAllByCollection(context, myCollection); Iterator<Item> i = itemService.findAllByCollection(context, myCollection);
while (i.hasNext()) while (i.hasNext())
{ {

View File

@@ -30,18 +30,14 @@ import org.dspace.core.service.LicenseService;
*/ */
public class LicenseEditServlet extends DSpaceServlet public class LicenseEditServlet extends DSpaceServlet
{ {
private LicenseService licenseService; private final transient LicenseService licenseService
= CoreServiceFactory.getInstance().getLicenseService();
@Override
public void init() throws ServletException {
super.init();
licenseService = CoreServiceFactory.getInstance().getLicenseService();
}
/** /**
* Handle GET requests. This does nothing but forwards * Handle GET requests. This does nothing but forwards
* the request on to the POST handler. * the request on to the POST handler.
*/ */
@Override
protected void doDSGet(Context c, HttpServletRequest request, protected void doDSGet(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -53,6 +49,7 @@ public class LicenseEditServlet extends DSpaceServlet
/** /**
* Handle the POST requests. * Handle the POST requests.
*/ */
@Override
protected void doDSPost(Context c, HttpServletRequest request, protected void doDSPost(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -40,25 +40,21 @@ import org.dspace.core.Context;
public class MetadataFieldRegistryServlet extends DSpaceServlet public class MetadataFieldRegistryServlet extends DSpaceServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(MetadataFieldRegistryServlet.class); private static final Logger log = Logger.getLogger(MetadataFieldRegistryServlet.class);
private String clazz = "org.dspace.app.webui.servlet.admin.MetadataFieldRegistryServlet"; private static final String clazz = "org.dspace.app.webui.servlet.admin.MetadataFieldRegistryServlet";
private MetadataFieldService fieldService; private final transient MetadataFieldService fieldService
= ContentServiceFactory.getInstance().getMetadataFieldService();
private MetadataSchemaService schemaService; private final transient MetadataSchemaService schemaService
= ContentServiceFactory.getInstance().getMetadataSchemaService();
@Override
public void init() throws ServletException {
super.init();
fieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
schemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
}
/** /**
* @see org.dspace.app.webui.servlet.DSpaceServlet#doDSGet(org.dspace.core.Context, * @see org.dspace.app.webui.servlet.DSpaceServlet#doDSGet(org.dspace.core.Context,
* javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse) * javax.servlet.http.HttpServletResponse)
*/ */
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -73,6 +69,7 @@ public class MetadataFieldRegistryServlet extends DSpaceServlet
* javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse) * javax.servlet.http.HttpServletResponse)
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -37,17 +37,14 @@ import org.dspace.core.Context;
public class MetadataSchemaRegistryServlet extends DSpaceServlet public class MetadataSchemaRegistryServlet extends DSpaceServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(MetadataSchemaRegistryServlet.class); private static final Logger log = Logger.getLogger(MetadataSchemaRegistryServlet.class);
private String clazz = "org.dspace.app.webui.servlet.admin.MetadataSchemaRegistryServlet";
private MetadataSchemaService schemaService; private static final String clazz = "org.dspace.app.webui.servlet.admin.MetadataSchemaRegistryServlet";
private final transient MetadataSchemaService schemaService
= ContentServiceFactory.getInstance().getMetadataSchemaService();
@Override @Override
public void init() throws ServletException {
super.init();
schemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -56,6 +53,7 @@ public class MetadataSchemaRegistryServlet extends DSpaceServlet
showSchemas(context, request, response); showSchemas(context, request, response);
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -29,14 +29,10 @@ import org.dspace.core.service.NewsService;
*/ */
public class NewsEditServlet extends DSpaceServlet public class NewsEditServlet extends DSpaceServlet
{ {
private NewsService newsService; private final transient NewsService newsService
= CoreServiceFactory.getInstance().getNewsService();
@Override @Override
public void init() throws ServletException {
super.init();
newsService = CoreServiceFactory.getInstance().getNewsService();
}
protected void doDSGet(Context c, HttpServletRequest request, protected void doDSGet(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -45,6 +41,7 @@ public class NewsEditServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/dspace-admin/news-main.jsp"); JSPManager.showJSP(request, response, "/dspace-admin/news-main.jsp");
} }
@Override
protected void doDSPost(Context c, HttpServletRequest request, protected void doDSPost(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -41,25 +41,21 @@ public class SuperviseServlet extends org.dspace.app.webui.servlet.DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(SuperviseServlet.class); private static final Logger log = Logger.getLogger(SuperviseServlet.class);
private GroupService groupService; private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
private SupervisorService supervisorService; private final transient SupervisorService supervisorService
= EPersonServiceFactory.getInstance().getSupervisorService();
private SupervisedItemService supervisedItemService; private final transient SupervisedItemService supervisedItemService
= ContentServiceFactory.getInstance().getSupervisedItemService();
private WorkspaceItemService workspaceItemService; private final transient WorkspaceItemService workspaceItemService
= ContentServiceFactory.getInstance().getWorkspaceItemService();
@Override @Override
public void init() throws ServletException {
super.init();
groupService = EPersonServiceFactory.getInstance().getGroupService();
supervisedItemService = ContentServiceFactory.getInstance().getSupervisedItemService();
supervisorService = EPersonServiceFactory.getInstance().getSupervisorService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
}
protected void doDSGet(Context c, protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -68,6 +64,7 @@ public class SuperviseServlet extends org.dspace.app.webui.servlet.DSpaceServlet
doDSPost(c, request, response); doDSPost(c, request, response);
} }
@Override
protected void doDSPost(Context c, protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException

View File

@@ -33,17 +33,13 @@ import org.dspace.workflowbasic.factory.BasicWorkflowServiceFactory;
*/ */
public class WorkflowAbortServlet extends DSpaceServlet public class WorkflowAbortServlet extends DSpaceServlet
{ {
private WorkflowItemService workflowItemService; private final transient WorkflowItemService workflowItemService
= BasicWorkflowServiceFactory.getInstance().getWorkflowItemService();
private WorkflowService workflowService; private final transient WorkflowService workflowService
= BasicWorkflowServiceFactory.getInstance().getWorkflowService();
@Override @Override
public void init() throws ServletException {
super.init();
workflowService = BasicWorkflowServiceFactory.getInstance().getWorkflowService();
workflowItemService = BasicWorkflowServiceFactory.getInstance().getWorkflowItemService();
}
protected void doDSGet(Context c, HttpServletRequest request, protected void doDSGet(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -52,6 +48,7 @@ public class WorkflowAbortServlet extends DSpaceServlet
showWorkflows(c, request, response); showWorkflows(c, request, response);
} }
@Override
protected void doDSPost(Context c, HttpServletRequest request, protected void doDSPost(Context c, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException