mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
[DS-707] Style / readability fixes
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5541 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -192,11 +192,15 @@ public class AuthenticationManager
|
||||
ret = AuthenticationMethod.NO_SUCH_USER;
|
||||
}
|
||||
if (ret == AuthenticationMethod.SUCCESS)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if (ret < bestRet)
|
||||
{
|
||||
bestRet = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bestRet;
|
||||
}
|
||||
|
||||
@@ -219,8 +223,12 @@ public class AuthenticationManager
|
||||
throws SQLException
|
||||
{
|
||||
for (int i = 0; i < methodStack.length; ++i)
|
||||
{
|
||||
if (methodStack[i].canSelfRegister(context, request, username))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -243,8 +251,12 @@ public class AuthenticationManager
|
||||
throws SQLException
|
||||
{
|
||||
for (int i = 0; i < methodStack.length; ++i)
|
||||
{
|
||||
if (methodStack[i].allowSetPassword(context, request, username))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -567,8 +567,10 @@ public class AuthorizeManager
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return policies;
|
||||
}
|
||||
@@ -613,8 +615,10 @@ public class AuthorizeManager
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return policies;
|
||||
}
|
||||
@@ -664,8 +668,10 @@ public class AuthorizeManager
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return policies;
|
||||
}
|
||||
@@ -883,8 +889,10 @@ public class AuthorizeManager
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Group[] groupArray = new Group[groups.size()];
|
||||
groupArray = groups.toArray(groupArray);
|
||||
|
@@ -157,10 +157,12 @@ public class BrowseConsumer implements Consumer
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Updated browse indices for Item id="
|
||||
+ String.valueOf(i.getID()) + ", hdl="
|
||||
+ i.getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Removed items are necessarily handled inline (ugh).
|
||||
|
||||
|
@@ -160,7 +160,9 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
array.add("CREATE INDEX " + table + "_item_id_idx ON " + table + "(item_id)");
|
||||
|
||||
if (value)
|
||||
{
|
||||
array.add("CREATE INDEX " + table + "_value_idx ON " + table + "(sort_value)");
|
||||
}
|
||||
|
||||
for (Integer i : sortCols)
|
||||
{
|
||||
@@ -253,8 +255,10 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
for (int i = 0; i < distinctIDs.length; i++)
|
||||
{
|
||||
if (!isFirstOccurrence(distinctIDs, i))
|
||||
{
|
||||
distinctIDs[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find all existing mappings for this item
|
||||
TableRowIterator tri = DatabaseManager.queryTable(context, table, "SELECT * FROM " + table + " WHERE item_id=?", itemID);
|
||||
@@ -282,9 +286,11 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
|
||||
// The item is no longer mapped to this community, so remove the database record
|
||||
if (!itemIsMapped)
|
||||
{
|
||||
DatabaseManager.delete(context, tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
tri.close();
|
||||
@@ -575,9 +581,11 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.dspace.browse.BrowseCreateDAO#updateCommunityMappings(int)
|
||||
@@ -593,8 +601,10 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
for (int i = 0; i < commID.length; i++)
|
||||
{
|
||||
if (!isFirstOccurrence(commID, i))
|
||||
{
|
||||
commID[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find all existing mappings for this item
|
||||
TableRowIterator tri = DatabaseManager.queryTable(context, "Communities2Item", "SELECT * FROM Communities2Item WHERE item_id=?", itemID);
|
||||
@@ -622,9 +632,11 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
|
||||
// The item is no longer mapped to this community, so remove the database record
|
||||
if (!itemIsMapped)
|
||||
{
|
||||
DatabaseManager.delete(context, tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
tri.close();
|
||||
@@ -727,7 +739,9 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
|
||||
// If the item does not exist in the table, return that it couldn't be found
|
||||
if (row == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Iterate through all the sort values
|
||||
for (Map.Entry<Integer, String> sortCol : sortCols.entrySet())
|
||||
@@ -740,7 +754,9 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
|
||||
// Check the column exists - if it doesn't, something has gone seriously wrong
|
||||
if (!row.hasColumn(column))
|
||||
{
|
||||
throw new BrowseException("Column '" + column + "' does not exist in table " + table);
|
||||
}
|
||||
|
||||
// Get the existing value from the column
|
||||
String oldValue = row.getStringColumn(column);
|
||||
@@ -760,8 +776,10 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
|
||||
// We've updated the row, so save it back to the database
|
||||
if (rowUpdated)
|
||||
{
|
||||
DatabaseManager.update(context, row);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.error("caught exception: ", e);
|
||||
@@ -970,8 +988,10 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Need to iterate the array as toArray will produce an array Integers,
|
||||
// not ints as we need.
|
||||
@@ -1009,8 +1029,10 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1026,14 +1048,18 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
private boolean isFirstOccurrence(int[] ids, int pos)
|
||||
{
|
||||
if (pos < 0 || pos >= ids.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int id = ids[pos];
|
||||
for (int i = 0; i < pos; i++)
|
||||
{
|
||||
if (id == ids[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -156,7 +156,9 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
array.add("CREATE INDEX " + table + "_item_id_idx ON " + table + "(item_id);");
|
||||
|
||||
if (value)
|
||||
{
|
||||
array.add("CREATE INDEX " + table + "_value_idx ON " + table + "(sort_value);");
|
||||
}
|
||||
|
||||
for (Integer i : sortCols)
|
||||
{
|
||||
@@ -250,8 +252,10 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
for (int i = 0; i < distinctIDs.length; i++)
|
||||
{
|
||||
if (!isFirstOccurrence(distinctIDs, i))
|
||||
{
|
||||
distinctIDs[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find all existing mappings for this item
|
||||
TableRowIterator tri = DatabaseManager.queryTable(context, table, "SELECT * FROM " + table + " WHERE item_id=?", itemID);
|
||||
@@ -279,9 +283,11 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
|
||||
// The item is no longer mapped to this community, so remove the database record
|
||||
if (!itemIsMapped)
|
||||
{
|
||||
DatabaseManager.delete(context, tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
tri.close();
|
||||
@@ -605,8 +611,10 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
for (int i = 0; i < commID.length; i++)
|
||||
{
|
||||
if (!isFirstOccurrence(commID, i))
|
||||
{
|
||||
commID[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find all existing mappings for this item
|
||||
TableRowIterator tri = DatabaseManager.queryTable(context, "Communities2Item", "SELECT * FROM Communities2Item WHERE item_id=?", itemID);
|
||||
@@ -634,9 +642,11 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
|
||||
// The item is no longer mapped to this community, so remove the database record
|
||||
if (!itemIsMapped)
|
||||
{
|
||||
DatabaseManager.delete(context, tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
tri.close();
|
||||
@@ -734,7 +744,9 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
|
||||
// If the item does not exist in the table, return that it couldn't be found
|
||||
if (row == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Iterate through all the sort values
|
||||
for (Map.Entry<Integer, String> sortCol : sortCols.entrySet())
|
||||
@@ -747,7 +759,9 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
|
||||
// Check the column exists - if it doesn't, something has gone seriously wrong
|
||||
if (!row.hasColumn(column))
|
||||
{
|
||||
throw new BrowseException("Column '" + column + "' does not exist in table " + table);
|
||||
}
|
||||
|
||||
// Get the existing value from the column
|
||||
String oldValue = row.getStringColumn(column);
|
||||
@@ -767,8 +781,10 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
|
||||
// We've updated the row, so save it back to the database
|
||||
if (rowUpdated)
|
||||
{
|
||||
DatabaseManager.update(context, row);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.error("caught exception: ", e);
|
||||
@@ -932,8 +948,10 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Need to iterate the array as toArray will produce an array Integers,
|
||||
// not ints as we need.
|
||||
@@ -971,8 +989,10 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -988,14 +1008,18 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
||||
private boolean isFirstOccurrence(int[] ids, int pos)
|
||||
{
|
||||
if (pos < 0 || pos >= ids.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int id = ids[pos];
|
||||
for (int i = 0; i < pos; i++)
|
||||
{
|
||||
if (id == ids[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -246,7 +246,9 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
TableRowIterator tri = null;
|
||||
|
||||
if (column == null || value == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -955,7 +957,9 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
if (tableMap != null)
|
||||
{
|
||||
if (tableDis != null)
|
||||
{
|
||||
queryBuf.append(" AND ");
|
||||
}
|
||||
|
||||
queryBuf.append(tableMap).append(".item_id=")
|
||||
.append(containerTable).append(".item_id AND ");
|
||||
@@ -983,14 +987,18 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
if (tableMap != null)
|
||||
{
|
||||
if (containerTable != null)
|
||||
{
|
||||
queryBuf.append(", ");
|
||||
}
|
||||
|
||||
queryBuf.append(tableMap);
|
||||
|
||||
if (tableDis != null)
|
||||
{
|
||||
queryBuf.append(", ").append(tableDis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a clause for counting results. Will return something of the form:
|
||||
@@ -1073,10 +1081,14 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
private void buildSelectStatement(StringBuffer queryBuf, List params) throws BrowseException
|
||||
{
|
||||
if (queryBuf.length() == 0)
|
||||
{
|
||||
throw new BrowseException("No arguments for SELECT statement");
|
||||
}
|
||||
|
||||
if (table == null || "".equals(table))
|
||||
{
|
||||
throw new BrowseException("No table for SELECT statement");
|
||||
}
|
||||
|
||||
// queryBuf already contains what we are selecting,
|
||||
// so insert the statement at the beginning
|
||||
|
@@ -252,7 +252,9 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
TableRowIterator tri = null;
|
||||
|
||||
if (column == null || value == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -959,7 +961,9 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
if (tableMap != null)
|
||||
{
|
||||
if (tableDis != null)
|
||||
{
|
||||
queryBuf.append(" AND ");
|
||||
}
|
||||
|
||||
queryBuf.append(tableMap).append(".item_id=")
|
||||
.append(containerTable).append(".item_id AND ");
|
||||
@@ -987,14 +991,18 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
if (tableMap != null)
|
||||
{
|
||||
if (containerTable != null)
|
||||
{
|
||||
queryBuf.append(", ");
|
||||
}
|
||||
|
||||
queryBuf.append(tableMap);
|
||||
|
||||
if (tableDis != null)
|
||||
{
|
||||
queryBuf.append(", ").append(tableDis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a clause for counting results. Will return something of the form:
|
||||
|
@@ -194,13 +194,19 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
|
||||
private String trunctateString(String value, int maxChars, String omissionMark)
|
||||
{
|
||||
if (value == null || maxChars < 1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (maxChars > value.length())
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (omissionMark != null && omissionMark.length() > 0)
|
||||
{
|
||||
return value.substring(0, maxChars - omissionMark.length()) + omissionMark;
|
||||
}
|
||||
|
||||
return value.substring(0, maxChars);
|
||||
}
|
||||
|
@@ -342,7 +342,9 @@ public class BrowseEngine
|
||||
// In this case, we will calculate a new offset for the last page of results
|
||||
offset = total - scope.getResultsPerPage();
|
||||
if (offset < 0)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
// And rerun the query
|
||||
dao.setOffset(offset);
|
||||
@@ -515,7 +517,9 @@ public class BrowseEngine
|
||||
// In this case, we will calculate a new offset for the last page of results
|
||||
offset = total - scope.getResultsPerPage();
|
||||
if (offset < 0)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
// And rerun the query
|
||||
dao.setOffset(offset);
|
||||
@@ -620,8 +624,10 @@ public class BrowseEngine
|
||||
if (so == null || so.getNumber() == 0)
|
||||
{
|
||||
if (browseIndex.getSortOption() != null)
|
||||
{
|
||||
so = browseIndex.getSortOption();
|
||||
}
|
||||
}
|
||||
|
||||
String col = "sort_1";
|
||||
if (so.getNumber() > 0)
|
||||
@@ -658,8 +664,10 @@ public class BrowseEngine
|
||||
if (so == null || so.getNumber() == 0)
|
||||
{
|
||||
if (browseIndex.getSortOption() != null)
|
||||
{
|
||||
so = browseIndex.getSortOption();
|
||||
}
|
||||
}
|
||||
|
||||
String col = "sort_1";
|
||||
if (so.getNumber() > 0)
|
||||
@@ -683,7 +691,9 @@ public class BrowseEngine
|
||||
throws BrowseException
|
||||
{
|
||||
if (!browseIndex.isMetadataIndex())
|
||||
{
|
||||
throw new IllegalArgumentException("getOffsetForDistinctValue called when not a metadata index");
|
||||
}
|
||||
|
||||
// now get the DAO to do the query for us, returning the highest
|
||||
// string value in the given column in the given table for the
|
||||
|
@@ -160,13 +160,19 @@ public class BrowseIndex
|
||||
datatype = matcher.group(4);
|
||||
|
||||
if (metadataAll != null)
|
||||
{
|
||||
metadata = metadataAll.split(",");
|
||||
}
|
||||
|
||||
if (metadata == null || metadata.length == 0)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (datatype == null || datatype.equals(""))
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
|
||||
// If an optional ordering configuration is supplied,
|
||||
// set the defaultOrder appropriately (asc or desc)
|
||||
@@ -174,8 +180,10 @@ public class BrowseIndex
|
||||
{
|
||||
String order = matcher.group(5);
|
||||
if (SortOption.DESCENDING.equalsIgnoreCase(order))
|
||||
{
|
||||
this.defaultOrder = SortOption.DESCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
tableBaseName = getItemBrowseIndex().tableBaseName;
|
||||
}
|
||||
@@ -186,11 +194,15 @@ public class BrowseIndex
|
||||
for (SortOption so : SortOption.getSortOptions())
|
||||
{
|
||||
if (so.getName().equals(sortName))
|
||||
{
|
||||
sortOption = so;
|
||||
}
|
||||
}
|
||||
|
||||
if (sortOption == null)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
|
||||
// If an optional ordering configuration is supplied,
|
||||
// set the defaultOrder appropriately (asc or desc)
|
||||
@@ -198,8 +210,10 @@ public class BrowseIndex
|
||||
{
|
||||
String order = matcher.group(4);
|
||||
if (SortOption.DESCENDING.equalsIgnoreCase(order))
|
||||
{
|
||||
this.defaultOrder = SortOption.DESCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
tableBaseName = getItemBrowseIndex().tableBaseName;
|
||||
}
|
||||
@@ -239,7 +253,9 @@ public class BrowseIndex
|
||||
public String getDataType()
|
||||
{
|
||||
if (sortOption != null)
|
||||
{
|
||||
return sortOption.getType();
|
||||
}
|
||||
|
||||
return datatype;
|
||||
}
|
||||
@@ -258,7 +274,9 @@ public class BrowseIndex
|
||||
public int getMetadataCount()
|
||||
{
|
||||
if (isMetadataIndex())
|
||||
{
|
||||
return metadata.length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -269,7 +287,9 @@ public class BrowseIndex
|
||||
public String[] getMdBits(int idx)
|
||||
{
|
||||
if (isMetadataIndex())
|
||||
{
|
||||
return mdBits[idx];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -345,7 +365,9 @@ public class BrowseIndex
|
||||
public String getSequenceName(boolean isDistinct, boolean isMap)
|
||||
{
|
||||
if (isDistinct || isMap)
|
||||
{
|
||||
return BrowseIndex.getSequenceName(number, isDistinct, isMap);
|
||||
}
|
||||
|
||||
return BrowseIndex.getSequenceName(tableBaseName, isDistinct, isMap);
|
||||
}
|
||||
@@ -454,7 +476,9 @@ public class BrowseIndex
|
||||
public String getTableName(boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
|
||||
{
|
||||
if (isDistinct || isMap)
|
||||
{
|
||||
return BrowseIndex.getTableName(number, isCommunity, isCollection, isDistinct, isMap);
|
||||
}
|
||||
|
||||
return BrowseIndex.getTableName(tableBaseName, isCommunity, isCollection, isDistinct, isMap);
|
||||
}
|
||||
@@ -706,8 +730,10 @@ public class BrowseIndex
|
||||
for (BrowseIndex bix : BrowseIndex.getBrowseIndices())
|
||||
{
|
||||
if (bix.getName().equals(name))
|
||||
{
|
||||
return bix;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -724,8 +750,10 @@ public class BrowseIndex
|
||||
for (BrowseIndex bix : BrowseIndex.getBrowseIndices())
|
||||
{
|
||||
if (bix.getSortOption() == so)
|
||||
{
|
||||
return bix;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -107,8 +107,10 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
BrowseItem[] bis = new BrowseItem[items.size()];
|
||||
return items.toArray(bis);
|
||||
@@ -160,8 +162,10 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
DCValue[] dcvs = new DCValue[values.size()];
|
||||
return values.toArray(dcvs);
|
||||
|
@@ -106,8 +106,10 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
BrowseItem[] bis = new BrowseItem[items.size()];
|
||||
return items.toArray(bis);
|
||||
@@ -159,8 +161,10 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
DCValue[] dcvs = new DCValue[values.size()];
|
||||
return values.toArray(dcvs);
|
||||
|
@@ -339,11 +339,15 @@ public class BrowserScope
|
||||
public String getOrder()
|
||||
{
|
||||
if (order != null)
|
||||
{
|
||||
return order;
|
||||
}
|
||||
|
||||
BrowseIndex bi = getBrowseIndex();
|
||||
if (bi != null)
|
||||
{
|
||||
return bi.getDefaultOrder();
|
||||
}
|
||||
|
||||
return SortOption.ASCENDING;
|
||||
}
|
||||
@@ -381,8 +385,10 @@ public class BrowserScope
|
||||
public void setResultsPerPage(int resultsPerPage)
|
||||
{
|
||||
if (resultsPerPage > -1)
|
||||
{
|
||||
this.resultsPerPage = resultsPerPage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the sortBy.
|
||||
@@ -466,12 +472,14 @@ public class BrowserScope
|
||||
for (SortOption so : SortOption.getSortOptions())
|
||||
{
|
||||
if (so.getNumber() == sortBy)
|
||||
{
|
||||
sortOption = so;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sortOption;
|
||||
}
|
||||
@@ -593,7 +601,9 @@ public class BrowserScope
|
||||
BrowseIndex bi = getBrowseIndex();
|
||||
|
||||
if (bi != null && SortOption.DESCENDING.equalsIgnoreCase(bi.getDefaultOrder()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -201,8 +201,10 @@ public class Bitstream extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Bitstream[] bitstreamArray = new Bitstream[bitstreams.size()];
|
||||
bitstreamArray = bitstreams.toArray(bitstreamArray);
|
||||
@@ -605,8 +607,10 @@ public class Bitstream extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return count == 1;
|
||||
}
|
||||
@@ -670,8 +674,10 @@ public class Bitstream 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);
|
||||
|
@@ -129,8 +129,10 @@ public class BitstreamFormat
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Cache ourselves
|
||||
context.cache(this, row.getIntColumn("bitstream_format_id"));
|
||||
@@ -209,7 +211,9 @@ public class BitstreamFormat
|
||||
mimeType);
|
||||
|
||||
if (formatRow == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return findByFinish(context, formatRow);
|
||||
}
|
||||
|
||||
@@ -334,8 +338,10 @@ public class BitstreamFormat
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Return the formats as an array
|
||||
BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()];
|
||||
@@ -392,8 +398,10 @@ public class BitstreamFormat
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Return the formats as an array
|
||||
BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()];
|
||||
@@ -633,7 +641,9 @@ public class BitstreamFormat
|
||||
BitstreamFormat unknown = findUnknown(bfContext);
|
||||
|
||||
if (unknown.getID() == getID())
|
||||
{
|
||||
throw new IllegalArgumentException("The Unknown bitstream format may not be deleted.");
|
||||
}
|
||||
|
||||
// Remove from cache
|
||||
bfContext.removeCached(this, getID());
|
||||
|
@@ -135,8 +135,10 @@ public class Bundle extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Cache ourselves
|
||||
context.cache(this, row.getIntColumn("bundle_id"));
|
||||
@@ -363,8 +365,10 @@ public class Bundle extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Item[] itemArray = new Item[items.size()];
|
||||
itemArray = (Item[]) items.toArray(itemArray);
|
||||
@@ -530,9 +534,11 @@ public class Bundle extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bundle metadata
|
||||
|
@@ -271,7 +271,9 @@ public class Collection extends DSpaceObject
|
||||
try
|
||||
{
|
||||
if(c!=null)
|
||||
{
|
||||
c.delete();
|
||||
}
|
||||
} catch(Exception e) { }
|
||||
|
||||
//pass exception on up the chain
|
||||
@@ -351,8 +353,10 @@ public class Collection 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);
|
||||
@@ -689,7 +693,9 @@ public class Collection extends DSpaceObject
|
||||
|
||||
// just return if there is no administrative group.
|
||||
if (submitters == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the link to the collection table.
|
||||
collectionRow.setColumnNull("submitter");
|
||||
@@ -763,7 +769,9 @@ public class Collection extends DSpaceObject
|
||||
|
||||
// just return if there is no administrative group.
|
||||
if (admins == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the link to the collection table.
|
||||
collectionRow.setColumnNull("admin");
|
||||
@@ -1128,8 +1136,10 @@ public class Collection extends DSpaceObject
|
||||
finally
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
items.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete bitstream logo
|
||||
setLogo(null);
|
||||
@@ -1262,8 +1272,10 @@ public class Collection 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);
|
||||
@@ -1293,7 +1305,10 @@ public class Collection extends DSpaceObject
|
||||
return false;
|
||||
}
|
||||
final Collection otherCollection = (Collection) other;
|
||||
if (this.getID() != otherCollection.getID()) return false;
|
||||
if (this.getID() != otherCollection.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -231,7 +231,9 @@ public class Community extends DSpaceObject
|
||||
try
|
||||
{
|
||||
if(c!=null)
|
||||
{
|
||||
c.delete();
|
||||
}
|
||||
} catch(Exception e) { }
|
||||
|
||||
//pass exception on up the chain
|
||||
@@ -257,7 +259,9 @@ public class Community extends DSpaceObject
|
||||
|
||||
// if creating a top-level Community, simulate an ADD event at the Site.
|
||||
if (parent == null)
|
||||
{
|
||||
context.addEvent(new Event(Event.ADD, Constants.SITE, Site.SITE_ID, Constants.COMMUNITY, c.getID(), c.handle));
|
||||
}
|
||||
|
||||
log.info(LogManager.getHeader(context, "create_community",
|
||||
"community_id=" + row.getIntColumn("community_id"))
|
||||
@@ -306,8 +310,10 @@ public class Community 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);
|
||||
@@ -359,8 +365,10 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
Community[] communityArray = new Community[topCommunities.size()];
|
||||
communityArray = (Community[]) topCommunities.toArray(communityArray);
|
||||
@@ -601,7 +609,9 @@ public class Community extends DSpaceObject
|
||||
|
||||
// just return if there is no administrative group.
|
||||
if (admins == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the link to the community table.
|
||||
communityRow.setColumnNull("admin");
|
||||
@@ -669,8 +679,10 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Put them in an array
|
||||
Collection[] collectionArray = new Collection[collections.size()];
|
||||
@@ -724,8 +736,10 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Put them in an array
|
||||
Community[] communityArray = new Community[subcommunities.size()];
|
||||
@@ -777,8 +791,10 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
|
||||
return parentCommunity;
|
||||
}
|
||||
@@ -879,9 +895,11 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new sub-community within this community.
|
||||
@@ -953,9 +971,11 @@ public class Community extends DSpaceObject
|
||||
{
|
||||
// close the TableRowIterator to free up resources
|
||||
if (tri != null)
|
||||
{
|
||||
tri.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a collection. Any items then orphaned are deleted.
|
||||
|
@@ -162,7 +162,9 @@ public class ChoiceAuthorityManager
|
||||
// field is expected to be "schema.element.qualifier"
|
||||
int dot = field.indexOf('.');
|
||||
if (dot < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String schema = field.substring(0, dot);
|
||||
String element = field.substring(dot+1);
|
||||
String qualifier = null;
|
||||
@@ -215,9 +217,11 @@ public class ChoiceAuthorityManager
|
||||
{
|
||||
ChoiceAuthority ma = controller.get(fieldKey);
|
||||
if (ma == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No choices plugin was configured for field \"" + fieldKey
|
||||
+ "\".");
|
||||
}
|
||||
return ma.getMatches(query, collection, start, limit, locale);
|
||||
}
|
||||
|
||||
@@ -237,9 +241,11 @@ public class ChoiceAuthorityManager
|
||||
{
|
||||
ChoiceAuthority ma = controller.get(fieldKey);
|
||||
if (ma == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No choices plugin was configured for field \"" + fieldKey
|
||||
+ "\".");
|
||||
}
|
||||
return ma.getBestMatch(query, collection, locale);
|
||||
}
|
||||
|
||||
@@ -261,7 +267,9 @@ public class ChoiceAuthorityManager
|
||||
{
|
||||
ChoiceAuthority ma = controller.get(fieldKey);
|
||||
if (ma == null)
|
||||
throw new IllegalArgumentException("No choices plugin was configured for field \""+fieldKey+"\".");
|
||||
{
|
||||
throw new IllegalArgumentException("No choices plugin was configured for field \"" + fieldKey + "\".");
|
||||
}
|
||||
return ma.getLabel(authKey, locale);
|
||||
}
|
||||
|
||||
|
@@ -190,10 +190,14 @@ public class Choices
|
||||
for (int i = 0; i < confidenceValue.length; ++i)
|
||||
{
|
||||
if (confidenceValue[i] == cv)
|
||||
{
|
||||
return confidenceText[i];
|
||||
}
|
||||
else if (confidenceValue[i] == CF_NOVALUE)
|
||||
{
|
||||
novalue = confidenceText[i];
|
||||
}
|
||||
}
|
||||
return novalue;
|
||||
}
|
||||
|
||||
@@ -223,8 +227,10 @@ public class Choices
|
||||
for (int i = 0; i < confidenceText.length; ++i)
|
||||
{
|
||||
if (confidenceText[i].equalsIgnoreCase(ct))
|
||||
{
|
||||
return confidenceValue[i];
|
||||
}
|
||||
}
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
@@ -60,9 +60,13 @@ public class ChoicesXMLGenerator
|
||||
{
|
||||
AttributesImpl resultAtts = new AttributesImpl();
|
||||
if (result.more)
|
||||
{
|
||||
resultAtts.addAttribute("", "more", "more", "boolean", "true");
|
||||
}
|
||||
if (result.isError())
|
||||
{
|
||||
resultAtts.addAttribute("", "error", "error", "boolean", "true");
|
||||
}
|
||||
resultAtts.addAttribute("", "start", "start", "int", String.valueOf(result.start));
|
||||
resultAtts.addAttribute("", "total", "total", "int", String.valueOf(result.total));
|
||||
|
||||
@@ -79,7 +83,9 @@ public class ChoicesXMLGenerator
|
||||
va.addAttribute("", "authority", "authority", "string", mdav.authority == null ? "":mdav.authority);
|
||||
va.addAttribute("", "value", "value", "string", mdav.value);
|
||||
if (result.defaultSelected == i)
|
||||
{
|
||||
va.addAttribute("", "selected", "selected", "boolean", "");
|
||||
}
|
||||
contentHandler.startElement(NS_URI, NS_NAME, "option", va);
|
||||
contentHandler.characters(mdav.label.toCharArray(), 0, mdav.label.length());
|
||||
contentHandler.endElement(NS_URI, NS_NAME, "option");
|
||||
@@ -101,7 +107,9 @@ public class ChoicesXMLGenerator
|
||||
AttributesImpl va = new AttributesImpl();
|
||||
va.addAttribute("", "authority", "authority", "string", mdav.authority == null ? "":mdav.authority);
|
||||
if (result.defaultSelected == i)
|
||||
{
|
||||
va.addAttribute("", "selected", "selected", "boolean", "");
|
||||
}
|
||||
contentHandler.startElement(NS_URI, NS_NAME, "li", va);
|
||||
contentHandler.startElement(NS_URI, NS_NAME, "span", classLabel);
|
||||
contentHandler.characters(mdav.label.toCharArray(), 0, mdav.label.length());
|
||||
@@ -125,7 +133,9 @@ public class ChoicesXMLGenerator
|
||||
va.addAttribute("", "authority", "authority", "string", mdav.authority == null ? "":mdav.authority);
|
||||
va.addAttribute("", "value", "value", "string", mdav.value);
|
||||
if (result.defaultSelected == i)
|
||||
{
|
||||
va.addAttribute("", "selected", "selected", "boolean", "");
|
||||
}
|
||||
contentHandler.startElement(NS_URI, NS_NAME, "Choice", va);
|
||||
contentHandler.characters(mdav.label.toCharArray(), 0, mdav.label.length());
|
||||
contentHandler.endElement(NS_URI, NS_NAME, "Choice");
|
||||
|
@@ -229,12 +229,16 @@ public class AIPTechMDCrosswalk
|
||||
Item item = (Item)dso;
|
||||
EPerson is = item.getSubmitter();
|
||||
if (is != null)
|
||||
{
|
||||
dc.add(makeDC("creator", null, is.getEmail()));
|
||||
}
|
||||
dc.add(makeDC("identifier", "uri", "hdl:" + item.getHandle()));
|
||||
Collection owningColl = item.getOwningCollection();
|
||||
String owner = owningColl.getHandle();
|
||||
if (owner != null)
|
||||
dc.add(makeDC("relation", "isPartOf", "hdl:"+owner));
|
||||
{
|
||||
dc.add(makeDC("relation", "isPartOf", "hdl:" + owner));
|
||||
}
|
||||
Collection inColl[] = item.getCollections();
|
||||
for (int i = 0; i < inColl.length; ++i)
|
||||
{
|
||||
@@ -242,27 +246,39 @@ public class AIPTechMDCrosswalk
|
||||
{
|
||||
String h = inColl[i].getHandle();
|
||||
if (h != null)
|
||||
dc.add(makeDC("relation", "isReferencedBy", "hdl:"+h));
|
||||
{
|
||||
dc.add(makeDC("relation", "isReferencedBy", "hdl:" + h));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.isWithdrawn())
|
||||
{
|
||||
dc.add(makeDC("rights", "accessRights", "WITHDRAWN"));
|
||||
}
|
||||
}
|
||||
else if (dso.getType() == Constants.BITSTREAM)
|
||||
{
|
||||
Bitstream bitstream = (Bitstream)dso;
|
||||
String bsName = bitstream.getName();
|
||||
if (bsName != null)
|
||||
{
|
||||
dc.add(makeDC("title", null, bsName));
|
||||
}
|
||||
String bsSource = bitstream.getSource();
|
||||
if (bsSource != null)
|
||||
{
|
||||
dc.add(makeDC("title", "alternative", bsSource));
|
||||
}
|
||||
String bsDesc = bitstream.getDescription();
|
||||
if (bsDesc != null)
|
||||
{
|
||||
dc.add(makeDC("description", null, bsDesc));
|
||||
}
|
||||
String bsUfmt = bitstream.getUserFormatDescription();
|
||||
if (bsUfmt != null)
|
||||
{
|
||||
dc.add(makeDC("format", null, bsUfmt));
|
||||
}
|
||||
BitstreamFormat bsf = bitstream.getFormat();
|
||||
dc.add(makeDC("format", "medium", bsf.getShortDescription()));
|
||||
dc.add(makeDC("format", "mimetype", bsf.getMIMEType()));
|
||||
@@ -276,14 +292,18 @@ public class AIPTechMDCrosswalk
|
||||
Community owners[] = collection.getCommunities();
|
||||
String ownerHdl = owners[0].getHandle();
|
||||
if (ownerHdl != null)
|
||||
{
|
||||
dc.add(makeDC("relation", "isPartOf", "hdl:" + ownerHdl));
|
||||
}
|
||||
for (int i = 1; i < owners.length; ++i)
|
||||
{
|
||||
String h = owners[i].getHandle();
|
||||
if (h != null)
|
||||
{
|
||||
dc.add(makeDC("relation", "isReferencedBy", "hdl:" + h));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dso.getType() == Constants.COMMUNITY)
|
||||
{
|
||||
Community community = (Community)dso;
|
||||
@@ -291,12 +311,19 @@ public class AIPTechMDCrosswalk
|
||||
Community owner = community.getParentCommunity();
|
||||
String ownerHdl = null;
|
||||
if (owner == null)
|
||||
{
|
||||
ownerHdl = Site.getSiteHandle();
|
||||
}
|
||||
else
|
||||
{
|
||||
ownerHdl = owner.getHandle();
|
||||
}
|
||||
|
||||
if (ownerHdl != null)
|
||||
{
|
||||
dc.add(makeDC("relation", "isPartOf", "hdl:" + ownerHdl));
|
||||
}
|
||||
}
|
||||
else if (dso.getType() == Constants.SITE)
|
||||
{
|
||||
Site site = (Site) dso;
|
||||
@@ -368,7 +395,9 @@ public class AIPTechMDCrosswalk
|
||||
String dcField = field.getAttributeValue("element");
|
||||
String qualifier = field.getAttributeValue("qualifier");
|
||||
if (qualifier != null)
|
||||
dcField += "."+qualifier;
|
||||
{
|
||||
dcField += "." + qualifier;
|
||||
}
|
||||
String value = field.getText();
|
||||
|
||||
if (type == Constants.BITSTREAM)
|
||||
@@ -441,14 +470,18 @@ public class AIPTechMDCrosswalk
|
||||
log.warn("Ignoring unknown Submitter="+value+" in AIP Tech MD, no matching EPerson and 'mets.dspaceAIP.ingest.createSubmitter' is false in dspace.cfg.");
|
||||
}
|
||||
if (sub != null)
|
||||
{
|
||||
item.setSubmitter(sub);
|
||||
}
|
||||
}
|
||||
else if (dcField.equals("rights.accessRights"))
|
||||
{
|
||||
//check if item is withdrawn
|
||||
if (value.equalsIgnoreCase("WITHDRAWN"))
|
||||
{
|
||||
item.withdraw();
|
||||
}
|
||||
}
|
||||
else if(dcField.equals("identifier.uri") ||
|
||||
dcField.equals("relation.isPartOf"))
|
||||
{
|
||||
@@ -464,14 +497,14 @@ public class AIPTechMDCrosswalk
|
||||
// These get connected when collections are re-mapped.
|
||||
}
|
||||
else
|
||||
log.warn("Got unrecognized DC field for Item: "+dcField);
|
||||
{
|
||||
log.warn("Got unrecognized DC field for Item: " + dcField);
|
||||
}
|
||||
|
||||
}
|
||||
else if (type == Constants.COMMUNITY ||
|
||||
type == Constants.COLLECTION)
|
||||
else if (type == Constants.COMMUNITY || type == Constants.COLLECTION)
|
||||
{
|
||||
if (dcField.equals("identifier.uri") ||
|
||||
dcField.equals("relation.isPartOf"))
|
||||
if (dcField.equals("identifier.uri") || dcField.equals("relation.isPartOf"))
|
||||
{
|
||||
// Ignore identifier.uri (which specifies object handle)
|
||||
// and relation.isPartOf (which specifies primary parent object)
|
||||
@@ -485,11 +518,15 @@ public class AIPTechMDCrosswalk
|
||||
// These get connected when collections are re-mapped.
|
||||
}
|
||||
else
|
||||
log.warn("Got unrecognized DC field for Collection/Community: "+dcField);
|
||||
{
|
||||
log.warn("Got unrecognized DC field for Collection/Community: " + dcField);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
log.warn("Skipping DIM field with mdschema=\""+schema+"\".");
|
||||
{
|
||||
log.warn("Skipping DIM field with mdschema=\"" + schema + "\".");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -505,16 +542,22 @@ public class AIPTechMDCrosswalk
|
||||
{
|
||||
BitstreamFormat bsf = BitstreamFormat.findByShortDescription(context, bsfShortName);
|
||||
if (bsf == null && bsfMIMEType != null)
|
||||
{
|
||||
bsf = PackageUtils.findOrCreateBitstreamFormat(context,
|
||||
bsfShortName,
|
||||
bsfMIMEType,
|
||||
bsfShortName,
|
||||
bsfSupport,
|
||||
bsfInternal);
|
||||
}
|
||||
if (bsf != null)
|
||||
((Bitstream)dso).setFormat(bsf);
|
||||
{
|
||||
((Bitstream) dso).setFormat(bsf);
|
||||
}
|
||||
else
|
||||
log.warn("Failed to find or create bitstream format named \""+bsfShortName+"\"");
|
||||
{
|
||||
log.warn("Failed to find or create bitstream format named \"" + bsfShortName + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -292,7 +292,9 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
long lmTime = 0;
|
||||
if (dso.getType() == Constants.ITEM)
|
||||
lmTime = ((Item)dso).getLastModified().getTime();
|
||||
{
|
||||
lmTime = ((Item) dso).getLastModified().getTime();
|
||||
}
|
||||
|
||||
// map of extra streams to put in Zip (these are located during makeManifest())
|
||||
MdStreamCache extraStreams = new MdStreamCache();
|
||||
@@ -325,7 +327,9 @@ public abstract class AbstractMETSDisseminator
|
||||
// link up this 'mdRef' to point to that file
|
||||
ref.setXlinkHref(fname);
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Writing EXTRA stream to Zip: "+fname);
|
||||
{
|
||||
log.debug("Writing EXTRA stream to Zip: " + fname);
|
||||
}
|
||||
//actually add the file to the Zip package
|
||||
ZipEntry ze = new ZipEntry(fname);
|
||||
if (lmTime != 0)
|
||||
@@ -414,8 +418,9 @@ public abstract class AbstractMETSDisseminator
|
||||
String zname = makeBitstreamURL(bitstreams[k], params);
|
||||
ZipEntry ze = new ZipEntry(zname);
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Writing CONTENT stream of bitstream("+String.valueOf(bitstreams[k].getID())+") to Zip: "+zname+
|
||||
", size="+String.valueOf(bitstreams[k].getSize()));
|
||||
{
|
||||
log.debug(new StringBuilder().append("Writing CONTENT stream of bitstream(").append(bitstreams[k].getID()).append(") to Zip: ").append(zname).append(", size=").append(bitstreams[k].getSize()).toString());
|
||||
}
|
||||
if (lmTime != 0)
|
||||
ze.setTime(lmTime);
|
||||
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
|
||||
@@ -454,7 +459,9 @@ public abstract class AbstractMETSDisseminator
|
||||
String zname = makeBitstreamURL(logoBs, params);
|
||||
ZipEntry ze = new ZipEntry(zname);
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Writing CONTENT stream of bitstream("+String.valueOf(logoBs.getID())+") to Zip: "+zname+", size="+String.valueOf(logoBs.getSize()));
|
||||
{
|
||||
log.debug("Writing CONTENT stream of bitstream(" + String.valueOf(logoBs.getID()) + ") to Zip: " + zname + ", size=" + String.valueOf(logoBs.getSize()));
|
||||
}
|
||||
ze.setSize(logoBs.getSize());
|
||||
//Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
|
||||
ze.setTime(DEFAULT_MODIFIED_DATE);
|
||||
@@ -673,9 +680,11 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
MdSec md = makeMdSec(context, dso, mdSecClass, mdTypes[i], params, extraStreams);
|
||||
if (md != null)
|
||||
{
|
||||
fAmdSec.getContent().add(md);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create amdSec for any tech md's, return its ID attribute.
|
||||
protected String addAmdSec(Context context, DSpaceObject dso, PackageParameters params,
|
||||
@@ -735,7 +744,9 @@ public abstract class AbstractMETSDisseminator
|
||||
|
||||
String identifier = "DB-ID-" + dso.getID();
|
||||
if(dso.getHandle()!=null)
|
||||
{
|
||||
identifier = dso.getHandle().replace('/', '-');
|
||||
}
|
||||
|
||||
// this ID should be globally unique (format: DSpace_[objType]_[handle with slash replaced with a dash])
|
||||
mets.setID("DSpace_" + Constants.typeText[dso.getType()] + "_" + identifier);
|
||||
@@ -750,7 +761,9 @@ public abstract class AbstractMETSDisseminator
|
||||
|
||||
MetsHdr metsHdr = makeMetsHdr(context, dso, params);
|
||||
if (metsHdr != null)
|
||||
{
|
||||
mets.getContent().add(metsHdr);
|
||||
}
|
||||
|
||||
// add DMD sections
|
||||
// Each type element MAY be either just a MODS-and-crosswalk name, OR
|
||||
@@ -807,7 +820,9 @@ public abstract class AbstractMETSDisseminator
|
||||
for (int i = 0; i < bundles.length; i++)
|
||||
{
|
||||
if (!includeBundle(bundles[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// unauthorized bundle?
|
||||
// NOTE: This must match the logic in disseminate()
|
||||
@@ -827,12 +842,16 @@ public abstract class AbstractMETSDisseminator
|
||||
FileGrp fileGrp = new FileGrp();
|
||||
String bName = bundles[i].getName();
|
||||
if ((bName != null) && !bName.equals(""))
|
||||
{
|
||||
fileGrp.setUSE(bundleToFileGrp(bName));
|
||||
}
|
||||
|
||||
// add technical metadata for a bundle
|
||||
String techBundID = addAmdSec(context, bundles[i], params, mets, extraStreams);
|
||||
if (techBundID != null)
|
||||
{
|
||||
fileGrp.setADMID(techBundID);
|
||||
}
|
||||
|
||||
// watch for primary bitstream
|
||||
int primaryBitstreamID = -1;
|
||||
@@ -856,9 +875,13 @@ public abstract class AbstractMETSDisseminator
|
||||
if (!auth)
|
||||
{
|
||||
if (unauth != null && unauth.equalsIgnoreCase("skip"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (!(unauth != null && unauth.equalsIgnoreCase("zero")))
|
||||
throw new AuthorizeException("Not authorized to read Bitstream, SID="+String.valueOf(bitstreams[bits].getSequenceID()));
|
||||
{
|
||||
throw new AuthorizeException("Not authorized to read Bitstream, SID=" + String.valueOf(bitstreams[bits].getSequenceID()));
|
||||
}
|
||||
}
|
||||
|
||||
String sid = String.valueOf(bitstreams[bits].getSequenceID());
|
||||
@@ -878,7 +901,9 @@ public abstract class AbstractMETSDisseminator
|
||||
|
||||
// if this is content, add to structmap too:
|
||||
if (isContentBundle)
|
||||
{
|
||||
div0.getContent().add(makeFileDiv(fileID, getObjectTypeString(bitstreams[bits])));
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're in THUMBNAIL or TEXT bundles, the bitstream is
|
||||
@@ -929,8 +954,10 @@ public abstract class AbstractMETSDisseminator
|
||||
// technical metadata for bitstream
|
||||
String techID = addAmdSec(context, bitstreams[bits], params, mets, extraStreams);
|
||||
if (techID != null)
|
||||
{
|
||||
file.setADMID(techID);
|
||||
}
|
||||
}
|
||||
fileSec.getContent().add(fileGrp);
|
||||
}
|
||||
}
|
||||
@@ -943,8 +970,10 @@ public abstract class AbstractMETSDisseminator
|
||||
Item item = ii.next();
|
||||
Div childDiv = makeChildDiv(getObjectTypeString(item), item, params);
|
||||
if(childDiv!=null)
|
||||
{
|
||||
div0.getContent().add(childDiv);
|
||||
}
|
||||
}
|
||||
Bitstream logoBs = ((Collection)dso).getLogo();
|
||||
if (logoBs != null)
|
||||
{
|
||||
@@ -962,8 +991,10 @@ public abstract class AbstractMETSDisseminator
|
||||
//add a child <div> for each subcommunity in this community
|
||||
Div childDiv = makeChildDiv(getObjectTypeString(subcomms[i]), subcomms[i], params);
|
||||
if(childDiv!=null)
|
||||
{
|
||||
div0.getContent().add(childDiv);
|
||||
}
|
||||
}
|
||||
// Collections are also directly under "DSpace Object Contents" <div>,
|
||||
// but are labeled as Collections.
|
||||
Collection colls[] = ((Community)dso).getCollections();
|
||||
@@ -972,8 +1003,10 @@ public abstract class AbstractMETSDisseminator
|
||||
//add a child <div> for each collection in this community
|
||||
Div childDiv = makeChildDiv(getObjectTypeString(colls[i]), colls[i], params);
|
||||
if(childDiv!=null)
|
||||
{
|
||||
div0.getContent().add(childDiv);
|
||||
}
|
||||
}
|
||||
//add Community logo bitstream
|
||||
Bitstream logoBs = ((Community)dso).getLogo();
|
||||
if (logoBs != null)
|
||||
@@ -993,21 +1026,30 @@ public abstract class AbstractMETSDisseminator
|
||||
Div childDiv = makeChildDiv(getObjectTypeString(comms[i]),
|
||||
comms[i], params);
|
||||
if(childDiv!=null)
|
||||
{
|
||||
div0.getContent().add(childDiv);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fileSec != null)
|
||||
{
|
||||
mets.getContent().add(fileSec);
|
||||
}
|
||||
mets.getContent().add(structMap);
|
||||
|
||||
// set links to metadata for object -- after type-specific
|
||||
// code since that can add to the object metadata.
|
||||
StringBuilder dmdIds = new StringBuilder();
|
||||
for (int i = 0; i < dmdId.length; ++i)
|
||||
dmdIds.append(" ").append(dmdId[i]);
|
||||
for (String currdmdId : dmdId)
|
||||
{
|
||||
dmdIds.append(" ").append(currdmdId);
|
||||
}
|
||||
|
||||
div0.setDMDID(dmdIds.substring(1));
|
||||
if (objectAMDID != null)
|
||||
{
|
||||
div0.setADMID(objectAMDID);
|
||||
}
|
||||
|
||||
// Does subclass have something to add to structMap?
|
||||
addStructMap(context, dso, params, mets);
|
||||
@@ -1134,7 +1176,9 @@ public abstract class AbstractMETSDisseminator
|
||||
protected String getHandleURN(String handle)
|
||||
{
|
||||
if (handle.startsWith("hdl:"))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
return "hdl:"+handle;
|
||||
}
|
||||
|
||||
@@ -1211,14 +1255,18 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
List res = xwalk.disseminateList(dso);
|
||||
if (!(res == null || res.isEmpty()))
|
||||
{
|
||||
pXML = new PreformedXML(outputter.outputString(res));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Element res = xwalk.disseminateElement(dso);
|
||||
if (res != null)
|
||||
{
|
||||
pXML = new PreformedXML(outputter.outputString(res));
|
||||
}
|
||||
}
|
||||
if (pXML != null)
|
||||
{
|
||||
me.getContent().add(pXML);
|
||||
@@ -1230,7 +1278,9 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
// ignore this xwalk if object is unsupported.
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Skipping MDsec because of CrosswalkObjectNotSupported: dso="+dso.toString()+", xwalk="+xwalk.getClass().getName());
|
||||
{
|
||||
log.debug("Skipping MDsec because of CrosswalkObjectNotSupported: dso=" + dso.toString() + ", xwalk=" + xwalk.getClass().getName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -168,8 +168,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
{
|
||||
String path = METSManifest.getFileName(mdref);
|
||||
if (packageFile == null)
|
||||
{
|
||||
throw new MetadataValidationException(
|
||||
"Failed referencing mdRef element, because there is no package specified.");
|
||||
}
|
||||
|
||||
// Use the 'getFileInputStream()' method from the
|
||||
// AbstractMETSIngester to retrieve the inputstream for the
|
||||
@@ -231,10 +233,12 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// must have a METS Manifest to ingest anything
|
||||
if (manifest == null)
|
||||
{
|
||||
throw new PackageValidationException(
|
||||
"No METS Manifest found (filename="
|
||||
+ METSManifest.MANIFEST_FILE
|
||||
+ "). Package is unacceptable!");
|
||||
}
|
||||
|
||||
// validate our manifest
|
||||
checkManifest(manifest);
|
||||
@@ -265,7 +269,9 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
// (restore previously existing obj)
|
||||
String action = "package_ingest";
|
||||
if (params.restoreModeEnabled())
|
||||
{
|
||||
action = "package_restore";
|
||||
}
|
||||
log.info(LogManager.getHeader(context, action,
|
||||
"Created new Object, type="
|
||||
+ Constants.typeText[dso.getType()] + ", handle="
|
||||
@@ -465,8 +471,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// Get the collection this workflow item belongs to
|
||||
if (wfi != null)
|
||||
{
|
||||
collection = wfi.getCollection();
|
||||
}
|
||||
}
|
||||
|
||||
// save manifest as a bitstream in Item if desired
|
||||
if (preserveManifest())
|
||||
@@ -506,7 +514,9 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// For Items, also sanity-check the metadata for minimum requirements.
|
||||
if (type == Constants.ITEM)
|
||||
{
|
||||
PackageUtils.checkItemMetadata((Item) dso);
|
||||
}
|
||||
|
||||
// -- Step 6 --
|
||||
// Finish things up!
|
||||
@@ -569,9 +579,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Object to be replaced (handle=" + dso.getHandle()
|
||||
+ ") is " + Constants.typeText[dso.getType()] + " id="
|
||||
+ dso.getID());
|
||||
}
|
||||
|
||||
// -- Step 2 --
|
||||
// Clear out current object (as we are replacing all its contents &
|
||||
@@ -649,7 +661,9 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// For Items, also sanity-check the metadata for minimum requirements.
|
||||
if (dso.getType() == Constants.ITEM)
|
||||
{
|
||||
PackageUtils.checkItemMetadata((Item) dso);
|
||||
}
|
||||
|
||||
// -- Step 6 --
|
||||
// Finish things up!
|
||||
@@ -701,9 +715,9 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
{
|
||||
primaryID = primaryFile.getAttributeValue("ID");
|
||||
if (log.isDebugEnabled())
|
||||
log
|
||||
.debug("Got primary bitstream file ID=\"" + primaryID
|
||||
+ "\"");
|
||||
{
|
||||
log.debug("Got primary bitstream file ID=\"" + primaryID + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2 -- find list of all content files from manifest
|
||||
@@ -722,8 +736,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
// basic validation -- check that it has an ID attribute
|
||||
String mfileID = mfile.getAttributeValue("ID");
|
||||
if (mfileID == null)
|
||||
{
|
||||
throw new PackageValidationException(
|
||||
"Invalid METS Manifest: file element without ID attribute.");
|
||||
}
|
||||
|
||||
// retrieve path/name of file in manifest
|
||||
String path = METSManifest.getFileName(mfile);
|
||||
@@ -771,13 +787,17 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
if (bitstream.getFormat().equals(unknownFormat))
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Guessing format of Bitstream left un-set: "
|
||||
+ bitstream.toString());
|
||||
}
|
||||
String mimeType = mfile.getAttributeValue("MIMETYPE");
|
||||
BitstreamFormat bf = (mimeType == null) ? null
|
||||
: BitstreamFormat.findByMIMEType(context, mimeType);
|
||||
if (bf == null)
|
||||
{
|
||||
bf = FormatIdentifier.guessFormat(context, bitstream);
|
||||
}
|
||||
bitstream.setFormat(bf);
|
||||
}
|
||||
bitstream.update();
|
||||
@@ -786,10 +806,12 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
// Step 3 -- Sanity checks
|
||||
// sanity check for primary bitstream
|
||||
if (primaryID != null && !setPrimaryBitstream)
|
||||
{
|
||||
log.warn("Could not find primary bitstream file ID=\"" + primaryID
|
||||
+ "\" in manifest file \"" + pkgFile.getAbsolutePath()
|
||||
+ "\"");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save/Preserve the METS Manifest as a Bitstream attached to the given
|
||||
@@ -822,9 +844,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
// Get magic bitstream format to identify manifest.
|
||||
String fmtName = getManifestBitstreamFormat();
|
||||
if (fmtName == null)
|
||||
{
|
||||
throw new PackageValidationException(
|
||||
"Configuration Error: No Manifest BitstreamFormat configured for METS ingester type="
|
||||
+ getConfigurationName());
|
||||
}
|
||||
BitstreamFormat manifestFormat = PackageUtils
|
||||
.findOrCreateBitstreamFormat(context, fmtName,
|
||||
"application/xml", fmtName + " package manifest");
|
||||
@@ -944,10 +968,12 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// must have a METS Manifest to replace anything
|
||||
if (manifest == null)
|
||||
{
|
||||
throw new PackageValidationException(
|
||||
"No METS Manifest found (filename="
|
||||
+ METSManifest.MANIFEST_FILE
|
||||
+ "). Package is unacceptable!");
|
||||
}
|
||||
|
||||
// It's possible that the object to replace will be passed in as
|
||||
// null. Let's determine the handle of the object to replace.
|
||||
@@ -993,11 +1019,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
{
|
||||
parent = HandleManager.resolveToObject(context, parentLink);
|
||||
if (parent == null)
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"Could not find a parent DSpaceObject referenced as '"
|
||||
+ parentLink
|
||||
+ "' in the METS Manifest. A valid parent DSpaceObject must be specified in the METS Manifest itself.");
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new UnsupportedOperationException(
|
||||
"Could not find a parent DSpaceObject where we can ingest this package. A valid parent DSpaceObject must be specified in the METS Manifest itself.");
|
||||
@@ -1111,8 +1139,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
throws AuthorizeException, SQLException, IOException
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Removing object " + Constants.typeText[dso.getType()]
|
||||
+ " id=" + dso.getID());
|
||||
}
|
||||
|
||||
switch (dso.getType())
|
||||
{
|
||||
@@ -1202,11 +1232,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
{
|
||||
parent = HandleManager.resolveToObject(context, parentLink);
|
||||
if (parent == null)
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"Could not find a parent DSpaceObject references as '"
|
||||
+ parentLink
|
||||
+ "' in the METS Manifest. A parent DSpaceObject must be specified from either the 'packager' command or noted in the METS Manifest itself.");
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new UnsupportedOperationException(
|
||||
"Could not find a parent DSpaceObject where we can ingest this package. A parent DSpaceObject must be specified from either the 'packager' command or noted in the METS Manifest itself.");
|
||||
|
@@ -110,7 +110,10 @@ public abstract class AbstractPackageDisseminator
|
||||
AuthorizeException, SQLException, IOException
|
||||
{
|
||||
//If unset, make sure the Parameters specifies this is a recursive dissemination
|
||||
if(!params.recursiveModeEnabled()) params.setRecursiveModeEnabled(true);
|
||||
if(!params.recursiveModeEnabled())
|
||||
{
|
||||
params.setRecursiveModeEnabled(true);
|
||||
}
|
||||
|
||||
//try to disseminate the first object using provided PackageDisseminator
|
||||
disseminate(context, dso, params, pkgFile);
|
||||
@@ -125,7 +128,10 @@ public abstract class AbstractPackageDisseminator
|
||||
//Determine where first file package was disseminated to, as all
|
||||
//others will be written to same directory
|
||||
String pkgDirectory = pkgFile.getCanonicalFile().getParent();
|
||||
if(!pkgDirectory.endsWith(File.separator)) pkgDirectory += File.separator;
|
||||
if(!pkgDirectory.endsWith(File.separator))
|
||||
{
|
||||
pkgDirectory += File.separator;
|
||||
}
|
||||
String fileExtension = PackageUtils.getFileExtension(pkgFile.getName());
|
||||
|
||||
//recursively disseminate content, based on object type
|
||||
|
@@ -135,7 +135,10 @@ public abstract class AbstractPackageIngester
|
||||
SQLException, IOException
|
||||
{
|
||||
//If unset, make sure the Parameters specifies this is a recursive ingest
|
||||
if(!params.recursiveModeEnabled()) params.setRecursiveModeEnabled(true);
|
||||
if(!params.recursiveModeEnabled())
|
||||
{
|
||||
params.setRecursiveModeEnabled(true);
|
||||
}
|
||||
|
||||
//Initial DSpace Object to ingest
|
||||
DSpaceObject dso = null;
|
||||
@@ -197,9 +200,11 @@ public abstract class AbstractPackageIngester
|
||||
Item childItem = (Item)dsoIngestedList.get(oldSize);
|
||||
Collection collection = (Collection)dso;
|
||||
if (!childItem.isIn(collection))
|
||||
{
|
||||
collection.addItem(childItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end if child pkgs
|
||||
}//end if not an Item
|
||||
}//end if DSpaceObject not null
|
||||
@@ -249,7 +254,10 @@ public abstract class AbstractPackageIngester
|
||||
SQLException, IOException
|
||||
{
|
||||
//If unset, make sure the Parameters specifies this is a recursive replace
|
||||
if(!params.recursiveModeEnabled()) params.setRecursiveModeEnabled(true);
|
||||
if(!params.recursiveModeEnabled())
|
||||
{
|
||||
params.setRecursiveModeEnabled(true);
|
||||
}
|
||||
|
||||
//actually ingest pkg using provided PackageIngester, and replace object
|
||||
//NOTE: 'dso' may be null! If it is null, the PackageIngester must determine
|
||||
@@ -294,9 +302,11 @@ public abstract class AbstractPackageIngester
|
||||
Item childItem = (Item)dsoIngestedList.get(oldSize);
|
||||
Collection collection = (Collection)replacedDso;
|
||||
if (!childItem.isIn(collection))
|
||||
{
|
||||
collection.addItem(childItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end if child pkgs
|
||||
}//end if not an Item
|
||||
|
||||
|
@@ -284,10 +284,26 @@ public class ConfigurationManager
|
||||
finally
|
||||
{
|
||||
if (br != null)
|
||||
try { br.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
br.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (fr != null)
|
||||
try { fr.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
fr.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return license;
|
||||
@@ -358,7 +374,9 @@ public class ConfigurationManager
|
||||
public static Enumeration<?> propertyNames()
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
loadConfig(null);
|
||||
}
|
||||
|
||||
return properties.propertyNames();
|
||||
}
|
||||
@@ -431,7 +449,9 @@ public class ConfigurationManager
|
||||
email.setContent(contentBuffer.toString());
|
||||
|
||||
if (charset != null)
|
||||
{
|
||||
email.setCharset(charset);
|
||||
}
|
||||
|
||||
return email;
|
||||
}
|
||||
@@ -574,7 +594,9 @@ public class ConfigurationManager
|
||||
{
|
||||
// in case it hasn't been done yet.
|
||||
if (loadedFile == null)
|
||||
{
|
||||
loadConfig(null);
|
||||
}
|
||||
|
||||
return loadedFile;
|
||||
}
|
||||
@@ -660,9 +682,11 @@ public class ConfigurationManager
|
||||
String key = (String)pe.nextElement();
|
||||
String value = interpolate(key, 1);
|
||||
if (value != null)
|
||||
{
|
||||
properties.setProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
@@ -676,7 +700,15 @@ public class ConfigurationManager
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
try { is.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load in default license
|
||||
@@ -714,16 +746,38 @@ public class ConfigurationManager
|
||||
finally
|
||||
{
|
||||
if (br != null)
|
||||
try { br.close(); } catch (IOException ioe) { }
|
||||
|
||||
if (ir != null)
|
||||
try { ir.close(); } catch (IOException ioe) { }
|
||||
|
||||
if (fir != null)
|
||||
try { fir.close(); } catch (IOException ioe) { }
|
||||
{
|
||||
try
|
||||
{
|
||||
br.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (ir != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ir.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (fir != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fir.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -799,7 +853,9 @@ public class ConfigurationManager
|
||||
private static String interpolate(String key, int level)
|
||||
{
|
||||
if (level > RECURSION_LIMIT)
|
||||
throw new IllegalArgumentException("ConfigurationManager: Too many levels of recursion in configuration property variable interpolation, property="+key);
|
||||
{
|
||||
throw new IllegalArgumentException("ConfigurationManager: Too many levels of recursion in configuration property variable interpolation, property=" + key);
|
||||
}
|
||||
String value = (String)properties.get(key);
|
||||
int from = 0;
|
||||
StringBuffer result = null;
|
||||
@@ -810,12 +866,18 @@ public class ConfigurationManager
|
||||
{
|
||||
int end = value.indexOf('}', start);
|
||||
if (end < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
String var = value.substring(start+2, end);
|
||||
if (result == null)
|
||||
{
|
||||
result = new StringBuffer(value.substring(from, start));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append(value.substring(from, start));
|
||||
}
|
||||
if (properties.containsKey(var))
|
||||
{
|
||||
String ivalue = interpolate(var, level+1);
|
||||
@@ -825,7 +887,9 @@ public class ConfigurationManager
|
||||
properties.setProperty(var, ivalue);
|
||||
}
|
||||
else
|
||||
result.append((String)properties.getProperty(var));
|
||||
{
|
||||
result.append((String) properties.getProperty(var));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -838,7 +902,9 @@ public class ConfigurationManager
|
||||
break;
|
||||
}
|
||||
if (result != null && from < value.length())
|
||||
{
|
||||
result.append(value.substring(from));
|
||||
}
|
||||
return (result == null) ? null : result.toString();
|
||||
}
|
||||
|
||||
@@ -949,9 +1015,11 @@ public class ConfigurationManager
|
||||
{
|
||||
Category c = (Category) cats.nextElement();
|
||||
if (!(c.getAllAppenders() instanceof org.apache.log4j.helpers.NullEnumeration))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -438,8 +438,10 @@ public class Context
|
||||
try
|
||||
{
|
||||
if (!connection.isClosed())
|
||||
{
|
||||
connection.rollback();
|
||||
}
|
||||
}
|
||||
catch (SQLException se)
|
||||
{
|
||||
log.error(se.getMessage());
|
||||
@@ -450,8 +452,10 @@ public class Context
|
||||
try
|
||||
{
|
||||
if (!connection.isClosed())
|
||||
{
|
||||
DatabaseManager.freeConnection(connection);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
|
@@ -67,9 +67,11 @@ public class BasicDispatcher extends Dispatcher
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if (consumers.containsKey(cp.getName()))
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"This dispatcher already has a consumer named \""
|
||||
+ cp.getName() + "\"");
|
||||
}
|
||||
|
||||
consumers.put(cp.getName(), cp);
|
||||
|
||||
@@ -108,8 +110,10 @@ public class BasicDispatcher extends Dispatcher
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Processing queue of "
|
||||
+ String.valueOf(events.size()) + " events.");
|
||||
}
|
||||
|
||||
// transaction identifier applies to all events created in
|
||||
// this context for the current transaction. Prefix it with
|
||||
@@ -123,9 +127,11 @@ public class BasicDispatcher extends Dispatcher
|
||||
event.setTransactionID(tid);
|
||||
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Iterating over "
|
||||
+ String.valueOf(consumers.values().size())
|
||||
+ " consumers...");
|
||||
}
|
||||
|
||||
for (Iterator ci = consumers.values().iterator(); ci.hasNext();)
|
||||
{
|
||||
@@ -134,8 +140,10 @@ public class BasicDispatcher extends Dispatcher
|
||||
if (event.pass(cp.getFilters()))
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Sending event to \"" + cp.getName()
|
||||
+ "\": " + event.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -162,8 +170,10 @@ public class BasicDispatcher extends Dispatcher
|
||||
if (cp != null)
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Calling end for consumer \"" + cp.getName()
|
||||
+ "\"");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -104,11 +104,15 @@ public class ConsumerProfile
|
||||
+ name + ".filters");
|
||||
|
||||
if (className == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No class configured for consumer named: " + name);
|
||||
}
|
||||
if (filterString == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No filters configured for consumer named: " + name);
|
||||
}
|
||||
|
||||
consumer = (Consumer) Class.forName(className.trim()).newInstance();
|
||||
|
||||
|
@@ -101,10 +101,14 @@ public abstract class AbstractTextFilterOFD implements OrderFormatDelegate
|
||||
if (language != null)
|
||||
{
|
||||
if (language.length() > 2 && language.charAt(2) == '_')
|
||||
language = language.substring(0,2);
|
||||
{
|
||||
language = language.substring(0, 2);
|
||||
}
|
||||
|
||||
if (language.length() > 3)
|
||||
language = language.substring(0,3);
|
||||
{
|
||||
language = language.substring(0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through filters, applying each in turn
|
||||
|
@@ -628,9 +628,15 @@ public class BitstreamStorageManager
|
||||
if (deleteDbRecords)
|
||||
{
|
||||
log.debug("deleting record");
|
||||
if (verbose) System.out.println(" - Deleting bitstream information (ID: " + bid + ")");
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - Deleting bitstream information (ID: " + bid + ")");
|
||||
}
|
||||
bitstreamInfoDAO.deleteBitstreamInfoWithHistory(bid);
|
||||
if (verbose) System.out.println(" - Deleting bitstream record from database (ID: " + bid + ")");
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - Deleting bitstream record from database (ID: " + bid + ")");
|
||||
}
|
||||
DatabaseManager.delete(context, "Bitstream", bid);
|
||||
}
|
||||
continue;
|
||||
@@ -647,9 +653,15 @@ public class BitstreamStorageManager
|
||||
if (deleteDbRecords)
|
||||
{
|
||||
log.debug("deleting db record");
|
||||
if (verbose) System.out.println(" - Deleting bitstream information (ID: " + bid + ")");
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - Deleting bitstream information (ID: " + bid + ")");
|
||||
}
|
||||
bitstreamInfoDAO.deleteBitstreamInfoWithHistory(bid);
|
||||
if (verbose) System.out.println(" - Deleting bitstream record from database (ID: " + bid + ")");
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - Deleting bitstream record from database (ID: " + bid + ")");
|
||||
}
|
||||
DatabaseManager.delete(context, "Bitstream", bid);
|
||||
}
|
||||
|
||||
@@ -666,7 +678,10 @@ public class BitstreamStorageManager
|
||||
{
|
||||
log.debug(message);
|
||||
}
|
||||
if (verbose) System.out.println(message);
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
// if the file was deleted then
|
||||
// try deleting the parents
|
||||
@@ -700,13 +715,19 @@ public class BitstreamStorageManager
|
||||
// time around will be a no-op.
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
if (verbose) System.err.println("Error: " + sqle.getMessage());
|
||||
if (verbose)
|
||||
{
|
||||
System.err.println("Error: " + sqle.getMessage());
|
||||
}
|
||||
context.abort();
|
||||
throw sqle;
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
if (verbose) System.err.println("Error: " + ioe.getMessage());
|
||||
if (verbose)
|
||||
{
|
||||
System.err.println("Error: " + ioe.getMessage());
|
||||
}
|
||||
context.abort();
|
||||
throw ioe;
|
||||
}
|
||||
@@ -824,7 +845,9 @@ public class BitstreamStorageManager
|
||||
// prefix. The internal-ID is supposed to be just a
|
||||
// filename, so this will not affect normal operation.
|
||||
if (sInternalId.indexOf(File.separator) != -1)
|
||||
sInternalId = sInternalId.substring(sInternalId.lastIndexOf(File.separator)+1);
|
||||
{
|
||||
sInternalId = sInternalId.substring(sInternalId.lastIndexOf(File.separator) + 1);
|
||||
}
|
||||
|
||||
sIntermediatePath = getIntermediatePath(sInternalId);
|
||||
}
|
||||
|
@@ -237,7 +237,9 @@ public abstract class AbstractProcessingStep
|
||||
List errorFields = getErrorFields(request);
|
||||
|
||||
if (errorFields != null)
|
||||
setErrorFields(request,null);
|
||||
{
|
||||
setErrorFields(request, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,7 +282,9 @@ public abstract class AbstractProcessingStep
|
||||
protected final void addErrorMessage(int errorFlag, String errorMessage)
|
||||
{
|
||||
if (this.errorMessages == null)
|
||||
{
|
||||
this.errorMessages = new HashMap();
|
||||
}
|
||||
|
||||
errorMessages.put(Integer.valueOf(errorFlag), errorMessage);
|
||||
}
|
||||
|
@@ -123,7 +123,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -155,7 +157,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
|
||||
// Add the actual collection;
|
||||
if (dso != null)
|
||||
{
|
||||
val.add(dso);
|
||||
}
|
||||
|
||||
val.add("numFound:" + queryResults.getResults().getNumFound());
|
||||
|
||||
@@ -297,7 +301,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
}
|
||||
//No values found!
|
||||
if(newestYear == -1 || oldestYear == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -326,7 +332,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
int bottomYear = year - gap;
|
||||
//Make sure we don't go below our last year found
|
||||
if(bottomYear < oldestYear)
|
||||
{
|
||||
bottomYear = oldestYear;
|
||||
}
|
||||
|
||||
//Also make sure we don't go above our newest year
|
||||
int currentTop = year;
|
||||
@@ -361,7 +369,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
public void addOptions(Options options) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
|
||||
//Should not happen
|
||||
if(scope == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
@@ -386,7 +396,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
if(facet != null){
|
||||
java.util.List<FacetField.Count> facetVals = facet.getValues();
|
||||
if(facetVals == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (FacetField.Count count : facetVals) {
|
||||
values.add(new FilterDisplayValue(count.getName(), count.getCount(), count.getAsFilterQuery()));
|
||||
}
|
||||
@@ -400,8 +412,10 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
for (FilterDisplayValue filterDisplayValue : values) {
|
||||
//No need to show empty years
|
||||
if(0 < filterDisplayValue.getCount())
|
||||
{
|
||||
sortedVals.put(filterDisplayValue.getDisplayedVal(), filterDisplayValue);
|
||||
}
|
||||
}
|
||||
//Make sure we retrieve our sorted values
|
||||
values = Arrays.asList(sortedVals.values().toArray(new FilterDisplayValue[sortedVals.size()]));
|
||||
}else{
|
||||
@@ -418,11 +432,13 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
|
||||
//No need to show empty years
|
||||
if(0 < count)
|
||||
{
|
||||
values.add(new FilterDisplayValue(name, count, facetQuery));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//This is needed to make sure that the date filters do not remain empty
|
||||
@@ -437,7 +453,9 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
for (int i = 0; i < shownFacets; i++) {
|
||||
|
||||
if (!iter.hasNext())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FilterDisplayValue value = iter.next();
|
||||
|
||||
|
@@ -157,7 +157,9 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
// What scope the search is at
|
||||
DSpaceObject scope = getScope();
|
||||
if (scope != null)
|
||||
{
|
||||
key += "-" + scope.getHandle();
|
||||
}
|
||||
|
||||
// The actual search query.
|
||||
key += "-" + getQuery();
|
||||
@@ -333,7 +335,9 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
String value = getSingleValue(item, "dc.relation.ispartof");
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix");
|
||||
@@ -345,8 +349,10 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
DSpaceObject obj = HandleManager.resolveToObject(context, value.replaceFirst(handlePrefix, ""));
|
||||
|
||||
if (obj != null && obj instanceof Item)
|
||||
{
|
||||
return (Item) obj;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
@@ -427,7 +433,9 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
public void performSearch(DSpaceObject scope) throws UIException, SearchServiceException {
|
||||
|
||||
if (queryResults != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String query = getQuery();
|
||||
@@ -448,7 +456,9 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
String[] fqs = getSolrFilterQueries();
|
||||
|
||||
if (fqs != null)
|
||||
{
|
||||
filterQueries.addAll(Arrays.asList(fqs));
|
||||
}
|
||||
|
||||
|
||||
queryArgs = this.prepareDefaultFilters("search", filterQueries.toArray(new String[filterQueries.size()]));
|
||||
|
@@ -132,7 +132,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -207,7 +209,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
|
||||
if (queryResults != null)
|
||||
{
|
||||
return queryResults;
|
||||
}
|
||||
|
||||
queryArgs = new SolrQuery();
|
||||
|
||||
@@ -241,7 +245,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
|
||||
int offset = RequestUtils.getIntParameter(request, OFFSET);
|
||||
if (offset == -1)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
queryArgs.setParam(FacetParams.FACET_OFFSET, String.valueOf(offset));
|
||||
|
||||
//We add +1 so we can use the extra one to make sure that we need to show the next page
|
||||
@@ -282,7 +288,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
// We shouldn't go lower then our max bottom year
|
||||
// Make sure to substract one so the bottom year is also counted !
|
||||
if(startYear < maxEndYear)
|
||||
{
|
||||
startYear = maxEndYear - 1;
|
||||
}
|
||||
|
||||
if(0 < offset){
|
||||
//Say that we have an offset of 10 years
|
||||
@@ -384,7 +392,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
|
||||
java.util.List<FacetField> facetFields = this.queryResults.getFacetFields();
|
||||
if (facetFields == null)
|
||||
{
|
||||
facetFields = new ArrayList<FacetField>();
|
||||
}
|
||||
|
||||
facetFields.addAll(this.queryResults.getFacetDates());
|
||||
|
||||
@@ -416,7 +426,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
//Only show the nextpageurl if we have at least one result following our current results
|
||||
String nextPageUrl = null;
|
||||
if (values.size() == (DEFAULT_PAGE_SIZE + 1))
|
||||
{
|
||||
nextPageUrl = getNextPageURL(request);
|
||||
}
|
||||
|
||||
results.setSimplePagination((int) queryResults.getResults().getNumFound(), offSet + 1,
|
||||
(offSet + (values.size() - 1)), getPreviousPageURL(request), nextPageUrl);
|
||||
@@ -426,7 +438,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
|
||||
List<String> filterQueries = new ArrayList<String>();
|
||||
if(request.getParameterValues("fq") != null)
|
||||
{
|
||||
filterQueries = Arrays.asList(request.getParameterValues("fq"));
|
||||
}
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
FacetField.Count value = values.get(i);
|
||||
|
||||
@@ -487,7 +501,9 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
Map<String, String> parameters = new HashMap<String, String>();
|
||||
parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
|
||||
if (queryArgs.get(FacetParams.FACET_OFFSET) != null)
|
||||
{
|
||||
parameters.put(OFFSET, String.valueOf(Integer.parseInt(queryArgs.get(FacetParams.FACET_OFFSET)) + DEFAULT_PAGE_SIZE));
|
||||
}
|
||||
|
||||
// Add the filter queries
|
||||
String url = generateURL("browse-discovery", parameters);
|
||||
@@ -504,12 +520,16 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
||||
private String getPreviousPageURL(Request request) {
|
||||
//If our offset should be 0 then we shouldn't be able to view a previous page url
|
||||
if ("0".equals(queryArgs.get(FacetParams.FACET_OFFSET)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, String> parameters = new HashMap<String, String>();
|
||||
parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
|
||||
if (queryArgs.get(FacetParams.FACET_OFFSET) != null)
|
||||
{
|
||||
parameters.put(OFFSET, String.valueOf(Integer.parseInt(queryArgs.get(FacetParams.FACET_OFFSET)) - DEFAULT_PAGE_SIZE));
|
||||
}
|
||||
|
||||
// Add the filter queries
|
||||
String url = generateURL("browse-discovery", parameters);
|
||||
|
@@ -87,7 +87,9 @@ public class CollectionRecentSubmissions extends AbstractFiltersTransformer {
|
||||
performSearch(collection);
|
||||
|
||||
if(queryResults == null)
|
||||
return;// queryResults;
|
||||
{
|
||||
return;
|
||||
}// queryResults;
|
||||
|
||||
// Build the collection viewer division.
|
||||
Division home = body.addDivision("collection-home", "primary repository collection");
|
||||
@@ -119,7 +121,9 @@ public class CollectionRecentSubmissions extends AbstractFiltersTransformer {
|
||||
|
||||
|
||||
if(queryResults != null)
|
||||
return;// queryResults;
|
||||
{
|
||||
return;
|
||||
}// queryResults;
|
||||
|
||||
queryArgs = prepareDefaultFilters("collection");
|
||||
|
||||
|
@@ -116,7 +116,9 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -145,10 +147,14 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
collection = (Collection) dso;
|
||||
|
||||
@@ -178,7 +184,9 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Collection collection = (Collection) dso;
|
||||
|
||||
@@ -201,7 +209,9 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
// Remove the protocol number, i.e. just list 'rss' or' atom'
|
||||
String[] parts = format.split("_");
|
||||
if (parts.length < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String feedFormat = parts[0].trim()+"+xml";
|
||||
|
||||
@@ -219,7 +229,9 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
@@ -228,9 +240,13 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
Division home = body.addDivision("collection-home", "primary repository collection");
|
||||
String name = collection.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
home.setHead(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
home.setHead(name);
|
||||
}
|
||||
|
||||
// The search / browse box.
|
||||
{
|
||||
|
@@ -86,7 +86,9 @@ public class CommunityRecentSubmissions extends AbstractFiltersTransformer
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Build the community viewer division.
|
||||
Division home = body.addDivision("community-home", "primary repository community");
|
||||
@@ -118,7 +120,9 @@ public class CommunityRecentSubmissions extends AbstractFiltersTransformer
|
||||
|
||||
|
||||
if(queryResults != null)
|
||||
return;// queryResults;
|
||||
{
|
||||
return;
|
||||
}// queryResults;
|
||||
|
||||
queryArgs = prepareDefaultFilters("community");
|
||||
|
||||
|
@@ -121,7 +121,9 @@ public class CommunitySearch extends AbstractDSpaceTransformer implements Cachea
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0"; // no item, something is wrong
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -149,10 +151,14 @@ public class CommunitySearch extends AbstractDSpaceTransformer implements Cachea
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
community = (Community) dso;
|
||||
|
||||
@@ -206,7 +212,9 @@ public class CommunitySearch extends AbstractDSpaceTransformer implements Cachea
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Community community = (Community) dso;
|
||||
|
@@ -183,8 +183,10 @@ public class BrowseListTag extends TagSupport
|
||||
// We haven't got a sort option defined, so get one for the index
|
||||
// - it may be required later
|
||||
if (so == null)
|
||||
{
|
||||
so = bix.getSortOption();
|
||||
}
|
||||
}
|
||||
|
||||
// If no config found, attempt to get one for this sort option
|
||||
if (so != null && browseListLine == null)
|
||||
@@ -248,7 +250,9 @@ public class BrowseListTag extends TagSupport
|
||||
if (browseListTok != null)
|
||||
{
|
||||
if (newBLLine.length() > 0)
|
||||
{
|
||||
newBLLine.append(",");
|
||||
}
|
||||
|
||||
newBLLine.append(browseListTok);
|
||||
}
|
||||
@@ -256,7 +260,9 @@ public class BrowseListTag extends TagSupport
|
||||
if (browseWidthTok != null)
|
||||
{
|
||||
if (newBWLine.length() > 0)
|
||||
{
|
||||
newBWLine.append(",");
|
||||
}
|
||||
|
||||
newBWLine.append(browseWidthTok);
|
||||
}
|
||||
|
@@ -231,7 +231,9 @@ public class ControlledVocabularyTag extends TagSupport
|
||||
boolean allowMultipleSelection, String contextPath)
|
||||
{
|
||||
if (vocabulary == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
String result = "";
|
||||
try
|
||||
@@ -267,7 +269,9 @@ public class ControlledVocabularyTag extends TagSupport
|
||||
String vocabularyPrunningXSLT, String filter)
|
||||
{
|
||||
if (vocabulary == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -361,8 +361,10 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
|
||||
{
|
||||
result += iterator.next().toString();
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
result += separator;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -64,10 +64,14 @@ public class ControlledVocabularyServlet extends DSpaceServlet
|
||||
String callerUrl = request.getParameter("callerUrl");
|
||||
|
||||
if (request.getParameter("ID") != null)
|
||||
{
|
||||
ID = request.getParameter("ID");
|
||||
}
|
||||
|
||||
if (request.getParameter("filter") != null)
|
||||
{
|
||||
filter = request.getParameter("filter");
|
||||
}
|
||||
|
||||
request.getSession()
|
||||
.setAttribute("controlledvocabulary.filter", filter);
|
||||
|
@@ -141,13 +141,19 @@ public class ClassicDSpaceLogConverter {
|
||||
{
|
||||
// Read inthe line and covnert it to a LogLine
|
||||
lines++;
|
||||
if (verbose) System.out.println(" - IN: " + line);
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - IN: " + line);
|
||||
}
|
||||
lline = LogAnalyser.getLogLine(line);
|
||||
|
||||
// Get rid of any lines that aren't INFO
|
||||
if ((lline == null) || (!lline.isLevel("INFO")))
|
||||
{
|
||||
if (verbose) System.out.println(" - IGNORED!");
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - IGNORED!");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -218,8 +224,14 @@ public class ClassicDSpaceLogConverter {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (verbose) System.out.println(" - IN: " + line);
|
||||
if (verbose) System.err.println("Error with log line! " + e.getMessage());
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println(" - IN: " + line);
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
System.err.println("Error with log line! " + e.getMessage());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -204,20 +204,32 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
UIException, SQLException, IOException, AuthorizeException {
|
||||
|
||||
if (!AuthorizeManager.isAdmin(context))
|
||||
{
|
||||
throw new AuthorizeException("You are not authorized to view this page.");
|
||||
}
|
||||
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
OPTIONS option = null;
|
||||
if (request.getParameter("java") != null)
|
||||
{
|
||||
option = OPTIONS.java;
|
||||
}
|
||||
if (request.getParameter("dspace") != null)
|
||||
{
|
||||
option = OPTIONS.dspace;
|
||||
}
|
||||
if (request.getParameter("alerts") != null)
|
||||
{
|
||||
option = OPTIONS.alerts;
|
||||
}
|
||||
if (request.getParameter("activity") != null)
|
||||
{
|
||||
option = OPTIONS.activity;
|
||||
}
|
||||
if (request.getParameter("harvest") != null)
|
||||
{
|
||||
option = OPTIONS.harvest;
|
||||
}
|
||||
|
||||
Division div = body.addInteractiveDivision("control-panel", contextPath+"/admin/panel", Division.METHOD_POST, "primary administrative");
|
||||
div.setHead(T_head);
|
||||
@@ -227,45 +239,77 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
|
||||
// our options, selected or not....
|
||||
if (option == OPTIONS.java)
|
||||
options.addItem().addHighlight("bold").addXref("?java",T_option_java);
|
||||
{
|
||||
options.addItem().addHighlight("bold").addXref("?java", T_option_java);
|
||||
}
|
||||
else
|
||||
options.addItemXref("?java",T_option_java);
|
||||
{
|
||||
options.addItemXref("?java", T_option_java);
|
||||
}
|
||||
|
||||
if (option == OPTIONS.dspace)
|
||||
options.addItem().addHighlight("bold").addXref("?dspace",T_option_dspace);
|
||||
{
|
||||
options.addItem().addHighlight("bold").addXref("?dspace", T_option_dspace);
|
||||
}
|
||||
else
|
||||
options.addItemXref("?dspace",T_option_dspace);
|
||||
{
|
||||
options.addItemXref("?dspace", T_option_dspace);
|
||||
}
|
||||
|
||||
if (option == OPTIONS.alerts)
|
||||
options.addItem().addHighlight("bold").addXref("?alerts",T_option_alerts);
|
||||
{
|
||||
options.addItem().addHighlight("bold").addXref("?alerts", T_option_alerts);
|
||||
}
|
||||
else
|
||||
options.addItemXref("?alerts",T_option_alerts);
|
||||
{
|
||||
options.addItemXref("?alerts", T_option_alerts);
|
||||
}
|
||||
|
||||
if (option == OPTIONS.harvest)
|
||||
options.addItem().addHighlight("bold").addXref("?harvest",T_option_harvest);
|
||||
{
|
||||
options.addItem().addHighlight("bold").addXref("?harvest", T_option_harvest);
|
||||
}
|
||||
else
|
||||
options.addItemXref("?harvest",T_option_harvest);
|
||||
{
|
||||
options.addItemXref("?harvest", T_option_harvest);
|
||||
}
|
||||
|
||||
String userSortTarget = "?activity";
|
||||
if (request.getParameter("sortBy") != null)
|
||||
userSortTarget += "&sortBy="+request.getParameter("sortBy");
|
||||
{
|
||||
userSortTarget += "&sortBy=" + request.getParameter("sortBy");
|
||||
}
|
||||
if (option == OPTIONS.activity)
|
||||
options.addItem().addHighlight("bold").addXref(userSortTarget,"Current Activity");
|
||||
{
|
||||
options.addItem().addHighlight("bold").addXref(userSortTarget, "Current Activity");
|
||||
}
|
||||
else
|
||||
options.addItemXref(userSortTarget,"Current Activity");
|
||||
{
|
||||
options.addItemXref(userSortTarget, "Current Activity");
|
||||
}
|
||||
|
||||
|
||||
// The main content:
|
||||
if (option == OPTIONS.java)
|
||||
{
|
||||
addJavaInformation(div);
|
||||
}
|
||||
else if (option == OPTIONS.dspace)
|
||||
{
|
||||
addDSpaceConfiguration(div);
|
||||
}
|
||||
else if (option == OPTIONS.alerts)
|
||||
{
|
||||
addAlerts(div);
|
||||
}
|
||||
else if (option == OPTIONS.activity)
|
||||
{
|
||||
addActivity(div);
|
||||
}
|
||||
else if (option == OPTIONS.harvest)
|
||||
{
|
||||
addHarvest(div);
|
||||
}
|
||||
else
|
||||
{
|
||||
div.addPara(T_select_panel);
|
||||
@@ -442,9 +486,13 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
if (recordAnonymousString != null)
|
||||
{
|
||||
if ("ON".equals(recordAnonymousString))
|
||||
{
|
||||
CurrentActivityAction.setRecordAnonymousEvents(true);
|
||||
}
|
||||
if ("OFF".equals(recordAnonymousString))
|
||||
{
|
||||
CurrentActivityAction.setRecordAnonymousEvents(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle bot recording
|
||||
@@ -452,24 +500,38 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
if (recordBotString != null)
|
||||
{
|
||||
if ("ON".equals(recordBotString))
|
||||
{
|
||||
CurrentActivityAction.setRecordBotEvents(true);
|
||||
}
|
||||
if ("OFF".equals(recordBotString))
|
||||
{
|
||||
CurrentActivityAction.setRecordBotEvents(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 1) Determine how to sort
|
||||
EventSort sortBy = EventSort.TIME;
|
||||
String sortByString = request.getParameter("sortBy");
|
||||
if (EventSort.TIME.toString().equals(sortByString))
|
||||
{
|
||||
sortBy = EventSort.TIME;
|
||||
}
|
||||
if (EventSort.URL.toString().equals(sortByString))
|
||||
{
|
||||
sortBy = EventSort.URL;
|
||||
}
|
||||
if (EventSort.SESSION.toString().equals(sortByString))
|
||||
{
|
||||
sortBy = EventSort.SESSION;
|
||||
}
|
||||
if (EventSort.AGENT.toString().equals(sortByString))
|
||||
{
|
||||
sortBy = EventSort.AGENT;
|
||||
}
|
||||
if (EventSort.IP.toString().equals(sortByString))
|
||||
{
|
||||
sortBy = EventSort.IP;
|
||||
}
|
||||
|
||||
// 2) Sort the events by the requested sorting parameter
|
||||
java.util.List<CurrentActivityAction.Event> events = CurrentActivityAction.getEvents();
|
||||
@@ -478,14 +540,22 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
|
||||
// 3) Toggle controls for anonymous and bot activity
|
||||
if (CurrentActivityAction.getRecordAnonymousEvents())
|
||||
div.addPara().addXref("?activity&sortBy="+sortBy+"&recordanonymous=OFF").addContent(T_stop_anonymous);
|
||||
{
|
||||
div.addPara().addXref("?activity&sortBy=" + sortBy + "&recordanonymous=OFF").addContent(T_stop_anonymous);
|
||||
}
|
||||
else
|
||||
div.addPara().addXref("?activity&sortBy="+sortBy+"&recordanonymous=ON").addContent(T_start_anonymous);
|
||||
{
|
||||
div.addPara().addXref("?activity&sortBy=" + sortBy + "&recordanonymous=ON").addContent(T_start_anonymous);
|
||||
}
|
||||
|
||||
if (CurrentActivityAction.getRecordBotEvents())
|
||||
div.addPara().addXref("?activity&sortBy="+sortBy+"&recordbots=OFF").addContent(T_stop_bot);
|
||||
{
|
||||
div.addPara().addXref("?activity&sortBy=" + sortBy + "&recordbots=OFF").addContent(T_stop_bot);
|
||||
}
|
||||
else
|
||||
div.addPara().addXref("?activity&sortBy="+sortBy+"&recordbots=ON").addContent(T_start_bot);
|
||||
{
|
||||
div.addPara().addXref("?activity&sortBy=" + sortBy + "&recordbots=ON").addContent(T_start_bot);
|
||||
}
|
||||
|
||||
|
||||
// 4) Display the results Table
|
||||
@@ -494,29 +564,49 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
activeUsers.setHead(T_activity_head.parameterize(CurrentActivityAction.MAX_EVENTS));
|
||||
Row row = activeUsers.addRow(Row.ROLE_HEADER);
|
||||
if (sortBy == EventSort.TIME)
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy="+EventSort.TIME).addContent(T_activity_sort_time);
|
||||
{
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy=" + EventSort.TIME).addContent(T_activity_sort_time);
|
||||
}
|
||||
else
|
||||
row.addCell().addXref("?activity&sortBy="+EventSort.TIME).addContent(T_activity_sort_time);
|
||||
{
|
||||
row.addCell().addXref("?activity&sortBy=" + EventSort.TIME).addContent(T_activity_sort_time);
|
||||
}
|
||||
|
||||
if (sortBy == EventSort.SESSION)
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy="+EventSort.SESSION).addContent(T_activity_sort_user);
|
||||
{
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy=" + EventSort.SESSION).addContent(T_activity_sort_user);
|
||||
}
|
||||
else
|
||||
row.addCell().addXref("?activity&sortBy="+EventSort.SESSION).addContent(T_activity_sort_user);
|
||||
{
|
||||
row.addCell().addXref("?activity&sortBy=" + EventSort.SESSION).addContent(T_activity_sort_user);
|
||||
}
|
||||
|
||||
if (sortBy == EventSort.IP)
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy="+EventSort.IP).addContent(T_activity_sort_ip);
|
||||
{
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy=" + EventSort.IP).addContent(T_activity_sort_ip);
|
||||
}
|
||||
else
|
||||
row.addCell().addXref("?activity&sortBy="+EventSort.IP).addContent(T_activity_sort_ip);
|
||||
{
|
||||
row.addCell().addXref("?activity&sortBy=" + EventSort.IP).addContent(T_activity_sort_ip);
|
||||
}
|
||||
|
||||
if (sortBy == EventSort.URL)
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy="+EventSort.URL).addContent(T_activity_sort_url);
|
||||
{
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy=" + EventSort.URL).addContent(T_activity_sort_url);
|
||||
}
|
||||
else
|
||||
row.addCell().addXref("?activity&sortBy="+EventSort.URL).addContent(T_activity_sort_url);
|
||||
{
|
||||
row.addCell().addXref("?activity&sortBy=" + EventSort.URL).addContent(T_activity_sort_url);
|
||||
}
|
||||
|
||||
if (sortBy == EventSort.AGENT)
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy="+EventSort.AGENT).addContent(T_activity_sort_agent);
|
||||
{
|
||||
row.addCell().addHighlight("bold").addXref("?activity&sortBy=" + EventSort.AGENT).addContent(T_activity_sort_agent);
|
||||
}
|
||||
else
|
||||
row.addCell().addXref("?activity&sortBy="+EventSort.AGENT).addContent(T_activity_sort_agent);
|
||||
{
|
||||
row.addCell().addXref("?activity&sortBy=" + EventSort.AGENT).addContent(T_activity_sort_agent);
|
||||
}
|
||||
|
||||
// Keep track of how many individual anonymous users there are, each unique anonymous
|
||||
// user is assigned an index based upon the servlet session id.
|
||||
@@ -527,7 +617,9 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
for (CurrentActivityAction.Event event : events)
|
||||
{
|
||||
if (event == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
shown++;
|
||||
|
||||
@@ -556,7 +648,9 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
{
|
||||
// Is this a new anonymous user?
|
||||
if (!anonymousHash.containsKey(event.getSessionID()))
|
||||
{
|
||||
anonymousHash.put(event.getSessionID(), anonymousCount++);
|
||||
}
|
||||
|
||||
eventRow.addCellContent(T_activity_anonymous.parameterize(anonymousHash.get(event.getSessionID())));
|
||||
}
|
||||
@@ -592,11 +686,17 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
{
|
||||
// Protect against null events while sorting
|
||||
if (a != null && b == null)
|
||||
{
|
||||
return 1; // A > B
|
||||
}
|
||||
else if (a == null && b != null)
|
||||
{
|
||||
return -1; // B > A
|
||||
}
|
||||
else if (a == null && b == null)
|
||||
{
|
||||
return 0; // A == B
|
||||
}
|
||||
|
||||
// Sort by the given ordering matrix
|
||||
if (EventSort.URL == sortBy)
|
||||
@@ -605,7 +705,9 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
String bURL = b.getURL();
|
||||
int cmp = aURL.compareTo(bURL);
|
||||
if (cmp != 0)
|
||||
{
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
else if (EventSort.AGENT == sortBy)
|
||||
{
|
||||
@@ -613,7 +715,9 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
String bAgent = b.getDectectedBrowser();
|
||||
int cmp = aAgent.compareTo(bAgent);
|
||||
if (cmp != 0)
|
||||
{
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
else if (EventSort.IP == sortBy)
|
||||
{
|
||||
@@ -621,7 +725,9 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
String bIP = b.getIP();
|
||||
int cmp = aIP.compareTo(bIP);
|
||||
if (cmp != 0)
|
||||
{
|
||||
return cmp;
|
||||
}
|
||||
|
||||
}
|
||||
else if (EventSort.SESSION == sortBy)
|
||||
@@ -631,22 +737,32 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
// IDs. Unfortunitaly we can not compare eperson names because
|
||||
// we do not have access to a context object.
|
||||
if (a.getEPersonID() > 0 && b.getEPersonID() < 0)
|
||||
{
|
||||
return 1; // A > B
|
||||
}
|
||||
else if (a.getEPersonID() < 0 && b.getEPersonID() > 0)
|
||||
{
|
||||
return -1; // B > A
|
||||
}
|
||||
|
||||
String aSession = a.getSessionID();
|
||||
String bSession = b.getSessionID();
|
||||
int cmp = aSession.compareTo(bSession);
|
||||
if (cmp != 0)
|
||||
{
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
|
||||
// All ways fall back to sorting by time, when events are equal.
|
||||
if (a.getTimeStamp() > b.getTimeStamp())
|
||||
{
|
||||
return 1; // A > B
|
||||
}
|
||||
else if (a.getTimeStamp() > b.getTimeStamp())
|
||||
{
|
||||
return -1; // B > A
|
||||
}
|
||||
return 0; // A == B
|
||||
}
|
||||
}
|
||||
@@ -675,12 +791,18 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
actionsItem.addButton("submit_harvest_reset").setValue(T_harvest_submit_reset);
|
||||
}
|
||||
if (HarvestScheduler.status == HarvestScheduler.HARVESTER_STATUS_PAUSED)
|
||||
{
|
||||
actionsItem.addButton("submit_harvest_resume").setValue(T_harvest_submit_resume);
|
||||
}
|
||||
if (HarvestScheduler.status == HarvestScheduler.HARVESTER_STATUS_RUNNING ||
|
||||
HarvestScheduler.status == HarvestScheduler.HARVESTER_STATUS_SLEEPING)
|
||||
{
|
||||
actionsItem.addButton("submit_harvest_pause").setValue(T_harvest_submit_pause);
|
||||
}
|
||||
if (HarvestScheduler.status != HarvestScheduler.HARVESTER_STATUS_STOPPED)
|
||||
{
|
||||
actionsItem.addButton("submit_harvest_stop").setValue(T_harvest_submit_stop);
|
||||
}
|
||||
|
||||
// Can be retrieved via "{context-path}/admin/collection?collectionID={id}"
|
||||
String baseURL = contextPath + "/admin/collection?collectionID=";
|
||||
@@ -723,14 +845,20 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
generatorSettings.addLabel(T_harvest_label_oai_url);
|
||||
String oaiUrl = ConfigurationManager.getProperty("dspace.oai.url");
|
||||
if (oaiUrl != null && oaiUrl != "")
|
||||
{
|
||||
generatorSettings.addItem(oaiUrl);
|
||||
}
|
||||
|
||||
generatorSettings.addLabel(T_harvest_label_oai_source);
|
||||
String oaiAuthoritativeSource = ConfigurationManager.getProperty("ore.authoritative.source");
|
||||
if (oaiAuthoritativeSource != null && oaiAuthoritativeSource != "")
|
||||
{
|
||||
generatorSettings.addItem(oaiAuthoritativeSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
generatorSettings.addItem("oai");
|
||||
}
|
||||
|
||||
// OAI Harvester settings (just iterate over all the values that start with "harvester")
|
||||
List harvesterSettings = div.addList("oai-harvester-settings");
|
||||
|
@@ -132,9 +132,13 @@ public class AuthorizationMain extends AbstractDSpaceTransformer
|
||||
Item actionItem = actionsList.addItem();
|
||||
Text queryField = actionItem.addText("identifier");
|
||||
if (query != null)
|
||||
{
|
||||
queryField.setValue(query);
|
||||
}
|
||||
if (errors.contains("identifier"))
|
||||
{
|
||||
queryField.addError(T_bad_name);
|
||||
}
|
||||
queryField.setHelp(T_search_help);
|
||||
actionItem.addButton("submit_edit").setValue(T_submit_find);
|
||||
actionsList.addLabel(T_actions_advanced);
|
||||
@@ -167,17 +171,25 @@ public class AuthorizationMain extends AbstractDSpaceTransformer
|
||||
for (Collection subCols : currentCommunity.getCollections())
|
||||
{
|
||||
if (containerSubList == null)
|
||||
{
|
||||
containerSubList = parentList.addList("subList" + currentCommunity.getID());
|
||||
}
|
||||
String name = subCols.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
containerSubList.addItemXref(baseURL+"&submit_edit&collection_id="+subCols.getID(), T_untitled);
|
||||
{
|
||||
containerSubList.addItemXref(baseURL + "&submit_edit&collection_id=" + subCols.getID(), T_untitled);
|
||||
}
|
||||
else
|
||||
containerSubList.addItemXref(baseURL+"&submit_edit&collection_id="+subCols.getID(), name);
|
||||
{
|
||||
containerSubList.addItemXref(baseURL + "&submit_edit&collection_id=" + subCols.getID(), name);
|
||||
}
|
||||
}
|
||||
for (Community subComs : currentCommunity.getSubcommunities())
|
||||
{
|
||||
if (containerSubList == null)
|
||||
{
|
||||
containerSubList = parentList.addList("subList" + currentCommunity.getID());
|
||||
}
|
||||
containerListBuilder(baseURL,containerSubList,subComs);
|
||||
}
|
||||
}
|
||||
|
@@ -140,7 +140,9 @@ public class AssignCollectionRoles extends AbstractDSpaceTransformer
|
||||
Group defaultRead = null;
|
||||
int defaultReadID = FlowContainerUtils.getCollectionDefaultRead(context, collectionID);
|
||||
if (defaultReadID >= 0)
|
||||
{
|
||||
defaultRead = Group.find(context, defaultReadID);
|
||||
}
|
||||
|
||||
// DIVISION: main
|
||||
Division main = body.addInteractiveDivision("collection-assign-roles",contextPath+"/admin/collection",Division.METHOD_POST,"primary administrative collection");
|
||||
|
@@ -123,17 +123,23 @@ public class AddBitstreamForm extends AbstractDSpaceTransformer
|
||||
// or one supplied from the dspace.cfg.
|
||||
String bundleString = ConfigurationManager.getProperty("xmlui.bundle.upload");
|
||||
if (bundleString == null || bundleString.length() == 0)
|
||||
{
|
||||
bundleString = DEFAULT_BUNDLE_LIST;
|
||||
}
|
||||
String[] parts = bundleString.split(",");
|
||||
for (String part : parts)
|
||||
{
|
||||
if (addBundleOption(item,select,part.trim()))
|
||||
{
|
||||
bundleCount++;
|
||||
}
|
||||
}
|
||||
select.setOptionSelected("ORIGINAL");
|
||||
|
||||
if (bundleCount == 0)
|
||||
{
|
||||
select.setDisabled();
|
||||
}
|
||||
|
||||
|
||||
File file = upload.addItem().addFile("file");
|
||||
@@ -142,24 +148,32 @@ public class AddBitstreamForm extends AbstractDSpaceTransformer
|
||||
file.setRequired();
|
||||
|
||||
if (bundleCount == 0)
|
||||
{
|
||||
file.setDisabled();
|
||||
}
|
||||
|
||||
Text description = upload.addItem().addText("description");
|
||||
description.setLabel(T_description_label);
|
||||
description.setHelp(T_description_help);
|
||||
|
||||
if (bundleCount == 0)
|
||||
{
|
||||
description.setDisabled();
|
||||
}
|
||||
|
||||
if (bundleCount == 0)
|
||||
{
|
||||
upload.addItem().addContent(T_no_bundles);
|
||||
}
|
||||
|
||||
// ITEM: actions
|
||||
Item actions = upload.addItem();
|
||||
Button button = actions.addButton("submit_upload");
|
||||
button.setValue(T_submit_upload);
|
||||
if (bundleCount == 0)
|
||||
{
|
||||
button.setDisabled();
|
||||
}
|
||||
|
||||
actions.addButton("submit_cancel").setValue(T_submit_cancel);
|
||||
|
||||
@@ -177,18 +191,24 @@ public class AddBitstreamForm extends AbstractDSpaceTransformer
|
||||
// to upload to this bundle because at upload time the bundle will be created but
|
||||
// there is no way anyone but super admin could have access to add to the bundle.
|
||||
if ( ! AuthorizeManager.isAdmin(context))
|
||||
{
|
||||
return false; // you can't upload to this bundle.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// At least one bundle exists, does the user have privleges to upload to it?
|
||||
Bundle bundle = bundles[0];
|
||||
if ( ! AuthorizeManager.authorizeActionBoolean(context, bundle, Constants.ADD))
|
||||
{
|
||||
return false; // you can't upload to this bundle.
|
||||
}
|
||||
|
||||
// You also need the write privlege on the bundle.
|
||||
if ( ! AuthorizeManager.authorizeActionBoolean(context, bundle, Constants.WRITE))
|
||||
return false; // you can't upload.
|
||||
{
|
||||
return false; // you can't upload
|
||||
}
|
||||
}
|
||||
|
||||
// It's okay to upload.
|
||||
|
@@ -141,12 +141,16 @@ public class BrowseItemForm extends AbstractDSpaceTransformer {
|
||||
String author = "unkown";
|
||||
DCValue[] dcAuthors = item.getDC("contributor",Item.ANY,Item.ANY);
|
||||
if (dcAuthors != null && dcAuthors.length >= 1)
|
||||
{
|
||||
author = dcAuthors[0].value;
|
||||
}
|
||||
|
||||
String title = "untitled";
|
||||
DCValue[] dcTitles = item.getDC("title",null,Item.ANY);
|
||||
if (dcTitles != null && dcTitles.length >= 1)
|
||||
{
|
||||
title = dcTitles[0].value;
|
||||
}
|
||||
|
||||
String url = contextPath+"/handle/"+item.getHandle();
|
||||
|
||||
@@ -203,14 +207,18 @@ public class BrowseItemForm extends AbstractDSpaceTransformer {
|
||||
Item item = iterator.next();
|
||||
|
||||
if (! item.isOwningCollection(collection))
|
||||
{
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (iterator != null)
|
||||
{
|
||||
iterator.close();
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
@@ -162,7 +162,9 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
// What scope the search is at
|
||||
DSpaceObject scope = getScope();
|
||||
if (scope != null)
|
||||
{
|
||||
key += "-" + scope.getHandle();
|
||||
}
|
||||
|
||||
// The actual search query.
|
||||
key += "-" + getQuery();
|
||||
@@ -276,7 +278,9 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
int lastItemIndex = queryResults.getStart()
|
||||
+ queryResults.getPageSize();
|
||||
if (itemsTotal < lastItemIndex)
|
||||
{
|
||||
lastItemIndex = itemsTotal;
|
||||
}
|
||||
int currentPage = (queryResults.getStart() / queryResults
|
||||
.getPageSize()) + 1;
|
||||
int pagesTotal = ((queryResults.getHitCount() - 1) / queryResults
|
||||
@@ -331,8 +335,10 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
ReferenceSet.TYPE_SUMMARY_LIST,null,"repository-search-results");
|
||||
// Only set a heading if there are both containers and items.
|
||||
if (resultsContainsBothContainersAndItems)
|
||||
{
|
||||
referenceSet.setHead(T_head3);
|
||||
}
|
||||
}
|
||||
referenceSet.addReference(resultDSO);
|
||||
}
|
||||
}
|
||||
@@ -415,7 +421,9 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
protected void performSearch() throws SQLException, IOException, UIException
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
String query = getQuery();
|
||||
|
@@ -161,7 +161,9 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
String numSearchField = request.getParameter("num_search_field");
|
||||
if (numSearchField == null || numSearchField.length() == 0)
|
||||
{
|
||||
numSearchField = "3";
|
||||
}
|
||||
|
||||
// Build the DRI Body
|
||||
Division search = body.addDivision("advanced-search","primary");
|
||||
@@ -202,7 +204,9 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
// Skip over all the fields we've displayed.
|
||||
int i = field.getIndex();
|
||||
if (i <= FIELD_DISPLAY_COUNT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
query.addHidden("conjunction"+i).setValue(field.getConjunction());
|
||||
query.addHidden("field"+i).setValue(field.getField());
|
||||
@@ -228,14 +232,18 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
{
|
||||
// No conjunction for the first row.
|
||||
if (row == 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
String current = request.getParameter("conjunction" + row);
|
||||
|
||||
// default to AND if nothing specified.
|
||||
if (current == null || current.length() == 0)
|
||||
{
|
||||
current = "AND";
|
||||
}
|
||||
|
||||
Select select = cell.addSelect("conjunction" + row);
|
||||
|
||||
@@ -308,8 +316,10 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
|
||||
Text text = cell.addText("query" + row);
|
||||
if (current != null)
|
||||
{
|
||||
text.setValue(current);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a URL for this search page which includes all the
|
||||
@@ -324,15 +334,21 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
|
||||
String numSearchField = request.getParameter("num_search_field");
|
||||
if (numSearchField != null)
|
||||
{
|
||||
parameters.put("num_search_field", numSearchField);
|
||||
}
|
||||
|
||||
String resultsPerPage = request.getParameter("results_per_page");
|
||||
if (resultsPerPage != null)
|
||||
{
|
||||
parameters.put("results_per_page", resultsPerPage);
|
||||
}
|
||||
|
||||
String scope = request.getParameter("scope");
|
||||
if (scope != null)
|
||||
{
|
||||
parameters.put("scope", scope);
|
||||
}
|
||||
|
||||
for (SearchField searchField : getSearchFields(request))
|
||||
{
|
||||
@@ -347,19 +363,29 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
}
|
||||
|
||||
if (parameters.get("page") == null)
|
||||
{
|
||||
parameters.put("page", String.valueOf(getParameterPage()));
|
||||
}
|
||||
|
||||
if (parameters.get("rpp") == null)
|
||||
{
|
||||
parameters.put("rpp", String.valueOf(getParameterRpp()));
|
||||
}
|
||||
|
||||
if (parameters.get("sort_by") == null)
|
||||
{
|
||||
parameters.put("sort_by", String.valueOf(getParameterSortBy()));
|
||||
}
|
||||
|
||||
if (parameters.get("order") == null)
|
||||
parameters.put("order",getParameterOrder());
|
||||
{
|
||||
parameters.put("order", getParameterOrder());
|
||||
}
|
||||
|
||||
if (parameters.get("etal") == null)
|
||||
parameters.put("etal",String.valueOf(getParameterEtAl()));
|
||||
{
|
||||
parameters.put("etal", String.valueOf(getParameterEtAl()));
|
||||
}
|
||||
|
||||
return super.generateURL("advanced-search", parameters);
|
||||
}
|
||||
@@ -394,11 +420,15 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
{
|
||||
// if the field is empty, then skip it and try a later one.
|
||||
if (field.getQuery() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the conjunction for everything but the first field.
|
||||
if (fields.indexOf(field) > 0)
|
||||
{
|
||||
query.append(" ").append(field.getConjunction()).append(" ").toString();
|
||||
}
|
||||
|
||||
// Two cases, one if a specific search field is specified or if
|
||||
// ANY is given then just a general search is performed.
|
||||
@@ -449,7 +479,9 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
public ArrayList<SearchField> getSearchFields(Request request) throws UIException
|
||||
{
|
||||
if (this.fields != null)
|
||||
{
|
||||
return this.fields;
|
||||
}
|
||||
|
||||
// Get how many fields to search
|
||||
int numSearchField;
|
||||
@@ -474,31 +506,43 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
|
||||
{
|
||||
field = field.trim();
|
||||
if (field.length() == 0)
|
||||
{
|
||||
field = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (query != null)
|
||||
{
|
||||
query = query.trim();
|
||||
if (query.length() == 0)
|
||||
{
|
||||
query = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (conjunction != null)
|
||||
{
|
||||
conjunction = conjunction.trim();
|
||||
if (conjunction.length() == 0)
|
||||
{
|
||||
conjunction = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null)
|
||||
{
|
||||
field = "ANY";
|
||||
}
|
||||
if (conjunction == null)
|
||||
{
|
||||
conjunction = "AND";
|
||||
}
|
||||
|
||||
if (query != null)
|
||||
fields.add(new SearchField(i,field,query,conjunction));
|
||||
{
|
||||
fields.add(new SearchField(i, field, query, conjunction));
|
||||
}
|
||||
}
|
||||
|
||||
this.fields = fields;
|
||||
|
@@ -100,7 +100,9 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -129,10 +131,14 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
collection = (Collection) dso;
|
||||
|
||||
@@ -161,7 +167,9 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
|
||||
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
@@ -169,7 +177,9 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
|
||||
|
||||
java.util.List<BrowseItem> items = getRecientlySubmittedItems(collection);
|
||||
if(items.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Division home = body.addDivision("collection-home", "primary repository collection");
|
||||
|
||||
@@ -195,12 +205,16 @@ public class CollectionRecentSubmissions extends AbstractDSpaceTransformer imple
|
||||
throws SQLException
|
||||
{
|
||||
if (recentSubmissionItems != null)
|
||||
{
|
||||
return recentSubmissionItems;
|
||||
}
|
||||
|
||||
String source = ConfigurationManager.getProperty("recent.submissions.sort-option");
|
||||
int numRecentSubmissions = ConfigurationManager.getIntProperty("recent.submissions.count", RECENT_SUBMISSIONS);
|
||||
if(numRecentSubmissions == 0)
|
||||
{
|
||||
return new ArrayList<BrowseItem>();
|
||||
}
|
||||
BrowserScope scope = new BrowserScope(context);
|
||||
scope.setCollection(collection);
|
||||
scope.setResultsPerPage(numRecentSubmissions);
|
||||
|
@@ -78,7 +78,9 @@ public class CollectionSearch extends AbstractDSpaceTransformer {
|
||||
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
|
@@ -114,7 +114,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -143,10 +145,14 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
collection = (Collection) dso;
|
||||
|
||||
@@ -176,16 +182,22 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Collection collection = (Collection) dso;
|
||||
|
||||
// Set the page title
|
||||
String name = collection.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(name);
|
||||
}
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
||||
@@ -199,7 +211,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
// Remove the protocol number, i.e. just list 'rss' or' atom'
|
||||
String[] parts = format.split("_");
|
||||
if (parts.length < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String feedFormat = parts[0].trim()+"+xml";
|
||||
|
||||
@@ -217,7 +231,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
|
@@ -177,7 +177,9 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
// Check if we are configured to assume validity.
|
||||
String assumeCacheValidity = ConfigurationManager.getProperty("xmlui.community-list.cache");
|
||||
if (assumeCacheValidity != null)
|
||||
{
|
||||
validity.setAssumedValidityDelay(assumeCacheValidity);
|
||||
}
|
||||
|
||||
this.validity = validity.complete();
|
||||
}
|
||||
@@ -296,9 +298,13 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
|
||||
String name = null;
|
||||
if (dso instanceof Community)
|
||||
{
|
||||
name = ((Community) dso).getMetadata("name");
|
||||
}
|
||||
else if (dso instanceof Collection)
|
||||
{
|
||||
name = ((Collection) dso).getMetadata("name");
|
||||
}
|
||||
|
||||
String url = contextPath + "/handle/"+dso.getHandle();
|
||||
list.addItem().addHighlight("bold").addXref(url, name);
|
||||
@@ -325,7 +331,9 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
if (communityNodes != null && communityNodes.size() > 0)
|
||||
{
|
||||
if (subList == null)
|
||||
subList = list.addList("sub-list-"+dso.getID());
|
||||
{
|
||||
subList = list.addList("sub-list-" + dso.getID());
|
||||
}
|
||||
|
||||
for (TreeNode communityNode : communityNodes)
|
||||
{
|
||||
@@ -354,7 +362,9 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
private TreeNode buildTree(Community[] communities) throws SQLException
|
||||
{
|
||||
if (root != null)
|
||||
{
|
||||
return root;
|
||||
}
|
||||
|
||||
TreeNode newRoot = new TreeNode();
|
||||
|
||||
@@ -370,7 +380,9 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
|
||||
// Short circuit if we have reached our max depth.
|
||||
if (node.getLevel() >= this.depth)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only communities nodes are pushed on the stack.
|
||||
Community community = (Community) node.getDSO();
|
||||
@@ -465,8 +477,10 @@ public class CommunityBrowser extends AbstractDSpaceTransformer implements Cache
|
||||
for (TreeNode node : children)
|
||||
{
|
||||
if (node.dso.getType() == type)
|
||||
{
|
||||
results.add(node);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
@@ -96,7 +96,9 @@ public class CommunityRecentSubmissions extends AbstractDSpaceTransformer implem
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return "0"; // no item, something is wrong
|
||||
{
|
||||
return "0";
|
||||
} // no item, something is wrong
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -116,10 +118,14 @@ public class CommunityRecentSubmissions extends AbstractDSpaceTransformer implem
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
community = (Community) dso;
|
||||
|
||||
@@ -147,7 +153,9 @@ public class CommunityRecentSubmissions extends AbstractDSpaceTransformer implem
|
||||
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Community community = (Community) dso;
|
||||
|
||||
@@ -155,7 +163,9 @@ public class CommunityRecentSubmissions extends AbstractDSpaceTransformer implem
|
||||
|
||||
java.util.List<BrowseItem> items = getRecentlySubmittedItems(community);
|
||||
if(items.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Division lastSubmittedDiv = home
|
||||
.addDivision("community-recent-submission","secondary recent-submission");
|
||||
@@ -181,12 +191,16 @@ public class CommunityRecentSubmissions extends AbstractDSpaceTransformer implem
|
||||
throws SQLException
|
||||
{
|
||||
if (recentSubmittedItems != null)
|
||||
{
|
||||
return recentSubmittedItems;
|
||||
}
|
||||
|
||||
String source = ConfigurationManager.getProperty("recent.submissions.sort-option");
|
||||
int numRecentSubmissions = ConfigurationManager.getIntProperty("recent.submissions.count", RECENT_SUBMISSIONS);
|
||||
if(numRecentSubmissions == 0)
|
||||
{
|
||||
return new ArrayList<BrowseItem>();
|
||||
}
|
||||
BrowserScope scope = new BrowserScope(context);
|
||||
scope.setCommunity(community);
|
||||
scope.setResultsPerPage(numRecentSubmissions);
|
||||
|
@@ -83,7 +83,9 @@ public class CommunitySearch extends AbstractDSpaceTransformer {
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Community community = (Community) dso;
|
||||
|
@@ -121,7 +121,9 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0"; // no item, something is wrong
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -148,10 +150,14 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
community = (Community) dso;
|
||||
|
||||
@@ -192,7 +198,9 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Community community = (Community) dso;
|
||||
@@ -216,7 +224,9 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
// Remove the protocol number, i.e. just list 'rss' or' atom'
|
||||
String[] parts = format.split("_");
|
||||
if (parts.length < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String feedFormat = parts[0].trim()+"+xml";
|
||||
|
||||
@@ -236,7 +246,9 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Community community = (Community) dso;
|
||||
|
@@ -179,7 +179,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (dso != null)
|
||||
{
|
||||
key += "-" + dso.getHandle();
|
||||
}
|
||||
|
||||
return HashUtil.hash(key);
|
||||
}
|
||||
@@ -202,7 +204,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso != null)
|
||||
{
|
||||
validity.add(dso);
|
||||
}
|
||||
|
||||
BrowseInfo info = getBrowseInfo();
|
||||
|
||||
@@ -251,7 +255,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
if (dso != null)
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
|
||||
}
|
||||
|
||||
pageMeta.addTrail().addContent(getTrailMessage(info));
|
||||
}
|
||||
@@ -566,7 +572,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
{
|
||||
// Don't create a previous page link if this is the first page
|
||||
if (info.isFirst())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, String> parameters = new HashMap<String, String>();
|
||||
parameters.putAll(params.getCommonParametersEncoded());
|
||||
@@ -592,7 +600,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
{
|
||||
// Don't create a next page link if this is the last page
|
||||
if (info.isLast())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, String> parameters = new HashMap<String, String>();
|
||||
parameters.putAll(params.getCommonParametersEncoded());
|
||||
@@ -616,7 +626,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
private BrowseParams getUserParams() throws SQLException, UIException
|
||||
{
|
||||
if (this.userParams != null)
|
||||
{
|
||||
return this.userParams;
|
||||
}
|
||||
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
@@ -632,9 +644,13 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
// Are we in a community or collection?
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (dso instanceof Community)
|
||||
{
|
||||
params.scope.setCommunity((Community) dso);
|
||||
}
|
||||
if (dso instanceof Collection)
|
||||
{
|
||||
params.scope.setCollection((Collection) dso);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -690,8 +706,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
params.scope.setOrder(request.getParameter(BrowseParams.ORDER));
|
||||
int offset = RequestUtils.getIntParameter(request, BrowseParams.OFFSET);
|
||||
params.scope.setOffset(offset > 0 ? offset : 0);
|
||||
params.scope.setResultsPerPage(RequestUtils.getIntParameter(request,
|
||||
BrowseParams.RESULTS_PER_PAGE));
|
||||
params.scope.setResultsPerPage(RequestUtils.getIntParameter(request, BrowseParams.RESULTS_PER_PAGE));
|
||||
params.scope.setStartsWith(URLDecode(request.getParameter(BrowseParams.STARTS_WITH)));
|
||||
String filterValue = request.getParameter(BrowseParams.FILTER_VALUE[0]);
|
||||
if (filterValue == null)
|
||||
@@ -707,7 +722,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
|
||||
// Filtering to a value implies this is a second level browse
|
||||
if (params.scope.getFilterValue() != null)
|
||||
{
|
||||
params.scope.setBrowseLevel(1);
|
||||
}
|
||||
|
||||
// if year and perhaps month have been selected, we translate these
|
||||
// into "startsWith"
|
||||
@@ -715,8 +732,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
if (params.year != null && !"".equals(params.year) && !"-1".equals(params.year))
|
||||
{
|
||||
String startsWith = params.year;
|
||||
if ((params.month != null) && !"-1".equals(params.month)
|
||||
&& !"".equals(params.month))
|
||||
if ((params.month != null) && !"-1".equals(params.month) && !"".equals(params.month))
|
||||
{
|
||||
// subtract 1 from the month, so the match works
|
||||
// appropriately
|
||||
@@ -763,7 +779,9 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
private BrowseInfo getBrowseInfo() throws SQLException, UIException
|
||||
{
|
||||
if (this.browseInfo != null)
|
||||
{
|
||||
return this.browseInfo;
|
||||
}
|
||||
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
|
||||
|
@@ -102,8 +102,10 @@ public class AuthenticatedSelector extends AbstractLogEnabled implements
|
||||
EPerson eperson = context.getCurrentUser();
|
||||
|
||||
if (eperson == null)
|
||||
{
|
||||
// No one is authenticated.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (EPERSON.equals(expression))
|
||||
{
|
||||
|
@@ -140,14 +140,20 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
|
||||
authorityInput = parameters.getParameter("authorityInput");
|
||||
String sStart = parameters.getParameter("start");
|
||||
if (sStart != null)
|
||||
{
|
||||
start = atoi(sStart);
|
||||
}
|
||||
String sLimit = parameters.getParameter("limit");
|
||||
if (sLimit != null)
|
||||
{
|
||||
limit = atoi(sLimit);
|
||||
}
|
||||
collection = parameters.getParameter("collection");
|
||||
if (collection == null)
|
||||
{
|
||||
collection = "-1";
|
||||
}
|
||||
}
|
||||
catch (org.apache.avalon.framework.parameters.ParameterException e)
|
||||
{
|
||||
throw new UIException("Missing a required parameter",e);
|
||||
|
@@ -212,19 +212,29 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
|
||||
|
||||
// Check required error conditions
|
||||
if (this.requireSubmission && this.submission == null)
|
||||
throw new ProcessingException("Unable to find submission for id: "+this.id);
|
||||
{
|
||||
throw new ProcessingException("Unable to find submission for id: " + this.id);
|
||||
}
|
||||
|
||||
if (this.requireWorkflow && !(submission instanceof WorkflowItem))
|
||||
throw new ProcessingException("The submission is not a workflow, "+this.id);
|
||||
{
|
||||
throw new ProcessingException("The submission is not a workflow, " + this.id);
|
||||
}
|
||||
|
||||
if (this.requireWorkspace && !(submission instanceof WorkspaceItem))
|
||||
throw new ProcessingException("The submission is not a workspace, "+this.id);
|
||||
{
|
||||
throw new ProcessingException("The submission is not a workspace, " + this.id);
|
||||
}
|
||||
|
||||
if (this.requireStep && stepAndPage.getStep() < 0)
|
||||
{
|
||||
throw new ProcessingException("Step is a required parameter.");
|
||||
}
|
||||
|
||||
if (this.requireHandle && handle == null)
|
||||
{
|
||||
throw new ProcessingException("Handle is a required parameter.");
|
||||
}
|
||||
|
||||
}
|
||||
catch (SQLException sqle)
|
||||
@@ -359,17 +369,23 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
|
||||
|
||||
//only have "<-Previous" button if not first step
|
||||
if(!isFirstStep())
|
||||
{
|
||||
actions.addButton(AbstractProcessingStep.PREVIOUS_BUTTON).setValue(T_previous);
|
||||
}
|
||||
|
||||
//always show "Save/Cancel"
|
||||
actions.addButton(AbstractProcessingStep.CANCEL_BUTTON).setValue(T_save);
|
||||
|
||||
//If last step, show "Complete Submission"
|
||||
if(isLastStep())
|
||||
{
|
||||
actions.addButton(AbstractProcessingStep.NEXT_BUTTON).setValue(T_complete);
|
||||
}
|
||||
else //otherwise, show "Next->"
|
||||
{
|
||||
actions.addButton(AbstractProcessingStep.NEXT_BUTTON).setValue(T_next);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -456,11 +472,15 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
|
||||
|
||||
int step = workspaceItem.getStageReached();
|
||||
if(step<0)
|
||||
step=0;
|
||||
{
|
||||
step = 0;
|
||||
}
|
||||
|
||||
int page = workspaceItem.getPageReached();
|
||||
if (page < 0)
|
||||
{
|
||||
page = 0;
|
||||
}
|
||||
|
||||
return new StepAndPage(step, page);
|
||||
}
|
||||
|
@@ -92,7 +92,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return HashUtil.hash(dso.getHandle());
|
||||
}
|
||||
@@ -120,10 +122,14 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Collection collection = (Collection) dso;
|
||||
|
||||
@@ -161,7 +167,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
|
@@ -123,7 +123,9 @@ public class CCLicenseStep extends AbstractSubmissionStep
|
||||
String exitURL = (https) ? "https://" : "http://";
|
||||
exitURL += server;
|
||||
if (! (port == 80 || port == 443))
|
||||
exitURL += ":"+port;
|
||||
{
|
||||
exitURL += ":" + port;
|
||||
}
|
||||
|
||||
exitURL += actionURL + "?submission-continue="+knot.getId()+"&cc_license_url=[license_url]";
|
||||
|
||||
|
@@ -87,9 +87,13 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
boolean help = false, error = false;
|
||||
if (request.getParameter("help") != null)
|
||||
{
|
||||
help = true;
|
||||
}
|
||||
if (request.getParameter("error") != null)
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
||||
Division div = body.addInteractiveDivision("test", "", "post", "primary");
|
||||
div.setHead("Advanced form test");
|
||||
@@ -115,9 +119,13 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
text.enableAddOperation();
|
||||
text.enableDeleteOperation();
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("This field is in error.");
|
||||
}
|
||||
text.setValue("First is special");
|
||||
Instance instance = text.addInstance();
|
||||
instance.setValue("Second raw");
|
||||
@@ -134,9 +142,13 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
select.setMultiple();
|
||||
select.setSize(4);
|
||||
if (help)
|
||||
{
|
||||
select.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
select.addError("This field is in error.");
|
||||
}
|
||||
select.addOption("one", "uno");
|
||||
select.addOption("two", "dos");
|
||||
select.addOption("three", "tres");
|
||||
@@ -175,19 +187,27 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
composite.enableAddOperation();
|
||||
composite.enableDeleteOperation();
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("This field is composed of two text fields, fill them both in.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
composite.addError("Just the composite is in error.");
|
||||
}
|
||||
text = composite.addText("firstA");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("This is helpfull text.");
|
||||
}
|
||||
text.addInstance().setValue("1, Raw A");
|
||||
text.addInstance().setValue("2, Raw A");
|
||||
text.addInstance().setValue("3, Raw A");
|
||||
|
||||
text = composite.addText("secondA");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("This is helpfull text.");
|
||||
}
|
||||
text.addInstance().setValue("1, Raw B");
|
||||
text.addInstance().setValue("2, Raw B");
|
||||
text.addInstance().setValue("3, Raw B");
|
||||
@@ -198,13 +218,19 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
composite.enableAddOperation();
|
||||
composite.enableDeleteOperation();
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("This field is composed of a select and text field, select one and type the other.");
|
||||
}
|
||||
|
||||
select = composite.addSelect("selectB");
|
||||
if (help)
|
||||
{
|
||||
select.setHelp("Me, me, me..... select me!");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
select.addError("The composite elements are in error.");
|
||||
}
|
||||
select.addOption("one","uno");
|
||||
select.addOption("two","dos");
|
||||
select.addOption("three","tres");
|
||||
@@ -218,9 +244,13 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
|
||||
text = composite.addText("TextB");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("Yay, yet another text field");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("The composite elements are in error.");
|
||||
}
|
||||
text.addInstance().setValue("1, Raw B");
|
||||
text.addInstance().setValue("2, Raw B");
|
||||
text.addInstance().setValue("3, Raw B");
|
||||
@@ -235,15 +265,23 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
composite.enableAddOperation();
|
||||
composite.enableDeleteOperation();
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("The date when something happened.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
composite.setHelp("The composite is in error.");
|
||||
}
|
||||
|
||||
text = composite.addText("day");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("day");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.setHelp("The first text field is in error.");
|
||||
}
|
||||
text.setSize(4,2);
|
||||
|
||||
text.addInstance().setValue("1");
|
||||
@@ -254,7 +292,9 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
|
||||
select = composite.addSelect("month");
|
||||
if (error)
|
||||
{
|
||||
select.setHelp("The select box is in error.");
|
||||
}
|
||||
select.addOption("","(Select Month)");
|
||||
select.addOption(1,"January");
|
||||
select.addOption(2,"Feburary");
|
||||
@@ -279,9 +319,13 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
text = composite.addText("year");
|
||||
text.setSize(4,4);
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("year");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.setHelp("The second text field is in error.");
|
||||
}
|
||||
text.addInstance().setValue("2001");
|
||||
text.addInstance().setValue("2002");
|
||||
text.addInstance().setValue("2003");
|
||||
@@ -301,13 +345,19 @@ public class AdvancedFormTest extends AbstractDSpaceTransformer {
|
||||
private String makeURL(boolean help, boolean error)
|
||||
{
|
||||
if (help && error)
|
||||
{
|
||||
return "?help&error";
|
||||
}
|
||||
|
||||
if (help)
|
||||
{
|
||||
return "?help";
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
return "?error";
|
||||
}
|
||||
|
||||
return "?neither";
|
||||
}
|
||||
|
@@ -96,9 +96,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
boolean help = false, error = false;
|
||||
if (request.getParameter("help") != null)
|
||||
{
|
||||
help = true;
|
||||
}
|
||||
if (request.getParameter("error") != null)
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
||||
|
||||
Division div = body.addInteractiveDivision("test", "", "post", "primary");
|
||||
@@ -106,14 +110,22 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
div.addPara("There are two options you can use to control how this page is generated. First is the help parameter, if this is present then help text will be provided for all fields. Next is the error parameter, if it is provided then all fields will be generated in error conditions.");
|
||||
|
||||
if (help)
|
||||
div.addPara().addXref(makeURL(false,error),"Turn help OFF");
|
||||
{
|
||||
div.addPara().addXref(makeURL(false, error), "Turn help OFF");
|
||||
}
|
||||
else
|
||||
div.addPara().addXref(makeURL(true,error),"Turn help ON");
|
||||
{
|
||||
div.addPara().addXref(makeURL(true, error), "Turn help ON");
|
||||
}
|
||||
|
||||
if (error)
|
||||
div.addPara().addXref(makeURL(help,false),"Turn errors OFF");
|
||||
{
|
||||
div.addPara().addXref(makeURL(help, false), "Turn errors OFF");
|
||||
}
|
||||
else
|
||||
div.addPara().addXref(makeURL(help,true),"Turn errors ON");
|
||||
{
|
||||
div.addPara().addXref(makeURL(help, true), "Turn errors ON");
|
||||
}
|
||||
|
||||
|
||||
List list = div.addList("fieldTest",List.TYPE_FORM);
|
||||
@@ -123,70 +135,102 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Text text = list.addItem().addText("text");
|
||||
text.setLabel("Text");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("This field is in error.");
|
||||
}
|
||||
text.setValue("Current raw value");
|
||||
|
||||
// Long help
|
||||
Text longHelp = list.addItem().addText("longHelp");
|
||||
longHelp.setLabel("Long Help");
|
||||
if (help)
|
||||
{
|
||||
longHelp.setHelp("This is a really long help message. It could potentially be a paragraph of material, really really long. Actually we don't know how long it can be because there is no upper limit on it! Although if you do find your self adding a long help message consider whether your user will actually read any of this, my bet is that they won't. However we still need to support these really, really, really, long messages that may break across multiple lines!");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
longHelp.addError("This field is in error.");
|
||||
}
|
||||
longHelp.setValue("Current raw value");
|
||||
|
||||
// Long error
|
||||
Text longError = list.addItem().addText("longError");
|
||||
longError.setLabel("Long Error");
|
||||
if (help)
|
||||
{
|
||||
longError.setHelp("TThis is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
longError.addError("This field is very much is serious trouble, it's so horrible wrong that i now have to give you a very long stern message that may break across multiple lines! To fix this problem you should examine what you are attempting to do and consider other factors like what might have lead you to this path vs another path. Are you sure you even want this field or might another one work just as well?");
|
||||
}
|
||||
longError.setValue("Current raw value");
|
||||
|
||||
// Text Area Field
|
||||
TextArea textArea = list.addItem().addTextArea("textarea");
|
||||
textArea.setLabel("Text Area");
|
||||
if (help)
|
||||
{
|
||||
textArea.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
textArea.addError("This field is in error.");
|
||||
}
|
||||
textArea.setValue("This is the raw value");
|
||||
|
||||
// Blank Text Area Field
|
||||
TextArea emptyTextArea = list.addItem().addTextArea("emptyTextarea");
|
||||
emptyTextArea.setLabel("Empty Text Area");
|
||||
if (help)
|
||||
{
|
||||
emptyTextArea.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
emptyTextArea.addError("This field is in error.");
|
||||
}
|
||||
|
||||
|
||||
// Password field
|
||||
Password password = list.addItem().addPassword("password");
|
||||
password.setLabel("password");
|
||||
if (help)
|
||||
{
|
||||
password.setHelp("This is helpfull text.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
password.addError("This field is in error.");
|
||||
}
|
||||
|
||||
// Hidden field
|
||||
Hidden hidden = list.addItem().addHidden("hidden");
|
||||
hidden.setLabel("Hidden");
|
||||
hidden.setValue("You can not see this.");
|
||||
if (help)
|
||||
{
|
||||
hidden.setHelp("This is hidden help?");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
hidden.addError("This a hidden error - I have no idea what this means?");
|
||||
}
|
||||
|
||||
// Checkbox field
|
||||
CheckBox checkBox = list.addItem().addCheckBox("fruit");
|
||||
if (help)
|
||||
{
|
||||
checkBox.setHelp("Select all the fruits that you like to eat");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
checkBox.addError("You are incorrect you actualy do like Tootse Rolls.");
|
||||
}
|
||||
checkBox.setLabel("fruits");
|
||||
checkBox.addOption("apple","Apples");
|
||||
checkBox.addOption(true,"orange","Oranges");
|
||||
@@ -199,9 +243,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Radio radio = list.addItem().addRadio("sex");
|
||||
radio.setLabel("Football colors");
|
||||
if (help)
|
||||
{
|
||||
radio.setHelp("Select the colors of the best (college) football team.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
radio.addError("Error, Maroon & White is the only acceptable answer.");
|
||||
}
|
||||
radio.addOption("ut","Burnt Orange & White");
|
||||
radio.addOption(true,"tamu","Maroon & White");
|
||||
radio.addOption("ttu","Tech Red & Black");
|
||||
@@ -213,17 +261,25 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
File file = list.addItem().addFile("file");
|
||||
file.setLabel("File");
|
||||
if (help)
|
||||
{
|
||||
file.setHelp("Upload a file.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
file.addError("This field is in error.");
|
||||
}
|
||||
|
||||
// Select (single)
|
||||
Select select = list.addItem().addSelect("select");
|
||||
select.setLabel("Select (single)");
|
||||
if (help)
|
||||
{
|
||||
select.setHelp("Select one of the options");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
select.addError("This field is in error.");
|
||||
}
|
||||
select.addOption("one","uno");
|
||||
select.addOption("two","dos");
|
||||
select.addOption("three","tres");
|
||||
@@ -236,9 +292,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
select.setMultiple();
|
||||
select.setSize(4);
|
||||
if (help)
|
||||
{
|
||||
select.setHelp("Select one or more options");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
select.addError("This field is in error.");
|
||||
}
|
||||
select.addOption("one","uno");
|
||||
select.addOption("two","dos");
|
||||
select.addOption("three","tres");
|
||||
@@ -257,9 +317,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
button.setLabel("Button");
|
||||
button.setValue("When you touch me I do things, lots of things");
|
||||
if (help)
|
||||
{
|
||||
button.setHelp("Submit buttons allow the user to submit the form.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
button.addError("This button is in error.");
|
||||
}
|
||||
|
||||
// Non-field-unlabeled-item
|
||||
list.addItem().addContent("The following fields are all various use cases of composites. Also note that this item is an item inside a list of type form that 1) does not contain a field and 2) does not have a label.");
|
||||
@@ -268,32 +332,46 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Composite composite = list.addItem().addComposite("composite-2text");
|
||||
composite.setLabel("Composite (two text fields)");
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("I am the help for the entire composite");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
composite.addError("Just the composite is in error");
|
||||
}
|
||||
text = composite.addText("partA");
|
||||
text.setLabel("Part A");
|
||||
text.setValue("Value for part A");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("Part A");
|
||||
}
|
||||
text = composite.addText("partB");
|
||||
text.setLabel("Part B");
|
||||
text.setValue("Value for part B");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("Part B");
|
||||
}
|
||||
|
||||
// composite select & text fields
|
||||
composite = list.addItem().addComposite("compositeB");
|
||||
composite.setLabel("Composite (select & text fields)");
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("This field is composed of a select and text field, select one and type the other.");
|
||||
}
|
||||
|
||||
select = composite.addSelect("selectB");
|
||||
select.setLabel("Numbers");
|
||||
if (help)
|
||||
{
|
||||
select.setHelp("Me, me, me..... select me!");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
select.addError("The composite components are in error.");
|
||||
}
|
||||
select.addOption("one","uno");
|
||||
select.addOption("two","dos");
|
||||
select.addOption("three","tres");
|
||||
@@ -304,34 +382,50 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
text = composite.addText("TextB");
|
||||
text.setLabel("Spanish Numbers");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("Yay, yet another text field");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("The composite components are in error.");
|
||||
}
|
||||
|
||||
|
||||
// Composite
|
||||
composite = list.addItem().addComposite("composite-date");
|
||||
composite.setLabel("Composite (date)");
|
||||
if (help)
|
||||
{
|
||||
composite.setHelp("The data the item was published.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
composite.addError("The date is in error.");
|
||||
}
|
||||
|
||||
text = composite.addText("year");
|
||||
text.setLabel("Year");
|
||||
text.setSize(4,4);
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("year");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("The year is in error");
|
||||
}
|
||||
|
||||
|
||||
select = composite.addSelect("month");
|
||||
select.setLabel("Month");
|
||||
if (error)
|
||||
{
|
||||
select.addError("The month is in error");
|
||||
}
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("month");
|
||||
}
|
||||
select.addOption("","(Select Month)");
|
||||
select.addOption(1,"January");
|
||||
select.addOption(2,"Feburary");
|
||||
@@ -350,9 +444,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
text = composite.addText("day");
|
||||
text.setLabel("Day");
|
||||
if (help)
|
||||
{
|
||||
text.setHelp("day");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
text.addError("The day is in error.");
|
||||
}
|
||||
text.setSize(4,2);
|
||||
|
||||
// Buttons one typical finds at the end of forums
|
||||
@@ -377,16 +475,24 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Text name = identity.addItem().addText("name");
|
||||
name.setLabel("Username");
|
||||
if (help)
|
||||
{
|
||||
name.setHelp("The username you wish to chooose");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
name.addError("Sorry, that username is allready used by another user.");
|
||||
}
|
||||
|
||||
Composite ssn = identity.addItem().addComposite("ssn");
|
||||
ssn.setLabel("SSN");
|
||||
if (help)
|
||||
{
|
||||
ssn.setHelp("Your Social Security Number, really we won't use it for anything bad.... you can trust me.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
ssn.addError("The SSN you entered is invalid.");
|
||||
}
|
||||
Text ssn1 = ssn.addText("ssn1");
|
||||
ssn1.setSize(4,4);
|
||||
Text ssn2 = ssn.addText("ssn2");
|
||||
@@ -400,9 +506,13 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
CheckBox intrest = intrests.addItem().addCheckBox("intrests");
|
||||
intrest.setLabel("Intrests");
|
||||
if (help)
|
||||
{
|
||||
intrest.setHelp("Select all topics which are of intrests to you.");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
intrest.addError("You're intrests are in error?");
|
||||
}
|
||||
intrest.addOption("DL","Digital Libraries");
|
||||
intrest.addOption("HT","Hypertexts");
|
||||
intrest.addOption("IM","Information Managment");
|
||||
@@ -415,16 +525,24 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
Text institution = affiliation.addItem().addText("institution");
|
||||
institution.setLabel("Institution");
|
||||
if (help)
|
||||
{
|
||||
name.setHelp("The institution you are affiliated with");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
name.addError("That institution is an invalid option.");
|
||||
}
|
||||
|
||||
Radio geography = affiliation.addItem().addRadio("geography");
|
||||
geography.setLabel("Geography");
|
||||
if (help)
|
||||
{
|
||||
geography.setHelp("Select your institution's geographical region");
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
geography.addError("Your entry is invalid.");
|
||||
}
|
||||
geography.addOption("na","North America");
|
||||
geography.addOption("sa","South America");
|
||||
geography.addOption("eu","Europe");
|
||||
@@ -445,13 +563,19 @@ public class BasicFormTest extends AbstractDSpaceTransformer
|
||||
private String makeURL(boolean help, boolean error)
|
||||
{
|
||||
if (help && error)
|
||||
{
|
||||
return "?help&error";
|
||||
}
|
||||
|
||||
if (help)
|
||||
{
|
||||
return "?help";
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
return "?error";
|
||||
}
|
||||
|
||||
return "?neither";
|
||||
}
|
||||
|
@@ -80,13 +80,19 @@ public class AJAXMenuGenerator extends AbstractGenerator
|
||||
String field = parameters.getParameter("field",null);
|
||||
String sstart = parameters.getParameter("start",null);
|
||||
if (sstart != null && sstart.length() > 0)
|
||||
{
|
||||
start = Integer.parseInt(sstart);
|
||||
}
|
||||
String slimit = parameters.getParameter("limit",null);
|
||||
if (slimit != null && slimit.length() > 0)
|
||||
{
|
||||
limit = Integer.parseInt(slimit);
|
||||
}
|
||||
String scoll = parameters.getParameter("collection",null);
|
||||
if (scoll != null && scoll.length() > 0)
|
||||
{
|
||||
collection = Integer.parseInt(scoll);
|
||||
}
|
||||
String query = parameters.getParameter("query",null);
|
||||
|
||||
// localization
|
||||
|
@@ -113,7 +113,9 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
this.contextPath = request.getContextPath();
|
||||
if (contextPath == null)
|
||||
{
|
||||
contextPath = "/";
|
||||
}
|
||||
|
||||
this.servletPath = request.getServletPath();
|
||||
this.sitemapURI = request.getSitemapURI();
|
||||
@@ -175,7 +177,9 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
|
||||
public ObjectManager getObjectManager()
|
||||
{
|
||||
if (this.objectManager == null)
|
||||
{
|
||||
this.objectManager = new DSpaceObjectManager();
|
||||
}
|
||||
return this.objectManager;
|
||||
}
|
||||
|
||||
@@ -184,7 +188,9 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
|
||||
{
|
||||
String name = this.getClass().getName();
|
||||
if (name.startsWith(NAME_TRIM))
|
||||
{
|
||||
name = name.substring(NAME_TRIM.length());
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -198,7 +204,9 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
|
||||
public static String URLEncode(String unencodedString) throws UIException
|
||||
{
|
||||
if (unencodedString == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -221,7 +229,9 @@ public abstract class AbstractDSpaceTransformer extends AbstractWingTransformer
|
||||
public static String URLDecode(String encodedString) throws UIException
|
||||
{
|
||||
if (encodedString == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -94,7 +94,9 @@ public class AspectGenerator extends FileGenerator implements
|
||||
|
||||
// If no aspect ID found, assume it's the first one.
|
||||
if (aspectID == null)
|
||||
{
|
||||
aspectID = 0;
|
||||
}
|
||||
|
||||
// Get the aspect ID of the next aspect & store it for later.
|
||||
aspectID++;
|
||||
|
@@ -348,9 +348,11 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
for (ResourcePolicy rp : AuthorizeManager.getPoliciesActionFilter(context, bitstream, Constants.READ))
|
||||
{
|
||||
if (rp.getGroupID() == 0)
|
||||
{
|
||||
this.isAnonymouslyReadable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Trim any path information from the bitstream
|
||||
if (bitstreamName != null && bitstreamName.length() >0 )
|
||||
@@ -404,7 +406,9 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
private Bitstream findBitstreamBySequence(Item item, int sequence) throws SQLException
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Bundle[] bundles = item.getBundles();
|
||||
for (Bundle bundle : bundles)
|
||||
@@ -435,12 +439,16 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
private Bitstream findBitstreamByName(Item item, String name) throws SQLException
|
||||
{
|
||||
if (name == null || item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Determine our the maximum number of directories that will be removed for a path.
|
||||
int maxDepthPathSearch = 3;
|
||||
if (ConfigurationManager.getProperty("xmlui.html.max-depth-guess") != null)
|
||||
{
|
||||
maxDepthPathSearch = ConfigurationManager.getIntProperty("xmlui.html.max-depth-guess");
|
||||
}
|
||||
|
||||
// Search for the named bitstream on this item. Each time through the loop
|
||||
// a directory is removed from the name until either our maximum depth is
|
||||
@@ -469,9 +477,11 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
int indexOfSlash = name.indexOf('/');
|
||||
|
||||
if (indexOfSlash < 0)
|
||||
{
|
||||
// No more directories to remove from the path, so return null for no
|
||||
// bitstream found.
|
||||
return null;
|
||||
}
|
||||
|
||||
name = name.substring(indexOfSlash+1);
|
||||
|
||||
@@ -481,7 +491,9 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
{
|
||||
int indexOfLastSlash = name.lastIndexOf('/');
|
||||
if (indexOfLastSlash > -1)
|
||||
name = name.substring(indexOfLastSlash+1);
|
||||
{
|
||||
name = name.substring(indexOfLastSlash + 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -510,7 +522,9 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
ProcessingException
|
||||
{
|
||||
if (this.bitstreamInputStream == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only allow If-Modified-Since protocol if request is from a spider
|
||||
// since response headers would encourage a browser to cache results
|
||||
@@ -553,8 +567,9 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
// Only encourage caching if this is not a restricted resource, i.e.
|
||||
// if it is accessed anonymously or is readable by Anonymous:
|
||||
if (isAnonymouslyReadable)
|
||||
response.setDateHeader("Expires", System.currentTimeMillis()
|
||||
+ expires);
|
||||
{
|
||||
response.setDateHeader("Expires", System.currentTimeMillis() + expires);
|
||||
}
|
||||
|
||||
// If this is a large bitstream then tell the browser it should treat it as a download.
|
||||
int threshold = ConfigurationManager.getIntProperty("xmlui.content_disposition_threshold");
|
||||
@@ -566,10 +581,14 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
try {
|
||||
String agent = request.getHeader("USER-AGENT");
|
||||
if (agent != null && agent.contains("MSIE"))
|
||||
name = URLEncoder.encode(name,"UTF8");
|
||||
{
|
||||
name = URLEncoder.encode(name, "UTF8");
|
||||
}
|
||||
else if (agent != null && agent.contains("Mozilla"))
|
||||
{
|
||||
name = MimeUtility.encodeText(name, "UTF8", "B");
|
||||
}
|
||||
}
|
||||
catch (UnsupportedEncodingException see)
|
||||
{
|
||||
// do nothing
|
||||
|
@@ -132,7 +132,9 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
protected String getMETSOBJID()
|
||||
{
|
||||
if (dso.getHandle() != null)
|
||||
return contextPath+"/handle/" + dso.getHandle();
|
||||
{
|
||||
return contextPath + "/handle/" + dso.getHandle();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -359,23 +361,21 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (String dmdType : dmdTypes)
|
||||
{
|
||||
// If DIM was requested then it was generated above without using
|
||||
// the crosswalk API. So we can skip this one.
|
||||
if ("DIM".equals(dmdType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
DisseminationCrosswalk crosswalk = getDisseminationCrosswalk(dmdType);
|
||||
|
||||
if (crosswalk == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String dmdID = getGenericID("dmd_");
|
||||
// Add our id to the list.
|
||||
@@ -513,7 +513,6 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
{
|
||||
AttributeMap attributes;
|
||||
|
||||
|
||||
// ///////////////////////
|
||||
// Start a new structure map
|
||||
attributes = new AttributeMap();
|
||||
@@ -527,7 +526,9 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
attributes.put("TYPE", getMETSLabel());
|
||||
// add references to the Descriptive metadata
|
||||
if (dmdSecIDS != null)
|
||||
{
|
||||
attributes.put("DMDID", dmdSecIDS.toString());
|
||||
}
|
||||
startElement(METS,"div",attributes);
|
||||
|
||||
|
||||
@@ -612,7 +613,9 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
private int countOccurances(String string, char character)
|
||||
{
|
||||
if (string == null || string.length() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fromIndex = -1;
|
||||
int count = 0;
|
||||
@@ -622,7 +625,9 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
fromIndex = string.indexOf('>', fromIndex+1);
|
||||
|
||||
if (fromIndex == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
@@ -643,13 +648,17 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
{
|
||||
// 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++;
|
||||
}
|
||||
|
||||
@@ -675,9 +684,13 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
attributes.put("mdschema",schema);
|
||||
attributes.put("element", element);
|
||||
if (qualifier != null)
|
||||
{
|
||||
attributes.put("qualifier", qualifier);
|
||||
}
|
||||
if (language != null)
|
||||
{
|
||||
attributes.put("language", language);
|
||||
}
|
||||
startElement(DIM,"field",attributes);
|
||||
|
||||
// Only try and add the metadata's value, but only if it is non null.
|
||||
@@ -697,27 +710,39 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
{
|
||||
// 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);
|
||||
|
@@ -204,7 +204,9 @@ public class AuthenticationUtil
|
||||
EPerson eperson) throws SQLException
|
||||
{
|
||||
if (eperson == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
|
||||
@@ -328,25 +330,35 @@ public class AuthenticationUtil
|
||||
{
|
||||
// Only allow loginAs if the administrator has allowed it.
|
||||
if (!ConfigurationManager.getBooleanProperty("xmlui.user.assumelogin", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only super administrators can login as someone else.
|
||||
if (!AuthorizeManager.isAdmin(context))
|
||||
{
|
||||
throw new AuthorizeException("xmlui.utils.AuthenticationUtil.onlyAdmins");
|
||||
}
|
||||
|
||||
// Just to be double be sure, make sure the administrator
|
||||
// is the one who actually authenticated himself.
|
||||
HttpSession session = request.getSession(false);
|
||||
Integer authenticatedID = (Integer) session.getAttribute(AUTHENTICATED_USER_ID);
|
||||
if (context.getCurrentUser().getID() != authenticatedID)
|
||||
{
|
||||
throw new AuthorizeException("xmlui.utils.AuthenticationUtil.onlyAuthenticatedAdmins");
|
||||
}
|
||||
|
||||
// You may not assume the login of another super administrator
|
||||
if (loginAs == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Group administrators = Group.find(context,1);
|
||||
if (administrators.isMember(loginAs))
|
||||
{
|
||||
throw new AuthorizeException("xmlui.utils.AuthenticationUtil.notAnotherAdmin");
|
||||
}
|
||||
|
||||
// Success, allow the user to login as another user.
|
||||
context.setCurrentUser(loginAs);
|
||||
|
@@ -263,7 +263,9 @@ public abstract class AbstractWingTransformer extends AbstractTransformer
|
||||
|
||||
// Update any attributes of this merged element.
|
||||
if (child != null)
|
||||
{
|
||||
attributes = child.merge(attributes);
|
||||
}
|
||||
stack.push(child);
|
||||
}
|
||||
// Send off the event with nothing modified except for the
|
||||
|
@@ -88,7 +88,9 @@ public abstract class AbstractWingElement implements WingElement
|
||||
protected AbstractWingElement(WingContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new NullPointerException("Context may not be null.");
|
||||
}
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@@ -145,8 +147,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (parameter == null || parameter.equals(""))
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure the parameter is not null or an empty string.
|
||||
@@ -160,8 +164,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (parameter == null)
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure that the parameter is a member of one of the options.
|
||||
@@ -180,11 +186,17 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (parameter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (String test : options)
|
||||
{
|
||||
if (parameter.equals(test))
|
||||
return; // short circuit the method call.
|
||||
{
|
||||
return;
|
||||
}
|
||||
} // short circuit the method call.
|
||||
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
@@ -204,8 +216,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (parameter <= greater)
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure that the parameter is LESS THAN (note: not equal to)
|
||||
@@ -222,8 +236,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (parameter >= lesser)
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure that the boolean test value is false.
|
||||
@@ -237,8 +253,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (test)
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure that the boolean test value is true.
|
||||
@@ -252,8 +270,10 @@ public abstract class AbstractWingElement implements WingElement
|
||||
throws WingInvalidArgument
|
||||
{
|
||||
if (!test)
|
||||
{
|
||||
throw new WingInvalidArgument(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the SAX event to start this element.
|
||||
@@ -404,7 +424,9 @@ public abstract class AbstractWingElement implements WingElement
|
||||
{
|
||||
|
||||
if (attributes == null)
|
||||
{
|
||||
attributes = new AttributesImpl();
|
||||
}
|
||||
if (attributeMap != null)
|
||||
{
|
||||
// Figure out the namespace issue
|
||||
|
@@ -170,9 +170,13 @@ public class Body extends AbstractWingElement implements WingMergeableElement
|
||||
Attributes attributes) throws SAXException, WingException
|
||||
{
|
||||
if (!WingConstants.DRI.URI.equals(namespace))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!E_BODY.equals(localName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -197,7 +201,9 @@ public class Body extends AbstractWingElement implements WingMergeableElement
|
||||
for (Division candidate : divisions)
|
||||
{
|
||||
if (candidate.mergeEqual(namespace, localName, qName, attributes))
|
||||
{
|
||||
found = candidate;
|
||||
}
|
||||
|
||||
}
|
||||
divisions.remove(found);
|
||||
@@ -235,14 +241,20 @@ public class Body extends AbstractWingElement implements WingMergeableElement
|
||||
throws SAXException
|
||||
{
|
||||
if (!merged)
|
||||
{
|
||||
startElement(contentHandler, namespaces, E_BODY, null);
|
||||
}
|
||||
|
||||
for (Division division : divisions)
|
||||
{
|
||||
division.toSAX(contentHandler, lexicalHandler, namespaces);
|
||||
}
|
||||
|
||||
if (!merged)
|
||||
{
|
||||
endElement(contentHandler, namespaces, E_BODY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dispose
|
||||
|
@@ -161,15 +161,23 @@ public class Cell extends RichTextContainer implements StructuralElement
|
||||
}
|
||||
|
||||
if (role != null)
|
||||
{
|
||||
attributes.put(A_ROLE, role);
|
||||
}
|
||||
// else
|
||||
// attributes.put(A_ROLE, ROLE_DATA);
|
||||
if (rows > 0)
|
||||
{
|
||||
attributes.put(A_ROWS, rows);
|
||||
}
|
||||
if (cols > 0)
|
||||
{
|
||||
attributes.put(A_COLS, cols);
|
||||
}
|
||||
if (rend != null)
|
||||
{
|
||||
attributes.put(A_RENDER, rend);
|
||||
}
|
||||
|
||||
startElement(contentHandler, namespaces, E_CELL, attributes);
|
||||
super.toSAX(contentHandler, lexicalHandler, namespaces);
|
||||
@@ -182,9 +190,13 @@ public class Cell extends RichTextContainer implements StructuralElement
|
||||
public void dispose()
|
||||
{
|
||||
for (AbstractWingElement content : contents)
|
||||
{
|
||||
content.dispose();
|
||||
}
|
||||
if (contents != null)
|
||||
{
|
||||
contents.clear();
|
||||
}
|
||||
contents = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
@@ -147,7 +147,9 @@ public class CheckBox extends Field
|
||||
throws WingException
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
setOptionSelected(returnValue);
|
||||
}
|
||||
return addOption(returnValue);
|
||||
}
|
||||
|
||||
@@ -180,7 +182,9 @@ public class CheckBox extends Field
|
||||
public void addOption(boolean selected,String returnValue, String characters) throws WingException
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
setOptionSelected(returnValue);
|
||||
}
|
||||
addOption(returnValue,characters);
|
||||
}
|
||||
|
||||
@@ -213,7 +217,9 @@ public class CheckBox extends Field
|
||||
public void addOption(boolean selected, int returnValue, String characters) throws WingException
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
setOptionSelected(returnValue);
|
||||
}
|
||||
addOption(returnValue,characters);
|
||||
}
|
||||
|
||||
@@ -246,7 +252,9 @@ public class CheckBox extends Field
|
||||
public void addOption(boolean selected, String returnValue, Message message) throws WingException
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
setOptionSelected(returnValue);
|
||||
}
|
||||
addOption(returnValue,message);
|
||||
}
|
||||
|
||||
@@ -279,7 +287,9 @@ public class CheckBox extends Field
|
||||
public void addOption(boolean selected, int returnValue, Message message) throws WingException
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
setOptionSelected(returnValue);
|
||||
}
|
||||
addOption(returnValue,message);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user