[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
{
/** log4j category */
private static Logger log = Logger.getLogger(AccessSettingTag.class);
private static final Logger log = Logger.getLogger(AccessSettingTag.class);
/** is advanced form enabled? */
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 */
private static final String restrictedGroup = ConfigurationManager.getProperty("webui.submission.restrictstep.groups");
/** the SubmittionInfo */
/** the SubmissionInfo */
private transient SubmissionInfo subInfo = null;
/** the target DSpaceObject */
@@ -68,15 +68,18 @@ public class AccessSettingTag extends TagSupport
/** add the policy button */
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()
{
super();
}
@Override
public int doStartTag() throws JspException
{
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)
{
policies = new ArrayList<ResourcePolicy>();
policies = new ArrayList<>();
policies.add(rp);
}
@@ -186,7 +189,7 @@ public class AccessSettingTag extends TagSupport
// Embargo Date
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");
}
else
@@ -365,6 +368,7 @@ public class AccessSettingTag extends TagSupport
return addpolicy;
}
@Override
public void release()
{
dso = null;

View File

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

View File

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

View File

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

View File

@@ -32,10 +32,11 @@ import org.w3c.dom.Document;
public class ControlledVocabularyTag extends TagSupport
{
// 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
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
private String filter;
@@ -46,12 +47,10 @@ public class ControlledVocabularyTag extends TagSupport
// a tag attribute that specifies the vocabulary to be displayed
private String vocabulary;
// an hashtable containing all the loaded vocabularies
public Map<String, Document> controlledVocabularies;
/**
* Process tag
*/
@Override
public int doStartTag() throws JspException
{
HttpServletRequest request = (HttpServletRequest) pageContext
@@ -69,7 +68,9 @@ public class ControlledVocabularyTag extends TagSupport
+ "vocabulary2html.xsl";
// 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)
{
controlledVocabularies = loadControlledVocabularies(vocabulariesPath);
@@ -112,6 +113,7 @@ public class ControlledVocabularyTag extends TagSupport
/**
* End processing tag
*/
@Override
public int doEndTag()
{
return EVAL_PAGE;
@@ -168,7 +170,7 @@ public class ControlledVocabularyTag extends TagSupport
*/
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())
{
prunnedVocabularies.put(entry.getKey(), filterVocabulary(entry.getValue(), vocabularyPrunningXSLT, getFilter()));
@@ -203,7 +205,7 @@ public class ControlledVocabularyTag extends TagSupport
try
{
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> parameters = new HashMap<>();
parameters.put("allowMultipleSelection", allowMultipleSelection ? "yes" : "no");
parameters.put("contextPath", contextPath);
result = XMLUtil.transformDocumentAsString(vocabulary, parameters, controlledVocabulary2HtmlXSLT);
@@ -236,7 +238,7 @@ public class ControlledVocabularyTag extends TagSupport
try
{
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> parameters = new HashMap<>();
parameters.put("filter", filter);
return XMLUtil.transformDocument(vocabulary, parameters, vocabularyPrunningXSLT);
}
@@ -259,11 +261,12 @@ public class ControlledVocabularyTag extends TagSupport
*/
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);
FilenameFilter filter = new FilenameFilter()
{
@Override
public boolean accept(File dir, String name)
{
return name.endsWith(".xml");

View File

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

View File

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

View File

@@ -26,7 +26,6 @@ import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.DCInputsReaderException;
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/";
/** Item to display */
private transient Item item;
private Item item;
/** Collections this item appears in */
private transient List<Collection> collections;
private List<Collection> collections;
/** The style to use - "default" or "full" */
private String style;
@@ -206,38 +205,45 @@ public class ItemTag extends TagSupport
private boolean showThumbs;
/** 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 */
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 */
private static Map<String,String> linkedMetadata;
private static final Map<String,String> linkedMetadata;
/** 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> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private final Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L;
private MetadataExposureService metadataExposureService = UtilServiceFactory.getInstance().getMetadataExposureService();
private ItemService itemService = ContentServiceFactory.getInstance().getItemService();
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private BundleService bundleService = ContentServiceFactory.getInstance().getBundleService();
private AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
private final transient MetadataExposureService metadataExposureService
= UtilServiceFactory.getInstance().getMetadataExposureService();
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private final transient MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private final transient BundleService bundleService
= ContentServiceFactory.getInstance().getBundleService();
private final transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
static {
int i;
linkedMetadata = new HashMap<String, String>();
linkedMetadata = new HashMap<>();
String linkMetadata;
i = 1;
@@ -253,7 +259,7 @@ public class ItemTag extends TagSupport
i++;
} while (linkMetadata != null);
urn2baseurl = new HashMap<String, String>();
urn2baseurl = new HashMap<>();
String urn;
i = 1;
@@ -287,6 +293,7 @@ public class ItemTag extends TagSupport
getThumbSettings();
}
@Override
public int doStartTag() throws JspException
{
try
@@ -385,6 +392,7 @@ public class ItemTag extends TagSupport
style = styleIn;
}
@Override
public void release()
{
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 (isDisplay){
List<String> displayValues = new ArrayList<String>();
List<String> displayValues = new ArrayList<>();
displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale);
@@ -585,7 +593,7 @@ public class ItemTag extends TagSupport
else
{
String foundUrn = null;
if (!style.equals("resolver"))
if (!"resolver".equals(style))
{
foundUrn = style;
}

View File

@@ -30,19 +30,21 @@ import org.dspace.authorize.service.ResourcePolicyService;
public class PoliciesListTag extends TagSupport
{
/** log4j category */
private static Logger log = Logger.getLogger(PoliciesListTag.class);
private static final Logger log = Logger.getLogger(PoliciesListTag.class);
/** Groups to make options list */
private transient List<ResourcePolicy> policies = null;
private transient boolean showButton = true;
private ResourcePolicyService policyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService();
private boolean showButton = true;
private final transient ResourcePolicyService policyService
= AuthorizeServiceFactory.getInstance().getResourcePolicyService();
public PoliciesListTag()
{
super();
}
@Override
public int doStartTag() throws JspException
{
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()
{
policies = null;

View File

@@ -30,21 +30,23 @@ public class SFXLinkTag extends TagSupport
{
/** Item to display SFX link for */
private transient Item item;
private Item item;
/** 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";
private static final long serialVersionUID = 7028793612957710128L;
private SFXFileReaderService sfxFileReaderService = SfxServiceFactory.getInstance().getSfxFileReaderService();
private final transient SFXFileReaderService sfxFileReaderService
= SfxServiceFactory.getInstance().getSfxFileReaderService();
public SFXLinkTag()
{
super();
}
@Override
public int doStartTag() throws JspException
{
try

View File

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

View File

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

View File

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

View File

@@ -5,9 +5,6 @@
*
* http://www.dspace.org/license/
*/
/*
*
*/
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.factory.ContentAuthorityServiceFactory;
import org.dspace.content.authority.service.ChoiceAuthorityService;
import org.dspace.content.authority.service.MetadataAuthorityService;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
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.Method;
/**
*
* @author bollini
*/
public class AuthorityChooseServlet extends DSpaceServlet {
private ChoiceAuthorityService choiceAuthorityService;
private final transient ChoiceAuthorityService choiceAuthorityService
= ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
private CollectionService collectionService;
@Override
public void init() throws ServletException {
super.init();
choiceAuthorityService = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
process(context, request, response);

View File

@@ -43,19 +43,14 @@ import org.dspace.utils.DSpace;
public class BatchImportServlet extends DSpaceServlet
{
/** 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
*
@@ -68,6 +63,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException
* @throws AuthorizeException
*/
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -93,7 +89,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null;
String colIdS = wrapper.getParameter("colId");
if (colIdS!=null){
collections = new ArrayList<Collection>();
collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
}
@@ -257,6 +253,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException
* @throws AuthorizeException
*/
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -265,7 +262,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null;
String colIdS = request.getParameter("colId");
if (colIdS!=null){
collections = new ArrayList<Collection>();
collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
}
@@ -305,7 +302,7 @@ public class BatchImportServlet extends DSpaceServlet
protected List<String> getRepeatedParameter(HttpServletRequest request,
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
boolean foundLast = false;

View File

@@ -32,7 +32,6 @@ import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.core.Utils;
import org.dspace.handle.HandleServiceImpl;
import org.dspace.handle.factory.HandleServiceFactory;
import org.dspace.handle.service.HandleService;
import org.dspace.usage.UsageEvent;
@@ -51,7 +50,7 @@ import org.dspace.utils.DSpace;
public class BitstreamServlet extends DSpaceServlet
{
/** 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.
@@ -59,17 +58,17 @@ public class BitstreamServlet extends DSpaceServlet
private int threshold;
// 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
public void init(ServletConfig arg0) throws ServletException {
super.init(arg0);
threshold = ConfigurationManager
.getIntProperty("webui.content_disposition_threshold");
handleService = HandleServiceFactory.getInstance().getHandleService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
}
@Override

View File

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

View File

@@ -45,7 +45,7 @@ import org.dspace.search.QueryResults;
public class ControlledVocabularySearchServlet extends DSpaceServlet
{
// the log
private static Logger log = Logger
private static final Logger log = Logger
.getLogger(ControlledVocabularySearchServlet.class);
// 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
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
*/
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -104,7 +101,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
*/
private List<String> extractKeywords(HttpServletRequest request)
{
List<String> keywords = new ArrayList<String>();
List<String> keywords = new ArrayList<>();
Enumeration enumeration = request.getParameterNames();
while (enumeration.hasMoreElements())
{
@@ -143,9 +140,9 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
start = 0;
}
List<String> itemHandles = new ArrayList<String>();
List<String> collectionHandles = new ArrayList<String>();
List<String> communityHandles = new ArrayList<String>();
List<String> itemHandles = new ArrayList<>();
List<String> collectionHandles = new ArrayList<>();
List<String> communityHandles = new ArrayList<>();
Item[] resultsItems;
Collection[] resultsCollections;
@@ -219,7 +216,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
Integer myType = qResults.getHitTypes().get(i);
// add the handle to the appropriate lists
switch (myType.intValue())
switch (myType)
{
case Constants.ITEM:
itemHandles.add(myHandle);
@@ -317,10 +314,10 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
request.setAttribute("communities", resultsCommunities);
request.setAttribute("collections", resultsCollections);
request.setAttribute("pagetotal", Integer.valueOf(pageTotal));
request.setAttribute("pagecurrent", Integer.valueOf(pageCurrent));
request.setAttribute("pagelast", Integer.valueOf(pageLast));
request.setAttribute("pagefirst", Integer.valueOf(pageFirst));
request.setAttribute("pagetotal", pageTotal);
request.setAttribute("pagecurrent", pageCurrent);
request.setAttribute("pagelast", pageLast);
request.setAttribute("pagefirst", pageFirst);
request.setAttribute("queryresults", qResults);
@@ -358,6 +355,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
/**
* Handle posts
*/
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -61,22 +61,19 @@ public class DSpaceServlet extends HttpServlet
*/
/** 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
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{

View File

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

View File

@@ -33,17 +33,12 @@ import org.dspace.eperson.service.EPersonService;
public class EditProfileServlet extends DSpaceServlet
{
/** Logger */
private static Logger log = Logger.getLogger(EditProfileServlet.class);
protected EPersonService personService;
@Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
private static final Logger log = Logger.getLogger(EditProfileServlet.class);
protected transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -57,6 +52,7 @@ public class EditProfileServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/register/edit-profile.jsp");
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -99,7 +95,7 @@ public class EditProfileServlet extends DSpaceServlet
personService.update(context, eperson);
// Show confirmation
request.setAttribute("password.updated", Boolean.valueOf(settingPassword));
request.setAttribute("password.updated", settingPassword);
JSPManager.showJSP(request, response,
"/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.webui.util.JSPManager;
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.BrowseException;
import org.dspace.browse.BrowseIndex;
@@ -43,15 +41,11 @@ import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
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.service.HandleService;
import org.dspace.search.Harvest;
@@ -66,7 +60,6 @@ import com.sun.syndication.io.FeedException;
* Currently supports only RSS feed formats.
*
* @author Ben Bosman, Richard Rodgers
* @version $Revision$
*/
public class FeedServlet extends DSpaceServlet
{
@@ -76,10 +69,10 @@ public class FeedServlet extends DSpaceServlet
// one hour in milliseconds
private static final long HOUR_MSECS = 60 * 60 * 1000;
/** log4j category */
private static Logger log = Logger.getLogger(FeedServlet.class);
private String clazz = "org.dspace.app.webui.servlet.FeedServlet";
private static final Logger log = Logger.getLogger(FeedServlet.class);
private static final String clazz = "org.dspace.app.webui.servlet.FeedServlet";
// are syndication feeds enabled?
private static boolean enabled = false;
// number of DSpace items per feed
@@ -96,17 +89,14 @@ public class FeedServlet extends DSpaceServlet
private static boolean includeAll = true;
// services API
private HandleService handleService;
private AuthorizeService authorizeService;
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private SubscribeService subscribeService;
private ItemService itemService;
private CommunityService communityService;
private CollectionService collectionService;
private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
static
{
@@ -118,7 +108,7 @@ public class FeedServlet extends DSpaceServlet
String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats");
if ( fmtsStr != null )
{
formats = new ArrayList<String>();
formats = new ArrayList<>();
String[] fmts = fmtsStr.split(",");
for (int i = 0; i < fmts.length; i++)
{
@@ -130,22 +120,13 @@ public class FeedServlet extends DSpaceServlet
cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size");
if (cacheSize > 0)
{
feedCache = new HashMap<String, CacheFeed>();
feedCache = new HashMap<>();
cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age");
}
}
}
@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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -158,7 +139,7 @@ public class FeedServlet extends DSpaceServlet
// build label map from localized Messages resource bundle
Locale locale = request.getLocale();
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_LOGO_TITLE, msgs.getString(clazz + ".logo.title"));
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
//Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, results[i], Constants.READ);
//boolean added = false;
List<Item> items = new ArrayList<Item>();
List<Item> items = new ArrayList<>();
for (Item result : results)
{
checkAccess:

View File

@@ -59,20 +59,20 @@ import org.dspace.utils.DSpace;
public class HTMLServlet extends DSpaceServlet
{
/** 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
* bitstream called "foo.html" should be served when "xxx/yyy/zzz/foo.html"
* is requested.
*/
private int maxDepthGuess;
private final int maxDepthGuess;
private ItemService itemService;
private HandleService handleService;
private BitstreamService bitstreamService;
private final transient ItemService itemService;
private final transient HandleService handleService;
private final transient BitstreamService bitstreamService;
/**
* 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
// handle POST requests, but in practice some HTML pages which
// are actually JSP get called on with a POST, so it's needed.
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -129,6 +130,7 @@ public class HTMLServlet extends DSpaceServlet
doDSGet(context, request, response);
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
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.UIUtil;
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.Community;
import org.dspace.content.DSpaceObject;
@@ -77,38 +75,30 @@ import org.jdom.output.XMLOutputter;
public class HandleServlet extends DSpaceServlet
{
/** 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; */
private DisseminationCrosswalk xHTMLHeadCrosswalk;
private final transient DisseminationCrosswalk xHTMLHeadCrosswalk
= (DisseminationCrosswalk) PluginManager
.getNamedPlugin(DisseminationCrosswalk.class, "XHTML_HEAD_ITEM");
// services API
private HandleService handleService;
private SubscribeService subscribeService;
private ItemService itemService;
private CommunityService communityService;
private CollectionService collectionService;
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();
}
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private final transient SubscribeService subscribeService
= EPersonServiceFactory.getInstance().getSubscribeService();
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -469,7 +459,7 @@ public class HandleServlet extends DSpaceServlet
else
{
// 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));
// Set attributes and display
request.setAttribute("suggest.enable", Boolean.valueOf(suggestEnable));
request.setAttribute("display.all", Boolean.valueOf(displayAll));
request.setAttribute("suggest.enable", suggestEnable);
request.setAttribute("display.all", displayAll);
request.setAttribute("item", item);
request.setAttribute("collections", collections);
request.setAttribute("dspace.layout.head", headMetadata);
@@ -716,8 +706,8 @@ public class HandleServlet extends DSpaceServlet
// Forward to collection home page
request.setAttribute("collection", collection);
request.setAttribute("community", community);
request.setAttribute("logged.in", Boolean.valueOf(e != null));
request.setAttribute("subscribed", Boolean.valueOf(subscribed));
request.setAttribute("logged.in", e != null);
request.setAttribute("subscribed", subscribed);
JSPManager.showJSP(request, response, "/collection-home.jsp");
if (updated)
@@ -823,7 +813,7 @@ public class HandleServlet extends DSpaceServlet
List<Community> parents = communityService.getAllParents(context, c);
// put into an array in reverse order
List<Community> reversedParents = new ArrayList<Community>();
List<Community> reversedParents = new ArrayList<>();
int index = parents.size() - 1;
for (int i = 0; i < parents.size(); i++)

View File

@@ -38,15 +38,10 @@ import org.dspace.core.Utils;
*/
public class ItemExportArchiveServlet extends DSpaceServlet {
/** log4j category */
private static Logger log = Logger.getLogger(ItemExportArchiveServlet.class);
private static final Logger log = Logger.getLogger(ItemExportArchiveServlet.class);
private ItemExportService itemExportService;
@Override
public void init() throws ServletException {
super.init();
itemExportService = ItemExportServiceFactory.getInstance().getItemExportService();
}
private final transient ItemExportService itemExportService
= ItemExportServiceFactory.getInstance().getItemExportService();
@Override
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.JSPManager;
import org.dspace.authenticate.AuthenticationMethod;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.authenticate.service.AuthenticationService;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager;
@@ -38,16 +39,12 @@ import org.dspace.core.LogManager;
public class LDAPServlet extends DSpaceServlet
{
/** log4j logger */
private static Logger log = Logger.getLogger(LDAPServlet.class);
private AuthenticationService authenticationService;
@Override
public void init() throws ServletException {
super.init();
}
private static final Logger log = Logger.getLogger(LDAPServlet.class);
private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
@Override
protected void doDSGet(Context context,
HttpServletRequest request,
HttpServletResponse response)
@@ -66,6 +63,7 @@ public class LDAPServlet extends DSpaceServlet
}
@Override
protected void doDSPost(Context context,
HttpServletRequest request,
HttpServletResponse response)

View File

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

View File

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

View File

@@ -38,13 +38,15 @@ public class OpenSearchServlet extends DSpaceServlet
{
private static final long serialVersionUID = 1L;
private SearchRequestProcessor internalLogic;
private transient SearchRequestProcessor internalLogic;
/** 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
{
internalLogic = (SearchRequestProcessor) PluginManager
@@ -62,6 +64,7 @@ public class OpenSearchServlet extends DSpaceServlet
}
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -41,16 +41,12 @@ import org.dspace.core.LogManager;
public class PasswordServlet extends DSpaceServlet
{
/** 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
public void init() throws ServletException {
super.init();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
}
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -59,6 +55,7 @@ public class PasswordServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/login/password.jsp");
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

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

View File

@@ -55,15 +55,15 @@ import org.dspace.utils.DSpace;
public class RequestItemServlet extends DSpaceServlet
{
/** 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 */
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;
/** The link Aproved genarate letter step*/
/** The link Approved generate letter step*/
public static final int APROVE_TOKEN = 3;
/* resume leter for request user*/
@@ -72,23 +72,19 @@ public class RequestItemServlet extends DSpaceServlet
/* resume leter for request dspace administrator*/
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
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,
HttpServletRequest request,
HttpServletResponse response)
@@ -132,6 +128,7 @@ public class RequestItemServlet extends DSpaceServlet
}
}
@Override
protected void doDSPost(Context context,
HttpServletRequest request,
HttpServletResponse response)
@@ -213,7 +210,7 @@ public class RequestItemServlet extends DSpaceServlet
request.setAttribute("title", title);
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");
return;
}
@@ -550,9 +547,11 @@ public class RequestItemServlet extends DSpaceServlet
{
String base = ConfigurationManager.getProperty("dspace.url");
String specialLink = (new StringBuffer()).append(base).append(
base.endsWith("/") ? "" : "/").append(
"request-item").append("?step=" + RequestItemServlet.ENTER_TOKEN)
String specialLink = (new StringBuffer()).append(base)
.append(base.endsWith("/") ? "" : "/")
.append("request-item")
.append("?step=")
.append(RequestItemServlet.ENTER_TOKEN)
.append("&token=")
.append(token)
.toString();

View File

@@ -43,14 +43,15 @@ import org.dspace.utils.DSpace;
public class RetrieveServlet extends DSpaceServlet
{
/** 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.
*/
private int threshold;
private BitstreamService bitstreamService;
private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
@Override
public void init(ServletConfig arg0) throws ServletException {
@@ -58,9 +59,9 @@ public class RetrieveServlet extends DSpaceServlet
super.init(arg0);
threshold = ConfigurationManager
.getIntProperty("webui.content_disposition_threshold");
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -32,7 +32,7 @@ import org.dspace.core.Context;
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
*
* @author Andrea Bollini
@@ -40,23 +40,19 @@ import org.dspace.utils.DSpace;
*/
public class SHERPAPublisherPolicyServlet extends DSpaceServlet
{
private SHERPASubmitService sherpaSubmitService = new DSpace()
.getServiceManager().getServiceByName(
private final transient SHERPASubmitService sherpaSubmitService
= new DSpace().getServiceManager().getServiceByName(
SHERPASubmitService.class.getCanonicalName(),
SHERPASubmitService.class);
private ItemService itemService;
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
/** log4j logger */
private static Logger log = Logger
private static final Logger log = Logger
.getLogger(SHERPAPublisherPolicyServlet.class);
@Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -71,7 +67,7 @@ public class SHERPAPublisherPolicyServlet extends DSpaceServlet
context, item);
if (shresp.isError())
{
request.setAttribute("error", new Boolean(true));
request.setAttribute("error", Boolean.TRUE);
}
else
{
@@ -103,6 +99,7 @@ public class SHERPAPublisherPolicyServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/sherpa/sherpa-policy.jsp");
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

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

View File

@@ -25,7 +25,7 @@ import org.dspace.core.Context;
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
*
* Pull information from the header as released by Shibboleth target.
@@ -44,16 +44,12 @@ import org.dspace.core.LogManager;
*/
public class ShibbolethServlet extends DSpaceServlet {
/** 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
public void init() throws ServletException {
super.init();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
}
protected void doDSGet(Context context,
HttpServletRequest request,
HttpServletResponse response)

View File

@@ -29,12 +29,12 @@ import org.dspace.core.PluginManager;
*/
public class SimpleSearchServlet extends DSpaceServlet
{
private SearchRequestProcessor internalLogic;
private transient SearchRequestProcessor internalLogic;
/** 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
{
@@ -53,6 +53,7 @@ public class SimpleSearchServlet extends DSpaceServlet
}
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import org.dspace.app.webui.util.JSPManager;
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.Context;
@@ -42,13 +40,7 @@ import org.dspace.core.Context;
*/
public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServlet
{
private AuthorizeService authorizeService;
@Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
}
@Override
protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -57,6 +49,7 @@ public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServle
doDSPost(c, request, response);
}
@Override
protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -109,7 +102,7 @@ public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServle
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 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
{
private SubscribeService subscribeService;
private CollectionService collectionService;
@Override
public void init() throws ServletException {
super.init();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
private final transient SubscribeService subscribeService
= EPersonServiceFactory.getInstance().getSubscribeService();
private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -55,6 +51,7 @@ public class SubscribeServlet extends DSpaceServlet
showSubscriptions(context, request, response, false);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -144,7 +141,7 @@ public class SubscribeServlet extends DSpaceServlet
request.setAttribute("availableSubscriptions", avail);
request.setAttribute("subscriptions", subs);
request.setAttribute("updated", Boolean.valueOf(updated));
request.setAttribute("updated", updated);
JSPManager.showJSP(request, response, "/mydspace/subscriptions.jsp");
}

View File

@@ -45,19 +45,15 @@ import org.dspace.handle.service.HandleService;
public class SuggestServlet extends DSpaceServlet
{
/** log4j category */
private static Logger log = Logger.getLogger(SuggestServlet.class);
private static final Logger log = Logger.getLogger(SuggestServlet.class);
private HandleService handleService;
private ItemService itemService;
@Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
itemService = ContentServiceFactory.getInstance().getItemService();
}
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -239,6 +235,7 @@ public class SuggestServlet extends DSpaceServlet
}
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response)
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.VersionUtil;
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.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
@@ -31,7 +29,6 @@ import org.dspace.versioning.Version;
import org.dspace.versioning.VersionHistory;
import org.dspace.versioning.factory.VersionServiceFactory;
import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService;
/**
* Servlet for handling the operations in the version history page
@@ -43,26 +40,15 @@ public class VersionHistoryServlet extends DSpaceServlet
{
/** log4j category */
private static Logger log = Logger.getLogger(VersionHistoryServlet.class);
private AuthorizeService authorizeService;
private ItemService itemService;
private VersionHistoryService versionHistoryService;
private static final Logger log = Logger.getLogger(VersionHistoryServlet.class);
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private final transient VersionHistoryService versionHistoryService
= VersionServiceFactory.getInstance().getVersionHistoryService();
private VersioningService versioningService;
@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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -147,6 +133,7 @@ public class VersionHistoryServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/tools/version-history.jsp");
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -35,16 +35,12 @@ public class VersionItemServlet extends DSpaceServlet
{
/** log4j category */
private static Logger log = Logger.getLogger(VersionItemServlet.class);
private ItemService itemService;
@Override
public void init() throws ServletException {
super.init();
itemService = ContentServiceFactory.getInstance().getItemService();
}
private static final Logger log = Logger.getLogger(VersionItemServlet.class);
private final transient ItemService itemService =
ContentServiceFactory.getInstance().getItemService();
@Override
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException,
AuthorizeException
@@ -81,7 +77,7 @@ public class VersionItemServlet extends DSpaceServlet
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
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.UIUtil;
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.Item;
import org.dspace.content.WorkspaceItem;
@@ -41,19 +39,12 @@ public class ViewWorkspaceItemServlet
{
/** 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
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
}
protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -62,6 +53,7 @@ public class ViewWorkspaceItemServlet
doDSPost(c, request, response);
}
@Override
protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -118,10 +110,10 @@ public class ViewWorkspaceItemServlet
// display item JSP for both handled and un-handled items
// Set attributes and display
// request.setAttribute("wsItem", wsItem);
request.setAttribute("display.all", Boolean.valueOf(displayAll));
request.setAttribute("display.all", displayAll);
request.setAttribute("item", item);
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");
}

View File

@@ -18,8 +18,6 @@ import org.apache.log4j.Logger;
import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil;
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.WorkspaceItem;
import org.dspace.content.factory.ContentServiceFactory;
@@ -36,21 +34,13 @@ import org.dspace.core.LogManager;
*/
public class WorkspaceServlet extends DSpaceServlet
{
/** 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
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
}
protected void doDSGet(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -59,6 +49,7 @@ public class WorkspaceServlet extends DSpaceServlet
doDSPost(c, request, response);
}
@Override
protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException

View File

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

View File

@@ -48,14 +48,10 @@ public class BitstreamFormatRegistry extends DSpaceServlet
/** User wants to create a new format */
public static final int CREATE = 4;
private BitstreamFormatService bitstreamFormatService;
private final transient BitstreamFormatService bitstreamFormatService
= ContentServiceFactory.getInstance().getBitstreamFormatService();
@Override
public void init() throws ServletException {
super.init();
bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
}
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -64,6 +60,7 @@ public class BitstreamFormatRegistry extends DSpaceServlet
showFormats(context, request, response);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -86,7 +83,7 @@ public class BitstreamFormatRegistry extends DSpaceServlet
&& request.getParameter("internal").equals("true"));
// Separate comma-separated extensions
List<String> extensions = new LinkedList<String>();
List<String> extensions = new LinkedList<>();
String extParam = request.getParameter("extensions");
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.ItemService;
import org.dspace.content.service.MetadataFieldService;
import org.dspace.content.service.MetadataSchemaService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
@@ -96,40 +95,33 @@ public class CollectionWizardServlet extends DSpaceServlet
public static final int PERM_ADMIN = 15;
/** 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 MetadataSchemaService metadataSchemaService;
private final transient MetadataFieldService metadataFieldService
= ContentServiceFactory.getInstance().getMetadataFieldService();
@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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -141,6 +133,7 @@ public class CollectionWizardServlet extends DSpaceServlet
doDSPost(context, request, response);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -664,7 +657,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// be an anonymous one.
if (anonReadPols.size() == 0)
{
request.setAttribute("permission", Integer.valueOf(PERM_READ));
request.setAttribute("permission", PERM_READ);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");
@@ -677,7 +670,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined
if (collection.getSubmitters() != null)
{
request.setAttribute("permission", Integer.valueOf(PERM_SUBMIT));
request.setAttribute("permission", PERM_SUBMIT);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");
@@ -690,7 +683,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined
if (collection.getWorkflowStep1() != null)
{
request.setAttribute("permission", Integer.valueOf(PERM_WF1));
request.setAttribute("permission", PERM_WF1);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");
@@ -703,7 +696,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined
if (collection.getWorkflowStep2() != null)
{
request.setAttribute("permission", Integer.valueOf(PERM_WF2));
request.setAttribute("permission", PERM_WF2);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");
@@ -716,7 +709,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// defined
if (collection.getWorkflowStep3() != null)
{
request.setAttribute("permission", Integer.valueOf(PERM_WF3));
request.setAttribute("permission", PERM_WF3);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");
@@ -729,7 +722,7 @@ public class CollectionWizardServlet extends DSpaceServlet
// administrator group
if (collection.getAdministrators() != null)
{
request.setAttribute("permission", Integer.valueOf(PERM_ADMIN));
request.setAttribute("permission", PERM_ADMIN);
JSPManager.showJSP(request, response,
"/dspace-admin/wizard-permissions.jsp");

View File

@@ -52,17 +52,17 @@ public class CurateServlet extends DSpaceServlet
private static final String TASK_QUEUE_NAME = ConfigurationManager.getProperty("curate", "ui.queuename");
// 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
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
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
private static Map<String, String[]> groupedTasks = new LinkedHashMap<String, String[]>();
private static Map<String, String[]> groupedTasks = new LinkedHashMap<>();
static
{
try
@@ -79,25 +79,21 @@ public class CurateServlet extends DSpaceServlet
}
/** 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
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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -105,6 +101,7 @@ public class CurateServlet extends DSpaceServlet
doDSPost(context, request, response);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException

View File

@@ -47,26 +47,22 @@ import org.dspace.eperson.service.GroupService;
*/
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;
@Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
groupService = EPersonServiceFactory.getInstance().getGroupService();
authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
accountService = EPersonServiceFactory.getInstance().getAccountService();
}
private final transient AccountService accountService
= EPersonServiceFactory.getInstance().getAccountService();
/** 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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -74,6 +70,7 @@ public class EPersonAdminServlet extends DSpaceServlet
showMain(context, request, response);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -321,7 +318,7 @@ public class EPersonAdminServlet extends DSpaceServlet
// Check the EPerson exists
if (e == null)
{
request.setAttribute("no_eperson_selected", new Boolean(true));
request.setAttribute("no_eperson_selected", Boolean.TRUE);
showMain(context, request, response);
}
// 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
{
private EPersonService personService;
@Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
private final transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -47,6 +43,7 @@ public class EPersonListServlet extends DSpaceServlet
doDSGet(context, request, response);
}
@Override
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -94,18 +91,18 @@ public class EPersonListServlet extends DSpaceServlet
if (search != null && !search.equals(""))
{
epeople = personService.search(context, search);
request.setAttribute("offset", Integer.valueOf(offset));
request.setAttribute("offset", offset);
}
else
{
// Retrieve the e-people in the specified order
epeople = personService.findAll(context, sortBy);
request.setAttribute("offset", Integer.valueOf(0));
request.setAttribute("offset", 0);
}
// Set attributes for JSP
request.setAttribute("sortby", Integer.valueOf(sortBy));
request.setAttribute("first", Integer.valueOf(first));
request.setAttribute("sortby", sortBy);
request.setAttribute("first", first);
request.setAttribute("epeople", epeople);
request.setAttribute("search", search);

View File

@@ -77,47 +77,43 @@ public class EditCommunitiesServlet extends DSpaceServlet
/** User wants to create a collection */
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;
/** User confirmed community deletion */
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;
/** User wants to delete a collection */
public static final int CONFIRM_DELETE_COLLECTION = 10;
/** 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
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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -126,6 +122,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
showControls(context, request, response);
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -333,7 +330,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
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);
}
@@ -350,7 +347,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
catch (AuthorizeException authex) {
request.setAttribute("policy_button", Boolean.FALSE);
}
if (authorizeService.isAdmin(context, community))
if (myAuthorizeService.isAdmin(context, community))
{
request.setAttribute("admin_community", Boolean.TRUE);
}
@@ -373,7 +370,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
static void storeAuthorizeAttributeCollectionEdit(Context context,
HttpServletRequest request, Collection collection) throws SQLException
{
if (authorizeService.isAdmin(context, collection))
if (myAuthorizeService.isAdmin(context, collection))
{
request.setAttribute("admin_collection", Boolean.TRUE);
}
@@ -427,7 +424,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
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);
}
@@ -993,7 +990,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
// Identify the format
BitstreamFormat bf = bitstreamFormatService.guessFormat(context, logoBS);
logoBS.setFormat(context, bf);
authorizeService.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser());
myAuthorizeService.addPolicy(context, logoBS, Constants.WRITE, context.getCurrentUser());
bitstreamService.update(context, logoBS);
String jsp;
@@ -1020,7 +1017,7 @@ public class EditCommunitiesServlet extends DSpaceServlet
jsp = "/tools/edit-collection.jsp";
}
if (authorizeService.isAdmin(context, dso))
if (myAuthorizeService.isAdmin(context, dso))
{
// set a variable to show all buttons
request.setAttribute("admin_button", Boolean.TRUE);

View File

@@ -104,40 +104,36 @@ public class EditItemServlet extends DSpaceServlet
public static final int PUBLICIZE = 11;
/** 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
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,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -197,6 +193,7 @@ public class EditItemServlet extends DSpaceServlet
}
}
@Override
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
@@ -308,7 +305,7 @@ public class EditItemServlet extends DSpaceServlet
List<Collection> allLinkedCollections = item.getCollections();
// 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)
{
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)
{
if (authorizeService.authorizeActionBoolean(context, c, Constants.REMOVE))
@@ -466,7 +463,7 @@ public class EditItemServlet extends DSpaceServlet
List<MetadataField> types = metadataFieldService.findAll(context);
// 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
List<MetadataSchema> schemas = metadataSchemaService.findAll(context);
@@ -620,7 +617,7 @@ public class EditItemServlet extends DSpaceServlet
Enumeration unsortedParamNames = request.getParameterNames();
// Put them in a list
List<String> sortedParamNames = new LinkedList<String>();
List<String> sortedParamNames = new LinkedList<>();
while (unsortedParamNames.hasMoreElements())
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,25 +41,21 @@ public class SuperviseServlet extends org.dspace.app.webui.servlet.DSpaceServlet
{
/** 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
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,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException
@@ -68,6 +64,7 @@ public class SuperviseServlet extends org.dspace.app.webui.servlet.DSpaceServlet
doDSPost(c, request, response);
}
@Override
protected void doDSPost(Context c,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException

View File

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