mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
[DS-1390] stage 1: move license, email texts, news out of Configuration Manager.
This commit is contained in:
@@ -31,6 +31,7 @@ import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.I18nUtil;
|
||||
import org.dspace.core.LicenseManager;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.event.Event;
|
||||
@@ -52,7 +53,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
* database after calling <code>update</code>. The default group of
|
||||
* submitters is slightly different - creating or removing this has instant
|
||||
* effect.
|
||||
*
|
||||
*
|
||||
* @author Robert Tansley
|
||||
* @version $Revision$
|
||||
*/
|
||||
@@ -96,7 +97,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Construct a collection with the given table row
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* the context this object exists in
|
||||
* @param row
|
||||
@@ -139,7 +140,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
submitters = groupFromColumn("submitter");
|
||||
admins = groupFromColumn("admin");
|
||||
|
||||
|
||||
// Get our Handle if any
|
||||
handle = HandleManager.findHandle(context, this);
|
||||
|
||||
@@ -153,12 +154,12 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get a collection from the database. Loads in the metadata
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* DSpace context object
|
||||
* @param id
|
||||
* ID of the collection
|
||||
*
|
||||
*
|
||||
* @return the collection, or null if the ID is invalid.
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -199,10 +200,10 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Create a new collection, with a new ID. This method is not public, and
|
||||
* does not check authorisation.
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* DSpace context object
|
||||
*
|
||||
*
|
||||
* @return the newly created collection
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
@@ -288,10 +289,10 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Get all collections in the system. These are alphabetically sorted by
|
||||
* collection name.
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* DSpace context object
|
||||
*
|
||||
*
|
||||
* @return the collections in the system
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -339,7 +340,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get the in_archive items in this collection. The order is indeterminate.
|
||||
*
|
||||
*
|
||||
* @return an iterator over the items in the collection.
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -358,7 +359,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get all the items in this collection. The order is indeterminate.
|
||||
*
|
||||
*
|
||||
* @return an iterator over the items in the collection.
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -376,7 +377,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get the internal ID of this collection
|
||||
*
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
public int getID()
|
||||
@@ -402,36 +403,36 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get the value of a metadata field
|
||||
*
|
||||
*
|
||||
* @param field
|
||||
* the name of the metadata field to get
|
||||
*
|
||||
*
|
||||
* @return the value of the metadata field
|
||||
*
|
||||
*
|
||||
* @exception IllegalArgumentException
|
||||
* if the requested metadata field doesn't exist
|
||||
*/
|
||||
public String getMetadata(String field)
|
||||
{
|
||||
String metadata = collectionRow.getStringColumn(field);
|
||||
return (metadata == null) ? "" : metadata;
|
||||
return (metadata == null) ? "" : metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a metadata value
|
||||
*
|
||||
*
|
||||
* @param field
|
||||
* the name of the metadata field to get
|
||||
* @param value
|
||||
* value to set the field to
|
||||
*
|
||||
*
|
||||
* @exception IllegalArgumentException
|
||||
* if the requested metadata field doesn't exist
|
||||
* @exception MissingResourceException
|
||||
*/
|
||||
public void setMetadata(String field, String value) throws MissingResourceException
|
||||
{
|
||||
if ((field.trim()).equals("name")
|
||||
if ((field.trim()).equals("name")
|
||||
&& (value == null || value.trim().equals("")))
|
||||
{
|
||||
try
|
||||
@@ -443,9 +444,9 @@ public class Collection extends DSpaceObject
|
||||
value = "Untitled";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set metadata field to null if null
|
||||
|
||||
/*
|
||||
* Set metadata field to null if null
|
||||
* and trim strings to eliminate excess
|
||||
* whitespace.
|
||||
*/
|
||||
@@ -457,7 +458,7 @@ public class Collection extends DSpaceObject
|
||||
{
|
||||
collectionRow.setColumn(field, value.trim());
|
||||
}
|
||||
|
||||
|
||||
modifiedMetadata = true;
|
||||
addDetails(field);
|
||||
}
|
||||
@@ -470,7 +471,7 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Get the logo for the collection. <code>null</code> is returned if the
|
||||
* collection does not have a logo.
|
||||
*
|
||||
*
|
||||
* @return the logo of the collection, or <code>null</code>
|
||||
*/
|
||||
public Bitstream getLogo()
|
||||
@@ -546,10 +547,10 @@ public class Collection extends DSpaceObject
|
||||
* Note that while the new group is created in the database, the association
|
||||
* between the group and the collection is not written until
|
||||
* <code>update</code> is called.
|
||||
*
|
||||
*
|
||||
* @param step
|
||||
* the step (1-3) of the workflow to create or get the group for
|
||||
*
|
||||
*
|
||||
* @return the workflow group associated with this collection
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
@@ -581,7 +582,7 @@ public class Collection extends DSpaceObject
|
||||
* Set the workflow group corresponding to a particular workflow step.
|
||||
* <code>null</code> can be passed in if there should be no associated
|
||||
* group for that workflow step; any existing group is NOT deleted.
|
||||
*
|
||||
*
|
||||
* @param step
|
||||
* the workflow step (1-3)
|
||||
* @param g
|
||||
@@ -606,10 +607,10 @@ public class Collection extends DSpaceObject
|
||||
* Get the the workflow group corresponding to a particular workflow step.
|
||||
* This returns <code>null</code> if there is no group associated with
|
||||
* this collection for the given step.
|
||||
*
|
||||
*
|
||||
* @param step
|
||||
* the workflow step (1-3)
|
||||
*
|
||||
*
|
||||
* @return the group of reviewers or <code>null</code>
|
||||
*/
|
||||
public Group getWorkflowGroup(int step)
|
||||
@@ -622,7 +623,7 @@ public class Collection extends DSpaceObject
|
||||
* either the newly created group or the previously existing one. Note that
|
||||
* other groups may also be allowed to submit to this collection by the
|
||||
* authorization system.
|
||||
*
|
||||
*
|
||||
* @return the default group of submitters associated with this collection
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
@@ -645,7 +646,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
// register this as the submitter group
|
||||
collectionRow.setColumn("submitter", submitters.getID());
|
||||
|
||||
|
||||
AuthorizeManager.addPolicy(ourContext, this, Constants.ADD, submitters);
|
||||
|
||||
modified = true;
|
||||
@@ -653,9 +654,9 @@ public class Collection extends DSpaceObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the submitters group, if no group has already been created
|
||||
* then return without error. This will merely dereference the current
|
||||
* submitters group from the collection so that it may be deleted
|
||||
* Remove the submitters group, if no group has already been created
|
||||
* then return without error. This will merely dereference the current
|
||||
* submitters group from the collection so that it may be deleted
|
||||
* without violating database constraints.
|
||||
*/
|
||||
public void removeSubmitters() throws SQLException, AuthorizeException
|
||||
@@ -672,11 +673,11 @@ public class Collection extends DSpaceObject
|
||||
// Remove the link to the collection table.
|
||||
collectionRow.setColumnNull("submitter");
|
||||
submitters = null;
|
||||
|
||||
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the default group of submitters, if there is one. Note that the
|
||||
* authorization system may allow others to submit to the collection, so
|
||||
@@ -684,7 +685,7 @@ public class Collection extends DSpaceObject
|
||||
* <P>
|
||||
* The default group of submitters for collection 100 is the one called
|
||||
* <code>collection_100_submit</code>.
|
||||
*
|
||||
*
|
||||
* @return the default group of submitters, or <code>null</code> if there
|
||||
* is no default group.
|
||||
*/
|
||||
@@ -697,7 +698,7 @@ public class Collection extends DSpaceObject
|
||||
* Create a default administrators group if one does not already exist.
|
||||
* Returns either the newly created group or the previously existing one.
|
||||
* Note that other groups may also be administrators.
|
||||
*
|
||||
*
|
||||
* @return the default group of editors associated with this collection
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
@@ -713,7 +714,7 @@ public class Collection extends DSpaceObject
|
||||
ourContext.turnOffAuthorisationSystem();
|
||||
admins = Group.create(ourContext);
|
||||
ourContext.restoreAuthSystemState();
|
||||
|
||||
|
||||
admins.setName("COLLECTION_" + getID() + "_ADMIN");
|
||||
admins.update();
|
||||
}
|
||||
@@ -723,15 +724,15 @@ public class Collection extends DSpaceObject
|
||||
|
||||
// register this as the admin group
|
||||
collectionRow.setColumn("admin", admins.getID());
|
||||
|
||||
|
||||
modified = true;
|
||||
return admins;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the administrators group, if no group has already been created
|
||||
* then return without error. This will merely dereference the current
|
||||
* administrators group from the collection so that it may be deleted
|
||||
* Remove the administrators group, if no group has already been created
|
||||
* then return without error. This will merely dereference the current
|
||||
* administrators group from the collection so that it may be deleted
|
||||
* without violating database constraints.
|
||||
*/
|
||||
public void removeAdministrators() throws SQLException, AuthorizeException
|
||||
@@ -748,7 +749,7 @@ public class Collection extends DSpaceObject
|
||||
// Remove the link to the collection table.
|
||||
collectionRow.setColumnNull("admin");
|
||||
admins = null;
|
||||
|
||||
|
||||
modified = true;
|
||||
}
|
||||
|
||||
@@ -759,7 +760,7 @@ public class Collection extends DSpaceObject
|
||||
* <P>
|
||||
* The default group of administrators for collection 100 is the one called
|
||||
* <code>collection_100_admin</code>.
|
||||
*
|
||||
*
|
||||
* @return group of administrators, or <code>null</code> if there is no
|
||||
* default group.
|
||||
*/
|
||||
@@ -772,7 +773,7 @@ public class Collection extends DSpaceObject
|
||||
* Get the license that users must grant before submitting to this
|
||||
* collection. If the collection does not have a specific license, the
|
||||
* site-wide default is returned.
|
||||
*
|
||||
*
|
||||
* @return the license for this collection
|
||||
*/
|
||||
public String getLicense()
|
||||
@@ -782,7 +783,7 @@ public class Collection extends DSpaceObject
|
||||
if (license == null || license.trim().equals(""))
|
||||
{
|
||||
// Fallback to site-wide default
|
||||
license = ConfigurationManager.getDefaultSubmissionLicense();
|
||||
license = LicenseManager.getDefaultSubmissionLicense();
|
||||
}
|
||||
|
||||
return license;
|
||||
@@ -790,8 +791,8 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get the license that users must grant before submitting to this
|
||||
* collection.
|
||||
*
|
||||
* collection.
|
||||
*
|
||||
* @return the license for this collection
|
||||
*/
|
||||
public String getLicenseCollection()
|
||||
@@ -801,7 +802,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Find out if the collection has a custom license
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if the collection has a custom license
|
||||
*/
|
||||
public boolean hasCustomLicense()
|
||||
@@ -814,7 +815,7 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Set the license for this collection. Passing in <code>null</code> means
|
||||
* that the site-wide default will be used.
|
||||
*
|
||||
*
|
||||
* @param license
|
||||
* the license, or <code>null</code>
|
||||
*/
|
||||
@@ -828,7 +829,7 @@ public class Collection extends DSpaceObject
|
||||
* returned if the collection does not have a template. Submission
|
||||
* mechanisms may copy this template to provide a convenient starting point
|
||||
* for a submission.
|
||||
*
|
||||
*
|
||||
* @return the item template, or <code>null</code>
|
||||
*/
|
||||
public Item getTemplateItem() throws SQLException
|
||||
@@ -841,7 +842,7 @@ public class Collection extends DSpaceObject
|
||||
* no action is taken. Caution: Make sure you call <code>update</code> on
|
||||
* the collection after doing this, or the item will have been created but
|
||||
* the collection record will not refer to it.
|
||||
*
|
||||
*
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
*/
|
||||
@@ -868,7 +869,7 @@ public class Collection extends DSpaceObject
|
||||
* record in the database, the collection record will be changed, including
|
||||
* any other changes made; in other words, this method does an
|
||||
* <code>update</code>.
|
||||
*
|
||||
*
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
* @throws IOException
|
||||
@@ -881,7 +882,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
collectionRow.setColumnNull("template_item_id");
|
||||
DatabaseManager.update(ourContext, collectionRow);
|
||||
|
||||
|
||||
if (template != null)
|
||||
{
|
||||
log.info(LogManager.getHeader(ourContext, "remove_template_item",
|
||||
@@ -894,7 +895,7 @@ public class Collection extends DSpaceObject
|
||||
ourContext.restoreAuthSystemState();
|
||||
template = null;
|
||||
}
|
||||
|
||||
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION, getID(), "remove_template_item"));
|
||||
}
|
||||
|
||||
@@ -903,7 +904,7 @@ public class Collection extends DSpaceObject
|
||||
* the item and the collection - it does nothing like set an issue date,
|
||||
* remove a personal workspace item etc. This has instant effect;
|
||||
* <code>update</code> need not be called.
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
* item to add
|
||||
* @throws SQLException
|
||||
@@ -930,7 +931,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Remove an item. If the item is then orphaned, it is deleted.
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
* item to remove
|
||||
* @throws SQLException
|
||||
@@ -956,20 +957,20 @@ public class Collection extends DSpaceObject
|
||||
}
|
||||
log.info(LogManager.getHeader(ourContext, "remove_item",
|
||||
"collection_id=" + getID() + ",item_id=" + item.getID()));
|
||||
|
||||
|
||||
DatabaseManager.updateQuery(ourContext,
|
||||
"DELETE FROM collection2item WHERE collection_id= ? "+
|
||||
"AND item_id= ? ",
|
||||
getID(), item.getID());
|
||||
DatabaseManager.setConstraintImmediate(ourContext, "coll2item_item_fk");
|
||||
|
||||
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COLLECTION, getID(), Constants.ITEM, item.getID(), item.getHandle()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the collection metadata (including logo and workflow groups) to
|
||||
* the database. Inserts if this is a new collection.
|
||||
*
|
||||
*
|
||||
* @throws SQLException
|
||||
* @throws IOException
|
||||
* @throws AuthorizeException
|
||||
@@ -996,7 +997,7 @@ public class Collection extends DSpaceObject
|
||||
clearDetails();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean canEditBoolean() throws java.sql.SQLException
|
||||
{
|
||||
return canEditBoolean(true);
|
||||
@@ -1020,7 +1021,7 @@ public class Collection extends DSpaceObject
|
||||
{
|
||||
canEdit(true);
|
||||
}
|
||||
|
||||
|
||||
public void canEdit(boolean useInheritance) throws AuthorizeException, SQLException
|
||||
{
|
||||
Community[] parents = getCommunities();
|
||||
@@ -1047,7 +1048,7 @@ public class Collection extends DSpaceObject
|
||||
* Delete the collection, including the metadata and logo. Items that are
|
||||
* then orphans are deleted. Groups associated with this collection
|
||||
* (workflow participants and submitters) are NOT deleted.
|
||||
*
|
||||
*
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
* @throws IOException
|
||||
@@ -1064,12 +1065,12 @@ public class Collection extends DSpaceObject
|
||||
|
||||
// remove subscriptions - hmm, should this be in Subscription.java?
|
||||
DatabaseManager.updateQuery(ourContext,
|
||||
"DELETE FROM subscription WHERE collection_id= ? ",
|
||||
"DELETE FROM subscription WHERE collection_id= ? ",
|
||||
getID());
|
||||
|
||||
// Remove Template Item
|
||||
removeTemplateItem();
|
||||
|
||||
|
||||
// Remove items
|
||||
ItemIterator items = getAllItems();
|
||||
|
||||
@@ -1079,7 +1080,7 @@ public class Collection extends DSpaceObject
|
||||
{
|
||||
Item item = items.next();
|
||||
IndexBrowse ib = new IndexBrowse(ourContext);
|
||||
|
||||
|
||||
if (item.isOwningCollection(this))
|
||||
{
|
||||
// the collection to be deleted is the owning collection, thus remove
|
||||
@@ -1092,12 +1093,12 @@ public class Collection extends DSpaceObject
|
||||
// Browse.itemRemoved(ourContext, itemId);
|
||||
collections[i].removeItem(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// the item was only mapped to this collection, so just remove it
|
||||
else
|
||||
{
|
||||
//notify Browse of removing item mapping.
|
||||
//notify Browse of removing item mapping.
|
||||
ib.indexItem(item);
|
||||
// Browse.itemChanged(ourContext, item);
|
||||
removeItem(item);
|
||||
@@ -1226,7 +1227,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Get the communities this collection appears in
|
||||
*
|
||||
*
|
||||
* @return array of <code>Community</code> objects
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -1282,10 +1283,10 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Return <code>true</code> if <code>other</code> is the same Collection
|
||||
* as this object, <code>false</code> otherwise
|
||||
*
|
||||
*
|
||||
* @param other
|
||||
* object to compare to
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if object passed in represents the same
|
||||
* collection as this object
|
||||
*/
|
||||
@@ -1321,7 +1322,7 @@ public class Collection extends DSpaceObject
|
||||
/**
|
||||
* Utility method for reading in a group from a group ID in a column. If the
|
||||
* column is null, null is returned.
|
||||
*
|
||||
*
|
||||
* @param col
|
||||
* the column name to read
|
||||
* @return the group referred to by that column, or null
|
||||
@@ -1339,7 +1340,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
/**
|
||||
* return type found in Constants
|
||||
*
|
||||
*
|
||||
* @return int Constants.COLLECTION
|
||||
*/
|
||||
public int getType()
|
||||
@@ -1351,13 +1352,13 @@ public class Collection extends DSpaceObject
|
||||
* return an array of collections that user has a given permission on
|
||||
* (useful for trimming 'select to collection' list) or figuring out which
|
||||
* collections a person is an editor for.
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* @param comm
|
||||
* (optional) restrict search to a community, else null
|
||||
* @param actionID
|
||||
* of the action
|
||||
*
|
||||
*
|
||||
* @return Collection [] of collections with matching permissions
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -1437,7 +1438,7 @@ public class Collection extends DSpaceObject
|
||||
|
||||
return itemcount;
|
||||
}
|
||||
|
||||
|
||||
public DSpaceObject getAdminObject(int action) throws SQLException
|
||||
{
|
||||
DSpaceObject adminObject = null;
|
||||
@@ -1473,7 +1474,7 @@ public class Collection extends DSpaceObject
|
||||
}
|
||||
return adminObject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DSpaceObject getParentObject() throws SQLException
|
||||
{
|
||||
|
Reference in New Issue
Block a user