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