mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
[DS-707] Style / readability fixes
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5579 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -322,10 +322,12 @@ public class ItemExport
|
||||
finally
|
||||
{
|
||||
if (i != null)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c.complete();
|
||||
}
|
||||
@@ -882,10 +884,12 @@ public class ItemExport
|
||||
finally
|
||||
{
|
||||
if (iitems != null)
|
||||
{
|
||||
iitems.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dso.getType() == Constants.COLLECTION)
|
||||
{
|
||||
Collection collection = (Collection) dso;
|
||||
@@ -914,9 +918,11 @@ public class ItemExport
|
||||
finally
|
||||
{
|
||||
if (iitems != null)
|
||||
{
|
||||
iitems.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dso.getType() == Constants.ITEM)
|
||||
{
|
||||
Item item = (Item) dso;
|
||||
@@ -1030,7 +1036,9 @@ public class ItemExport
|
||||
finally
|
||||
{
|
||||
if (iitems != null)
|
||||
{
|
||||
iitems.close();
|
||||
}
|
||||
|
||||
// Make sure the database connection gets closed in all conditions.
|
||||
try {
|
||||
|
@@ -953,7 +953,9 @@ public class ItemImport
|
||||
String value = getStringValue(n); //n.getNodeValue();
|
||||
// compensate for empty value getting read as "null", which won't display
|
||||
if (value == null)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
// //getElementData(n, "element");
|
||||
String element = getAttributeValue(n, "element");
|
||||
String qualifier = getAttributeValue(n, "qualifier"); //NodeValue();
|
||||
|
@@ -389,7 +389,9 @@ public class MediaFilterManager
|
||||
if (updateIndex)
|
||||
{
|
||||
if (!isQuiet)
|
||||
{
|
||||
System.out.println("Updating search index:");
|
||||
}
|
||||
DSIndexer.updateIndex(c);
|
||||
}
|
||||
|
||||
@@ -437,10 +439,12 @@ public class MediaFilterManager
|
||||
finally
|
||||
{
|
||||
if (i != null)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyFiltersCommunity(Context c, Community community)
|
||||
throws Exception
|
||||
@@ -478,10 +482,12 @@ public class MediaFilterManager
|
||||
finally
|
||||
{
|
||||
if (i != null)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyFiltersItem(Context c, Item item) throws Exception
|
||||
{
|
||||
@@ -708,7 +714,9 @@ public class MediaFilterManager
|
||||
{
|
||||
//do pre-processing of this bitstream, and if it fails, skip this bitstream!
|
||||
if(!formatFilter.preProcessBitstream(c, item, source))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean overWrite = MediaFilterManager.isForce;
|
||||
|
||||
@@ -743,8 +751,10 @@ public class MediaFilterManager
|
||||
if (!overWrite && (existingBitstream != null))
|
||||
{
|
||||
if (!isQuiet)
|
||||
{
|
||||
System.out.println("SKIPPED: bitstream " + source.getID()
|
||||
+ " (item: " + item.getHandle() + ") because '" + newName + "' already exists");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -753,8 +763,10 @@ public class MediaFilterManager
|
||||
if (destStream == null)
|
||||
{
|
||||
if (!isQuiet)
|
||||
{
|
||||
System.out.println("SKIPPED: bitstream " + source.getID()
|
||||
+ " (item: " + item.getHandle() + ") because filtering was unsuccessful");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -797,8 +809,10 @@ public class MediaFilterManager
|
||||
}
|
||||
|
||||
if (!isQuiet)
|
||||
{
|
||||
System.out.println("FILTERED: bitstream " + source.getID()
|
||||
+ " (item: " + item.getHandle() + ") and created '" + newName + "'");
|
||||
}
|
||||
|
||||
//do post-processing of the generated bitstream
|
||||
formatFilter.postProcessBitstream(c, item, b);
|
||||
@@ -835,7 +849,9 @@ public class MediaFilterManager
|
||||
if(skipList!=null && skipList.contains(identifier))
|
||||
{
|
||||
if (!isQuiet)
|
||||
{
|
||||
System.out.println("SKIP-LIST: skipped bitstreams within identifier " + identifier);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@@ -220,8 +220,10 @@ public class METSExport
|
||||
finally
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
items.close();
|
||||
}
|
||||
}
|
||||
|
||||
context.abort();
|
||||
System.exit(0);
|
||||
@@ -261,7 +263,15 @@ public class METSExport
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
try { is.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -213,10 +213,14 @@ public class GenerateSitemaps
|
||||
String url = handleURLStem + comms[i].getHandle();
|
||||
|
||||
if (makeHTMLMap)
|
||||
{
|
||||
html.addURL(url, null);
|
||||
}
|
||||
if (makeSitemapOrg)
|
||||
{
|
||||
sitemapsOrg.addURL(url, null);
|
||||
}
|
||||
}
|
||||
|
||||
Collection[] colls = Collection.findAll(c);
|
||||
|
||||
@@ -225,10 +229,14 @@ public class GenerateSitemaps
|
||||
String url = handleURLStem + colls[i].getHandle();
|
||||
|
||||
if (makeHTMLMap)
|
||||
{
|
||||
html.addURL(url, null);
|
||||
}
|
||||
if (makeSitemapOrg)
|
||||
{
|
||||
sitemapsOrg.addURL(url, null);
|
||||
}
|
||||
}
|
||||
|
||||
ItemIterator allItems = Item.findAll(c);
|
||||
try
|
||||
@@ -242,9 +250,13 @@ public class GenerateSitemaps
|
||||
Date lastMod = i.getLastModified();
|
||||
|
||||
if (makeHTMLMap)
|
||||
{
|
||||
html.addURL(url, lastMod);
|
||||
}
|
||||
if (makeSitemapOrg)
|
||||
{
|
||||
sitemapsOrg.addURL(url, lastMod);
|
||||
}
|
||||
i.decache();
|
||||
|
||||
itemCount++;
|
||||
@@ -271,8 +283,10 @@ public class GenerateSitemaps
|
||||
finally
|
||||
{
|
||||
if (allItems != null)
|
||||
{
|
||||
allItems.close();
|
||||
}
|
||||
}
|
||||
|
||||
c.abort();
|
||||
}
|
||||
|
@@ -99,7 +99,9 @@ public class MetadataExposure
|
||||
{
|
||||
// the administrator's override
|
||||
if (context != null && AuthorizeManager.isAdmin(context))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// for schema.element, just check schema->elementSet
|
||||
if (!isInitialized())
|
||||
@@ -118,7 +120,9 @@ public class MetadataExposure
|
||||
{
|
||||
Map<String,Set<String>> elts = hiddenElementMaps.get(schema);
|
||||
if (elts == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Set<String> quals = elts.get(element);
|
||||
return quals == null ? false : quals.contains(qualifier);
|
||||
}
|
||||
|
@@ -308,7 +308,9 @@ public class IPAuthentication implements AuthenticationMethod
|
||||
for (int i = 0; i < results.length; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
gsb.append(",");
|
||||
}
|
||||
gsb.append(results[i]);
|
||||
}
|
||||
|
||||
|
@@ -170,7 +170,9 @@ public class LDAPAuthentication
|
||||
|
||||
// Skip out when no netid or password is given.
|
||||
if (netid == null || password == null)
|
||||
{
|
||||
return BAD_ARGS;
|
||||
}
|
||||
|
||||
// Locate the eperson
|
||||
EPerson eperson = null;
|
||||
@@ -379,25 +381,37 @@ public class LDAPAuthentication
|
||||
if (attlist[0]!=null)
|
||||
{
|
||||
att = atts.get(attlist[0]);
|
||||
if (att != null) ldapEmail = (String)att.get();
|
||||
if (att != null)
|
||||
{
|
||||
ldapEmail = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[1]!=null)
|
||||
{
|
||||
att = atts.get(attlist[1]);
|
||||
if (att != null) ldapGivenName = (String)att.get();
|
||||
if (att != null)
|
||||
{
|
||||
ldapGivenName = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[2]!=null)
|
||||
{
|
||||
att = atts.get(attlist[2]);
|
||||
if (att != null) ldapSurname = (String)att.get();
|
||||
if (att != null)
|
||||
{
|
||||
ldapSurname = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[3]!=null)
|
||||
{
|
||||
att = atts.get(attlist[3]);
|
||||
if (att != null) ldapPhone = (String)att.get();
|
||||
if (att != null)
|
||||
{
|
||||
ldapPhone = (String) att.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,8 +436,10 @@ public class LDAPAuthentication
|
||||
try
|
||||
{
|
||||
if (ctx != null)
|
||||
{
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
}
|
||||
|
@@ -194,7 +194,9 @@ public class LDAPHierarchicalAuthentication
|
||||
|
||||
// Skip out when no netid or password is given.
|
||||
if (netid == null || password == null)
|
||||
{
|
||||
return BAD_ARGS;
|
||||
}
|
||||
|
||||
// Locate the eperson
|
||||
EPerson eperson = null;
|
||||
@@ -451,25 +453,33 @@ public class LDAPHierarchicalAuthentication
|
||||
if (attlist[0] != null) {
|
||||
att = atts.get(attlist[0]);
|
||||
if (att != null)
|
||||
{
|
||||
ldapEmail = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[1] != null) {
|
||||
att = atts.get(attlist[1]);
|
||||
if (att != null)
|
||||
{
|
||||
ldapGivenName = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[2] != null) {
|
||||
att = atts.get(attlist[2]);
|
||||
if (att != null)
|
||||
{
|
||||
ldapSurname = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist[3] != null) {
|
||||
att = atts.get(attlist[3]);
|
||||
if (att != null)
|
||||
{
|
||||
ldapPhone = (String) att.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (answer.hasMoreElements()) {
|
||||
@@ -502,7 +512,9 @@ public class LDAPHierarchicalAuthentication
|
||||
try
|
||||
{
|
||||
if (ctx != null)
|
||||
{
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
@@ -544,7 +556,9 @@ public class LDAPHierarchicalAuthentication
|
||||
// Close the context when we're done
|
||||
try {
|
||||
if (ctx != null)
|
||||
{
|
||||
ctx.close();
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
}
|
||||
}
|
||||
|
@@ -543,7 +543,9 @@ public class IndexBrowse
|
||||
DCValue value = null;
|
||||
|
||||
if (itemMDMap != null)
|
||||
{
|
||||
value = (DCValue) itemMDMap.get(metadata);
|
||||
}
|
||||
|
||||
// We haven't used this metadata before, so grab it from the item
|
||||
if (value == null)
|
||||
@@ -564,9 +566,11 @@ public class IndexBrowse
|
||||
value = dcv[0];
|
||||
|
||||
if (itemMDMap != null)
|
||||
{
|
||||
itemMDMap.put(metadata, dcv[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// normalise the values as we insert into the sort map
|
||||
if (value != null && value.value != null)
|
||||
|
@@ -120,9 +120,11 @@ public class ItemCountDAOOracle implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the count of the given community
|
||||
@@ -160,9 +162,11 @@ public class ItemCountDAOOracle implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dspace context to use
|
||||
@@ -302,9 +306,11 @@ public class ItemCountDAOOracle implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the count for the given community
|
||||
@@ -344,7 +350,9 @@ public class ItemCountDAOOracle implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -120,9 +120,11 @@ public class ItemCountDAOPostgres implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the count of the given community
|
||||
@@ -160,9 +162,11 @@ public class ItemCountDAOPostgres implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dspace context to use
|
||||
@@ -302,9 +306,11 @@ public class ItemCountDAOPostgres implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the count for the given community
|
||||
@@ -344,7 +350,9 @@ public class ItemCountDAOPostgres implements ItemCountDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -124,8 +124,10 @@ public class LocaleOrderingFilter implements TextFilter
|
||||
RuleBasedCollator collator = (RuleBasedCollator)Collator.getInstance(locale);
|
||||
|
||||
if (collator != null)
|
||||
{
|
||||
return collator;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -230,11 +230,17 @@ public class DCDate
|
||||
granularity = DateGran.TIME;
|
||||
Date date = tryParse(fullIso, fromDC);
|
||||
if (date == null)
|
||||
{
|
||||
date = tryParse(fullIso2, fromDC);
|
||||
}
|
||||
if (date == null)
|
||||
{
|
||||
date = tryParse(fullIso3, fromDC);
|
||||
}
|
||||
if (date == null)
|
||||
{
|
||||
date = tryParse(fullIso4, fromDC);
|
||||
}
|
||||
if (date == null)
|
||||
{
|
||||
// Seems there is no time component to the date.
|
||||
@@ -442,7 +448,9 @@ public class DCDate
|
||||
public String toString()
|
||||
{
|
||||
if (calendar == null)
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
return toStringInternal();
|
||||
}
|
||||
|
||||
|
@@ -121,8 +121,10 @@ public class FormatIdentifier
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
return retFormat;
|
||||
}
|
||||
}
|
||||
|
@@ -194,7 +194,9 @@ public class InstallItem
|
||||
// add date available if not under embargo, otherwise it will
|
||||
// be set when the embargo is lifted.
|
||||
if (embargoLiftDate == null)
|
||||
{
|
||||
item.addDC("date", "available", null, now.toString());
|
||||
}
|
||||
|
||||
// create issue date if not present
|
||||
DCValue[] currentDateIssued = item.getDC("date", "issued", Item.ANY);
|
||||
@@ -249,7 +251,9 @@ public class InstallItem
|
||||
|
||||
// set embargo lift date and take away read access if indicated.
|
||||
if (embargoLiftDate != null)
|
||||
{
|
||||
EmbargoManager.setEmbargo(c, item, embargoLiftDate);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@@ -704,7 +704,9 @@ public class Item extends DSpaceObject
|
||||
// authority sanity check: if authority is required, was it supplied?
|
||||
// XXX FIXME? can't throw a "real" exception here without changing all the callers to expect it, so use a runtime exception
|
||||
if (authorityRequired && (dcv.authority == null || dcv.authority.length() == 0))
|
||||
throw new IllegalArgumentException("The metadata field \""+fieldName+"\" requires an authority key but none was provided. Vaue=\""+dcv.value+"\"");
|
||||
{
|
||||
throw new IllegalArgumentException("The metadata field \"" + fieldName + "\" requires an authority key but none was provided. Vaue=\"" + dcv.value + "\"");
|
||||
}
|
||||
}
|
||||
if (values[i] != null)
|
||||
{
|
||||
@@ -1045,8 +1047,10 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Collection[] collectionArray = new Collection[collections.size()];
|
||||
collectionArray = (Collection[]) collections.toArray(collectionArray);
|
||||
@@ -1099,8 +1103,10 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Community[] communityArray = new Community[communities.size()];
|
||||
communityArray = (Community[]) communities.toArray(communityArray);
|
||||
@@ -1149,9 +1155,11 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bundle[] bundleArray = new Bundle[bundles.size()];
|
||||
bundleArray = (Bundle[]) bundles.toArray(bundleArray);
|
||||
@@ -1328,9 +1336,11 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a single bitstream in a new bundle. Provided as a convenience
|
||||
@@ -1623,11 +1633,15 @@ public class Item extends DSpaceObject
|
||||
|
||||
// Check the metadata field is the same
|
||||
if (matched && dcFields[dcIdx].getFieldID() != tr.getIntColumn("metadata_field_id"))
|
||||
{
|
||||
matched = false;
|
||||
}
|
||||
|
||||
// Check the place is the same
|
||||
if (matched && placeNum[dcIdx] != tr.getIntColumn("place"))
|
||||
{
|
||||
matched = false;
|
||||
}
|
||||
|
||||
// Check the text is the same
|
||||
if (matched)
|
||||
@@ -1673,8 +1687,10 @@ public class Item extends DSpaceObject
|
||||
if (!((dcv.authority == null && auth == null) ||
|
||||
(dcv.authority != null && auth != null && dcv.authority.equals(auth))
|
||||
&& dcv.confidence == conf))
|
||||
{
|
||||
matched = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If the db record is identical to the in memory values
|
||||
if (matched)
|
||||
@@ -2022,8 +2038,14 @@ public class Item extends DSpaceObject
|
||||
return false;
|
||||
}
|
||||
final Item other = (Item) obj;
|
||||
if (this.getType() != other.getType()) return false;
|
||||
if (this.getID() != other.getID()) return false;
|
||||
if (this.getType() != other.getType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.getID() != other.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2384,11 +2406,15 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
MetadataSchema mds = MetadataSchema.find(context, schema);
|
||||
if (mds == null)
|
||||
throw new IllegalArgumentException("No such metadata schema: "+schema);
|
||||
{
|
||||
throw new IllegalArgumentException("No such metadata schema: " + schema);
|
||||
}
|
||||
MetadataField mdf = MetadataField.findByElement(context, mds.getSchemaID(), element, qualifier);
|
||||
if (mdf == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No such metadata field: schema="+schema+", element="+element+", qualifier="+qualifier);
|
||||
"No such metadata field: schema=" + schema + ", element=" + element + ", qualifier=" + qualifier);
|
||||
}
|
||||
|
||||
String query = "SELECT item.* FROM metadatavalue,item WHERE item.in_archive='1' "+
|
||||
"AND item.item_id = metadatavalue.item_id AND metadata_field_id = ?";
|
||||
@@ -2558,10 +2584,14 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
MetadataSchema mds = MetadataSchema.find(context, schema);
|
||||
if (mds == null)
|
||||
throw new IllegalArgumentException("No such metadata schema: "+schema);
|
||||
{
|
||||
throw new IllegalArgumentException("No such metadata schema: " + schema);
|
||||
}
|
||||
MetadataField mdf = MetadataField.findByElement(context, mds.getSchemaID(), element, qualifier);
|
||||
if (mdf == null)
|
||||
throw new IllegalArgumentException("No such metadata field: schema="+schema+", element="+element+", qualifier="+qualifier);
|
||||
{
|
||||
throw new IllegalArgumentException("No such metadata field: schema=" + schema + ", element=" + element + ", qualifier=" + qualifier);
|
||||
}
|
||||
|
||||
TableRowIterator rows = DatabaseManager.queryTable(context, "item",
|
||||
"SELECT item.* FROM metadatavalue,item WHERE item.in_archive='1' "+
|
||||
@@ -2650,10 +2680,12 @@ public class Item extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
@@ -275,6 +275,8 @@ public class ItemIterator
|
||||
public void close()
|
||||
{
|
||||
if (itemRows != null)
|
||||
{
|
||||
itemRows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -332,8 +332,10 @@ public class MetadataField
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
@@ -372,8 +374,10 @@ public class MetadataField
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert list into an array
|
||||
MetadataField[] typeArray = new MetadataField[fields.size()];
|
||||
@@ -410,8 +414,10 @@ public class MetadataField
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert list into an array
|
||||
MetadataField[] typeArray = new MetadataField[fields.size()];
|
||||
@@ -629,7 +635,9 @@ public class MetadataField
|
||||
// 'sanity check' first.
|
||||
Integer iid = Integer.valueOf(id);
|
||||
if (!id2field.containsKey(iid))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (MetadataField) id2field.get(iid);
|
||||
}
|
||||
@@ -670,8 +678,10 @@ public class MetadataField
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
id2field = new_id2field;
|
||||
}
|
||||
|
@@ -306,8 +306,10 @@ public class MetadataSchema
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
@@ -411,8 +413,10 @@ public class MetadataSchema
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert list into an array
|
||||
MetadataSchema[] typeArray = new MetadataSchema[schemas.size()];
|
||||
@@ -545,7 +549,9 @@ public class MetadataSchema
|
||||
|
||||
// sanity check
|
||||
if (!id2schema.containsKey(iid))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (MetadataSchema) id2schema.get(iid);
|
||||
}
|
||||
@@ -565,7 +571,9 @@ public class MetadataSchema
|
||||
{
|
||||
// If we are not passed a valid schema name then return
|
||||
if (shortName == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isCacheInitialized())
|
||||
{
|
||||
@@ -573,7 +581,9 @@ public class MetadataSchema
|
||||
}
|
||||
|
||||
if (!name2schema.containsKey(shortName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (MetadataSchema) name2schema.get(shortName);
|
||||
}
|
||||
@@ -617,8 +627,10 @@ public class MetadataSchema
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
id2schema = new_id2schema;
|
||||
name2schema = new_name2schema;
|
||||
|
@@ -338,8 +338,10 @@ public class MetadataValue
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
@@ -383,8 +385,10 @@ public class MetadataValue
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -89,8 +89,10 @@ public class DCInputAuthority extends SelfNamedPlugin implements ChoiceAuthority
|
||||
try
|
||||
{
|
||||
if (dci == null)
|
||||
{
|
||||
dci = new DCInputsReader();
|
||||
}
|
||||
}
|
||||
catch (DCInputsReaderException e)
|
||||
{
|
||||
log.error("Failed reading DCInputs initialization: ",e);
|
||||
@@ -144,8 +146,10 @@ public class DCInputAuthority extends SelfNamedPlugin implements ChoiceAuthority
|
||||
{
|
||||
v[i] = new Choice(values[i], values[i], labels[i]);
|
||||
if (values[i].equalsIgnoreCase(query))
|
||||
{
|
||||
dflt = i;
|
||||
}
|
||||
}
|
||||
return new Choices(v, 0, v.length, Choices.CF_AMBIGUOUS, false, dflt);
|
||||
}
|
||||
|
||||
|
@@ -106,9 +106,11 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
|
||||
// sanity check
|
||||
if (url == null)
|
||||
{
|
||||
throw new IllegalStateException("Missing DSpace configuration keys for LCName Query");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// punt! this is a poor implementation..
|
||||
public Choices getBestMatch(String text, int collection, String locale)
|
||||
@@ -159,7 +161,9 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
|
||||
// XXX arbitrary default limit - should be configurable?
|
||||
if (limit == 0)
|
||||
{
|
||||
limit = 50;
|
||||
}
|
||||
|
||||
NameValuePair args[] = new NameValuePair[6];
|
||||
args[0] = new NameValuePair("operation", "searchRetrieve");
|
||||
@@ -194,8 +198,10 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
|
||||
// this probably just means more results available..
|
||||
if (handler.hits != handler.result.size())
|
||||
log.warn("Discrepency in results, result.length="+handler.result.size()+
|
||||
", yet expected results="+handler.hits);
|
||||
{
|
||||
log.warn("Discrepency in results, result.length=" + handler.result.size() +
|
||||
", yet expected results=" + handler.hits);
|
||||
}
|
||||
boolean more = handler.hits > (start + handler.result.size());
|
||||
|
||||
// XXX add non-auth option; perhaps the UI should do this?
|
||||
@@ -311,7 +317,9 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
{
|
||||
// HACK: many LC name entries end with ',' ...trim it.
|
||||
if (name.endsWith(","))
|
||||
name = name.substring(0, name.length()-1);
|
||||
{
|
||||
name = name.substring(0, name.length() - 1);
|
||||
}
|
||||
|
||||
// XXX DEBUG
|
||||
// log.debug("Got result, name="+name+", lccn="+lccn);
|
||||
@@ -342,7 +350,9 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
}
|
||||
|
||||
if (lastTag.equals("100") && lastCode.equals("d") && (name != null))
|
||||
name = name+" "+textValue;
|
||||
{
|
||||
name = name + " " + textValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -360,16 +370,20 @@ public class LCNameAuthority implements ChoiceAuthority
|
||||
{
|
||||
lastTag = atts.getValue("tag");
|
||||
if (lastTag == null)
|
||||
{
|
||||
log.warn("MARC datafield without tag attribute!");
|
||||
}
|
||||
}
|
||||
else if (localName.equals("subfield") &&
|
||||
namespaceURI.equals(NS_MX))
|
||||
{
|
||||
lastCode = atts.getValue("code");
|
||||
if (lastCode == null)
|
||||
{
|
||||
log.warn("MARC subfield without code attribute!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void error(SAXParseException exception)
|
||||
throws SAXException
|
||||
|
@@ -136,7 +136,9 @@ public class MetadataAuthorityManager
|
||||
// get minConfidence level for this field if any
|
||||
int mci = readConfidence("authority.minconfidence."+field);
|
||||
if (mci >= Choices.CF_UNSET)
|
||||
{
|
||||
minConfidence.put(fkey, Integer.valueOf(mci));
|
||||
}
|
||||
log.debug("Authority Control: For schema="+schema+", elt="+element+", qual="+qualifier+", controlled="+ctl+", required="+req);
|
||||
}
|
||||
}
|
||||
@@ -144,8 +146,10 @@ public class MetadataAuthorityManager
|
||||
// get default min confidence if any:
|
||||
int dmc = readConfidence("authority.minconfidence");
|
||||
if (dmc >= Choices.CF_UNSET)
|
||||
{
|
||||
defaultMinConfidence = dmc;
|
||||
}
|
||||
}
|
||||
|
||||
private int readConfidence(String key)
|
||||
{
|
||||
|
@@ -79,7 +79,9 @@ public class CreativeCommonsRDFStreamIngestionCrosswalk
|
||||
if (dso.getType() == Constants.ITEM)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Reading a Creative Commons license, MIMEtype="+MIMEType);
|
||||
{
|
||||
log.debug("Reading a Creative Commons license, MIMEtype=" + MIMEType);
|
||||
}
|
||||
|
||||
CreativeCommons.setLicense(context, (Item)dso, in, MIMEType);
|
||||
}
|
||||
|
@@ -99,7 +99,9 @@ public class DIMDisseminationCrosswalk
|
||||
public Element disseminateElement(DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||
{
|
||||
if (dso.getType() != Constants.ITEM)
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("DIMDisseminationCrosswalk can only crosswalk an Item.");
|
||||
}
|
||||
Item item = (Item)dso;
|
||||
|
||||
DCValue[] dc = item.getMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);
|
||||
@@ -110,11 +112,17 @@ public class DIMDisseminationCrosswalk
|
||||
field.setAttribute("mdschema", dc[i].schema);
|
||||
field.setAttribute("element", dc[i].element);
|
||||
if (dc[i].qualifier != null)
|
||||
{
|
||||
field.setAttribute("qualifier", dc[i].qualifier);
|
||||
}
|
||||
if (dc[i].language != null)
|
||||
{
|
||||
field.setAttribute("lang", dc[i].language);
|
||||
}
|
||||
if (dc[i].value != null)
|
||||
{
|
||||
field.setText(dc[i].value);
|
||||
}
|
||||
dim.addContent(field);
|
||||
}
|
||||
return dim;
|
||||
|
@@ -88,7 +88,9 @@ public class DIMIngestionCrosswalk
|
||||
public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||
|
||||
if (dso.getType() != Constants.ITEM)
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("DIMIngestionCrosswalk can only crosswalk an Item.");
|
||||
}
|
||||
Item item = (Item)dso;
|
||||
|
||||
if (root == null) {
|
||||
|
@@ -81,7 +81,9 @@ public class LicenseStreamIngestionCrosswalk
|
||||
if (dso.getType() == Constants.ITEM)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Reading a DSpace Deposit license, MIMEtype="+MIMEType);
|
||||
{
|
||||
log.debug("Reading a DSpace Deposit license, MIMEtype=" + MIMEType);
|
||||
}
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
Utils.copy(in, baos);
|
||||
|
@@ -127,13 +127,17 @@ public class METSDisseminationCrosswalk
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
if (dso.getType() != Constants.ITEM)
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("METSDisseminationCrosswalk can only crosswalk an Item.");
|
||||
}
|
||||
Item item = (Item)dso;
|
||||
|
||||
PackageDisseminator dip = (PackageDisseminator)
|
||||
PluginManager.getNamedPlugin(PackageDisseminator.class, METS_PACKAGER_PLUGIN);
|
||||
if (dip == null)
|
||||
throw new CrosswalkInternalException("Cannot find a disseminate plugin for package="+METS_PACKAGER_PLUGIN);
|
||||
{
|
||||
throw new CrosswalkInternalException("Cannot find a disseminate plugin for package=" + METS_PACKAGER_PLUGIN);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -385,7 +385,9 @@ public class METSRightsCrosswalk
|
||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||
{
|
||||
if (!(root.getName().equals("RightsDeclarationMD")))
|
||||
throw new MetadataValidationException("Wrong root element for METSRights: "+root.toString());
|
||||
{
|
||||
throw new MetadataValidationException("Wrong root element for METSRights: " + root.toString());
|
||||
}
|
||||
ingest(context, dso, root.getChildren());
|
||||
}
|
||||
|
||||
@@ -416,12 +418,16 @@ public class METSRightsCrosswalk
|
||||
{
|
||||
// we cannot crosswalk METSRights to a SITE object
|
||||
if (dso.getType() == Constants.SITE)
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("Wrong target object type, METSRightsCrosswalk cannot crosswalk a SITE object.");
|
||||
}
|
||||
|
||||
//First, clear all existing Policies on this DSpace Object
|
||||
// as we don't want them to conflict with policies we will be adding
|
||||
if(!ml.isEmpty())
|
||||
{
|
||||
AuthorizeManager.removeAllPolicies(context, dso);
|
||||
}
|
||||
|
||||
// Loop through each Element in the List
|
||||
Iterator mi = ml.iterator();
|
||||
@@ -449,7 +455,9 @@ public class METSRightsCrosswalk
|
||||
//get DSpace Anonymous group, ID=0
|
||||
Group anonGroup = Group.find(context, 0);
|
||||
if(anonGroup==null)
|
||||
{
|
||||
throw new CrosswalkInternalException("The DSpace database has not been properly initialized. The Anonymous Group is missing from the database.");
|
||||
}
|
||||
|
||||
assignPermissions(context, dso, anonGroup, permsElement);
|
||||
} // else if this permission declaration pertains to Administrators
|
||||
@@ -458,7 +466,9 @@ public class METSRightsCrosswalk
|
||||
//get DSpace Administrator group, ID=1
|
||||
Group adminGroup = Group.find(context, 1);
|
||||
if(adminGroup==null)
|
||||
{
|
||||
throw new CrosswalkInternalException("The DSpace database has not been properly initialized. The Administrator Group is missing from the database.");
|
||||
}
|
||||
|
||||
assignPermissions(context, dso, adminGroup, permsElement);
|
||||
} // else if this permission pertains to another DSpace group
|
||||
@@ -512,7 +522,9 @@ public class METSRightsCrosswalk
|
||||
//If cannot find by email, try by netID
|
||||
//(though METSRights should contain email if it was exported by DSpace)
|
||||
if(person==null)
|
||||
{
|
||||
person = EPerson.findByNetid(context, personEmail);
|
||||
}
|
||||
|
||||
//if not found, throw an error -- user should restore person from the SITE AIP
|
||||
if(person==null)
|
||||
@@ -621,9 +633,11 @@ public class METSRightsCrosswalk
|
||||
{
|
||||
//if found, this is the Action ID corresponding to this permission
|
||||
if(otherTypesMapping.get(actionType).equals(otherPermitType))
|
||||
{
|
||||
return actionType;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log.warn("Unrecognized @OTHERPERMITTYPE attribute value ("
|
||||
|
@@ -129,8 +129,10 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
String key = (String)pe.nextElement();
|
||||
if (key.startsWith(CONFIG_PREFIX))
|
||||
{
|
||||
aliasList.add(key.substring(CONFIG_PREFIX.length()));
|
||||
}
|
||||
}
|
||||
aliases = (String[])aliasList.toArray(new String[aliasList.size()]);
|
||||
}
|
||||
|
||||
@@ -240,7 +242,9 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
throws CrosswalkInternalException
|
||||
{
|
||||
if (modsMap != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
String myAlias = getPluginInstanceName();
|
||||
if (myAlias == null)
|
||||
{
|
||||
@@ -277,7 +281,15 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
finally
|
||||
{
|
||||
if (pfs != null)
|
||||
try { pfs.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
pfs.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modsMap = new HashMap();
|
||||
@@ -296,11 +308,13 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
modsTriple trip = modsTriple.create(qdc, pair[0], pair[1]);
|
||||
if (trip != null)
|
||||
{
|
||||
modsMap.put(qdc, trip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MODS namespace
|
||||
@@ -390,13 +404,17 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
Element me = (Element)trip.xml.clone();
|
||||
if (addSchema)
|
||||
{
|
||||
me.setAttribute("schemaLocation", schemaLocation, XSI_NS);
|
||||
}
|
||||
Iterator ni = trip.xpath.selectNodes(me).iterator();
|
||||
if (!ni.hasNext())
|
||||
log.warn("XPath \""+trip.xpath.getXPath()+
|
||||
"\" found no elements in \""+
|
||||
outputUgly.outputString(me)+
|
||||
"\", qdc="+qdc);
|
||||
{
|
||||
log.warn("XPath \"" + trip.xpath.getXPath() +
|
||||
"\" found no elements in \"" +
|
||||
outputUgly.outputString(me) +
|
||||
"\", qdc=" + qdc);
|
||||
}
|
||||
while (ni.hasNext())
|
||||
{
|
||||
Object what = ni.next();
|
||||
@@ -468,14 +486,20 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
String url = site.getURL();
|
||||
|
||||
if (identifier_uri != null)
|
||||
{
|
||||
metadata.add(createDCValue("identifier.uri", null, identifier_uri));
|
||||
}
|
||||
|
||||
//FIXME: adding two URIs for now (site handle and URL), in case site isn't using handles
|
||||
if (url != null)
|
||||
{
|
||||
metadata.add(createDCValue("identifier.uri", null, url));
|
||||
}
|
||||
|
||||
if (title != null)
|
||||
{
|
||||
metadata.add(createDCValue("title", null, title));
|
||||
}
|
||||
|
||||
return (DCValue[]) metadata.toArray(new DCValue[metadata.size()]);
|
||||
}
|
||||
@@ -500,22 +524,34 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
String title = community.getMetadata("name");
|
||||
|
||||
if (description != null)
|
||||
{
|
||||
metadata.add(createDCValue("description", null, description));
|
||||
}
|
||||
|
||||
if (description_abstract != null)
|
||||
{
|
||||
metadata.add(createDCValue("description", "abstract", description_abstract));
|
||||
}
|
||||
|
||||
if (description_table != null)
|
||||
{
|
||||
metadata.add(createDCValue("description", "tableofcontents", description_table));
|
||||
}
|
||||
|
||||
if (identifier_uri != null)
|
||||
{
|
||||
metadata.add(createDCValue("identifier.uri", null, identifier_uri));
|
||||
}
|
||||
|
||||
if (rights != null)
|
||||
{
|
||||
metadata.add(createDCValue("rights", null, rights));
|
||||
}
|
||||
|
||||
if (title != null)
|
||||
{
|
||||
metadata.add(createDCValue("title", null, title));
|
||||
}
|
||||
|
||||
return (DCValue[]) metadata.toArray(new DCValue[metadata.size()]);
|
||||
}
|
||||
@@ -543,28 +579,44 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
String title = collection.getMetadata("name");
|
||||
|
||||
if (description != null)
|
||||
metadata.add(createDCValue("description",null, description));
|
||||
{
|
||||
metadata.add(createDCValue("description", null, description));
|
||||
}
|
||||
|
||||
if (description_abstract != null)
|
||||
metadata.add(createDCValue("description","abstract",description_abstract));
|
||||
{
|
||||
metadata.add(createDCValue("description", "abstract", description_abstract));
|
||||
}
|
||||
|
||||
if (description_table != null)
|
||||
metadata.add(createDCValue("description","tableofcontents",description_table));
|
||||
{
|
||||
metadata.add(createDCValue("description", "tableofcontents", description_table));
|
||||
}
|
||||
|
||||
if (identifier_uri != null)
|
||||
metadata.add(createDCValue("identifier","uri", identifier_uri));
|
||||
{
|
||||
metadata.add(createDCValue("identifier", "uri", identifier_uri));
|
||||
}
|
||||
|
||||
if (provenance != null)
|
||||
{
|
||||
metadata.add(createDCValue("provenance", null, provenance));
|
||||
}
|
||||
|
||||
if (rights != null)
|
||||
{
|
||||
metadata.add(createDCValue("rights", null, rights));
|
||||
}
|
||||
|
||||
if (rights_license != null)
|
||||
{
|
||||
metadata.add(createDCValue("rights.license", null, rights_license));
|
||||
}
|
||||
|
||||
if (title != null)
|
||||
{
|
||||
metadata.add(createDCValue("title", null, title));
|
||||
}
|
||||
|
||||
return (DCValue[]) metadata.toArray(new DCValue[metadata.size()]);
|
||||
}
|
||||
@@ -615,8 +667,10 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
char c = value.charAt(i);
|
||||
if (Verifier.isXMLCharacter((int)c))
|
||||
{
|
||||
result.append(c);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,9 @@ public class OAIDCIngestionCrosswalk
|
||||
public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||
|
||||
if (dso.getType() != Constants.ITEM)
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("DIMIngestionCrosswalk can only crosswalk an Item.");
|
||||
}
|
||||
Item item = (Item)dso;
|
||||
|
||||
if (root == null) {
|
||||
|
@@ -100,8 +100,10 @@ public class ItemDAOPostgres extends ItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -123,8 +125,10 @@ public class ItemDAOPostgres extends ItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -146,8 +150,10 @@ public class ItemDAOPostgres extends ItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -194,7 +194,9 @@ public class DSpaceAIPDisseminator
|
||||
|
||||
// Add a LASTMODDATE for items
|
||||
if (dso.getType() == Constants.ITEM)
|
||||
metsHdr.setLASTMODDATE(((Item)dso).getLastModified());
|
||||
{
|
||||
metsHdr.setLASTMODDATE(((Item) dso).getLastModified());
|
||||
}
|
||||
|
||||
// Agent Custodian - name custodian, the DSpace Archive, by handle.
|
||||
Agent agent = new Agent();
|
||||
@@ -387,15 +389,19 @@ public class DSpaceAIPDisseminator
|
||||
//By default, disseminate Deposit License, and any CC Licenses
|
||||
// to an item's rightsMD section
|
||||
if (PackageUtils.findDepositLicense(context, (Item)dso) != null)
|
||||
{
|
||||
result.add(DSPACE_DEPOSIT_LICENSE_MDTYPE);
|
||||
}
|
||||
|
||||
if (CreativeCommons.getLicenseRdfBitstream((Item)dso) != null)
|
||||
{
|
||||
result.add(CREATIVE_COMMONS_RDF_MDTYPE);
|
||||
}
|
||||
else if (CreativeCommons.getLicenseTextBitstream((Item)dso) != null)
|
||||
{
|
||||
result.add(CREATIVE_COMMONS_TEXT_MDTYPE);
|
||||
}
|
||||
}
|
||||
|
||||
//By default, also add METSRights info to the rightsMD
|
||||
result.add("METSRights");
|
||||
@@ -440,8 +446,10 @@ public class DSpaceAIPDisseminator
|
||||
{
|
||||
Item bi[] = bn[0].getItems();
|
||||
if (bi.length > 0)
|
||||
{
|
||||
handle = bi[0].getHandle();
|
||||
}
|
||||
}
|
||||
if (handle != null)
|
||||
{
|
||||
return ConfigurationManager
|
||||
|
@@ -117,7 +117,9 @@ public class DSpaceAIPIngester
|
||||
throw new MetadataValidationException("Cannot accept METS with no PROFILE attribute!");
|
||||
}
|
||||
else if (!profile.equals(DSpaceAIPDisseminator.PROFILE_1_0))
|
||||
throw new MetadataValidationException("METS has unacceptable PROFILE attribute, profile="+profile);
|
||||
{
|
||||
throw new MetadataValidationException("METS has unacceptable PROFILE attribute, profile=" + profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +146,9 @@ public class DSpaceAIPIngester
|
||||
// Check to see what dmdSec the user specified in the 'dmd' parameter
|
||||
String userDmd = null;
|
||||
if (params != null)
|
||||
{
|
||||
userDmd = params.getProperty("dmd");
|
||||
}
|
||||
if (userDmd != null && userDmd.length() > 0)
|
||||
{
|
||||
for (int i = 0; i < dmds.length; ++i)
|
||||
@@ -197,10 +201,12 @@ public class DSpaceAIPIngester
|
||||
{
|
||||
String g = dmds[i].getAttributeValue("GROUPID");
|
||||
if (g != null && !g.equals(groupID))
|
||||
{
|
||||
manifest.crosswalkItemDmd(context, params, dso, dmds[i], callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise take the first. Don't xwalk more than one because
|
||||
// each xwalk _adds_ metadata, and could add duplicate fields.
|
||||
@@ -248,8 +254,10 @@ public class DSpaceAIPIngester
|
||||
}
|
||||
|
||||
if(newLicense)
|
||||
{
|
||||
PackageUtils.addDepositLicense(context, license, item, collection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Last change to fix up a DSpace Object.
|
||||
@@ -306,12 +314,18 @@ public class DSpaceAIPIngester
|
||||
Element mets = manifest.getMets();
|
||||
String typeStr = mets.getAttributeValue("TYPE");
|
||||
if (typeStr == null || typeStr.length() == 0)
|
||||
{
|
||||
throw new PackageValidationException("Manifest is missing the required mets@TYPE attribute.");
|
||||
}
|
||||
if (typeStr.startsWith("DSpace "))
|
||||
{
|
||||
typeStr = typeStr.substring(7);
|
||||
}
|
||||
int type = Constants.getTypeID(typeStr);
|
||||
if (type < 0)
|
||||
throw new PackageValidationException("Manifest has unrecognized value in mets@TYPE attribute: "+typeStr);
|
||||
{
|
||||
throw new PackageValidationException("Manifest has unrecognized value in mets@TYPE attribute: " + typeStr);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@@ -184,7 +184,9 @@ public class DSpaceMETSDisseminator
|
||||
|
||||
String result[] = null;
|
||||
if (params != null)
|
||||
{
|
||||
result = params.getProperties("dmd");
|
||||
}
|
||||
if (result == null || result.length == 0)
|
||||
{
|
||||
result = new String[1];
|
||||
|
@@ -124,7 +124,9 @@ public class DSpaceMETSIngester
|
||||
// Check to see what dmdSec the user specified in the 'dmd' parameter
|
||||
String userDmd = null;
|
||||
if (params != null)
|
||||
{
|
||||
userDmd = params.getProperty("dmd");
|
||||
}
|
||||
if (userDmd != null && userDmd.length() > 0)
|
||||
{
|
||||
for (int i = 0; i < dmds.length; ++i)
|
||||
@@ -176,19 +178,22 @@ public class DSpaceMETSIngester
|
||||
{
|
||||
String g = dmds[i].getAttributeValue("GROUPID");
|
||||
if (g != null && !g.equals(groupID))
|
||||
{
|
||||
manifest.crosswalkItemDmd(context, params, dso, dmds[i], callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise take the first. Don't xwalk more than one because
|
||||
// each xwalk _adds_ metadata, and could add duplicate fields.
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise take the first. Don't xwalk more than one because
|
||||
// each xwalk _adds_ metadata, and could add duplicate fields.
|
||||
if (dmds.length > 0)
|
||||
{
|
||||
manifest.crosswalkItemDmd(context, params, dso, dmds[0], callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -204,8 +209,10 @@ public class DSpaceMETSIngester
|
||||
AuthorizeException, SQLException, IOException
|
||||
{
|
||||
if (PackageUtils.findDepositLicense(context, item) == null)
|
||||
{
|
||||
PackageUtils.addDepositLicense(context, license, item, collection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishObject(Context context, DSpaceObject dso,
|
||||
@@ -234,8 +241,11 @@ public class DSpaceMETSIngester
|
||||
{
|
||||
MediaFilter mf = (MediaFilter)PluginManager.getNamedPlugin(MediaFilter.class, mfNames[i]);
|
||||
if (bundleName.equals(mf.getBundleName()))
|
||||
{
|
||||
return mf.getFilteredName(origName);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -233,7 +233,9 @@ public class METSManifest
|
||||
{
|
||||
String u = xsd.toURL().toString();
|
||||
if (result.length() > 0)
|
||||
{
|
||||
result.append(" ");
|
||||
}
|
||||
result.append(val[0]).append(" ").append(u);
|
||||
}
|
||||
catch (java.net.MalformedURLException e)
|
||||
@@ -288,15 +290,16 @@ public class METSManifest
|
||||
|
||||
// Set validation feature
|
||||
if (validate)
|
||||
builder.setFeature("http://apache.org/xml/features/validation/schema",
|
||||
true);
|
||||
{
|
||||
builder.setFeature("http://apache.org/xml/features/validation/schema", true);
|
||||
}
|
||||
|
||||
// Tell the parser where local copies of schemas are, to speed up
|
||||
// validation. Local XSDs are identified in the configuration file.
|
||||
if (localSchemas.length() > 0)
|
||||
builder.setProperty(
|
||||
"http://apache.org/xml/properties/schema/external-schemaLocation",
|
||||
localSchemas);
|
||||
{
|
||||
builder.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", localSchemas);
|
||||
}
|
||||
|
||||
// Parse the METS file
|
||||
Document metsDocument;
|
||||
@@ -351,11 +354,15 @@ public class METSManifest
|
||||
throws MetadataValidationException
|
||||
{
|
||||
if (contentFiles != null)
|
||||
{
|
||||
return contentFiles;
|
||||
}
|
||||
|
||||
Element fileSec = mets.getChild("fileSec", metsNS);
|
||||
if (fileSec == null)
|
||||
{
|
||||
throw new MetadataValidationException("Invalid METS Manifest: DSpace requires a fileSec element, but it is missing.");
|
||||
}
|
||||
|
||||
contentFiles = new ArrayList();
|
||||
Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
|
||||
@@ -415,7 +422,9 @@ public class METSManifest
|
||||
{
|
||||
String groupID = file.getAttributeValue("GROUPID");
|
||||
if (groupID == null || groupID.equals(""))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -426,11 +435,15 @@ public class METSManifest
|
||||
if (oFiles.size() > 0)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Got ORIGINAL file for derived="+file.toString());
|
||||
{
|
||||
log.debug("Got ORIGINAL file for derived=" + file.toString());
|
||||
}
|
||||
Element flocat = ((Element)oFiles.get(0)).getChild("FLocat", metsNS);
|
||||
if (flocat != null)
|
||||
{
|
||||
return flocat.getAttributeValue("href", xlinkNS);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (JDOMException je)
|
||||
@@ -537,13 +550,19 @@ public class METSManifest
|
||||
Element objDiv = getObjStructDiv();
|
||||
Element fptr = objDiv.getChild("fptr", metsNS);
|
||||
if (fptr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String id = fptr.getAttributeValue("FILEID");
|
||||
if (id == null)
|
||||
{
|
||||
throw new MetadataValidationException("fptr for Primary Bitstream is missing the required FILEID attribute.");
|
||||
}
|
||||
Element result = getElementByXPath("descendant::mets:file[@ID=\""+id+"\"]", false);
|
||||
if (result == null)
|
||||
throw new MetadataValidationException("Cannot find file element for Primary Bitstream: looking for ID="+id);
|
||||
{
|
||||
throw new MetadataValidationException("Cannot find file element for Primary Bitstream: looking for ID=" + id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -556,14 +575,22 @@ public class METSManifest
|
||||
{
|
||||
Element md = mdSec.getChild("mdRef", metsNS);
|
||||
if (md == null)
|
||||
{
|
||||
md = mdSec.getChild("mdWrap", metsNS);
|
||||
}
|
||||
if (md == null)
|
||||
{
|
||||
throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element has neither mdRef nor mdWrap child.");
|
||||
}
|
||||
String result = md.getAttributeValue("MDTYPE");
|
||||
if (result != null && result.equals("OTHER"))
|
||||
{
|
||||
result = md.getAttributeValue("OTHERMDTYPE");
|
||||
}
|
||||
if (result == null)
|
||||
throw new MetadataValidationException("Invalid METS Manifest: "+md.getName()+" has no MDTYPE or OTHERMDTYPE attribute.");
|
||||
{
|
||||
throw new MetadataValidationException("Invalid METS Manifest: " + md.getName() + " has no MDTYPE or OTHERMDTYPE attribute.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -579,12 +606,16 @@ public class METSManifest
|
||||
{
|
||||
String mimeType = mdWrap.getAttributeValue("MIMETYPE");
|
||||
if (mimeType == null && mdWrap.getChild("xmlData", metsNS) != null)
|
||||
{
|
||||
mimeType = "text/xml";
|
||||
}
|
||||
return mimeType;
|
||||
}
|
||||
Element mdRef = mdSec.getChild("mdRef", metsNS);
|
||||
if (mdRef != null)
|
||||
{
|
||||
return mdRef.getAttributeValue("MIMETYPE");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -746,15 +777,21 @@ public class METSManifest
|
||||
//get first <structMap>
|
||||
Element sm = mets.getChild("structMap", metsNS);
|
||||
if (sm == null)
|
||||
{
|
||||
throw new MetadataValidationException("METS document is missing the required structMap element.");
|
||||
}
|
||||
|
||||
//get first <div>
|
||||
Element result = sm.getChild("div", metsNS);
|
||||
if (result == null)
|
||||
{
|
||||
throw new MetadataValidationException("METS document is missing the required first div element in first structMap.");
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Got getObjStructDiv result="+result.toString());
|
||||
{
|
||||
log.debug("Got getObjStructDiv result=" + result.toString());
|
||||
}
|
||||
|
||||
return (Element)result;
|
||||
}
|
||||
@@ -814,8 +851,10 @@ public class METSManifest
|
||||
{
|
||||
String filePath = mptr.getAttributeValue("href", xlinkNS);
|
||||
if(filePath!=null && filePath.length()>0)
|
||||
{
|
||||
childPathList.add(filePath);
|
||||
}
|
||||
}
|
||||
}//end <mptr> loop
|
||||
}//end if <mptr>'s exist
|
||||
}//end child <div> loop
|
||||
@@ -856,17 +895,23 @@ public class METSManifest
|
||||
}
|
||||
|
||||
if (parentStructMap == null)
|
||||
{
|
||||
throw new MetadataValidationException("METS document is missing the required structMap[@LABEL='Parent'] element.");
|
||||
}
|
||||
|
||||
//get first <div>
|
||||
Element linkDiv = parentStructMap.getChild("div", metsNS);
|
||||
if (linkDiv == null)
|
||||
{
|
||||
throw new MetadataValidationException("METS document is missing the required first div element in structMap[@LABEL='Parent'].");
|
||||
}
|
||||
|
||||
//the link is in the <mptr> in the @xlink:href attribute
|
||||
Element mptr = linkDiv.getChild("mptr", metsNS);
|
||||
if (mptr != null)
|
||||
{
|
||||
return mptr.getAttributeValue("href", xlinkNS);
|
||||
}
|
||||
|
||||
//return null if we couldn't find the link
|
||||
return null;
|
||||
@@ -921,8 +966,10 @@ public class METSManifest
|
||||
xwalkName = ConfigurationManager.getProperty(
|
||||
CONFIG_METS_PREFIX+"default.ingest.crosswalk."+type);
|
||||
if (xwalkName == null)
|
||||
{
|
||||
xwalkName = type;
|
||||
}
|
||||
}
|
||||
return PluginManager.getNamedPlugin(clazz, xwalkName);
|
||||
}
|
||||
|
||||
@@ -940,7 +987,9 @@ public class METSManifest
|
||||
Element objDiv = getObjStructDiv();
|
||||
String dmds = objDiv.getAttributeValue("DMDID");
|
||||
if (dmds == null)
|
||||
{
|
||||
throw new MetadataValidationException("Invalid METS: Missing reference to Item descriptive metadata, first div on first structmap must have a DMDID attribute.");
|
||||
}
|
||||
String dmdID[] = dmds.split("\\s+");
|
||||
Element result[] = new Element[dmdID.length];
|
||||
|
||||
@@ -965,7 +1014,9 @@ public class METSManifest
|
||||
if (amds == null)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("getItemRightsMD: No ADMID references found.");
|
||||
}
|
||||
return new Element[0];
|
||||
}
|
||||
String amdID[] = amds.split("\\s+");
|
||||
@@ -975,8 +1026,10 @@ public class METSManifest
|
||||
List rmds = getElementByXPath("mets:amdSec[@ID=\""+amdID[i]+"\"]", false).
|
||||
getChildren("rightsMD", metsNS);
|
||||
if (rmds.size() > 0)
|
||||
{
|
||||
resultList.addAll(rmds);
|
||||
}
|
||||
}
|
||||
return (Element[])resultList.toArray(new Element[resultList.size()]);
|
||||
}
|
||||
|
||||
@@ -1058,7 +1111,9 @@ public class METSManifest
|
||||
if (amds == null)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("crosswalkObjectTechMD: No ADMID references found.");
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
return amds.split("\\s+");
|
||||
@@ -1128,8 +1183,10 @@ public class METSManifest
|
||||
finally
|
||||
{
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
} // If we couldn't find an <mdRef>, then we'll try an <mdWrap>
|
||||
// with a <binData> element instead.
|
||||
// (this is how METS wraps embedded base64-encoded content streams)
|
||||
@@ -1189,7 +1246,9 @@ public class METSManifest
|
||||
{
|
||||
Element file = getElementByXPath("descendant::mets:file[@ID=\""+fileId+"\"]", false);
|
||||
if (file == null)
|
||||
throw new MetadataValidationException("Failed in Bitstream crosswalk, Could not find file element with ID="+fileId);
|
||||
{
|
||||
throw new MetadataValidationException("Failed in Bitstream crosswalk, Could not find file element with ID=" + fileId);
|
||||
}
|
||||
|
||||
// In DSpace METS SIP spec, admin metadata is only "highly
|
||||
// recommended", not "required", so it is OK if there is no ADMID.
|
||||
|
@@ -57,20 +57,26 @@ public class ItemService
|
||||
if (primaryBitstream != null)
|
||||
{
|
||||
if (primaryBitstream.getFormat().getMIMEType().equals("text/html"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
thumbBitstream = dao.getNamedBitstream(itemId, "THUMBNAIL", primaryBitstream.getName() + ".jpg");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (requireOriginal)
|
||||
{
|
||||
primaryBitstream = dao.getFirstBitstream(itemId, "ORIGINAL");
|
||||
}
|
||||
|
||||
thumbBitstream = dao.getFirstBitstream(itemId, "THUMBNAIL");
|
||||
}
|
||||
|
||||
if (thumbBitstream != null)
|
||||
{
|
||||
return new Thumbnail(thumbBitstream, primaryBitstream);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -466,8 +466,10 @@ public class I18nUtil
|
||||
{
|
||||
Locale lc = makeLocale(ls);
|
||||
if (lc != null)
|
||||
{
|
||||
resultList.add(lc);
|
||||
}
|
||||
}
|
||||
return resultList.toArray(new Locale[resultList.size()]);
|
||||
}
|
||||
}
|
||||
|
@@ -285,19 +285,23 @@ public class EmbargoManager
|
||||
else
|
||||
{
|
||||
if (processOneItem(context, (Item)dso, line, now))
|
||||
{
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemIterator ii = Item.findByMetadataField(context, lift_schema, lift_element, lift_qualifier, Item.ANY);
|
||||
while (ii.hasNext())
|
||||
{
|
||||
if (processOneItem(context, ii.next(), line, now))
|
||||
{
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("Cache size at end = "+context.getCacheSize());
|
||||
context.complete();
|
||||
context = null;
|
||||
@@ -342,19 +346,27 @@ public class EmbargoManager
|
||||
if (liftDate.toDate().before(now))
|
||||
{
|
||||
if (line.hasOption('v'))
|
||||
System.err.println("Lifting embargo from Item handle="+item.getHandle()+", lift date="+lift[0].value);
|
||||
{
|
||||
System.err.println("Lifting embargo from Item handle=" + item.getHandle() + ", lift date=" + lift[0].value);
|
||||
}
|
||||
if (line.hasOption('n'))
|
||||
{
|
||||
if (!line.hasOption('q'))
|
||||
System.err.println("DRY RUN: would have lifted embargo from Item handle="+item.getHandle()+", lift date="+lift[0].value);
|
||||
{
|
||||
System.err.println("DRY RUN: would have lifted embargo from Item handle=" + item.getHandle() + ", lift date=" + lift[0].value);
|
||||
}
|
||||
}
|
||||
else if (!line.hasOption('c'))
|
||||
{
|
||||
liftEmbargo(context, item);
|
||||
}
|
||||
}
|
||||
else if (!line.hasOption('l'))
|
||||
{
|
||||
if (line.hasOption('v'))
|
||||
System.err.println("Checking current embargo on Item handle="+item.getHandle()+", lift date="+lift[0].value);
|
||||
{
|
||||
System.err.println("Checking current embargo on Item handle=" + item.getHandle() + ", lift date=" + lift[0].value);
|
||||
}
|
||||
setter.checkEmbargo(context, item);
|
||||
}
|
||||
}
|
||||
@@ -377,7 +389,9 @@ public class EmbargoManager
|
||||
String terms = ConfigurationManager.getProperty("embargo.field.terms");
|
||||
String lift = ConfigurationManager.getProperty("embargo.field.lift");
|
||||
if (terms == null || lift == null)
|
||||
{
|
||||
throw new IllegalStateException("Missing one or more of the required DSpace configuration properties for EmbargoManager, check your configuration file.");
|
||||
}
|
||||
terms_schema = getSchemaOf(terms);
|
||||
terms_element = getElementOf(terms);
|
||||
terms_qualifier = getQualifierOf(terms);
|
||||
@@ -387,11 +401,14 @@ public class EmbargoManager
|
||||
|
||||
setter = (EmbargoSetter)PluginManager.getSinglePlugin(EmbargoSetter.class);
|
||||
if (setter == null)
|
||||
{
|
||||
throw new IllegalStateException("The EmbargoSetter plugin was not defined in DSpace configuration.");
|
||||
}
|
||||
lifter = (EmbargoLifter)PluginManager.getSinglePlugin(EmbargoLifter.class);
|
||||
if (lifter == null)
|
||||
{
|
||||
throw new IllegalStateException("The EmbargoLifter plugin was not defined in DSpace configuration.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -246,10 +246,11 @@ public class EPerson extends DSpaceObject
|
||||
throws SQLException
|
||||
{
|
||||
if (netid == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
TableRow row = DatabaseManager.findByUnique(context, "eperson",
|
||||
"netid", netid);
|
||||
TableRow row = DatabaseManager.findByUnique(context, "eperson", "netid", netid);
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
@@ -327,8 +328,10 @@ public class EPerson extends DSpaceObject
|
||||
queryBuf.append("rec WHERE rownum<=? ");
|
||||
// If we also have an offset, then convert the limit into the maximum row number
|
||||
if (offset > 0)
|
||||
{
|
||||
limit += offset;
|
||||
}
|
||||
}
|
||||
|
||||
// Return only the records after the specified offset (row number)
|
||||
if (offset > 0)
|
||||
@@ -340,11 +343,15 @@ public class EPerson extends DSpaceObject
|
||||
else
|
||||
{
|
||||
if (limit > 0)
|
||||
{
|
||||
queryBuf.append(" LIMIT ? ");
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
queryBuf.append(" OFFSET ? ");
|
||||
}
|
||||
}
|
||||
|
||||
String dbquery = queryBuf.toString();
|
||||
|
||||
@@ -403,9 +410,11 @@ public class EPerson extends DSpaceObject
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
{
|
||||
rows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of epeople returned by a specific query, without the overhead
|
||||
@@ -525,9 +534,11 @@ public class EPerson extends DSpaceObject
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
{
|
||||
rows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new eperson
|
||||
@@ -1008,8 +1019,10 @@ public class EPerson extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// check for eperson in workflowitem table
|
||||
tri = DatabaseManager.queryTable(myContext, "workflowitem",
|
||||
@@ -1027,8 +1040,10 @@ public class EPerson extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// check for eperson in tasklistitem table
|
||||
tri = DatabaseManager.queryTable(myContext, "tasklistitem",
|
||||
@@ -1046,8 +1061,10 @@ public class EPerson extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// the list of tables can be used to construct an error message
|
||||
// explaining to the user why the eperson cannot be deleted.
|
||||
|
@@ -164,8 +164,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// now get Group objects
|
||||
tri = DatabaseManager.queryTable(myContext,"epersongroup",
|
||||
@@ -198,8 +200,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -469,9 +473,11 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Also need to get all "Special Groups" user is a member of!
|
||||
// Otherwise, you're ignoring the user's membership to these groups!
|
||||
// However, we only do this is we are looking up the special groups
|
||||
@@ -509,8 +515,10 @@ public class Group extends DSpaceObject
|
||||
|
||||
groupQuery.append("child_id= ? ");
|
||||
if (i.hasNext())
|
||||
{
|
||||
groupQuery.append(" OR ");
|
||||
}
|
||||
}
|
||||
|
||||
// was member of at least one group
|
||||
// NOTE: even through the query is built dynamically, all data is
|
||||
@@ -534,8 +542,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return groupIDs;
|
||||
}
|
||||
@@ -610,8 +620,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// now we have all the groups (including this one)
|
||||
// it is time to find all the EPeople who belong to those groups
|
||||
@@ -629,7 +641,9 @@ public class Group extends DSpaceObject
|
||||
epersonQuery.append("eperson_group_id= ? ");
|
||||
|
||||
if (i.hasNext())
|
||||
{
|
||||
epersonQuery.append(" OR ");
|
||||
}
|
||||
|
||||
while (i.hasNext())
|
||||
{
|
||||
@@ -638,8 +652,10 @@ public class Group extends DSpaceObject
|
||||
|
||||
epersonQuery.append("eperson_group_id= ? ");
|
||||
if (i.hasNext())
|
||||
{
|
||||
epersonQuery.append(" OR ");
|
||||
}
|
||||
}
|
||||
|
||||
//get all the EPerson IDs
|
||||
// Note: even through the query is dynamically built all data is separated
|
||||
@@ -663,8 +679,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return epeopleIDs;
|
||||
}
|
||||
@@ -806,9 +824,11 @@ public class Group extends DSpaceObject
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
{
|
||||
rows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -864,8 +884,10 @@ public class Group extends DSpaceObject
|
||||
queryBuf.append("rec WHERE rownum<=? ");
|
||||
// If we also have an offset, then convert the limit into the maximum row number
|
||||
if (offset > 0)
|
||||
{
|
||||
limit += offset;
|
||||
}
|
||||
}
|
||||
|
||||
// Return only the records after the specified offset (row number)
|
||||
if (offset > 0)
|
||||
@@ -877,11 +899,15 @@ public class Group extends DSpaceObject
|
||||
else
|
||||
{
|
||||
if (limit > 0)
|
||||
{
|
||||
queryBuf.append(" LIMIT ? ");
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
queryBuf.append(" OFFSET ? ");
|
||||
}
|
||||
}
|
||||
|
||||
String dbquery = queryBuf.toString();
|
||||
|
||||
@@ -939,9 +965,11 @@ public class Group extends DSpaceObject
|
||||
finally
|
||||
{
|
||||
if (rows != null)
|
||||
{
|
||||
rows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of groups returned by a specific query, without the overhead
|
||||
@@ -1189,7 +1217,10 @@ public class Group extends DSpaceObject
|
||||
return false;
|
||||
}
|
||||
final Group other = (Group) obj;
|
||||
if(this.getID() != other.getID()) return false;
|
||||
if(this.getID() != other.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1257,8 +1288,10 @@ public class Group extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// now parents is a hash of all of the IDs of groups that are parents
|
||||
// and each hash entry is a hash of all of the IDs of children of those
|
||||
@@ -1311,7 +1344,9 @@ public class Group extends DSpaceObject
|
||||
|
||||
// degenerate case, this parent has no children
|
||||
if (!parents.containsKey(parent))
|
||||
{
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
// got this far, so we must have children
|
||||
Set<Integer> children = parents.get(parent);
|
||||
|
@@ -449,8 +449,10 @@ public class Event implements Serializable
|
||||
{
|
||||
int id = Constants.getTypeID(s.toUpperCase());
|
||||
if (id >= 0)
|
||||
{
|
||||
return 1 << id;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -591,16 +593,19 @@ public class Event implements Serializable
|
||||
for (Iterator fi = filters.iterator(); fi.hasNext();)
|
||||
{
|
||||
int filter[] = (int[]) fi.next();
|
||||
if ((subjectType & filter[SUBJECT_MASK]) != 0
|
||||
&& (eventType & filter[EVENT_MASK]) != 0)
|
||||
if ((subjectType & filter[SUBJECT_MASK]) != 0 && (eventType & filter[EVENT_MASK]) != 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Filtering event: " + "eventType="
|
||||
+ String.valueOf(eventType) + ", subjectType="
|
||||
+ String.valueOf(subjectType) + ", result="
|
||||
+ String.valueOf(result));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -132,7 +132,9 @@ public class EventManager
|
||||
}
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
name = DEFAULT_DISPATCHER;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -318,8 +320,10 @@ public class EventManager
|
||||
{
|
||||
ConsumerProfile cp = (ConsumerProfile) ci.next();
|
||||
if (cp != null)
|
||||
{
|
||||
cp.getConsumer().finish(ctx);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
@@ -275,7 +275,9 @@ public class HandleManager
|
||||
DatabaseManager.update(context, row);
|
||||
|
||||
if(log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Unbound Handle " + row.getStringColumn("handle") + " from object " + Constants.typeText[dso.getType()] + " id=" + dso.getID());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -308,7 +310,9 @@ public class HandleManager
|
||||
{
|
||||
//If this is the Site-wide Handle, return Site object
|
||||
if (handle.equals(Site.getSiteHandle()))
|
||||
{
|
||||
return Site.find(context, 0);
|
||||
}
|
||||
//Otherwise, return null (i.e. handle not found in DB)
|
||||
return null;
|
||||
}
|
||||
@@ -431,8 +435,10 @@ public class HandleManager
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (iterator != null)
|
||||
{
|
||||
iterator.close();
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
@@ -171,7 +171,9 @@ public class HarvestedCollection
|
||||
public boolean isReady() throws SQLException
|
||||
{
|
||||
if (this.isHarvestable() && (this.getHarvestStatus() == HarvestedCollection.STATUS_READY || this.getHarvestStatus() == HarvestedCollection.STATUS_OAI_ERROR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -205,10 +207,16 @@ public class HarvestedCollection
|
||||
public static List<Integer> findReady(Context c) throws SQLException
|
||||
{
|
||||
int harvestInterval = ConfigurationManager.getIntProperty("harvester.harvestFrequency");
|
||||
if (harvestInterval == 0) harvestInterval = 720;
|
||||
if (harvestInterval == 0)
|
||||
{
|
||||
harvestInterval = 720;
|
||||
}
|
||||
|
||||
int expirationInterval = ConfigurationManager.getIntProperty("harvester.threadTimeout");
|
||||
if (expirationInterval == 0) expirationInterval = 24;
|
||||
if (expirationInterval == 0)
|
||||
{
|
||||
expirationInterval = 24;
|
||||
}
|
||||
|
||||
Date startTime;
|
||||
Date expirationTime;
|
||||
@@ -267,7 +275,9 @@ public class HarvestedCollection
|
||||
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested asc limit 1";
|
||||
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested asc";
|
||||
}
|
||||
|
||||
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
|
||||
query, 0, 0);
|
||||
@@ -290,7 +300,9 @@ public class HarvestedCollection
|
||||
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested desc limit 1";
|
||||
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested desc";
|
||||
}
|
||||
|
||||
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
|
||||
query , 0, 0);
|
||||
|
@@ -129,8 +129,10 @@ public class HarvestedItem
|
||||
}
|
||||
finally {
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resolvedItem;
|
||||
}
|
||||
|
@@ -156,14 +156,18 @@ public class OAIHarvester {
|
||||
public OAIHarvester(Context c, DSpaceObject dso, HarvestedCollection hc) throws HarvestingException, SQLException
|
||||
{
|
||||
if (dso.getType() != Constants.COLLECTION)
|
||||
{
|
||||
throw new HarvestingException("OAIHarvester can only harvest collections");
|
||||
}
|
||||
|
||||
ourContext = c;
|
||||
targetCollection = (Collection)dso;
|
||||
|
||||
harvestRow = hc;
|
||||
if (harvestRow == null || !harvestRow.isHarvestable())
|
||||
{
|
||||
throw new HarvestingException("Provided collection is not set up for harvesting");
|
||||
}
|
||||
|
||||
// Set the ORE options
|
||||
Namespace ORESerializationNamespace = OAIHarvester.getORENamespace();
|
||||
@@ -262,12 +266,16 @@ public class OAIHarvester {
|
||||
String oaiSetId = harvestRow.getOaiSetId();
|
||||
//If we have all selected then make sure that we do not include a set filter
|
||||
if("all".equals(oaiSetId))
|
||||
{
|
||||
oaiSetId = null;
|
||||
}
|
||||
|
||||
Date lastHarvestDate = harvestRow.getHarvestDate();
|
||||
String fromDate = null;
|
||||
if (lastHarvestDate != null)
|
||||
{
|
||||
fromDate = processDate(harvestRow.getHarvestDate());
|
||||
}
|
||||
|
||||
Date startTime = new Date();
|
||||
String toDate = processDate(startTime,0);
|
||||
@@ -283,7 +291,9 @@ public class OAIHarvester {
|
||||
try {
|
||||
dateGranularity = OAIGetDateGranularity(oaiSource);
|
||||
if (fromDate != null)
|
||||
{
|
||||
fromDate = fromDate.substring(0, dateGranularity.length());
|
||||
}
|
||||
toDate = toDate.substring(0, dateGranularity.length());
|
||||
|
||||
descMDPrefix = OAIResolveNamespaceToPrefix(oaiSource, metadataNS.getURI());
|
||||
@@ -318,7 +328,10 @@ public class OAIHarvester {
|
||||
|
||||
// expiration timer starts
|
||||
int expirationInterval = ConfigurationManager.getIntProperty("harvester.threadTimeout");
|
||||
if (expirationInterval == 0) expirationInterval = 24;
|
||||
if (expirationInterval == 0)
|
||||
{
|
||||
expirationInterval = 24;
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startTime);
|
||||
@@ -332,7 +345,9 @@ public class OAIHarvester {
|
||||
ListRecords listRecords = new ListRecords(oaiSource, fromDate, toDate, oaiSetId, descMDPrefix);
|
||||
log.debug("Harvesting request parameters: listRecords " + oaiSource + " " + fromDate + " " + toDate + " " + oaiSetId + " " + descMDPrefix);
|
||||
if (listRecords != null)
|
||||
{
|
||||
log.info("HTTP Request: " + listRecords.getRequestURL());
|
||||
}
|
||||
while (listRecords != null)
|
||||
{
|
||||
records = new ArrayList<Element>();
|
||||
@@ -369,10 +384,14 @@ public class OAIHarvester {
|
||||
for (Element record : records) {
|
||||
// check for STOP interrupt from the scheduler
|
||||
if (HarvestScheduler.interrupt == HarvestScheduler.HARVESTER_INTERRUPT_STOP)
|
||||
{
|
||||
throw new HarvestingException("Harvest process for " + targetCollection.getID() + " interrupted by stopping the scheduler.");
|
||||
}
|
||||
// check for timeout
|
||||
if (expirationTime.before(new Date()))
|
||||
{
|
||||
throw new HarvestingException("runHarvest method timed out for collection " + targetCollection.getID());
|
||||
}
|
||||
|
||||
processRecord(record,OREPrefix);
|
||||
ourContext.commit();
|
||||
@@ -448,7 +467,9 @@ public class OAIHarvester {
|
||||
if (header.getAttribute("status") != null && header.getAttribute("status").getValue().equals("deleted")) {
|
||||
log.info("Item " + itemOaiID + " has been marked as deleted on the OAI server.");
|
||||
if (item != null)
|
||||
{
|
||||
targetCollection.removeItem(item);
|
||||
}
|
||||
|
||||
ourContext.restoreAuthSystemState();
|
||||
return;
|
||||
@@ -544,8 +565,10 @@ public class OAIHarvester {
|
||||
{
|
||||
DSpaceObject dso = HandleManager.resolveToObject(ourContext, handle);
|
||||
if (dso != null)
|
||||
{
|
||||
throw new HarvestingException("Handle collision: attempted to re-assign handle '" + handle + "' to an incoming harvested item '" + hi.getOaiID() + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
item = InstallItem.installItem(ourContext, wi, handle);
|
||||
@@ -616,10 +639,16 @@ public class OAIHarvester {
|
||||
private String extractHandle(Item item)
|
||||
{
|
||||
String acceptedHandleServersString = ConfigurationManager.getProperty("harvester.acceptedHandleServer");
|
||||
if (acceptedHandleServersString == null) acceptedHandleServersString = "hdl.handle.net";
|
||||
if (acceptedHandleServersString == null)
|
||||
{
|
||||
acceptedHandleServersString = "hdl.handle.net";
|
||||
}
|
||||
|
||||
String rejectedHandlePrefixString = ConfigurationManager.getProperty("harvester.rejectedHandlePrefix");
|
||||
if (rejectedHandlePrefixString == null) rejectedHandlePrefixString = "123456789";
|
||||
if (rejectedHandlePrefixString == null)
|
||||
{
|
||||
rejectedHandlePrefixString = "123456789";
|
||||
}
|
||||
|
||||
DCValue[] values = item.getMetadata("dc", "identifier", Item.ANY, Item.ANY);
|
||||
|
||||
@@ -634,13 +663,17 @@ public class OAIHarvester {
|
||||
// http://hdl.handle.net/1234/12
|
||||
String[] urlPieces = value.value.split("/");
|
||||
if (urlPieces.length != 5)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String server : acceptedHandleServers) {
|
||||
if (urlPieces[2].equals(server)) {
|
||||
for (String prefix : rejectedHandlePrefixes) {
|
||||
if (!urlPieces[3].equals(prefix))
|
||||
{
|
||||
return urlPieces[3] + "/" + urlPieces[4];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -661,10 +694,16 @@ public class OAIHarvester {
|
||||
{
|
||||
// The two options, with three possibilities each: add, ignore, fail
|
||||
String schemaChoice = ConfigurationManager.getProperty("harvester.unknownSchema");
|
||||
if (schemaChoice == null) schemaChoice = "fail";
|
||||
if (schemaChoice == null)
|
||||
{
|
||||
schemaChoice = "fail";
|
||||
}
|
||||
|
||||
String fieldChoice = ConfigurationManager.getProperty("harvester.unknownField");
|
||||
if (fieldChoice == null) fieldChoice = "fail";
|
||||
if (fieldChoice == null)
|
||||
{
|
||||
fieldChoice = "fail";
|
||||
}
|
||||
|
||||
List<String> clearList = new ArrayList<String>();
|
||||
|
||||
@@ -927,9 +966,13 @@ public class OAIHarvester {
|
||||
}
|
||||
|
||||
if (testORE && OREOAIPrefix == null)
|
||||
{
|
||||
errorSet.add(OAI_ORE_ERROR + ": The OAI server does not support ORE dissemination");
|
||||
}
|
||||
if (DMDOAIPrefix == null)
|
||||
{
|
||||
errorSet.add(OAI_DMD_ERROR + ": The OAI server does not support dissemination in this format");
|
||||
}
|
||||
|
||||
// Now scan the sets and make sure the one supplied is in the list
|
||||
boolean foundSet = false;
|
||||
@@ -1112,16 +1155,27 @@ public class OAIHarvester {
|
||||
String harvestAdminParam = ConfigurationManager.getProperty("harvester.eperson");
|
||||
harvestAdmin = null;
|
||||
if (harvestAdminParam != null && harvestAdminParam.length() > 0)
|
||||
{
|
||||
harvestAdmin = EPerson.findByEmail(mainContext, harvestAdminParam);
|
||||
}
|
||||
|
||||
harvestThreads = new Stack<HarvestThread>();
|
||||
|
||||
maxActiveThreads = ConfigurationManager.getIntProperty("harvester.maxThreads");
|
||||
if (maxActiveThreads == 0) maxActiveThreads = 3;
|
||||
if (maxActiveThreads == 0)
|
||||
{
|
||||
maxActiveThreads = 3;
|
||||
}
|
||||
minHeartbeat = ConfigurationManager.getIntProperty("harvester.minHeartbeat") * 1000;
|
||||
if (minHeartbeat == 0) minHeartbeat = 30000;
|
||||
if (minHeartbeat == 0)
|
||||
{
|
||||
minHeartbeat = 30000;
|
||||
}
|
||||
maxHeartbeat = ConfigurationManager.getIntProperty("harvester.maxHeartbeat") * 1000;
|
||||
if (maxHeartbeat == 0) maxHeartbeat = 3600000;
|
||||
if (maxHeartbeat == 0)
|
||||
{
|
||||
maxHeartbeat = 3600000;
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@@ -1153,7 +1207,9 @@ public class OAIHarvester {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
if (interrupt != HARVESTER_INTERRUPT_STOP)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case HARVESTER_INTERRUPT_STOP:
|
||||
interrupt = HARVESTER_INTERRUPT_NONE;
|
||||
status = HARVESTER_STATUS_STOPPED;
|
||||
@@ -1221,7 +1277,10 @@ public class OAIHarvester {
|
||||
HarvestedCollection hc = HarvestedCollection.find(tempContext, nextCollectionId);
|
||||
|
||||
int harvestInterval = ConfigurationManager.getIntProperty("harvester.harvestFrequency");
|
||||
if (harvestInterval == 0) harvestInterval = 720;
|
||||
if (harvestInterval == 0)
|
||||
{
|
||||
harvestInterval = 720;
|
||||
}
|
||||
|
||||
Date nextTime;
|
||||
long nextHarvest = 0;
|
||||
|
@@ -110,7 +110,9 @@ public class LicenseCleanup
|
||||
File processed = new File("license.processed");
|
||||
|
||||
if (processed.exists())
|
||||
{
|
||||
props.load(new FileInputStream(processed));
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -162,7 +164,9 @@ public class LicenseCleanup
|
||||
Bundle[] bundles = item.getBundles("CC-LICENSE");
|
||||
|
||||
if (bundles == null || bundles.length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bundle bundle = bundles[0];
|
||||
|
||||
|
@@ -100,7 +100,9 @@ public class DSAnalyzer extends Analyzer
|
||||
{
|
||||
// If it is the default field, or bounded fields is turned off in the config, return the default value
|
||||
if ("default".equalsIgnoreCase(fieldName) || !ConfigurationManager.getBooleanProperty("search.boundedfields", false))
|
||||
{
|
||||
return super.getPositionIncrementGap(fieldName);
|
||||
}
|
||||
|
||||
// Not the default field, and we want bounded fields, so return an large gap increment
|
||||
return 10;
|
||||
|
@@ -586,8 +586,10 @@ public class DSIndexer
|
||||
finally
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
items.close();
|
||||
}
|
||||
}
|
||||
|
||||
Collection[] collections = Collection.findAll(context);
|
||||
for (int i = 0; i < collections.length; i++)
|
||||
|
@@ -316,8 +316,10 @@ public class Harvest
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return infoObjects;
|
||||
}
|
||||
@@ -401,9 +403,11 @@ public class Harvest
|
||||
finally
|
||||
{
|
||||
if (colRows != null)
|
||||
{
|
||||
colRows.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -243,7 +243,15 @@ public class DatabaseManager
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
if (statement != null)
|
||||
try { statement.close(); } catch (SQLException s) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException s)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
throw sqle;
|
||||
}
|
||||
@@ -294,7 +302,15 @@ public class DatabaseManager
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
if (statement != null)
|
||||
try { statement.close(); } catch (SQLException s) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException s)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
throw sqle;
|
||||
}
|
||||
@@ -373,8 +389,10 @@ public class DatabaseManager
|
||||
finally
|
||||
{
|
||||
if (iterator != null)
|
||||
{
|
||||
iterator.close();
|
||||
}
|
||||
}
|
||||
|
||||
return (retRow);
|
||||
}
|
||||
@@ -410,8 +428,10 @@ public class DatabaseManager
|
||||
finally
|
||||
{
|
||||
if (iterator != null)
|
||||
{
|
||||
iterator.close();
|
||||
}
|
||||
}
|
||||
return (retRow);
|
||||
}
|
||||
|
||||
@@ -538,10 +558,14 @@ public class DatabaseManager
|
||||
String ctable = canonicalize(table);
|
||||
|
||||
if ( ! DB_SAFE_NAME.matcher(ctable).matches())
|
||||
throw new SQLException("Unable to execute select query because table name ("+ctable+") contains non alphanumeric characters.");
|
||||
{
|
||||
throw new SQLException("Unable to execute select query because table name (" + ctable + ") contains non alphanumeric characters.");
|
||||
}
|
||||
|
||||
if ( ! DB_SAFE_NAME.matcher(column).matches())
|
||||
throw new SQLException("Unable to execute select query because column name ("+column+") contains non alphanumeric characters.");
|
||||
{
|
||||
throw new SQLException("Unable to execute select query because column name (" + column + ") contains non alphanumeric characters.");
|
||||
}
|
||||
|
||||
String sql = "select * from " + ctable + " where "+ column +" = ? ";
|
||||
|
||||
@@ -593,10 +617,14 @@ public class DatabaseManager
|
||||
String ctable = canonicalize(table);
|
||||
|
||||
if ( ! DB_SAFE_NAME.matcher(ctable).matches())
|
||||
throw new SQLException("Unable to execute delete query because table name ("+ctable+") contains non alphanumeric characters.");
|
||||
{
|
||||
throw new SQLException("Unable to execute delete query because table name (" + ctable + ") contains non alphanumeric characters.");
|
||||
}
|
||||
|
||||
if ( ! DB_SAFE_NAME.matcher(column).matches())
|
||||
throw new SQLException("Unable to execute delete query because column name ("+column+") contains non alphanumeric characters.");
|
||||
{
|
||||
throw new SQLException("Unable to execute delete query because column name (" + column + ") contains non alphanumeric characters.");
|
||||
}
|
||||
|
||||
String sql = "delete from "+ctable+" where "+column+" = ? ";
|
||||
|
||||
@@ -627,9 +655,11 @@ public class DatabaseManager
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
{
|
||||
pstmt.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return conn;
|
||||
}
|
||||
@@ -726,7 +756,9 @@ public class DatabaseManager
|
||||
}
|
||||
|
||||
if (newID < 0)
|
||||
{
|
||||
throw new SQLException("Unable to retrieve sequence ID");
|
||||
}
|
||||
|
||||
// Set the ID in the table row object
|
||||
row.setColumn(getPrimaryKeyColumn(table), newID);
|
||||
@@ -817,7 +849,9 @@ public class DatabaseManager
|
||||
public static int delete(Context context, TableRow row) throws SQLException
|
||||
{
|
||||
if (null == row.getTable())
|
||||
{
|
||||
throw new IllegalArgumentException("Row not associated with a table");
|
||||
}
|
||||
|
||||
String pk = getPrimaryKeyColumn(row);
|
||||
|
||||
|
@@ -137,12 +137,16 @@ public class InitializeDatabase
|
||||
{
|
||||
myFile = new File("etc/" + dbName + "/" + name);
|
||||
if (myFile.exists())
|
||||
{
|
||||
return new FileReader(myFile.getCanonicalPath());
|
||||
}
|
||||
}
|
||||
|
||||
myFile = new File("etc/" + name);
|
||||
if (myFile.exists())
|
||||
{
|
||||
return new FileReader(myFile.getCanonicalPath());
|
||||
}
|
||||
|
||||
return new FileReader(name);
|
||||
}
|
||||
|
@@ -556,9 +556,13 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
String confidence = request.getParameter(metadataField + "_confidence");
|
||||
|
||||
if (lastName != null)
|
||||
{
|
||||
lasts.add(lastName);
|
||||
}
|
||||
if (firstNames != null)
|
||||
{
|
||||
firsts.add(firstNames);
|
||||
}
|
||||
auths.add(authority == null ? "" : authority);
|
||||
confs.add(confidence == null ? "" : confidence);
|
||||
}
|
||||
@@ -709,7 +713,9 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
vals = new LinkedList();
|
||||
String value = request.getParameter(metadataField);
|
||||
if (value != null)
|
||||
{
|
||||
vals.add(value.trim());
|
||||
}
|
||||
if (isAuthorityControlled)
|
||||
{
|
||||
auths = new LinkedList();
|
||||
@@ -876,7 +882,9 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
{
|
||||
// if number is null, just set to a nullstring
|
||||
if (n == null)
|
||||
{
|
||||
n = "";
|
||||
}
|
||||
|
||||
series.add(s);
|
||||
numbers.add(n);
|
||||
@@ -969,8 +977,10 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
}
|
||||
|
||||
if (addValue)
|
||||
{
|
||||
vals.add(s.trim());
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@@ -96,8 +96,10 @@ public abstract class InitialArticleWord implements TextFilter
|
||||
// Only need to do so if we haven't already got one
|
||||
// of the right length
|
||||
if (initialArticleWord.length() != articleWordArr[idx].length())
|
||||
{
|
||||
initialArticleWord = extractText(str, curPos, articleWordArr[idx].length());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
initialArticleWord = extractText(str, curPos, articleWordArr[idx].length());
|
||||
@@ -213,7 +215,9 @@ public abstract class InitialArticleWord implements TextFilter
|
||||
}
|
||||
|
||||
if (testPos < str.length())
|
||||
{
|
||||
return str.substring(pos, pos + len);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -124,43 +124,51 @@ public class Language
|
||||
|
||||
private static class LanguageMaps
|
||||
{
|
||||
private static final Map langMapIANA = new HashMap();
|
||||
private static final Map langMapISO639_1 = new HashMap();
|
||||
private static final Map langMapISO639_2 = new HashMap();
|
||||
private static final Map<String, Language> langMapIANA = new HashMap<String, Language>();
|
||||
private static final Map<String, Language> langMapISO639_1 = new HashMap<String, Language>();
|
||||
private static final Map<String, Language> langMapISO639_2 = new HashMap<String, Language>();
|
||||
|
||||
static void add(Language l)
|
||||
{
|
||||
if (l.IANA != null && l.IANA.length() > 0 && !langMapIANA.containsKey(l.IANA))
|
||||
{
|
||||
langMapIANA.put(l.IANA, l);
|
||||
}
|
||||
|
||||
if (l.ISO639_1 != null && l.ISO639_1.length() > 0 && !langMapISO639_1.containsKey(l.ISO639_1))
|
||||
{
|
||||
langMapISO639_1.put(l.ISO639_1, l);
|
||||
}
|
||||
|
||||
if (l.ISO639_2 != null && l.ISO639_2.length() > 0 && !langMapISO639_2.containsKey(l.ISO639_2))
|
||||
{
|
||||
langMapISO639_2.put(l.ISO639_2, l);
|
||||
}
|
||||
}
|
||||
|
||||
public static Language getLanguage(String lang)
|
||||
{
|
||||
if (langMapIANA.containsKey(lang))
|
||||
return (Language)langMapIANA.get(lang);
|
||||
{
|
||||
return langMapIANA.get(lang);
|
||||
}
|
||||
|
||||
return (Language)langMapISO639_2.get(lang);
|
||||
return langMapISO639_2.get(lang);
|
||||
}
|
||||
|
||||
public static Language getLanguageForIANA(String iana)
|
||||
{
|
||||
return (Language)langMapIANA.get(iana);
|
||||
return langMapIANA.get(iana);
|
||||
}
|
||||
|
||||
public static Language getLanguageForISO639_1(String iso)
|
||||
{
|
||||
return (Language)langMapISO639_1.get(iso);
|
||||
return langMapISO639_1.get(iso);
|
||||
}
|
||||
|
||||
public static Language getLanguageForISO639_2(String iso)
|
||||
{
|
||||
return (Language)langMapISO639_2.get(iso);
|
||||
return langMapISO639_2.get(iso);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,9 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
||||
{
|
||||
// No language - no words
|
||||
if (StringUtils.isEmpty(lang))
|
||||
{
|
||||
return defaultWords;
|
||||
}
|
||||
|
||||
Language l = Language.getLanguage(lang);
|
||||
|
||||
@@ -81,17 +83,19 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
||||
if (l != null && ianaArticleMap.containsKey(l.IANA))
|
||||
{
|
||||
// Get the list of words for this language
|
||||
ArticlesForLang articles = (ArticlesForLang)ianaArticleMap.get(l.IANA);
|
||||
ArticlesForLang articles = ianaArticleMap.get(l.IANA);
|
||||
|
||||
if (articles != null)
|
||||
{
|
||||
return articles.words;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Mapping of IANA codes to article word lists
|
||||
private static Map ianaArticleMap = new HashMap();
|
||||
private static Map<String, ArticlesForLang> ianaArticleMap = new HashMap<String, ArticlesForLang>();
|
||||
|
||||
private static String[] defaultWords = null;
|
||||
|
||||
@@ -247,7 +251,7 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
||||
};
|
||||
|
||||
// Initialize the lang -> article map
|
||||
ianaArticleMap = new HashMap();
|
||||
ianaArticleMap = new HashMap<String, ArticlesForLang>();
|
||||
|
||||
int wordIdx = 0;
|
||||
int langIdx = 0;
|
||||
@@ -273,10 +277,12 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
||||
|
||||
// Add language to list if we haven't done so already
|
||||
if (!words.contains(articleWordArray[wordIdx][0]))
|
||||
{
|
||||
words.add(articleWordArray[wordIdx][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through languages
|
||||
for (Map.Entry<Language, List> langToWord : langWordMap.entrySet())
|
||||
@@ -315,7 +321,7 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
||||
Language l = Language.getLanguage(langArr[idx]);
|
||||
if (l != null && ianaArticleMap.containsKey(l.IANA))
|
||||
{
|
||||
afl[idx] = (ArticlesForLang)ianaArticleMap.get(l.IANA);
|
||||
afl[idx] = ianaArticleMap.get(l.IANA);
|
||||
if (afl[idx] != null)
|
||||
{
|
||||
wordCount += afl[idx].words.length;
|
||||
|
@@ -118,8 +118,10 @@ public class IndexEventConsumer implements Consumer {
|
||||
et = Event.MODIFY;
|
||||
subject = ((Bundle) subject).getItems()[0];
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Transforming Bundle event into MODIFY of Item "
|
||||
+ subject.getHandle());
|
||||
}
|
||||
} else
|
||||
{
|
||||
return;
|
||||
@@ -213,8 +215,10 @@ public class IndexEventConsumer implements Consumer {
|
||||
try {
|
||||
indexer.unIndexContent(ctx, hdl, true);
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("UN-Indexed Item, handle=" + hdl);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Failed while UN-indexing object: " + hdl, e);
|
||||
}
|
||||
|
@@ -60,7 +60,9 @@ public class ItemFacets extends org.dspace.app.xmlui.aspect.discovery.AbstractFi
|
||||
|
||||
org.dspace.content.DSpaceObject dso = org.dspace.app.xmlui.utils.HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof org.dspace.content.Item))
|
||||
{
|
||||
return;
|
||||
}
|
||||
org.dspace.content.Item item = (org.dspace.content.Item) dso;
|
||||
|
||||
try {
|
||||
@@ -76,7 +78,9 @@ public class ItemFacets extends org.dspace.app.xmlui.aspect.discovery.AbstractFi
|
||||
public void performSearch(org.dspace.content.DSpaceObject dso) throws org.dspace.discovery.SearchServiceException {
|
||||
|
||||
if(queryResults != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.queryArgs = prepareDefaultFilters("item");
|
||||
|
||||
|
@@ -79,7 +79,9 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (dso != null)
|
||||
{
|
||||
key += "-" + dso.getHandle();
|
||||
}
|
||||
|
||||
return HashUtil.hash(key);
|
||||
}
|
||||
|
@@ -100,7 +100,9 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
||||
|
||||
query = request.getParameter(CommonParams.Q);
|
||||
if(query == null)
|
||||
{
|
||||
query = "*:*";
|
||||
}
|
||||
|
||||
//Retrieve all our filter queries
|
||||
filterQueries = request.getParameterValues(CommonParams.FQ);
|
||||
@@ -126,7 +128,9 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
||||
facetSort = request.getParameter(FacetParams.FACET_SORT);
|
||||
//Make sure we have a valid sorting value
|
||||
if(!FacetParams.FACET_SORT_INDEX.equals(facetSort) && !FacetParams.FACET_SORT_COUNT.equals(facetSort))
|
||||
{
|
||||
facetSort = null;
|
||||
}
|
||||
|
||||
//Retrieve our facet min count
|
||||
facetMinCount = 1;
|
||||
@@ -163,13 +167,17 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
||||
}
|
||||
|
||||
if(props.getProperty("solr.search.server") != null)
|
||||
{
|
||||
this.solrServerUrl = props.getProperty("solr.search.server").toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void generate() throws IOException, SAXException, ProcessingException {
|
||||
if(solrServerUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
@@ -196,7 +204,9 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
||||
|
||||
params.put(FacetParams.FACET_LIMIT, String.valueOf(facetLimit));
|
||||
if(facetSort != null)
|
||||
{
|
||||
params.put(FacetParams.FACET_SORT, facetSort);
|
||||
}
|
||||
params.put(FacetParams.FACET_MINCOUNT, String.valueOf(facetMinCount));
|
||||
|
||||
solrRequestUrl = AbstractDSpaceTransformer.generateURL(solrRequestUrl, params);
|
||||
@@ -205,7 +215,9 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
||||
for (String facetField : facetFields) {
|
||||
//This class can only be used for autocomplete facet fields
|
||||
if(!facetField.endsWith(".year") && !facetField.endsWith("_ac"))
|
||||
{
|
||||
facetField += "_ac";
|
||||
}
|
||||
solrRequestUrl += "&" + FacetParams.FACET_FIELD + "=" + URLEncoder.encode(facetField, Constants.DEFAULT_ENCODING);
|
||||
}
|
||||
}
|
||||
|
@@ -219,7 +219,9 @@ public class ItemListTag extends TagSupport
|
||||
if (listTok != null)
|
||||
{
|
||||
if (newLLine.length() > 0)
|
||||
{
|
||||
newLLine.append(",");
|
||||
}
|
||||
|
||||
newLLine.append(listTok);
|
||||
}
|
||||
@@ -227,7 +229,9 @@ public class ItemListTag extends TagSupport
|
||||
if (widthTok != null)
|
||||
{
|
||||
if (newWLine.length() > 0)
|
||||
{
|
||||
newWLine.append(",");
|
||||
}
|
||||
|
||||
newWLine.append(widthTok);
|
||||
}
|
||||
|
@@ -389,7 +389,9 @@ public class ItemTag extends TagSupport
|
||||
String configLine = styleSelection.getConfigurationForStyle(style);
|
||||
|
||||
if (configLine == null)
|
||||
{
|
||||
configLine = defaultFields;
|
||||
}
|
||||
|
||||
out.println("<center><table class=\"itemDisplayTable\">");
|
||||
|
||||
@@ -453,7 +455,9 @@ public class ItemTag extends TagSupport
|
||||
|
||||
// check for hidden field, even if it's configured..
|
||||
if (MetadataExposure.isHidden(context, schema, element, qualifier))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// FIXME: Still need to fix for metadata language?
|
||||
DCValue[] values = item.getMetadata(schema, element, qualifier, Item.ANY);
|
||||
|
@@ -331,13 +331,17 @@ public class FeedServlet extends DSpaceServlet
|
||||
BrowserScope scope = new BrowserScope(context);
|
||||
scope.setBrowseIndex(bix);
|
||||
if (dso != null)
|
||||
{
|
||||
scope.setBrowseContainer(dso);
|
||||
}
|
||||
|
||||
for (SortOption so : SortOption.getSortOptions())
|
||||
{
|
||||
if (so.getName().equals(idx))
|
||||
{
|
||||
scope.setSortBy(so.getNumber());
|
||||
}
|
||||
}
|
||||
scope.setOrder(SortOption.DESCENDING);
|
||||
scope.setResultsPerPage(itemCount);
|
||||
|
||||
|
@@ -128,9 +128,11 @@ public class HTMLServlet extends DSpaceServlet
|
||||
for (int k = 0; k < bitstreams.length; k++)
|
||||
{
|
||||
if (bsName.equals(bitstreams[k].getName()))
|
||||
{
|
||||
return bitstreams[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -72,7 +72,9 @@ public class LoadDSpaceConfig extends HttpServlet
|
||||
{
|
||||
String osName = System.getProperty("os.name");
|
||||
if (osName != null)
|
||||
{
|
||||
osName = osName.toLowerCase();
|
||||
}
|
||||
|
||||
if (osName != null && osName.contains("windows"))
|
||||
{
|
||||
|
@@ -808,8 +808,10 @@ public class MyDSpaceServlet extends DSpaceServlet
|
||||
finally
|
||||
{
|
||||
if (subs != null)
|
||||
{
|
||||
subs.close();
|
||||
}
|
||||
}
|
||||
|
||||
Item[] items = new Item[subList.size()];
|
||||
|
||||
|
@@ -717,7 +717,9 @@ public class EditCommunitiesServlet extends DSpaceServlet
|
||||
if (contentSource.equals("source_normal"))
|
||||
{
|
||||
if (hc != null)
|
||||
{
|
||||
hc.delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -80,7 +80,10 @@ public class GroupListServlet extends DSpaceServlet
|
||||
|
||||
// What's the index of the first group to show? Default is 0
|
||||
int first = UIUtil.getIntParameter(request, "first");
|
||||
if (first == -1) first = 0;
|
||||
if (first == -1)
|
||||
{
|
||||
first = 0;
|
||||
}
|
||||
|
||||
// Retrieve the e-people in the specified order
|
||||
Group[] groups = Group.findAll(context, sortBy);
|
||||
|
@@ -173,8 +173,10 @@ public class ItemMapServlet extends DSpaceServlet
|
||||
finally
|
||||
{
|
||||
if (i != null)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
|
||||
// remove this collection's entry because we already have a native
|
||||
// count
|
||||
@@ -353,9 +355,11 @@ public class ItemMapServlet extends DSpaceServlet
|
||||
finally
|
||||
{
|
||||
if (itr != null)
|
||||
{
|
||||
itr.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BrowseException e)
|
||||
{
|
||||
log.error("caught exception: ", e);
|
||||
@@ -397,8 +401,10 @@ public class ItemMapServlet extends DSpaceServlet
|
||||
finally
|
||||
{
|
||||
if (i != null)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("collection", myCollection);
|
||||
request.setAttribute("browsetext", targetCollection
|
||||
|
@@ -312,7 +312,9 @@ public class JSPStepManager
|
||||
// first, do any pre-processing and get the JSP to display
|
||||
// (assuming that this step has an interface)
|
||||
if(stepJSPUI!=null)
|
||||
{
|
||||
stepJSPUI.doPreProcessing(context, request, response, subInfo);
|
||||
}
|
||||
|
||||
// Complete this step, if this response has not already
|
||||
// been committed.
|
||||
|
@@ -384,7 +384,9 @@ public class JSPUploadStep extends JSPStep
|
||||
// if multipart form, then we just finished a file upload
|
||||
if ((contentType != null)
|
||||
&& (contentType.indexOf("multipart/form-data") != -1))
|
||||
{
|
||||
fileUpload = true;
|
||||
}
|
||||
|
||||
// show the appropriate upload page
|
||||
// (based on if a file has just been uploaded or not)
|
||||
|
@@ -64,9 +64,15 @@ public class LNIRemoteException extends org.apache.axis.AxisFault implements j
|
||||
|
||||
private java.lang.Object __equalsCalc = null;
|
||||
public synchronized boolean equals(java.lang.Object obj) {
|
||||
if (!(obj instanceof LNIRemoteException)) return false;
|
||||
if (!(obj instanceof LNIRemoteException))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
LNIRemoteException other = (LNIRemoteException) obj;
|
||||
if (this == obj) return true;
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (__equalsCalc != null) {
|
||||
return (__equalsCalc.equals(obj));
|
||||
}
|
||||
|
@@ -180,8 +180,10 @@ class DAVCollection extends DAVDSpaceObject
|
||||
finally
|
||||
{
|
||||
if (ii != null)
|
||||
{
|
||||
ii.close();
|
||||
}
|
||||
}
|
||||
|
||||
return (DAVResource[]) result.toArray(new DAVResource[result.size()]);
|
||||
}
|
||||
@@ -625,10 +627,12 @@ class DAVCollection extends DAVDSpaceObject
|
||||
{
|
||||
Community[] ca = this.collection.getCommunities();
|
||||
if (ca != null)
|
||||
{
|
||||
for (Community element : ca)
|
||||
{
|
||||
element.removeCollection(this.collection);
|
||||
}
|
||||
}
|
||||
// collection.delete();
|
||||
return HttpServletResponse.SC_OK; // HTTP OK
|
||||
}
|
||||
|
@@ -142,6 +142,7 @@ public class DAVServlet extends HttpServlet
|
||||
{
|
||||
Cookie cookies[] = request.getCookies();
|
||||
if (cookies != null)
|
||||
{
|
||||
for (Cookie element : cookies)
|
||||
{
|
||||
if (element.getName().equals(COOKIE_NAME))
|
||||
@@ -149,6 +150,7 @@ public class DAVServlet extends HttpServlet
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -199,10 +199,26 @@ public class DIDLCrosswalk extends Crosswalk
|
||||
finally
|
||||
{
|
||||
if (bis != null)
|
||||
try { bis.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
bis.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (is != null)
|
||||
try { is.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contextl.complete();
|
||||
|
@@ -62,7 +62,9 @@ public class Dataset {
|
||||
this.matrix = (float[][]) ArrayUtils.clone(matrix);
|
||||
nbRows = matrix.length;
|
||||
if(0 < matrix.length && 0 < matrix[0].length)
|
||||
{
|
||||
nbCols = matrix[0].length;
|
||||
}
|
||||
initColumnLabels(nbCols);
|
||||
initRowLabels(nbRows);
|
||||
}
|
||||
@@ -201,10 +203,12 @@ public class Dataset {
|
||||
for (float[] vector : matrix) {
|
||||
for (float v : vector) {
|
||||
if (v != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,9 @@ public class DatasetTimeGenerator extends DatasetGenerator {
|
||||
Calendar endCal1 = Calendar.getInstance();
|
||||
endCal1.setTime(end);
|
||||
if(endCal1.before(startCal1))
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
// TODO: ensure future dates are tested. Although we normally do not
|
||||
// have visits from the future.
|
||||
|
@@ -46,7 +46,9 @@ public class IPTable {
|
||||
end = range[1].trim().split("/")[0].split("\\.");
|
||||
|
||||
if (start.length != 4 || end.length != 4)
|
||||
{
|
||||
throw new IPFormatException(ip + " - Ranges need to be full IPv4 Addresses");
|
||||
}
|
||||
|
||||
if (!(start[0].equals(end[0]) && start[1].equals(end[1]) && start[2].equals(end[2]))) {
|
||||
throw new IPFormatException(ip + " - Ranges can only be across the last subnet x.y.z.0 - x.y.z.254");
|
||||
@@ -123,19 +125,30 @@ public class IPTable {
|
||||
String[] subnets = ip.split("\\.");
|
||||
|
||||
if (subnets.length != 4)
|
||||
{
|
||||
throw new IPFormatException("needs to be single IP Address");
|
||||
}
|
||||
|
||||
Map<String, Map<String, Set<String>>> first = map.get(subnets[0]);
|
||||
|
||||
if (first == null) return false;
|
||||
if (first == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Map<String, Set<String>> second = first.get(subnets[1]);
|
||||
|
||||
if (second == null) return false;
|
||||
if (second == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<String> third = second.get(subnets[2]);
|
||||
|
||||
if (third == null) return false;
|
||||
if (third == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return third.contains(subnets[3]) || third.contains("*");
|
||||
|
||||
|
@@ -779,13 +779,19 @@ public class LocationUtils {
|
||||
static
|
||||
{
|
||||
if(countryCodeList == null)
|
||||
{
|
||||
countryCodeList = Arrays.asList(countryCodes);
|
||||
}
|
||||
if(continentCodeList == null)
|
||||
{
|
||||
continentCodeList = Arrays.asList(continentCodes);
|
||||
}
|
||||
|
||||
if(countryNameList == null)
|
||||
{
|
||||
countryNameList = Arrays.asList(countryNames);
|
||||
}
|
||||
}
|
||||
|
||||
private static String[][] continentCodeToName = new String[][]{
|
||||
{"NA", "North America"},
|
||||
@@ -818,8 +824,10 @@ public class LocationUtils {
|
||||
// String continentCode = getContinentCode(countryCode);
|
||||
for (String[] contCodeName : continentCodeToName) {
|
||||
if (contCodeName[0].equals(continentCode))
|
||||
{
|
||||
return contCodeName[1];
|
||||
}
|
||||
}
|
||||
return continentCode;
|
||||
}
|
||||
}
|
||||
|
@@ -87,7 +87,9 @@ public class ControlPanelAction extends AbstractAction
|
||||
|
||||
// Update the message
|
||||
if (message != null)
|
||||
{
|
||||
SystemwideAlerts.setMessage(message);
|
||||
}
|
||||
|
||||
if (countdown >= 0)
|
||||
{
|
||||
|
@@ -214,22 +214,28 @@ public class CurrentActivityAction extends AbstractAction
|
||||
{
|
||||
EPerson eperson = context.getCurrentUser();
|
||||
if (eperson != null)
|
||||
{
|
||||
epersonID = eperson.getID();
|
||||
}
|
||||
}
|
||||
|
||||
if (request != null)
|
||||
{
|
||||
url = request.getSitemapURI();
|
||||
HttpSession session = request.getSession(true);
|
||||
if (session != null)
|
||||
{
|
||||
sessionID = session.getId();
|
||||
}
|
||||
|
||||
userAgent = request.getHeader("User-Agent");
|
||||
|
||||
ip = request.getHeader(IP_HEADER);
|
||||
if (ip == null)
|
||||
{
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
}
|
||||
|
||||
// The current time
|
||||
timestamp = System.currentTimeMillis();
|
||||
@@ -282,7 +288,9 @@ public class CurrentActivityAction extends AbstractAction
|
||||
public boolean isBot()
|
||||
{
|
||||
if (userAgent == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String ua = userAgent.toLowerCase();
|
||||
|
||||
return (ua.contains("google/") ||
|
||||
@@ -302,61 +310,97 @@ public class CurrentActivityAction extends AbstractAction
|
||||
public String getDectectedBrowser()
|
||||
{
|
||||
if (userAgent == null)
|
||||
{
|
||||
return "No browser provided";
|
||||
}
|
||||
|
||||
String userAgentLower = userAgent.toLowerCase();
|
||||
|
||||
// BOTS
|
||||
if (userAgent.toLowerCase().contains("google/"))
|
||||
if (userAgentLower.contains("google/"))
|
||||
{
|
||||
return "Google (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("msnbot/"))
|
||||
if (userAgentLower.contains("msnbot/"))
|
||||
{
|
||||
return "MSN (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("googlebot/"))
|
||||
if (userAgentLower.contains("googlebot/"))
|
||||
{
|
||||
return "Google (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("webcrawler/"))
|
||||
if (userAgentLower.contains("webcrawler/"))
|
||||
{
|
||||
return "WebCrawler (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("inktomi"))
|
||||
if (userAgentLower.contains("inktomi"))
|
||||
{
|
||||
return "Inktomi (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("teoma"))
|
||||
if (userAgentLower.contains("teoma"))
|
||||
{
|
||||
return "Teoma (bot)";
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().contains("bot"))
|
||||
if (userAgentLower.contains("bot"))
|
||||
{
|
||||
return "Unknown (bot)";
|
||||
}
|
||||
|
||||
// Normal Browsers
|
||||
if (userAgent.contains("Lotus-Notes/"))
|
||||
{
|
||||
return "Lotus-Notes";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Opera"))
|
||||
{
|
||||
return "Opera";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Safari/"))
|
||||
{
|
||||
if (userAgent.contains("Chrome"))
|
||||
{
|
||||
return "Chrome";
|
||||
}
|
||||
|
||||
return "Safari";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Konqueror/"))
|
||||
{
|
||||
return "Konqueror";
|
||||
}
|
||||
|
||||
// Internet explorer browsers
|
||||
if (userAgent.contains("MSIE"))
|
||||
{
|
||||
if (userAgent.contains("MSIE 9"))
|
||||
{
|
||||
return "MSIE 9";
|
||||
}
|
||||
if (userAgent.contains("MSIE 8"))
|
||||
{
|
||||
return "MSIE 8";
|
||||
}
|
||||
if (userAgent.contains("MSIE 7"))
|
||||
{
|
||||
return "MSIE 7";
|
||||
}
|
||||
if (userAgent.contains("MSIE 6"))
|
||||
{
|
||||
return "MSIE 6";
|
||||
}
|
||||
if (userAgent.contains("MSIE 5"))
|
||||
{
|
||||
return "MSIE 5";
|
||||
}
|
||||
|
||||
// Can't fine the version number
|
||||
return "MSIE";
|
||||
@@ -366,37 +410,59 @@ public class CurrentActivityAction extends AbstractAction
|
||||
if (userAgent.contains("Gecko/"))
|
||||
{
|
||||
if (userAgent.contains("Camio/"))
|
||||
{
|
||||
return "Gecko/Camino";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Chimera/"))
|
||||
{
|
||||
return "Gecko/Chimera";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firebird/"))
|
||||
{
|
||||
return "Gecko/Firebird";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Phoenix/"))
|
||||
{
|
||||
return "Gecko/Phoenix";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Galeon"))
|
||||
{
|
||||
return "Gecko/Galeon";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firefox/1"))
|
||||
{
|
||||
return "Firefox 1.x";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firefox/2"))
|
||||
{
|
||||
return "Firefox 2.x";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firefox/3"))
|
||||
{
|
||||
return "Firefox 3.x";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firefox/4"))
|
||||
{
|
||||
return "Firefox 4.x";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Firefox/"))
|
||||
{
|
||||
return "Firefox"; // can't find the exact version
|
||||
}
|
||||
|
||||
if (userAgent.contains("Netscape/"))
|
||||
{
|
||||
return "Netscape";
|
||||
}
|
||||
|
||||
// Can't find the exact distribution
|
||||
return "Gecko";
|
||||
@@ -408,10 +474,14 @@ public class CurrentActivityAction extends AbstractAction
|
||||
return "KHTML";
|
||||
|
||||
if (userAgent.contains("Netscape/"))
|
||||
{
|
||||
return "Netscape";
|
||||
}
|
||||
|
||||
if (userAgent.contains("Mozilla/"))
|
||||
{
|
||||
return "Mozilla"; // Almost everything says they are mozilla.
|
||||
}
|
||||
|
||||
// if you get all the way to the end and still nothing, return unknown.
|
||||
return "Unknown";
|
||||
|
@@ -117,21 +117,35 @@ public class FlowContainerUtils
|
||||
|
||||
// If they don't have a name then make it untitled.
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
name = "Untitled";
|
||||
}
|
||||
|
||||
// If empty, make it null.
|
||||
if (shortDescription != null && shortDescription.length() == 0)
|
||||
{
|
||||
shortDescription = null;
|
||||
}
|
||||
if (introductoryText != null && introductoryText.length() == 0)
|
||||
{
|
||||
introductoryText = null;
|
||||
}
|
||||
if (copyrightText != null && copyrightText.length() == 0)
|
||||
{
|
||||
copyrightText = null;
|
||||
}
|
||||
if (sideBarText != null && sideBarText.length() == 0)
|
||||
{
|
||||
sideBarText = null;
|
||||
}
|
||||
if (license != null && license.length() == 0)
|
||||
{
|
||||
license = null;
|
||||
}
|
||||
if (provenanceDescription != null && provenanceDescription.length() == 0)
|
||||
{
|
||||
provenanceDescription = null;
|
||||
}
|
||||
|
||||
// Save the metadata
|
||||
collection.setMetadata("name", name);
|
||||
@@ -155,7 +169,9 @@ public class FlowContainerUtils
|
||||
Object object = request.get("logo");
|
||||
Part filePart = null;
|
||||
if (object instanceof Part)
|
||||
{
|
||||
filePart = (Part) object;
|
||||
}
|
||||
|
||||
if (filePart != null && filePart.getSize() > 0)
|
||||
{
|
||||
@@ -195,7 +211,9 @@ public class FlowContainerUtils
|
||||
if (contentSource.equals("source_normal"))
|
||||
{
|
||||
if (hc != null)
|
||||
{
|
||||
hc.delete();
|
||||
}
|
||||
|
||||
result.setContinue(true);
|
||||
}
|
||||
@@ -350,7 +368,9 @@ public class FlowContainerUtils
|
||||
String oaiSetId = request.getParameter("oai_setid");
|
||||
oaiSetId = request.getParameter("oai-set-setting");
|
||||
if(!"all".equals(oaiSetId))
|
||||
{
|
||||
oaiSetId = request.getParameter("oai_setid");
|
||||
}
|
||||
String metadataKey = request.getParameter("metadata_format");
|
||||
String harvestType = request.getParameter("harvest_level");
|
||||
int harvestTypeInt = 0;
|
||||
@@ -446,32 +466,42 @@ public class FlowContainerUtils
|
||||
{
|
||||
role = collection.getAdministrators();
|
||||
if (role == null)
|
||||
{
|
||||
role = collection.createAdministrators();
|
||||
}
|
||||
}
|
||||
else if (ROLE_SUBMIT.equals(roleName))
|
||||
{
|
||||
role = collection.getSubmitters();
|
||||
if (role == null)
|
||||
{
|
||||
role = collection.createSubmitters();
|
||||
}
|
||||
}
|
||||
else if (ROLE_WF_STEP1.equals(roleName))
|
||||
{
|
||||
role = collection.getWorkflowGroup(1);
|
||||
if (role == null)
|
||||
{
|
||||
role = collection.createWorkflowGroup(1);
|
||||
}
|
||||
|
||||
}
|
||||
else if (ROLE_WF_STEP2.equals(roleName))
|
||||
{
|
||||
role = collection.getWorkflowGroup(2);
|
||||
if (role == null)
|
||||
{
|
||||
role = collection.createWorkflowGroup(2);
|
||||
}
|
||||
}
|
||||
else if (ROLE_WF_STEP3.equals(roleName))
|
||||
{
|
||||
role = collection.getWorkflowGroup(3);
|
||||
if (role == null)
|
||||
{
|
||||
role = collection.createWorkflowGroup(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -481,7 +511,9 @@ public class FlowContainerUtils
|
||||
|
||||
// If the role name was valid then role should be non null,
|
||||
if (role != null)
|
||||
{
|
||||
return role.getID();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -534,7 +566,9 @@ public class FlowContainerUtils
|
||||
for (ResourcePolicy policy : policies)
|
||||
{
|
||||
if (policy.getGroupID() == groupID)
|
||||
{
|
||||
policy.delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, Delete the role's actual group.
|
||||
@@ -605,7 +639,9 @@ public class FlowContainerUtils
|
||||
int roleID = getCollectionDefaultRead(context, collectionID);
|
||||
|
||||
if (roleID != 0)
|
||||
{
|
||||
throw new UIException("Unable to create a new default read group because either the group allready exists or multiple groups are assigned the default privleges.");
|
||||
}
|
||||
|
||||
Collection collection = Collection.find(context,collectionID);
|
||||
Group role = Group.create(context);
|
||||
@@ -723,21 +759,35 @@ public class FlowContainerUtils
|
||||
|
||||
// If they don't have a name then make it untitled.
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
name = "Untitled";
|
||||
}
|
||||
|
||||
// If empty, make it null.
|
||||
if (shortDescription != null && shortDescription.length() == 0)
|
||||
{
|
||||
shortDescription = null;
|
||||
}
|
||||
if (introductoryText != null && introductoryText.length() == 0)
|
||||
{
|
||||
introductoryText = null;
|
||||
}
|
||||
if (copyrightText != null && copyrightText.length() == 0)
|
||||
{
|
||||
copyrightText = null;
|
||||
}
|
||||
if (sideBarText != null && sideBarText.length() == 0)
|
||||
{
|
||||
sideBarText = null;
|
||||
}
|
||||
if (license != null && license.length() == 0)
|
||||
{
|
||||
license = null;
|
||||
}
|
||||
if (provenanceDescription != null && provenanceDescription.length() == 0)
|
||||
{
|
||||
provenanceDescription = null;
|
||||
}
|
||||
|
||||
// Save the metadata
|
||||
newCollection.setMetadata("name", name);
|
||||
@@ -753,7 +803,9 @@ public class FlowContainerUtils
|
||||
Object object = request.get("logo");
|
||||
Part filePart = null;
|
||||
if (object instanceof Part)
|
||||
{
|
||||
filePart = (Part) object;
|
||||
}
|
||||
|
||||
if (filePart != null && filePart.getSize() > 0)
|
||||
{
|
||||
@@ -811,17 +863,27 @@ public class FlowContainerUtils
|
||||
|
||||
// If they don't have a name then make it untitled.
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
name = "Untitled";
|
||||
}
|
||||
|
||||
// If empty, make it null.
|
||||
if (shortDescription != null && shortDescription.length() == 0)
|
||||
{
|
||||
shortDescription = null;
|
||||
}
|
||||
if (introductoryText != null && introductoryText.length() == 0)
|
||||
{
|
||||
introductoryText = null;
|
||||
}
|
||||
if (copyrightText != null && copyrightText.length() == 0)
|
||||
{
|
||||
copyrightText = null;
|
||||
}
|
||||
if (sideBarText != null && sideBarText.length() == 0)
|
||||
{
|
||||
sideBarText = null;
|
||||
}
|
||||
|
||||
newCommunity.setMetadata("name", name);
|
||||
newCommunity.setMetadata("short_description", shortDescription);
|
||||
@@ -833,7 +895,9 @@ public class FlowContainerUtils
|
||||
Object object = request.get("logo");
|
||||
Part filePart = null;
|
||||
if (object instanceof Part)
|
||||
{
|
||||
filePart = (Part) object;
|
||||
}
|
||||
|
||||
if (filePart != null && filePart.getSize() > 0)
|
||||
{
|
||||
@@ -878,17 +942,27 @@ public class FlowContainerUtils
|
||||
|
||||
// If they don't have a name then make it untitled.
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
name = "Untitled";
|
||||
}
|
||||
|
||||
// If empty, make it null.
|
||||
if (shortDescription != null && shortDescription.length() == 0)
|
||||
{
|
||||
shortDescription = null;
|
||||
}
|
||||
if (introductoryText != null && introductoryText.length() == 0)
|
||||
{
|
||||
introductoryText = null;
|
||||
}
|
||||
if (copyrightText != null && copyrightText.length() == 0)
|
||||
{
|
||||
copyrightText = null;
|
||||
}
|
||||
if (sideBarText != null && sideBarText.length() == 0)
|
||||
{
|
||||
sideBarText = null;
|
||||
}
|
||||
|
||||
// Save the data
|
||||
community.setMetadata("name", name);
|
||||
@@ -908,7 +982,9 @@ public class FlowContainerUtils
|
||||
Object object = request.get("logo");
|
||||
Part filePart = null;
|
||||
if (object instanceof Part)
|
||||
{
|
||||
filePart = (Part) object;
|
||||
}
|
||||
|
||||
if (filePart != null && filePart.getSize() > 0)
|
||||
{
|
||||
@@ -971,8 +1047,10 @@ public class FlowContainerUtils
|
||||
{
|
||||
role = community.getAdministrators();
|
||||
if (role == null)
|
||||
{
|
||||
role = community.createAdministrators();
|
||||
}
|
||||
}
|
||||
|
||||
// In case we needed to create a group, save our changes
|
||||
community.update();
|
||||
@@ -980,7 +1058,9 @@ public class FlowContainerUtils
|
||||
|
||||
// If the role name was valid then role should be non null,
|
||||
if (role != null)
|
||||
{
|
||||
return role.getID();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1015,8 +1095,10 @@ public class FlowContainerUtils
|
||||
for (ResourcePolicy policy : policies)
|
||||
{
|
||||
if (policy.getGroupID() == groupID)
|
||||
{
|
||||
policy.delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, delete the role's actual group.
|
||||
community.update();
|
||||
@@ -1111,7 +1193,9 @@ public class FlowContainerUtils
|
||||
public static String escapeXMLEntities(String value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Escape any XML entities
|
||||
int amp = -1;
|
||||
@@ -1119,27 +1203,39 @@ public class FlowContainerUtils
|
||||
{
|
||||
// Is it an xml entity named by number?
|
||||
if (substringCompare(value,amp+1,'#'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// &
|
||||
if (substringCompare(value,amp+1,'a','m','p',';'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// '
|
||||
if (substringCompare(value,amp+1,'a','p','o','s',';'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// "
|
||||
if (substringCompare(value,amp+1,'q','u','o','t',';'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// <
|
||||
if (substringCompare(value,amp+1,'l','t',';'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// >
|
||||
if (substringCompare(value,amp+1,'g','t',';'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Replace the ampersand with an XML entity.
|
||||
value = value.substring(0,amp) + "&" + value.substring(amp+1);
|
||||
@@ -1161,13 +1257,17 @@ public class FlowContainerUtils
|
||||
{
|
||||
// Is the string long enough?
|
||||
if (string.length() <= index + characters.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do all the characters match?
|
||||
for (char character : characters)
|
||||
{
|
||||
if (string.charAt(index) != character)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.environment.http.HttpEnvironment;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dspace.app.xmlui.utils.AuthenticationUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -108,12 +109,18 @@ public class FlowEPersonUtils {
|
||||
boolean certificate = (request.getParameter("certificate") != null) ? true : false;
|
||||
|
||||
// If we have errors, the form needs to be resubmitted to fix those problems
|
||||
if (email.length() == 0)
|
||||
if (StringUtils.isEmpty(email))
|
||||
{
|
||||
result.addError("email_address");
|
||||
if (first.length() == 0)
|
||||
}
|
||||
if (StringUtils.isEmpty(first))
|
||||
{
|
||||
result.addError("first_name");
|
||||
if (last.length() == 0)
|
||||
}
|
||||
if (StringUtils.isEmpty(last))
|
||||
{
|
||||
result.addError("last_name");
|
||||
}
|
||||
|
||||
|
||||
// Check if the email address is all ready being used.
|
||||
@@ -178,12 +185,18 @@ public class FlowEPersonUtils {
|
||||
|
||||
|
||||
// If we have errors, the form needs to be resubmitted to fix those problems
|
||||
if (email.length() == 0)
|
||||
if (StringUtils.isEmpty(email))
|
||||
{
|
||||
result.addError("email_address");
|
||||
if (first.length() == 0)
|
||||
}
|
||||
if (StringUtils.isEmpty(first))
|
||||
{
|
||||
result.addError("first_name");
|
||||
if (last.length() == 0)
|
||||
}
|
||||
if (StringUtils.isEmpty(last))
|
||||
{
|
||||
result.addError("last_name");
|
||||
}
|
||||
|
||||
|
||||
// No errors, so we edit the EPerson with the data provided
|
||||
|
@@ -80,12 +80,16 @@ public class FlowGroupUtils {
|
||||
public static String getName(Context context, int groupID) throws SQLException
|
||||
{
|
||||
if (groupID < 0)
|
||||
{
|
||||
return "New Group";
|
||||
}
|
||||
|
||||
Group group = Group.find(context,groupID);
|
||||
|
||||
if (group == null)
|
||||
{
|
||||
return "New Group";
|
||||
}
|
||||
|
||||
return group.getName();
|
||||
}
|
||||
@@ -101,12 +105,16 @@ public class FlowGroupUtils {
|
||||
{
|
||||
// New group, just return an empty list
|
||||
if (groupID < 0)
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
Group group = Group.find(context,groupID);
|
||||
|
||||
if (group == null)
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
EPerson[] epeople = group.getMembers();
|
||||
|
||||
@@ -129,12 +137,16 @@ public class FlowGroupUtils {
|
||||
public static String[] getGroupMembers(Context context, int groupID) throws SQLException
|
||||
{
|
||||
if (groupID < 0)
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
Group group = Group.find(context,groupID);
|
||||
|
||||
if (group == null)
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
Group[] groups = group.getMemberGroups();
|
||||
|
||||
|
@@ -220,7 +220,9 @@ public class FlowItemUtils
|
||||
|
||||
// the user selected the remove checkbox.
|
||||
if (remove != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the field's name broken up
|
||||
String[] parts = parseName(name);
|
||||
@@ -228,10 +230,14 @@ public class FlowItemUtils
|
||||
// probe for a confidence value
|
||||
int iconf = Choices.CF_UNSET;
|
||||
if (confidence != null && confidence.length() > 0)
|
||||
{
|
||||
iconf = Choices.getConfidenceValue(confidence);
|
||||
}
|
||||
// upgrade to a minimum of NOVALUE if there IS an authority key
|
||||
if (authority != null && authority.length() > 0 && iconf == Choices.CF_UNSET)
|
||||
{
|
||||
iconf = Choices.CF_NOVALUE;
|
||||
}
|
||||
item.addMetadata(parts[0], parts[1], parts[2], lang,
|
||||
value, authority, iconf);
|
||||
}
|
||||
@@ -390,10 +396,14 @@ public class FlowItemUtils
|
||||
|
||||
// Remove item from its owning collection and add to the destination
|
||||
if (!alreadyInCollection)
|
||||
{
|
||||
destination.addItem(item);
|
||||
}
|
||||
|
||||
if (owningCollection != null)
|
||||
{
|
||||
owningCollection.removeItem(item);
|
||||
}
|
||||
|
||||
item.setOwningCollection(destination);
|
||||
item.update();
|
||||
@@ -465,7 +475,9 @@ public class FlowItemUtils
|
||||
Object object = request.get("file");
|
||||
Part filePart = null;
|
||||
if (object instanceof Part)
|
||||
{
|
||||
filePart = (Part) object;
|
||||
}
|
||||
|
||||
if (filePart != null && filePart.getSize() > 0)
|
||||
{
|
||||
@@ -645,7 +657,9 @@ public class FlowItemUtils
|
||||
String[] parts = id.split("/");
|
||||
|
||||
if (parts.length != 2)
|
||||
throw new UIException("Unable to parse id into bundle and bitstream id: "+id);
|
||||
{
|
||||
throw new UIException("Unable to parse id into bundle and bitstream id: " + id);
|
||||
}
|
||||
|
||||
int bundleID = Integer.valueOf(parts[0]);
|
||||
int bitstreamID = Integer.valueOf(parts[1]);
|
||||
|
@@ -110,16 +110,19 @@ public class FlowRegistryUtils
|
||||
throw new UIException(uee);
|
||||
}
|
||||
|
||||
if (namespace == null ||
|
||||
namespace.length() <= 0)
|
||||
if (namespace == null || namespace.length() <= 0)
|
||||
{
|
||||
result.addError("namespace");
|
||||
}
|
||||
if (name == null ||
|
||||
name.length() <= 0 ||
|
||||
name.indexOf('.') != -1 ||
|
||||
name.indexOf('_') != -1 ||
|
||||
name.indexOf(' ') != -1)
|
||||
{
|
||||
// The name must not be empty nor contain dot, underscore or spaces.
|
||||
result.addError("name");
|
||||
}
|
||||
|
||||
|
||||
if (result.getErrors() == null)
|
||||
@@ -213,7 +216,9 @@ public class FlowRegistryUtils
|
||||
|
||||
// Make sure qualifier is null if blank.
|
||||
if ("".equals(qualifier))
|
||||
{
|
||||
qualifier = null;
|
||||
}
|
||||
|
||||
if (result.getErrors() == null)
|
||||
{
|
||||
@@ -277,12 +282,16 @@ public class FlowRegistryUtils
|
||||
|
||||
// Make sure qualifier is null if blank.
|
||||
if ("".equals(qualifier))
|
||||
{
|
||||
qualifier = null;
|
||||
}
|
||||
|
||||
// Check to make sure the field is unique, sometimes the NonUniqueMetadataException is not thrown.
|
||||
MetadataField possibleDuplicate = MetadataField.findByElement(context, schemaID, element, qualifier);
|
||||
if (possibleDuplicate != null && possibleDuplicate.getFieldID() != fieldID)
|
||||
{
|
||||
result.addError("duplicate_field");
|
||||
}
|
||||
|
||||
if (result.getErrors() == null)
|
||||
{
|
||||
@@ -334,28 +343,38 @@ public class FlowRegistryUtils
|
||||
if (element.indexOf('.') != -1 ||
|
||||
element.indexOf('_') != -1 ||
|
||||
element.indexOf(' ') != -1)
|
||||
{
|
||||
errors.add("element_badchar");
|
||||
}
|
||||
|
||||
// Is the element too long?
|
||||
if (element.length() > 64)
|
||||
{
|
||||
errors.add("element_tolong");
|
||||
}
|
||||
|
||||
|
||||
// The qualifier can be empty.
|
||||
if (qualifier != null && qualifier.length() > 0)
|
||||
{
|
||||
if (qualifier.length() > 64)
|
||||
{
|
||||
errors.add("qualifier_tolong");
|
||||
}
|
||||
|
||||
if (qualifier.indexOf('.') != -1 ||
|
||||
qualifier.indexOf('_') != -1 ||
|
||||
qualifier.indexOf(' ') != -1)
|
||||
{
|
||||
errors.add("qualifier_badchar");
|
||||
}
|
||||
}
|
||||
|
||||
// If there were no errors then just return null.
|
||||
if (errors.size() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
@@ -186,7 +186,9 @@ public class FlowResult {
|
||||
public String getHeader()
|
||||
{
|
||||
if (this.header != null)
|
||||
{
|
||||
return this.header.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -206,7 +208,9 @@ public class FlowResult {
|
||||
public String getMessage()
|
||||
{
|
||||
if (this.message != null)
|
||||
{
|
||||
return this.message.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -244,7 +248,9 @@ public class FlowResult {
|
||||
public void addError(String newError)
|
||||
{
|
||||
if (this.errors == null)
|
||||
{
|
||||
this.errors = new ArrayList<String>();
|
||||
}
|
||||
|
||||
this.errors.add(newError);
|
||||
}
|
||||
@@ -294,7 +300,9 @@ public class FlowResult {
|
||||
public void setParameter(String name, Object value)
|
||||
{
|
||||
if (this.parameters == null)
|
||||
this.parameters = new HashMap<String,Object>();
|
||||
{
|
||||
this.parameters = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
this.parameters.put(name, value);
|
||||
}
|
||||
@@ -309,7 +317,9 @@ public class FlowResult {
|
||||
public Object getParameter(String name)
|
||||
{
|
||||
if (this.parameters == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.parameters.get(name);
|
||||
}
|
||||
|
@@ -148,7 +148,9 @@ public class ItemExport extends AbstractDSpaceTransformer implements
|
||||
}
|
||||
}
|
||||
if (errors.size() <= 0)
|
||||
{
|
||||
message = T_item_export_success;
|
||||
}
|
||||
} else if (request.getParameter("collectionID") != null) {
|
||||
Collection col = null;
|
||||
try {
|
||||
@@ -169,7 +171,9 @@ public class ItemExport extends AbstractDSpaceTransformer implements
|
||||
}
|
||||
}
|
||||
if (errors.size() <= 0)
|
||||
{
|
||||
message = T_col_export_success;
|
||||
}
|
||||
} else if (request.getParameter("communityID") != null) {
|
||||
Community com = null;
|
||||
try {
|
||||
@@ -190,8 +194,10 @@ public class ItemExport extends AbstractDSpaceTransformer implements
|
||||
}
|
||||
}
|
||||
if (errors.size() <= 0)
|
||||
{
|
||||
message = T_community_export_success;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
availableExports = org.dspace.app.itemexport.ItemExport
|
||||
|
@@ -276,7 +276,9 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
context.setHead(T_context_head);
|
||||
context.addItemXref(contextPath+"/admin/community?communityID=" + community.getID(), T_context_edit_community);
|
||||
if (AuthorizeManager.isAdmin(this.context, dso))
|
||||
context.addItem().addXref(contextPath+"/admin/export?communityID="+community.getID(), T_context_export_community );
|
||||
{
|
||||
context.addItem().addXref(contextPath + "/admin/export?communityID=" + community.getID(), T_context_export_community);
|
||||
}
|
||||
context.addItem().addXref(contextPath+ "/csv/handle/"+dso.getHandle(),T_context_export_metadata );
|
||||
}
|
||||
|
||||
|
@@ -170,7 +170,9 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
|
||||
|
||||
// Same for the current action; it can either blank (-1), manually set, or inherited from the current policy
|
||||
if (policy != null && actionID == -1)
|
||||
{
|
||||
actionID = policy.getAction();
|
||||
}
|
||||
|
||||
String errorString = parameters.getParameter("errors",null);
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
@@ -241,7 +243,9 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
|
||||
}
|
||||
}
|
||||
if (errors.contains("action_id"))
|
||||
{
|
||||
actionSelect.addError(T_error_no_action);
|
||||
}
|
||||
|
||||
|
||||
// currently set group
|
||||
@@ -268,7 +272,9 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
|
||||
Item searchItem = actionsList.addItem();
|
||||
Text searchText = searchItem.addText("query");
|
||||
if (!query.equals("-1"))
|
||||
{
|
||||
searchText.setValue(query);
|
||||
}
|
||||
searchItem.addButton("submit_search_groups").setValue(T_submit_search_groups);
|
||||
|
||||
|
||||
@@ -307,9 +313,13 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
|
||||
|
||||
String nextURL = null, prevURL = null;
|
||||
if (page < ((totalResults - 1) / RESULTS_PER_PAGE))
|
||||
nextURL = baseURL+"&page="+(page+1);
|
||||
{
|
||||
nextURL = baseURL + "&page=" + (page + 1);
|
||||
}
|
||||
if (page > 0)
|
||||
prevURL = baseURL+"&page="+(page-1);
|
||||
{
|
||||
prevURL = baseURL + "&page=" + (page - 1);
|
||||
}
|
||||
|
||||
div.setSimplePagination(totalResults,firstIndex,lastIndex,prevURL, nextURL);
|
||||
}
|
||||
|
@@ -151,7 +151,9 @@ public class EditCollectionMetadataForm extends AbstractDSpaceTransformer
|
||||
short_description.setValue(thisCollection.getMetadata("short_description"));
|
||||
short_description.setSize(40);
|
||||
if (short_description_error != null)
|
||||
{
|
||||
short_description.addError(short_description_error);
|
||||
}
|
||||
|
||||
// introductory text
|
||||
metadataList.addLabel(T_label_introductory_text);
|
||||
@@ -159,7 +161,9 @@ public class EditCollectionMetadataForm extends AbstractDSpaceTransformer
|
||||
introductory_text.setValue(thisCollection.getMetadata("introductory_text"));
|
||||
introductory_text.setSize(6, 40);
|
||||
if (introductory_text_error != null)
|
||||
{
|
||||
introductory_text.addError(introductory_text_error);
|
||||
}
|
||||
|
||||
// copyright text
|
||||
metadataList.addLabel(T_label_copyright_text);
|
||||
@@ -167,7 +171,9 @@ public class EditCollectionMetadataForm extends AbstractDSpaceTransformer
|
||||
copyright_text.setValue(thisCollection.getMetadata("copyright_text"));
|
||||
copyright_text.setSize(6, 40);
|
||||
if (copyright_text_error != null)
|
||||
{
|
||||
copyright_text.addError(copyright_text_error);
|
||||
}
|
||||
|
||||
// legacy sidebar text; may or may not be used for news
|
||||
metadataList.addLabel(T_label_side_bar_text);
|
||||
@@ -175,7 +181,9 @@ public class EditCollectionMetadataForm extends AbstractDSpaceTransformer
|
||||
side_bar_text.setValue(thisCollection.getMetadata("side_bar_text"));
|
||||
side_bar_text.setSize(6, 40);
|
||||
if (side_bar_text_error != null)
|
||||
{
|
||||
side_bar_text.addError(side_bar_text_error);
|
||||
}
|
||||
|
||||
// license text
|
||||
metadataList.addLabel(T_label_license);
|
||||
|
@@ -135,7 +135,9 @@ public class EditCommunityMetadataForm extends AbstractDSpaceTransformer
|
||||
short_description.setValue(thisCommunity.getMetadata("short_description"));
|
||||
short_description.setSize(40);
|
||||
if (short_description_error != null)
|
||||
{
|
||||
short_description.addError(short_description_error);
|
||||
}
|
||||
|
||||
// introductory text
|
||||
metadataList.addLabel(T_label_introductory_text);
|
||||
@@ -143,7 +145,9 @@ public class EditCommunityMetadataForm extends AbstractDSpaceTransformer
|
||||
introductory_text.setValue(thisCommunity.getMetadata("introductory_text"));
|
||||
introductory_text.setSize(6, 40);
|
||||
if (introductory_text_error != null)
|
||||
{
|
||||
introductory_text.addError(introductory_text_error);
|
||||
}
|
||||
|
||||
// copyright text
|
||||
metadataList.addLabel(T_label_copyright_text);
|
||||
@@ -151,7 +155,9 @@ public class EditCommunityMetadataForm extends AbstractDSpaceTransformer
|
||||
copyright_text.setValue(thisCommunity.getMetadata("copyright_text"));
|
||||
copyright_text.setSize(6, 40);
|
||||
if (copyright_text_error != null)
|
||||
{
|
||||
copyright_text.addError(copyright_text_error);
|
||||
}
|
||||
|
||||
// legacy sidebar text; may or may not be used for news
|
||||
metadataList.addLabel(T_label_side_bar_text);
|
||||
@@ -159,7 +165,9 @@ public class EditCommunityMetadataForm extends AbstractDSpaceTransformer
|
||||
side_bar_text.setValue(thisCommunity.getMetadata("side_bar_text"));
|
||||
side_bar_text.setSize(6, 40);
|
||||
if (side_bar_text_error != null)
|
||||
{
|
||||
side_bar_text.addError(side_bar_text_error);
|
||||
}
|
||||
|
||||
// the row to upload a new logo
|
||||
metadataList.addLabel(T_label_logo);
|
||||
|
@@ -208,7 +208,9 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
EPerson eperson = EPerson.find(context, epersonID);
|
||||
|
||||
if (eperson == null)
|
||||
throw new UIException("Unable to find eperson for id:"+epersonID);
|
||||
{
|
||||
throw new UIException("Unable to find eperson for id:" + epersonID);
|
||||
}
|
||||
|
||||
String emailValue = eperson.getEmail();
|
||||
String firstValue = eperson.getFirstName();
|
||||
@@ -219,13 +221,21 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
java.util.List<String> deleteConstraints = eperson.getDeleteConstraints();
|
||||
|
||||
if (request.getParameter("email_address") != null)
|
||||
{
|
||||
emailValue = request.getParameter("email_address");
|
||||
}
|
||||
if (request.getParameter("first_name") != null)
|
||||
{
|
||||
firstValue = request.getParameter("first_name");
|
||||
}
|
||||
if (request.getParameter("last_name") != null)
|
||||
{
|
||||
lastValue = request.getParameter("last_name");
|
||||
}
|
||||
if (request.getParameter("phone") != null)
|
||||
{
|
||||
phoneValue = request.getParameter("phone");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -271,8 +281,10 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
firstName.setLabel(T_first_name);
|
||||
firstName.setValue(firstValue);
|
||||
if (errors.contains("first_name"))
|
||||
{
|
||||
firstName.addError(T_error_fname);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
identity.addLabel(T_first_name);
|
||||
@@ -286,8 +298,10 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
lastName.setLabel(T_last_name);
|
||||
lastName.setValue(lastValue);
|
||||
if (errors.contains("last_name"))
|
||||
{
|
||||
lastName.addError(T_error_lname);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
identity.addLabel(T_last_name);
|
||||
@@ -329,7 +343,9 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
Button submitLoginAs = special.addButton("submit_login_as");
|
||||
submitLoginAs.setValue(T_submit_login_as);
|
||||
if (!ConfigurationManager.getBooleanProperty("xmlui.user.assumelogin", false))
|
||||
{
|
||||
submitLoginAs.setDisabled();
|
||||
}
|
||||
|
||||
if (deleteConstraints != null && deleteConstraints.size() > 0)
|
||||
{
|
||||
@@ -349,7 +365,9 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
hi.addContent(" ");
|
||||
}
|
||||
else if (idx > 0)
|
||||
{
|
||||
hi.addContent(", ");
|
||||
}
|
||||
|
||||
if ("item".equals(constraint))
|
||||
{
|
||||
@@ -376,7 +394,9 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
|
||||
Item buttons = identity.addItem();
|
||||
if (admin)
|
||||
{
|
||||
buttons.addButton("submit_save").setValue(T_submit_save);
|
||||
}
|
||||
buttons.addButton("submit_cancel").setValue(T_submit_cancel);
|
||||
|
||||
|
||||
@@ -397,13 +417,15 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
// Check if this membership is via another group or not, if so then add a note.
|
||||
Group via = findViaGroup(eperson, group);
|
||||
if (via != null)
|
||||
{
|
||||
item.addHighlight("fade").addContent(T_indirect_member.parameterize(via.getName()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (groups.length <= 0)
|
||||
{
|
||||
member.addItem().addHighlight("italic").addContent(T_member_none);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
edit.addHidden("administrative-continue").setValue(knot.getId());
|
||||
@@ -427,8 +449,10 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
for (EPerson direct : group.getMembers())
|
||||
{
|
||||
if (direct.getID() == eperson.getID())
|
||||
{
|
||||
// Direct membership
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise check what group this eperson is a member through
|
||||
@@ -440,9 +464,11 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
|
||||
for (Group target : targets)
|
||||
{
|
||||
if (member.getID() == target.getID())
|
||||
{
|
||||
return member;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This should never happen, but let's just say we couldn't find the relationship.
|
||||
return null;
|
||||
|
@@ -175,7 +175,9 @@ public class ManageEPeopleMain extends AbstractDSpaceTransformer
|
||||
org.dspace.app.xmlui.wing.element.Item actionItem = actionsList.addItem();
|
||||
Text queryField = actionItem.addText("query");
|
||||
if (query != null)
|
||||
{
|
||||
queryField.setValue(query);
|
||||
}
|
||||
queryField.setHelp(T_search_help);
|
||||
actionItem.addButton("submit_search").setValue(T_go);
|
||||
|
||||
@@ -194,9 +196,13 @@ public class ManageEPeopleMain extends AbstractDSpaceTransformer
|
||||
|
||||
String nextURL = null, prevURL = null;
|
||||
if (page < (resultCount / PAGE_SIZE))
|
||||
nextURL = baseURL+"&page="+(page+1);
|
||||
{
|
||||
nextURL = baseURL + "&page=" + (page + 1);
|
||||
}
|
||||
if (page > 0)
|
||||
prevURL = baseURL+"&page="+(page-1);
|
||||
{
|
||||
prevURL = baseURL + "&page=" + (page - 1);
|
||||
}
|
||||
|
||||
search.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
|
||||
}
|
||||
|
@@ -225,12 +225,15 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
int groupID = parameters.getParameterAsInteger("groupID",-1);
|
||||
String currentName = URLDecode(parameters.getParameter("groupName",null));
|
||||
if (currentName == null || currentName.length() == 0)
|
||||
{
|
||||
currentName = FlowGroupUtils.getName(context, groupID);
|
||||
}
|
||||
|
||||
Group group = null;
|
||||
if (groupID >= 0)
|
||||
group = Group.find(context,groupID);
|
||||
|
||||
{
|
||||
group = Group.find(context, groupID);
|
||||
}
|
||||
|
||||
// Find the collection or community if applicable
|
||||
Collection collection = null;
|
||||
@@ -260,9 +263,11 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
for (String id : memberGroupIDsString.split(","))
|
||||
{
|
||||
if (id.length() > 0)
|
||||
{
|
||||
memberGroupIDs.add(Integer.valueOf(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get list of member epeople
|
||||
String memberEPeopleIDsString = parameters.getParameter("memberEPeopleIDs",null);
|
||||
@@ -337,7 +342,9 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
groupText.setHelp(T_label_instructions);
|
||||
}
|
||||
else if (errors.contains("group_name") || errors.contains("group_name_duplicate"))
|
||||
{
|
||||
groupText.addError("");
|
||||
}
|
||||
|
||||
|
||||
Para searchBoxes = actions.addPara();
|
||||
@@ -365,7 +372,9 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
|
||||
boolean changes = false;
|
||||
if (group != null)
|
||||
changes = addMemberList(main,group,memberGroupIDs,memberEPeopleIDs,highlightEPersonID,highlightGroupID);
|
||||
{
|
||||
changes = addMemberList(main, group, memberGroupIDs, memberEPeopleIDs, highlightEPersonID, highlightGroupID);
|
||||
}
|
||||
|
||||
|
||||
Para buttons = main.addPara();
|
||||
@@ -373,7 +382,9 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
buttons.addButton("submit_cancel").setValue(T_submit_cancel);
|
||||
|
||||
if (changes)
|
||||
{
|
||||
main.addPara().addHighlight("warn").addContent(T_pending_warn);
|
||||
}
|
||||
|
||||
|
||||
main.addHidden("administrative-continue").setValue(knot.getId());
|
||||
@@ -400,9 +411,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
|
||||
String nextURL = null, prevURL = null;
|
||||
if (page < (resultCount / RESULTS_PER_PAGE))
|
||||
nextURL = baseURL+"&page="+(page+1);
|
||||
{
|
||||
nextURL = baseURL + "&page=" + (page + 1);
|
||||
}
|
||||
if (page > 0)
|
||||
prevURL = baseURL+"&page="+(page-1);
|
||||
{
|
||||
prevURL = baseURL + "&page=" + (page - 1);
|
||||
}
|
||||
|
||||
results.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
|
||||
}
|
||||
@@ -477,9 +492,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
|
||||
String nextURL = null, prevURL = null;
|
||||
if (page < (resultCount / RESULTS_PER_PAGE))
|
||||
nextURL = baseURL+"&page="+(page+1);
|
||||
{
|
||||
nextURL = baseURL + "&page=" + (page + 1);
|
||||
}
|
||||
if (page > 0)
|
||||
prevURL = baseURL+"&page="+(page-1);
|
||||
{
|
||||
prevURL = baseURL + "&page=" + (page - 1);
|
||||
}
|
||||
|
||||
results.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
|
||||
}
|
||||
@@ -643,8 +662,10 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
for (Group group : parent.getMemberGroups())
|
||||
{
|
||||
if (!allMemberGroupIDs.contains(group.getID()))
|
||||
{
|
||||
allMemberGroupIDs.add(group.getID());
|
||||
}
|
||||
}
|
||||
// Sort them to a consistent ordering
|
||||
Collections.sort(allMemberGroupIDs);
|
||||
|
||||
@@ -658,8 +679,10 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
addMemberRow(table, group, highlight,pendingAddition,pendingRemoval);
|
||||
|
||||
if (pendingAddition || pendingRemoval)
|
||||
{
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get all members, pend or actual
|
||||
@@ -668,8 +691,10 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
for (EPerson eperson : parent.getMembers())
|
||||
{
|
||||
if (!allMemberEPeopleIDs.contains(eperson.getID()))
|
||||
{
|
||||
allMemberEPeopleIDs.add(eperson.getID());
|
||||
}
|
||||
}
|
||||
// Sort them to a consistent ordering
|
||||
Collections.sort(allMemberEPeopleIDs);
|
||||
|
||||
@@ -682,8 +707,10 @@ public class EditGroupForm extends AbstractDSpaceTransformer
|
||||
addMemberRow(table,eperson,highlight,pendingAddition,pendingRemoval);
|
||||
|
||||
if (pendingAddition || pendingRemoval)
|
||||
{
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (allMemberGroupIDs.size() <= 0 && allMemberEPeopleIDs.size() <= 0)
|
||||
{
|
||||
|
@@ -181,7 +181,9 @@ public class ManageGroupsMain extends AbstractDSpaceTransformer
|
||||
org.dspace.app.xmlui.wing.element.Item actionItem = actionsList.addItem();
|
||||
Text queryField = actionItem.addText("query");
|
||||
if (query != null)
|
||||
{
|
||||
queryField.setValue(query);
|
||||
}
|
||||
queryField.setHelp(T_search_help);
|
||||
actionItem.addButton("submit_search").setValue(T_go);
|
||||
|
||||
@@ -204,9 +206,13 @@ public class ManageGroupsMain extends AbstractDSpaceTransformer
|
||||
|
||||
String nextURL = null, prevURL = null;
|
||||
if (page < (resultCount / PAGE_SIZE))
|
||||
nextURL = baseURL+"&page="+(page+1);
|
||||
{
|
||||
nextURL = baseURL + "&page=" + (page + 1);
|
||||
}
|
||||
if (page > 0)
|
||||
prevURL = baseURL+"&page="+(page-1);
|
||||
{
|
||||
prevURL = baseURL + "&page=" + (page - 1);
|
||||
}
|
||||
|
||||
search.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
|
||||
}
|
||||
|
@@ -99,7 +99,9 @@ public class DeleteBitstreamsConfirm extends AbstractDSpaceTransformer
|
||||
String[] parts = id.split("/");
|
||||
|
||||
if (parts.length != 2)
|
||||
throw new UIException("Unable to parse id into bundle and bitstream id: "+id);
|
||||
{
|
||||
throw new UIException("Unable to parse id into bundle and bitstream id: " + id);
|
||||
}
|
||||
|
||||
int bitstreamID = Integer.valueOf(parts[1]);
|
||||
|
||||
@@ -125,7 +127,9 @@ public class DeleteBitstreamsConfirm extends AbstractDSpaceTransformer
|
||||
String format = null;
|
||||
BitstreamFormat bitstreamFormat = bitstream.getFormat();
|
||||
if (bitstreamFormat != null)
|
||||
{
|
||||
format = bitstreamFormat.getShortDescription();
|
||||
}
|
||||
|
||||
Row row = table.addRow();
|
||||
row.addCell().addContent(bitstream.getName());
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user