Merge pull request #1170 from mwoodiupui/DS-2763

[DS-2763] EHCache throwing a NotSerializableException: org.dspace.content.CollectionServiceImpl
This commit is contained in:
helix84
2015-12-02 13:04:43 +01:00
88 changed files with 806 additions and 901 deletions

View File

@@ -9,12 +9,8 @@ package org.dspace.app.bulkedit;
import org.apache.commons.lang3.StringUtils;
import org.dspace.authority.AuthorityValue;
import org.dspace.app.bulkedit.DSpaceCSVLine;
import org.dspace.app.bulkedit.MetadataImport;
import org.dspace.app.bulkedit.MetadataImportInvalidHeadingException;
import org.dspace.authority.factory.AuthorityServiceFactory;
import org.dspace.authority.service.AuthorityValueService;
import org.dspace.content.Collection;
import org.dspace.content.*;
import org.dspace.content.Collection;
import org.dspace.content.factory.ContentServiceFactory;
@@ -73,10 +69,10 @@ public class DSpaceCSV implements Serializable
/** The authority separator in an escaped form for using in regexes */
protected String escapedAuthoritySeparator;
protected final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
protected final MetadataSchemaService metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
protected final MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
protected final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService();
protected transient final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
protected transient final MetadataSchemaService metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
protected transient final MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
protected transient final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService();
/** Whether to export all metadata such as handles and provenance information */
@@ -262,16 +258,16 @@ public class DSpaceCSV implements Serializable
setAuthoritySeparator();
// Create the headings
headings = new ArrayList<String>();
headings = new ArrayList<>();
// Create the blank list of items
lines = new ArrayList<DSpaceCSVLine>();
lines = new ArrayList<>();
// Initialise the counter
counter = 0;
// Set the metadata fields to ignore
ignore = new HashMap<String, String>();
ignore = new HashMap<>();
String toIgnore = ConfigurationManager.getProperty("bulkedit", "ignore-on-export");
if ((toIgnore == null) || ("".equals(toIgnore.trim())))
{
@@ -495,7 +491,7 @@ public class DSpaceCSV implements Serializable
// Split up on field separator
String[] parts = line.split(escapedFieldSeparator);
ArrayList<String> bits = new ArrayList<String>();
ArrayList<String> bits = new ArrayList<>();
bits.addAll(Arrays.asList(parts));
// Merge parts with embedded separators
@@ -624,7 +620,7 @@ public class DSpaceCSV implements Serializable
// Create the headings line
String[] csvLines = new String[counter + 1];
csvLines[0] = "id" + fieldSeparator + "collection";
List<String> headingsCopy = new ArrayList<String>(headings);
List<String> headingsCopy = new ArrayList<>(headings);
Collections.sort(headingsCopy);
for (String value : headingsCopy)
{
@@ -701,10 +697,11 @@ public class DSpaceCSV implements Serializable
*
* @return The formatted String as a csv
*/
@Override
public final String toString()
{
// Return the csv as one long string
StringBuffer csvLines = new StringBuffer();
StringBuilder csvLines = new StringBuilder();
String[] lines = this.getCSVLinesAsStringArray();
for (String line : lines)
{

View File

@@ -22,15 +22,16 @@ import java.util.*;
public class DSpaceCSVLine implements Serializable
{
/** The item id of the item represented by this line. -1 is for a new item */
private UUID id;
private final UUID id;
/** The elements in this line in a hashtable, keyed by the metadata type */
private Map<String, ArrayList> items;
private final Map<String, ArrayList> items;
protected final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService();
protected transient final AuthorityValueService authorityValueService
= AuthorityServiceFactory.getInstance().getAuthorityValueService();
/** ensuring that the order-sensible columns of the csv are processed in the correct order */
private final Comparator<? super String> headerComparator = new Comparator<String>() {
private transient final Comparator<? super String> headerComparator = new Comparator<String>() {
@Override
public int compare(String md1, String md2) {
// The metadata coming from an external source should be processed after the others
@@ -60,7 +61,7 @@ public class DSpaceCSVLine implements Serializable
{
// Store the ID + separator, and initialise the hashtable
this.id = itemId;
items = new TreeMap<String, ArrayList>(headerComparator);
items = new TreeMap<>(headerComparator);
// this.items = new HashMap<String, ArrayList>();
}
@@ -71,7 +72,7 @@ public class DSpaceCSVLine implements Serializable
{
// Set the ID to be null, and initialise the hashtable
this.id = null;
this.items = new TreeMap<String, ArrayList>(headerComparator);
this.items = new TreeMap<>(headerComparator);
}
/**
@@ -149,6 +150,7 @@ public class DSpaceCSVLine implements Serializable
* Write this line out as a CSV formatted string, in the order given by the headings provided
*
* @param headings The headings which define the order the elements must be presented in
* @param fieldSeparator
* @return The CSV formatted String
*/
protected String toCSV(List<String> headings, String fieldSeparator)
@@ -177,6 +179,7 @@ public class DSpaceCSVLine implements Serializable
* Internal method to create a CSV formatted String joining a given set of elements
*
* @param values The values to create the string from
* @param valueSeparator
* @return The line as a CSV formatted String
*/
protected String valueToCSV(List<String> values, String valueSeparator)

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.browse;
import java.io.Serializable;
import java.util.*;
import org.apache.log4j.Logger;
@@ -26,12 +27,12 @@ import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
import org.dspace.utils.DSpace;
/**
*
*
* @author Andrea Bollini (CILEA)
* @author Adán Román Ruiz at arvo.es (bugfix)
* @author Panagiotis Koutsourakis (National Documentation Centre) (bugfix)
* @author Kostas Stamatis (National Documentation Centre) (bugfix)
*
*
*/
public class SolrBrowseDAO implements BrowseDAO
{
@@ -40,7 +41,8 @@ public class SolrBrowseDAO implements BrowseDAO
this.context = context;
}
static private class FacetValueComparator implements Comparator
static private class FacetValueComparator
implements Comparator, Serializable
{
@Override
public int compare(Object o1, Object o2)
@@ -64,10 +66,10 @@ public class SolrBrowseDAO implements BrowseDAO
}
/** Log4j log */
private static Logger log = Logger.getLogger(SolrBrowseDAO.class);
private static final Logger log = Logger.getLogger(SolrBrowseDAO.class);
/** The DSpace context */
private Context context;
private final Context context;
// SQL query related attributes for this class
@@ -136,7 +138,7 @@ public class SolrBrowseDAO implements BrowseDAO
private boolean itemsDiscoverable = true;
private boolean showFrequencies;
private DiscoverResult getSolrResponse() throws BrowseException
{
if (sResponse == null)
@@ -205,7 +207,7 @@ public class SolrBrowseDAO implements BrowseDAO
}
else if (!itemsDiscoverable)
{
query.addFilterQueries("discoverable:false");
query.addFilterQueries("discoverable:false");
}
}
@@ -254,7 +256,7 @@ public class SolrBrowseDAO implements BrowseDAO
int count = doCountQuery();
int start = offset > 0 ? offset : 0;
int max = limit > 0 ? limit : count; //if negative, return everything
List<String[]> result = new ArrayList<String[]>();
List<String[]> result = new ArrayList<>();
if (ascending)
{
for (int i = start; i < (start + max) && i < count; i++)
@@ -390,22 +392,22 @@ public class SolrBrowseDAO implements BrowseDAO
return doCountQuery() - ascValue;
}
}
@Override
public boolean isEnableBrowseFrequencies()
{
return showFrequencies;
}
@Override
public void setEnableBrowseFrequencies(boolean enableBrowseFrequencies)
{
showFrequencies = enableBrowseFrequencies;
showFrequencies = enableBrowseFrequencies;
}
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getContainerID()
*/
@Override
@@ -416,7 +418,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getContainerIDField()
*/
@Override
@@ -427,7 +429,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getContainerTable()
*/
@Override
@@ -445,7 +447,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getFocusField()
*/
@Override
@@ -456,7 +458,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getFocusValue()
*/
@Override
@@ -467,7 +469,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getLimit()
*/
@Override
@@ -478,7 +480,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getOffset()
*/
@Override
@@ -489,7 +491,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getOrderField()
*/
@Override
@@ -507,7 +509,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getTable()
*/
@Override
@@ -518,7 +520,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getValue()
*/
@Override
@@ -529,7 +531,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#getValueField()
*/
@Override
@@ -540,7 +542,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#isAscending()
*/
@Override
@@ -551,7 +553,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#isDistinct()
*/
@Override
@@ -562,7 +564,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setAscending(boolean)
*/
@Override
@@ -574,7 +576,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setContainerID(int)
*/
@Override
@@ -586,7 +588,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setContainerIDField(java.lang.String)
*/
@Override
@@ -598,7 +600,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setContainerTable(java.lang.String)
*/
@Override
@@ -618,7 +620,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setDistinct(boolean)
*/
@Override
@@ -630,7 +632,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setEqualsComparator(boolean)
*/
@Override
@@ -642,7 +644,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setFocusField(java.lang.String)
*/
@Override
@@ -654,7 +656,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setFocusValue(java.lang.String)
*/
@Override
@@ -666,7 +668,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setLimit(int)
*/
@Override
@@ -678,7 +680,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setOffset(int)
*/
@Override
@@ -690,7 +692,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setOrderField(java.lang.String)
*/
@Override
@@ -710,7 +712,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setTable(java.lang.String)
*/
@Override
@@ -740,7 +742,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setValue(java.lang.String)
*/
@Override
@@ -752,7 +754,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setFilterValuePartial(boolean)
*/
@Override
@@ -764,7 +766,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
*/
@Override
@@ -776,7 +778,7 @@ public class SolrBrowseDAO implements BrowseDAO
/*
* (non-Javadoc)
*
*
* @see org.dspace.browse.BrowseDAO#useEqualsComparator()
*/
@Override

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.checker;
import java.io.Serializable;
import javax.persistence.*;
/**
@@ -16,7 +17,8 @@ import javax.persistence.*;
*/
@Entity
@Table(name="checksum_results")
public final class ChecksumResult
public class ChecksumResult
implements Serializable
{
@Id
@Column(name="result_code")

View File

@@ -71,7 +71,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
private Collection collection;
@Transient
private BitstreamService bitstreamService;
private transient BitstreamService bitstreamService;
public Bitstream()

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.content;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
@@ -31,7 +32,7 @@ import javax.persistence.*;
*/
@Entity
@Table(name="bitstreamformatregistry")
public class BitstreamFormat
public class BitstreamFormat implements Serializable
{
@Id
@@ -71,7 +72,7 @@ public class BitstreamFormat
private List<String> fileExtensions;
@Transient
private BitstreamFormatService bitstreamFormatService;
private transient BitstreamFormatService bitstreamFormatService;
/**
* The "unknown" support level - for bitstream formats that are unknown to
@@ -109,7 +110,7 @@ public class BitstreamFormat
*
* @return the short description
*/
public final String getShortDescription()
public String getShortDescription()
{
return shortDescription;
}
@@ -127,7 +128,7 @@ public class BitstreamFormat
*
* @return the description
*/
public final String getDescription()
public String getDescription()
{
return description;
}
@@ -139,7 +140,7 @@ public class BitstreamFormat
* @param s
* the new description
*/
public final void setDescription(String s)
public void setDescription(String s)
{
this.description = s;
}
@@ -172,7 +173,7 @@ public class BitstreamFormat
*
* @return the support level
*/
public final int getSupportLevel()
public int getSupportLevel()
{
return supportLevel;
}
@@ -194,7 +195,7 @@ public class BitstreamFormat
*
* @return <code>true</code> if the bitstream format is an internal type
*/
public final boolean isInternal()
public boolean isInternal()
{
return internal;
}
@@ -206,7 +207,7 @@ public class BitstreamFormat
* pass in <code>true</code> if the bitstream format is an
* internal type
*/
public final void setInternal(boolean b)
public void setInternal(boolean b)
{
internal = b;
}

View File

@@ -47,7 +47,7 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
inverseJoinColumns={@JoinColumn(name="bitstream_id") }
)
@OrderColumn(name="bitstream_order")
private List<Bitstream> bitstreams = new ArrayList<>();
private final List<Bitstream> bitstreams = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
@@ -55,10 +55,10 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "bundle_id", referencedColumnName = "uuid") },
inverseJoinColumns = {@JoinColumn(name = "item_id", referencedColumnName = "uuid") }
)
private List<Item> items = new ArrayList<>();
private final List<Item> items = new ArrayList<>();
@Transient
protected BundleService bundleService;
protected transient BundleService bundleService;
protected Bundle()
{

View File

@@ -83,10 +83,10 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
joinColumns = {@JoinColumn(name = "collection_id") },
inverseJoinColumns = {@JoinColumn(name = "community_id") }
)
private List<Community> communities = new ArrayList<>();
private final List<Community> communities = new ArrayList<>();
@Transient
private CollectionService collectionService;
private transient CollectionService collectionService;
// Keys for accessing Collection metadata
@Transient

View File

@@ -7,9 +7,15 @@
*/
package org.dspace.content;
import java.io.Serializable;
import java.util.Comparator;
public class CollectionNameComparator implements Comparator<Collection> {
/**
* Compares the names of two {@link Collection}s.
*/
public class CollectionNameComparator
implements Comparator<Collection>, Serializable
{
@Override
public int compare(Collection collection1, Collection collection2) {
return collection1.getName().compareTo(collection2.getName());

View File

@@ -41,7 +41,7 @@ import java.util.*;
public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService {
/** log4j category */
private static Logger log = Logger.getLogger(CollectionServiceImpl.class);
private static final Logger log = Logger.getLogger(CollectionServiceImpl.class);
@Autowired(required = true)
protected CollectionDAO collectionDAO;
@@ -132,7 +132,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
return findAuthorized(context, null, actionID);
}
List<Collection> myResults = new ArrayList<Collection>();
List<Collection> myResults = new ArrayList<>();
if(authorizeService.isAdmin(context))
{
@@ -359,6 +359,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
/**
* Get the value of a metadata field
*
* @param collection
* @param field
* the name of the metadata field to get
*
@@ -533,7 +534,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
}
context.addEvent(new Event(Event.ADD, Constants.COLLECTION, collection.getID(),
Constants.ITEM, item.getID(), item.getHandle(),
Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection)));
}
@@ -546,13 +547,13 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
item.removeCollection(collection);
//Check if we orphaned our poor item
if (item.getCollections().size() == 0)
if (item.getCollections().isEmpty())
{
// Orphan; delete it
itemService.delete(context, item);
}
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
collection.getID(), Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection)));
}
@@ -733,9 +734,9 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
@Override
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException {
List<Collection> myResults = new ArrayList<Collection>();
List<Collection> myResults = new ArrayList<>();
List<Collection> myCollections = null;
List<Collection> myCollections;
if (community != null)
{

View File

@@ -33,7 +33,7 @@ import java.util.*;
public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
{
/** log4j category */
private static Logger log = Logger.getLogger(Community.class);
private static final Logger log = Logger.getLogger(Community.class);
@Column(name="community_id", insertable = false, updatable = false)
private Integer legacyId;
@@ -44,13 +44,13 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "parent_comm_id") },
inverseJoinColumns = {@JoinColumn(name = "child_comm_id") }
)
private List<Community> subCommunities = new ArrayList<>();
private final List<Community> subCommunities = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "subCommunities")
private List<Community> parentCommunities = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "communities", cascade = {CascadeType.PERSIST})
private List<Collection> collections = new ArrayList<>();
private final List<Collection> collections = new ArrayList<>();
@OneToOne
@JoinColumn(name = "admin")
@@ -69,7 +69,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
public static final String SIDEBAR_TEXT = "side_bar_text";
@Transient
protected CommunityService communityService;
protected transient CommunityService communityService;
protected Community() {
}
@@ -207,6 +207,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
return true;
}
@Override
public int hashCode()
{
return new HashCodeBuilder().append(getID()).toHashCode();

View File

@@ -78,13 +78,13 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "item_id") },
inverseJoinColumns = {@JoinColumn(name = "collection_id") }
)
private List<Collection> collections = new ArrayList<>();
private final List<Collection> collections = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "items")
private List<Bundle> bundles = new ArrayList<>();
private final List<Bundle> bundles = new ArrayList<>();
@Transient
private ItemService itemService;
private transient ItemService itemService;
protected Item() {
}

View File

@@ -17,12 +17,12 @@ import org.dspace.sort.OrderFormat;
/**
* Compare two Items by their DCValues.
*
*
* The DCValues to be compared are specified by the element, qualifier and
language parameters to the constructor. If the Item has more than one
matching Metadatum, then the max parameter to the constructor specifies whether
the maximum or minimum lexicographic value will be used.
*
*
* @author Peter Breton
* @version $Revision$
*/
@@ -40,11 +40,12 @@ public class ItemComparator implements Comparator, Serializable
/** Whether maximum or minimum value will be used */
protected boolean max;
protected ItemService itemService;
protected transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
/**
* Constructor.
*
*
* @param element
* The Dublin Core element
* @param qualifier
@@ -63,19 +64,18 @@ public class ItemComparator implements Comparator, Serializable
this.qualifier = qualifier;
this.language = language;
this.max = max;
this.itemService = ContentServiceFactory.getInstance().getItemService();
}
/**
* Compare two Items by checking their DCValues for element, qualifier, and
* language.
*
*
* <p>
* Return >= 1 if the first is lexicographically greater than the second; <=
* -1 if the second is lexicographically greater than the first, and 0
* otherwise.
* </p>
*
*
* @param first
* The first object to compare. Must be an object of type
* org.dspace.content.Item.
@@ -122,11 +122,12 @@ public class ItemComparator implements Comparator, Serializable
* Return true if the object is equal to this one, false otherwise. Another
* object is equal to this one if it is also an ItemComparator, and has the
* same values for element, qualifier, language, and max.
*
*
* @param obj
* The object to compare to.
* @return True if the other object is equal to this one, false otherwise.
*/
@Override
public boolean equals(Object obj)
{
if (!(obj instanceof ItemComparator))
@@ -141,13 +142,16 @@ public class ItemComparator implements Comparator, Serializable
&& equalsWithNull(language, other.language) && (max == other.max);
}
@Override
public int hashCode()
{
return new HashCodeBuilder().append(element).append(qualifier).append(language).append(max).toHashCode();
}
/**
* Return true if the first string is equal to the second. Either or both
* @param first
* @param second
* @return true if the first string is equal to the second. Either or both
* may be null.
*/
protected boolean equalsWithNull(String first, String second)
@@ -170,7 +174,7 @@ public class ItemComparator implements Comparator, Serializable
* values, null is returned. If there is exactly one value, then it is
* returned. Otherwise, either the maximum or minimum lexicographical value
* is returned; the parameter to the constructor says which.
*
*
* @param item
* The item to check
* @return The chosen value, or null
@@ -180,7 +184,7 @@ public class ItemComparator implements Comparator, Serializable
// The overall array and each element are guaranteed non-null
List<MetadataValue> dcvalues = itemService.getMetadata(item, MetadataSchema.DC_SCHEMA, element, qualifier, language);
if (dcvalues.size() == 0)
if (dcvalues.isEmpty())
{
return null;
}
@@ -192,7 +196,7 @@ public class ItemComparator implements Comparator, Serializable
// We want to sort using Strings, but also keep track of
// which Metadatum the value came from.
Map<String, Integer> values = new HashMap<String, Integer>();
Map<String, Integer> values = new HashMap<>();
for (int i = 0; i < dcvalues.size(); i++)
{
@@ -204,7 +208,7 @@ public class ItemComparator implements Comparator, Serializable
}
}
if (values.size() == 0)
if (values.isEmpty())
{
return null;
}
@@ -220,6 +224,8 @@ public class ItemComparator implements Comparator, Serializable
/**
* Normalize the title of a Metadatum.
* @param value
* @return
*/
protected String normalizeTitle(MetadataValue value)
{

View File

@@ -26,7 +26,7 @@ public class Site extends DSpaceObject
{
@Transient
private SiteService siteService;
private transient SiteService siteService;
/**
* Get the type of this object, found in Constants

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.content;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@@ -26,7 +27,7 @@ import javax.persistence.*;
*/
@Entity
@Table(name = "workspaceitem")
public class WorkspaceItem implements InProgressSubmission
public class WorkspaceItem implements InProgressSubmission, Serializable
{
@Id
@@ -67,7 +68,7 @@ public class WorkspaceItem implements InProgressSubmission
joinColumns = {@JoinColumn(name = "workspace_item_id") },
inverseJoinColumns = {@JoinColumn(name = "eperson_group_id") }
)
private List<Group> supervisorGroups = new ArrayList<>();
private final List<Group> supervisorGroups = new ArrayList<>();
/**
@@ -131,6 +132,7 @@ public class WorkspaceItem implements InProgressSubmission
* @param o The other workspace item to compare to
* @return If they are equal or not
*/
@Override
public boolean equals(Object o) {
if (this == o)
{
@@ -150,6 +152,7 @@ public class WorkspaceItem implements InProgressSubmission
return true;
}
@Override
public int hashCode()
{
return new HashCodeBuilder().append(getID()).toHashCode();

View File

@@ -15,6 +15,7 @@ import org.dspace.core.GenericDAO;
* All DSpaceObject DAO classes should implement this class since it ensures that the T object is of type DSpaceObject
*
* @author kevinvandevelde at atmire.com
* @param <T>
*/
public interface DSpaceObjectDAO<T extends DSpaceObject> extends GenericDAO<T> {
}

View File

@@ -17,6 +17,7 @@ import java.sql.SQLException;
* to identify DSpaceObjects prior to DSpace 6.0
*
* @author kevinvandevelde at atmire.com
* @param <T>
*/
public interface DSpaceObjectLegacySupportDAO<T extends DSpaceObject> extends DSpaceObjectDAO<T> {

View File

@@ -64,7 +64,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
private String digestAlgorithm;
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "epeople")
private List<Group> groups = new ArrayList<>();
private final List<Group> groups = new ArrayList<>();
/** The e-mail field (for sorting) */
public static final int EMAIL = 1;
@@ -82,7 +82,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
public static final int LANGUAGE = 5;
@Transient
protected EPersonService ePersonService;
protected transient EPersonService ePersonService;
protected EPerson() {
}

View File

@@ -52,7 +52,7 @@ public class Group extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "eperson_group_id") },
inverseJoinColumns = {@JoinColumn(name = "eperson_id") }
)
private List<EPerson> epeople = new ArrayList<>();
private final List<EPerson> epeople = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
@@ -60,19 +60,19 @@ public class Group extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "parent_id") },
inverseJoinColumns = {@JoinColumn(name = "child_id") }
)
private List<Group> groups = new ArrayList<>();
private final List<Group> groups = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "groups")
private List<Group> parentGroups = new ArrayList<>();
private final List<Group> parentGroups = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "supervisorGroups")
private List<WorkspaceItem> supervisedItems = new ArrayList<>();
private final List<WorkspaceItem> supervisedItems = new ArrayList<>();
@Transient
private boolean groupsChanged;
@Transient
private GroupService groupService;
private transient GroupService groupService;
public Group() {
}

View File

@@ -50,20 +50,20 @@ public class UsageEvent extends Event {
*/
private static final long serialVersionUID = 1L;
private transient HttpServletRequest request;
private HttpServletRequest request;
private transient String ip;
private String ip;
private transient String userAgent;
private String userAgent;
private transient String xforwardedfor;
private String xforwardedfor;
private transient Context context;
private Context context;
private transient DSpaceObject object;
private DSpaceObject object;
private Action action;
private static String checkParams(Action action, HttpServletRequest request, Context context, DSpaceObject object)
{
StringBuilder eventName = new StringBuilder();

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

View File

@@ -35,8 +35,8 @@ public class DataProviderServlet extends HttpServlet {
private static final Logger log = Logger.getLogger(DataProviderServlet.class);
protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
protected final transient HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
/**
* Processes requests for both HTTP
* <code>GET</code> and

View File

@@ -32,8 +32,8 @@ public class LocalURIRedirectionServlet extends HttpServlet
private final static Logger log = Logger.getLogger(LocalURIRedirectionServlet.class);
protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
protected final transient HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
/**
* Processes requests for both HTTP
* <code>GET</code> and
@@ -112,6 +112,7 @@ public class LocalURIRedirectionServlet extends HttpServlet
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
@@ -126,6 +127,7 @@ public class LocalURIRedirectionServlet extends HttpServlet
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
@@ -136,6 +138,7 @@ public class LocalURIRedirectionServlet extends HttpServlet
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Ensures that URIs used in RDF can be dereferenced.";
}

View File

@@ -28,9 +28,16 @@ import org.purl.sword.base.SWORDException;
*/
public class AtomDocumentServlet extends DepositServlet {
/**
public AtomDocumentServlet()
throws ServletException
{
super();
}
/**
* Process the get request.
*/
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {

View File

@@ -47,7 +47,7 @@ import org.purl.sword.base.SWORDErrorException;
public class DepositServlet extends HttpServlet {
/** Sword repository */
protected SWORDServer myRepository;
protected final transient SWORDServer myRepository;
/** Authentication type */
private String authN;
@@ -59,36 +59,41 @@ public class DepositServlet extends HttpServlet {
private String tempDirectory;
/** Counter */
private static AtomicInteger counter = new AtomicInteger(0);
private static final AtomicInteger counter = new AtomicInteger(0);
/** Logger */
private static Logger log = Logger.getLogger(DepositServlet.class);
private static final Logger log = Logger.getLogger(DepositServlet.class);
/**
* Initialise the servlet
*
* @throws ServletException
*/
public void init() throws ServletException {
public DepositServlet()
throws ServletException
{
// Instantiate the correct SWORD Server class
String className = getServletContext().getInitParameter("sword-server-class");
if (className == null) {
log.fatal("Unable to read value of 'sword-server-class' from Servlet context");
} else {
try {
myRepository = (SWORDServer) Class.forName(className)
.newInstance();
log.info("Using " + className + " as the SWORDServer");
} catch (Exception e) {
log
.fatal("Unable to instantiate class from 'sword-server-class': "
+ className);
throw new ServletException(
"Unable to instantiate class from 'sword-server-class': "
+ className, e);
}
throw new ServletException("Unable to read value of 'sword-server-class' from Servlet context");
}
try {
myRepository = (SWORDServer) Class.forName(className)
.newInstance();
log.info("Using " + className + " as the SWORDServer");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
log.fatal("Unable to instantiate class from 'sword-server-class': "
+ className);
throw new ServletException(
"Unable to instantiate class from 'sword-server-class': "
+ className, e);
}
}
/**
* Initialise the servlet
*
* @throws ServletException
*/
@Override
public void init() throws ServletException {
authN = getServletContext().getInitParameter("authentication-method");
if ((authN == null) || (authN.equals(""))) {
authN = "None";
@@ -145,6 +150,7 @@ public class DepositServlet extends HttpServlet {
/**
* Process the Get request. This will return an unimplemented response.
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Send a '501 Not Implemented'
response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
@@ -153,6 +159,7 @@ public class DepositServlet extends HttpServlet {
/**
* Process a post request.
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Create the Deposit request
Deposit d = new Deposit();
@@ -235,7 +242,7 @@ public class DepositServlet extends HttpServlet {
d.setFile(file);
// Set the X-On-Behalf-Of header
String onBehalfOf = request.getHeader(HttpHeaders.X_ON_BEHALF_OF.toString());
String onBehalfOf = request.getHeader(HttpHeaders.X_ON_BEHALF_OF);
if ((onBehalfOf != null) && (onBehalfOf.equals("reject"))) {
// user name is "reject", so throw a not know error to allow the client to be tested
throw new SWORDErrorException(ErrorCodes.TARGET_OWNER_UKNOWN,"unknown user \"reject\"");
@@ -299,13 +306,13 @@ public class DepositServlet extends HttpServlet {
DepositResponse dr = myRepository.doDeposit(d);
// Echo back the user agent
if (request.getHeader(HttpHeaders.USER_AGENT.toString()) != null) {
dr.getEntry().setUserAgent(request.getHeader(HttpHeaders.USER_AGENT.toString()));
if (request.getHeader(HttpHeaders.USER_AGENT) != null) {
dr.getEntry().setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
}
// Echo back the packaging format
if (request.getHeader(HttpHeaders.X_PACKAGING.toString()) != null) {
dr.getEntry().setPackaging(request.getHeader(HttpHeaders.X_PACKAGING.toString()));
if (request.getHeader(HttpHeaders.X_PACKAGING) != null) {
dr.getEntry().setPackaging(request.getHeader(HttpHeaders.X_PACKAGING));
}
// Print out the Deposit Response
@@ -380,8 +387,8 @@ public class DepositServlet extends HttpServlet {
Summary sum = new Summary();
sum.setContent(summary);
sed.setSummary(sum);
if (request.getHeader(HttpHeaders.USER_AGENT.toString()) != null) {
sed.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT.toString()));
if (request.getHeader(HttpHeaders.USER_AGENT) != null) {
sed.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
}
response.setStatus(status);
response.setContentType("application/atom+xml; charset=UTF-8");

View File

@@ -33,7 +33,7 @@ import org.purl.sword.base.ServiceDocumentRequest;
public class ServiceDocumentServlet extends HttpServlet {
/** The repository */
private SWORDServer myRepository;
private final transient SWORDServer myRepository;
/** Authentication type. */
private String authN;
@@ -42,24 +42,22 @@ public class ServiceDocumentServlet extends HttpServlet {
private int maxUploadSize;
/** Logger */
private static Logger log = Logger.getLogger(ServiceDocumentServlet.class);
private static final Logger log = Logger.getLogger(ServiceDocumentServlet.class);
/**
* Initialise the servlet.
*
* @throws ServletException
*/
public void init() throws ServletException {
public ServiceDocumentServlet()
throws ServletException
{
// Instantiate the correct SWORD Server class
String className = getServletContext().getInitParameter("sword-server-class");
if (className == null) {
log.fatal("Unable to read value of 'sword-server-class' from Servlet context");
throw new ServletException("Unable to read value of 'sword-server-class' from Servlet context");
} else {
try {
myRepository = (SWORDServer) Class.forName(className)
.newInstance();
log.info("Using " + className + " as the SWORDServer");
} catch (Exception e) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
log.fatal("Unable to instantiate class from 'server-class': "
+ className);
throw new ServletException(
@@ -67,6 +65,15 @@ public class ServiceDocumentServlet extends HttpServlet {
+ className, e);
}
}
}
/**
* Initialise the servlet.
*
* @throws ServletException
*/
@Override
public void init() throws ServletException {
// Set the authentication method
authN = getServletContext().getInitParameter("authentication-method");
@@ -95,6 +102,7 @@ public class ServiceDocumentServlet extends HttpServlet {
/**
* Process the get request.
*/
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// Create the ServiceDocumentRequest
@@ -116,8 +124,7 @@ public class ServiceDocumentServlet extends HttpServlet {
}
// Set the x-on-behalf-of header
sdr.setOnBehalfOf(request.getHeader(HttpHeaders.X_ON_BEHALF_OF
.toString()));
sdr.setOnBehalfOf(request.getHeader(HttpHeaders.X_ON_BEHALF_OF));
// Set the IP address
sdr.setIPAddress(request.getRemoteAddr());
@@ -156,6 +163,7 @@ public class ServiceDocumentServlet extends HttpServlet {
/**
* Process the post request. This will return an unimplemented response.
*/
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// Send a '501 Not Implemented'

View File

@@ -54,7 +54,7 @@ public class DSpaceValidity implements SourceValidity
/** Simple flag to note if the object has been completed. */
protected boolean completed = false;
/** A hash of the validityKey taken after completetion */
/** A hash of the validityKey taken after completion */
protected long hash;
/** The time when the validity is no longer assumed to be valid */
@@ -64,9 +64,9 @@ public class DSpaceValidity implements SourceValidity
protected long assumedValidityDelay = 0;
protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
transient protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
transient protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
transient protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
/**

View File

@@ -151,7 +151,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.2</version>
<version>3.0.3</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>