mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 06:53:09 +00:00
fix conflict
This commit is contained in:
@@ -7,19 +7,7 @@
|
||||
*/
|
||||
package org.dspace.administer;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.cli.*;
|
||||
import org.apache.xml.serialize.Method;
|
||||
import org.apache.xml.serialize.OutputFormat;
|
||||
import org.apache.xml.serialize.XMLSerializer;
|
||||
@@ -31,6 +19,14 @@ import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.dspace.core.Context;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author Graham Triggs
|
||||
@@ -314,16 +310,16 @@ public class MetadataExporter
|
||||
private static String getSchemaName(Context context, MetadataField mdField) throws SQLException, RegistryExportException
|
||||
{
|
||||
// Get name from cache
|
||||
String name = schemaMap.get(mdField.getMetadataSchema().getSchemaID());
|
||||
String name = schemaMap.get(mdField.getMetadataSchema().getID());
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
// Name not retrieved before, so get the schema now
|
||||
MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getSchemaID());
|
||||
MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getID());
|
||||
if (mdSchema != null)
|
||||
{
|
||||
name = mdSchema.getName();
|
||||
schemaMap.put(mdSchema.getSchemaID(), name);
|
||||
schemaMap.put(mdSchema.getID(), name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.app.requestitem;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
@@ -19,7 +20,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="requestitem")
|
||||
public class RequestItem {
|
||||
public class RequestItem implements ReloadableEntity<Integer> {
|
||||
|
||||
|
||||
@Id
|
||||
@@ -76,7 +77,7 @@ public class RequestItem {
|
||||
{
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
public Integer getID() {
|
||||
return requestitem_id;
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.app.util;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
@@ -19,7 +20,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="webapp")
|
||||
public class WebApp {
|
||||
public class WebApp implements ReloadableEntity<Integer> {
|
||||
|
||||
|
||||
@Id
|
||||
@@ -50,7 +51,7 @@ public class WebApp {
|
||||
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -503,6 +503,8 @@ public class AuthorizeServiceImpl implements AuthorizeService
|
||||
throws SQLException, AuthorizeException
|
||||
{
|
||||
// now add them to the destination object
|
||||
List<ResourcePolicy> newPolicies = new LinkedList<>();
|
||||
|
||||
for (ResourcePolicy srp : policies)
|
||||
{
|
||||
ResourcePolicy rp = resourcePolicyService.create(c);
|
||||
@@ -517,21 +519,17 @@ public class AuthorizeServiceImpl implements AuthorizeService
|
||||
rp.setRpName(srp.getRpName());
|
||||
rp.setRpDescription(srp.getRpDescription());
|
||||
rp.setRpType(srp.getRpType());
|
||||
// and write out new policy
|
||||
resourcePolicyService.update(c, rp);
|
||||
|
||||
// and add policy to list of new policies
|
||||
newPolicies.add(rp);
|
||||
}
|
||||
|
||||
serviceFactory.getDSpaceObjectService(dest).updateLastModified(c, dest);
|
||||
resourcePolicyService.update(c, newPolicies);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllPolicies(Context c, DSpaceObject o) throws SQLException, AuthorizeException {
|
||||
resourcePolicyService.removeAllPolicies(c, o, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllPolicies(Context c, DSpaceObject o, boolean updateLastModified) throws SQLException, AuthorizeException {
|
||||
resourcePolicyService.removeAllPolicies(c, o, updateLastModified);
|
||||
resourcePolicyService.removeAllPolicies(c, o);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -681,7 +679,6 @@ public class AuthorizeServiceImpl implements AuthorizeService
|
||||
myPolicy.setEPerson(eperson);
|
||||
myPolicy.setRpType(rpType);
|
||||
resourcePolicyService.update(context, myPolicy);
|
||||
serviceFactory.getDSpaceObjectService(dso).updateLastModified(context, dso);
|
||||
|
||||
return myPolicy;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.authorize;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.hibernate.annotations.Type;
|
||||
@@ -25,7 +26,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="resourcepolicy")
|
||||
public class ResourcePolicy{
|
||||
public class ResourcePolicy implements ReloadableEntity<Integer> {
|
||||
public static String TYPE_SUBMISSION = "TYPE_SUBMISSION";
|
||||
public static String TYPE_WORKFLOW = "TYPE_WORKFLOW";
|
||||
public static String TYPE_CUSTOM= "TYPE_CUSTOM";
|
||||
|
@@ -7,13 +7,9 @@
|
||||
*/
|
||||
package org.dspace.authorize;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.dspace.authorize.dao.ResourcePolicyDAO;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -24,6 +20,9 @@ import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Service implementation for the ResourcePolicy object.
|
||||
* This class is responsible for all business logic calls for the ResourcePolicy object and is autowired by spring.
|
||||
@@ -204,17 +203,7 @@ public class ResourcePolicyServiceImpl implements ResourcePolicyService
|
||||
|
||||
@Override
|
||||
public void removeAllPolicies(Context c, DSpaceObject o) throws SQLException, AuthorizeException {
|
||||
// FIXME: authorization check?
|
||||
removeAllPolicies(c, o, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllPolicies(Context c, DSpaceObject o, boolean updateLastModified) throws SQLException, AuthorizeException {
|
||||
// FIXME: authorization check?
|
||||
if(updateLastModified)
|
||||
{
|
||||
contentServiceFactory.getDSpaceObjectService(o).updateLastModified(c, o);
|
||||
}
|
||||
resourcePolicyDAO.deleteByDso(c, o);
|
||||
}
|
||||
|
||||
@@ -269,12 +258,31 @@ public class ResourcePolicyServiceImpl implements ResourcePolicyService
|
||||
*/
|
||||
@Override
|
||||
public void update(Context context, ResourcePolicy resourcePolicy) throws SQLException, AuthorizeException {
|
||||
if(resourcePolicy.getdSpaceObject() != null){
|
||||
//A policy for a DSpace Object has been modified, fire a modify event on the DSpace object
|
||||
contentServiceFactory.getDSpaceObjectService(resourcePolicy.getdSpaceObject()).updateLastModified(context, resourcePolicy.getdSpaceObject());
|
||||
update(context, Collections.singletonList(resourcePolicy));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ResourcePolicies
|
||||
*/
|
||||
@Override
|
||||
public void update(Context context, List<ResourcePolicy> resourcePolicies) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(resourcePolicies)) {
|
||||
Set<DSpaceObject> relatedDSpaceObjects = new HashSet<>();
|
||||
|
||||
for (ResourcePolicy resourcePolicy : resourcePolicies) {
|
||||
if (resourcePolicy.getdSpaceObject() != null) {
|
||||
relatedDSpaceObjects.add(resourcePolicy.getdSpaceObject());
|
||||
}
|
||||
|
||||
// FIXME: Check authorisation
|
||||
resourcePolicyDAO.save(context, resourcePolicy);
|
||||
}
|
||||
|
||||
//Update the last modified timestamp of all related DSpace Objects
|
||||
for (DSpaceObject dSpaceObject : relatedDSpaceObjects) {
|
||||
//A policy for a DSpace Object has been modified, fire a modify event on the DSpace object
|
||||
contentServiceFactory.getDSpaceObjectService(dSpaceObject).updateLastModified(context, dSpaceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,10 +7,6 @@
|
||||
*/
|
||||
package org.dspace.authorize.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.content.Collection;
|
||||
@@ -19,6 +15,10 @@ import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AuthorizeManager handles all authorization checks for DSpace. For better
|
||||
* security, DSpace assumes that you do not have the right to do something
|
||||
@@ -309,8 +309,6 @@ public interface AuthorizeService {
|
||||
*/
|
||||
public void removeAllPolicies(Context c, DSpaceObject o) throws SQLException, AuthorizeException;
|
||||
|
||||
public void removeAllPolicies(Context c, DSpaceObject o, boolean updateLastModified) throws SQLException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* removes ALL policies for an object that are not of the input type.
|
||||
*
|
||||
|
@@ -45,8 +45,6 @@ public interface ResourcePolicyService extends DSpaceCRUDService<ResourcePolicy>
|
||||
|
||||
public void removeAllPolicies(Context c, DSpaceObject o) throws SQLException, AuthorizeException;
|
||||
|
||||
public void removeAllPolicies(Context c, DSpaceObject o, boolean updateLastModified) throws SQLException, AuthorizeException;
|
||||
|
||||
public void removePolicies(Context c, DSpaceObject o, int actionId) throws SQLException, AuthorizeException;
|
||||
|
||||
public void removePolicies(Context c, DSpaceObject o, String type) throws SQLException, AuthorizeException;
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.checker;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
@@ -25,7 +26,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="checksum_history")
|
||||
public class ChecksumHistory
|
||||
public class ChecksumHistory implements ReloadableEntity<Long>
|
||||
{
|
||||
|
||||
|
||||
@@ -33,7 +34,7 @@ public class ChecksumHistory
|
||||
@Column(name="check_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="checksum_history_check_id_seq")
|
||||
@SequenceGenerator(name="checksum_history_check_id_seq", sequenceName="checksum_history_check_id_seq", allocationSize = 1)
|
||||
private long id;
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "bitstream_id")
|
||||
@@ -66,7 +67,7 @@ public class ChecksumHistory
|
||||
{
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
public Long getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -15,12 +15,16 @@ import java.util.List;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.CollectionId;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class representing a particular bitstream format.
|
||||
@@ -33,14 +37,14 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="bitstreamformatregistry")
|
||||
public class BitstreamFormat implements Serializable
|
||||
public class BitstreamFormat implements Serializable, ReloadableEntity<Integer>
|
||||
{
|
||||
|
||||
@Id
|
||||
@Column(name="bitstream_format_id", nullable = false, unique = true)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="bitstreamformatregistry_seq")
|
||||
@SequenceGenerator(name="bitstreamformatregistry_seq", sequenceName="bitstreamformatregistry_seq", allocationSize = 1, initialValue = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@Column(name="short_description", length = 128, unique = true)
|
||||
private String shortDescription;
|
||||
@@ -111,7 +115,7 @@ public class BitstreamFormat implements Serializable
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
public final int getID()
|
||||
public final Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import org.dspace.core.LogManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -181,18 +182,26 @@ public class BitstreamFormatServiceImpl implements BitstreamFormatService {
|
||||
|
||||
@Override
|
||||
public void update(Context context, BitstreamFormat bitstreamFormat) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(bitstreamFormat));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<BitstreamFormat> bitstreamFormats) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(bitstreamFormats)) {
|
||||
// Check authorisation - only administrators can change formats
|
||||
if (!authorizeService.isAdmin(context))
|
||||
{
|
||||
if (!authorizeService.isAdmin(context)) {
|
||||
throw new AuthorizeException(
|
||||
"Only administrators can modify bitstream formats");
|
||||
}
|
||||
|
||||
for (BitstreamFormat bitstreamFormat : bitstreamFormats) {
|
||||
log.info(LogManager.getHeader(context, "update_bitstream_format",
|
||||
"bitstream_format_id=" + bitstreamFormat.getID()));
|
||||
|
||||
bitstreamFormatDAO.save(context, bitstreamFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, BitstreamFormat bitstreamFormat) throws SQLException, AuthorizeException {
|
||||
|
@@ -250,7 +250,9 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
|
||||
bitstream.getBundles().clear();
|
||||
|
||||
deleteMetadata(context, bitstream);
|
||||
|
||||
// Remove policies
|
||||
authorizeService.removeAllPolicies(context, bitstream);
|
||||
|
||||
// Remove bitstream itself
|
||||
bitstream.setDeleted(true);
|
||||
|
@@ -409,8 +409,6 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
|
||||
// remove our authorization policies
|
||||
authorizeService.removeAllPolicies(context, bundle);
|
||||
|
||||
deleteMetadata(context, bundle);
|
||||
|
||||
// Remove ourself
|
||||
bundleDAO.delete(context, bundle);
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.dao.CollectionDAO;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.*;
|
||||
import org.dspace.core.*;
|
||||
import org.dspace.core.service.LicenseService;
|
||||
@@ -25,12 +24,7 @@ import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.eperson.service.SubscribeService;
|
||||
import org.dspace.event.Event;
|
||||
import org.dspace.harvest.HarvestedCollection;
|
||||
import org.dspace.harvest.HarvestedCollectionServiceImpl;
|
||||
import org.dspace.harvest.HarvestedItem;
|
||||
import org.dspace.harvest.factory.HarvestServiceFactory;
|
||||
import org.dspace.harvest.service.HarvestedCollectionService;
|
||||
import org.dspace.harvest.service.HarvestedItemService;
|
||||
import org.dspace.kernel.ServiceManager;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -744,8 +738,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
groupService.delete(context, g);
|
||||
}
|
||||
|
||||
|
||||
deleteMetadata(context, collection);
|
||||
Iterator<Community> owningCommunities = collection.getCommunities().iterator();
|
||||
while (owningCommunities.hasNext())
|
||||
{
|
||||
|
@@ -532,9 +532,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
// Remove any Handle
|
||||
handleService.unbindHandle(context, community);
|
||||
|
||||
deleteMetadata(context, community);
|
||||
|
||||
|
||||
Group g = community.getAdministrators();
|
||||
|
||||
// Delete community row
|
||||
|
@@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.handle.Handle;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
@@ -25,7 +26,7 @@ import javax.persistence.*;
|
||||
@Entity
|
||||
@Inheritance(strategy= InheritanceType.JOINED)
|
||||
@Table(name = "dspaceobject")
|
||||
public abstract class DSpaceObject implements Serializable
|
||||
public abstract class DSpaceObject implements Serializable, ReloadableEntity<java.util.UUID>
|
||||
{
|
||||
@Id
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@@ -38,18 +39,18 @@ public abstract class DSpaceObject implements Serializable
|
||||
@Transient
|
||||
private StringBuffer eventDetails = null;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dSpaceObject", cascade={CascadeType.PERSIST}, orphanRemoval = true)
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dSpaceObject", cascade = CascadeType.ALL)
|
||||
@OrderBy("metadataField, place")
|
||||
private List<MetadataValue> metadata = new ArrayList<>();
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dso")
|
||||
// Order by is here to ensure that the oldest handle is retrieved first,
|
||||
// multiple handles are assigned to the latest version of an item the original handle will have the lowest identifier
|
||||
// This handle is the prefered handle.
|
||||
// This handle is the preferred handle.
|
||||
@OrderBy("id ASC")
|
||||
private List<Handle> handles = new ArrayList<>();
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dSpaceObject", cascade={CascadeType.PERSIST}, orphanRemoval = false)
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dSpaceObject", cascade = CascadeType.ALL)
|
||||
private List<ResourcePolicy> resourcePolicies = new ArrayList<>();
|
||||
|
||||
/**
|
||||
|
@@ -393,17 +393,6 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected method that deletes all metadata values from the database, should only be called when deleting the item.
|
||||
* @param context the dspaceObject
|
||||
* @param dso the dspaceObject who's metadata we are to delete
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
protected void deleteMetadata(Context context, T dso) throws SQLException {
|
||||
|
||||
metadataValueService.delete(context, dso);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method for pattern-matching metadata elements. This
|
||||
* method will return <code>true</code> if the given schema,
|
||||
|
@@ -7,10 +7,10 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Interface for manipulating in-progress submissions, without having to know at
|
||||
* which stage of submission they are (in workspace or workflow system)
|
||||
@@ -25,7 +25,7 @@ public interface InProgressSubmission
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
int getID();
|
||||
Integer getID();
|
||||
|
||||
/**
|
||||
* Get the incomplete item object
|
||||
|
@@ -610,14 +610,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
log.info(LogManager.getHeader(context, "delete_item", "item_id="
|
||||
+ item.getID()));
|
||||
|
||||
deleteMetadata(context, item);
|
||||
|
||||
// Remove bundles
|
||||
removeAllBundles(context, item);
|
||||
|
||||
// remove all of our authorization policies
|
||||
authorizeService.removeAllPolicies(context, item, false);
|
||||
|
||||
// Remove any Handle
|
||||
handleService.unbindHandle(context, item);
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@@ -29,13 +30,13 @@ import javax.persistence.*;
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
@Table(name="metadatafieldregistry")
|
||||
public class MetadataField {
|
||||
public class MetadataField implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="metadata_field_id", nullable = false, unique = true)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="metadatafieldregistry_seq")
|
||||
@SequenceGenerator(name="metadatafieldregistry_seq", sequenceName="metadatafieldregistry_seq", allocationSize = 1, initialValue = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "metadata_schema_id",nullable = false)
|
||||
@@ -67,7 +68,7 @@ public class MetadataField {
|
||||
*
|
||||
* @return metadata field id
|
||||
*/
|
||||
public int getFieldID()
|
||||
public Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@@ -175,7 +176,7 @@ public class MetadataField {
|
||||
return false;
|
||||
}
|
||||
final MetadataField other = (MetadataField) obj;
|
||||
if (this.getFieldID() != other.getFieldID())
|
||||
if (this.getID() != other.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -190,8 +191,8 @@ public class MetadataField {
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 47 * hash + getFieldID();
|
||||
hash = 47 * hash + getMetadataSchema().getSchemaID();
|
||||
hash = 47 * hash + getID();
|
||||
hash = 47 * hash + getMetadataSchema().getID();
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
if (hasElement(context, -1, metadataSchema, element, qualifier))
|
||||
{
|
||||
throw new NonUniqueMetadataException("Please make " + element + "."
|
||||
+ qualifier + " unique within schema #" + metadataSchema.getSchemaID());
|
||||
+ qualifier + " unique within schema #" + metadataSchema.getID());
|
||||
}
|
||||
|
||||
// Create a table row and update it with the values
|
||||
@@ -71,7 +71,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
metadataFieldDAO.save(context, metadataField);
|
||||
|
||||
log.info(LogManager.getHeader(context, "create_metadata_field",
|
||||
"metadata_field_id=" + metadataField.getFieldID()));
|
||||
"metadata_field_id=" + metadataField.getID()));
|
||||
return metadataField;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
}
|
||||
|
||||
// Ensure the element and qualifier are unique within a given schema.
|
||||
if (hasElement(context, metadataField.getFieldID(), metadataField.getMetadataSchema(), metadataField.getElement(), metadataField.getQualifier()))
|
||||
if (hasElement(context, metadataField.getID(), metadataField.getMetadataSchema(), metadataField.getElement(), metadataField.getQualifier()))
|
||||
{
|
||||
throw new NonUniqueMetadataException("Please make " + metadataField.getMetadataSchema().getName() + "." + metadataField.getElement() + "."
|
||||
+ metadataField.getQualifier());
|
||||
@@ -127,7 +127,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
metadataFieldDAO.save(context, metadataField);
|
||||
|
||||
log.info(LogManager.getHeader(context, "update_metadatafieldregistry",
|
||||
"metadata_field_id=" + metadataField.getFieldID() + "element=" + metadataField.getElement()
|
||||
"metadata_field_id=" + metadataField.getID() + "element=" + metadataField.getElement()
|
||||
+ "qualifier=" + metadataField.getQualifier()));
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
}
|
||||
|
||||
log.info(LogManager.getHeader(context, "delete_metadata_field",
|
||||
"metadata_field_id=" + metadataField.getFieldID()));
|
||||
"metadata_field_id=" + metadataField.getID()));
|
||||
|
||||
metadataValueService.deleteByMetadataField(context, metadataField);
|
||||
metadataFieldDAO.delete(context, metadataField);
|
||||
|
@@ -8,12 +8,11 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.hibernate.annotations.*;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Class representing a schema in DSpace.
|
||||
@@ -32,7 +31,7 @@ import javax.persistence.Table;
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
@Table(name="metadataschemaregistry")
|
||||
public class MetadataSchema
|
||||
public class MetadataSchema implements ReloadableEntity<Integer>
|
||||
{
|
||||
/** Short Name of built-in Dublin Core schema. */
|
||||
public static final String DC_SCHEMA = "dc";
|
||||
@@ -41,7 +40,7 @@ public class MetadataSchema
|
||||
@Column(name="metadata_schema_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="metadataschemaregistry_seq")
|
||||
@SequenceGenerator(name="metadataschemaregistry_seq", sequenceName="metadataschemaregistry_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "namespace", unique = true, length = 256)
|
||||
private String namespace;
|
||||
@@ -137,7 +136,7 @@ public class MetadataSchema
|
||||
*
|
||||
* @return schema record key
|
||||
*/
|
||||
public int getSchemaID()
|
||||
public Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public class MetadataSchemaServiceImpl implements MetadataSchemaService {
|
||||
metadataSchemaDAO.save(context, metadataSchema);
|
||||
log.info(LogManager.getHeader(context, "create_metadata_schema",
|
||||
"metadata_schema_id="
|
||||
+ metadataSchema.getSchemaID()));
|
||||
+ metadataSchema.getID()));
|
||||
return metadataSchema;
|
||||
}
|
||||
|
||||
@@ -92,21 +92,21 @@ public class MetadataSchemaServiceImpl implements MetadataSchemaService {
|
||||
}
|
||||
|
||||
// Ensure the schema name is unique
|
||||
if (!uniqueShortName(context, metadataSchema.getSchemaID(), metadataSchema.getName()))
|
||||
if (!uniqueShortName(context, metadataSchema.getID(), metadataSchema.getName()))
|
||||
{
|
||||
throw new NonUniqueMetadataException("Please make the name " + metadataSchema.getName()
|
||||
+ " unique");
|
||||
}
|
||||
|
||||
// Ensure the schema namespace is unique
|
||||
if (!uniqueNamespace(context, metadataSchema.getSchemaID(), metadataSchema.getNamespace()))
|
||||
if (!uniqueNamespace(context, metadataSchema.getID(), metadataSchema.getNamespace()))
|
||||
{
|
||||
throw new NonUniqueMetadataException("Please make the namespace " + metadataSchema.getNamespace()
|
||||
+ " unique");
|
||||
}
|
||||
metadataSchemaDAO.save(context, metadataSchema);
|
||||
log.info(LogManager.getHeader(context, "update_metadata_schema",
|
||||
"metadata_schema_id=" + metadataSchema.getSchemaID() + "namespace="
|
||||
"metadata_schema_id=" + metadataSchema.getID() + "namespace="
|
||||
+ metadataSchema.getNamespace() + "name=" + metadataSchema.getName()));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class MetadataSchemaServiceImpl implements MetadataSchemaService {
|
||||
}
|
||||
|
||||
log.info(LogManager.getHeader(context, "delete_metadata_schema",
|
||||
"metadata_schema_id=" + metadataSchema.getSchemaID()));
|
||||
"metadata_schema_id=" + metadataSchema.getID()));
|
||||
|
||||
metadataSchemaDAO.delete(context, metadataSchema);
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
@@ -26,14 +27,14 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="metadatavalue")
|
||||
public class MetadataValue
|
||||
public class MetadataValue implements ReloadableEntity<Integer>
|
||||
{
|
||||
/** The reference to the metadata field */
|
||||
@Id
|
||||
@Column(name="metadata_value_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="metadatavalue_seq")
|
||||
@SequenceGenerator(name="metadatavalue_seq", sequenceName="metadatavalue_seq", allocationSize = 1)
|
||||
private int valueId;
|
||||
private Integer id;
|
||||
|
||||
/** The primary key for the metadata value */
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@@ -81,9 +82,9 @@ public class MetadataValue
|
||||
*
|
||||
* @return metadata value ID
|
||||
*/
|
||||
public int getValueId()
|
||||
public Integer getID()
|
||||
{
|
||||
return valueId;
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,11 +239,11 @@ public class MetadataValue
|
||||
return false;
|
||||
}
|
||||
final MetadataValue other = (MetadataValue) obj;
|
||||
if (this.valueId != other.valueId)
|
||||
if (this.id != other.id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.getValueId() != other.getValueId())
|
||||
if (this.getID() != other.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -257,8 +258,8 @@ public class MetadataValue
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 47 * hash + this.valueId;
|
||||
hash = 47 * hash + this.getValueId();
|
||||
hash = 47 * hash + this.id;
|
||||
hash = 47 * hash + this.getID();
|
||||
hash = 47 * hash + this.getDSpaceObject().getID().hashCode();
|
||||
return hash;
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ public class MetadataValueServiceImpl implements MetadataValueService {
|
||||
public void update(Context context, MetadataValue metadataValue) throws SQLException {
|
||||
metadataValueDAO.save(context, metadataValue);
|
||||
log.info(LogManager.getHeader(context, "update_metadatavalue",
|
||||
"metadata_value_id=" + metadataValue.getValueId()));
|
||||
"metadata_value_id=" + metadataValue.getID()));
|
||||
|
||||
}
|
||||
|
||||
@@ -89,17 +89,10 @@ public class MetadataValueServiceImpl implements MetadataValueService {
|
||||
@Override
|
||||
public void delete(Context context, MetadataValue metadataValue) throws SQLException {
|
||||
log.info(LogManager.getHeader(context, "delete_metadata_value",
|
||||
" metadata_value_id=" + metadataValue.getValueId()));
|
||||
" metadata_value_id=" + metadataValue.getID()));
|
||||
metadataValueDAO.delete(context, metadataValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, DSpaceObject dso) throws SQLException {
|
||||
log.info(LogManager.getHeader(context, "delete_metadata_values",
|
||||
" dso=" + dso.getID()));
|
||||
metadataValueDAO.delete(context, dso);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetadataValue> findByValueLike(Context context, String value) throws SQLException {
|
||||
return metadataValueDAO.findByValueLike(context, value);
|
||||
|
@@ -7,19 +7,19 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class representing an item in the process of being submitted by a user
|
||||
@@ -29,14 +29,14 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "workspaceitem")
|
||||
public class WorkspaceItem implements InProgressSubmission, Serializable
|
||||
public class WorkspaceItem implements InProgressSubmission, Serializable, ReloadableEntity<Integer>
|
||||
{
|
||||
|
||||
@Id
|
||||
@Column(name = "workspace_item_id", unique = true, nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="workspaceitem_seq")
|
||||
@SequenceGenerator(name="workspaceitem_seq", sequenceName="workspaceitem_seq", allocationSize = 1)
|
||||
private int workspaceItemId;
|
||||
private Integer workspaceItemId;
|
||||
|
||||
/** The item this workspace object pertains to */
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@@ -90,7 +90,7 @@ public class WorkspaceItem implements InProgressSubmission, Serializable
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public int getID()
|
||||
public Integer getID()
|
||||
{
|
||||
return workspaceItemId;
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ public class CrosswalkMetadataValidator {
|
||||
if (forceCreate && schemaChoice.equals("add")) {
|
||||
try {
|
||||
mdSchema = metadataSchemaService.create(context, schema, String.valueOf(new Date().getTime()));
|
||||
mdSchema.setNamespace("unknown" + mdSchema.getSchemaID());
|
||||
mdSchema.setNamespace("unknown" + mdSchema.getID());
|
||||
metadataSchemaService.update(context, mdSchema);
|
||||
} catch (NonUniqueMetadataException e) {
|
||||
// This case should not be possible
|
||||
|
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
package org.dspace.content.dao;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.core.Context;
|
||||
@@ -36,5 +35,4 @@ public interface MetadataValueDAO extends GenericDAO<MetadataValue> {
|
||||
|
||||
int countRows(Context context) throws SQLException;
|
||||
|
||||
public void delete(Context context, DSpaceObject dso) throws SQLException;
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ public class CollectionDAOImpl extends AbstractHibernateDSODAO<Collection> imple
|
||||
if(limit != null){
|
||||
hibernateQuery.setMaxResults(limit);
|
||||
}
|
||||
hibernateQuery.setParameter(order.toString(), order.getFieldID());
|
||||
hibernateQuery.setParameter(order.toString(), order.getID());
|
||||
return list(hibernateQuery);
|
||||
}
|
||||
|
||||
|
@@ -70,7 +70,7 @@ public class CommunityDAOImpl extends AbstractHibernateDSODAO<Community> impleme
|
||||
if(limit != null){
|
||||
query.setMaxResults(limit);
|
||||
}
|
||||
query.setParameter(sortField.toString(), sortField.getFieldID());
|
||||
query.setParameter(sortField.toString(), sortField.getID());
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CommunityDAOImpl extends AbstractHibernateDSODAO<Community> impleme
|
||||
addMetadataSortQuery(queryBuilder, Arrays.asList(sortField), ListUtils.EMPTY_LIST);
|
||||
|
||||
Query query = createQuery(context, queryBuilder.toString());
|
||||
query.setParameter(sortField.toString(), sortField.getFieldID());
|
||||
query.setParameter(sortField.toString(), sortField.getID());
|
||||
|
||||
return findMany(context, query);
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ public class ItemDAOImpl extends AbstractHibernateDSODAO<Item> implements ItemDA
|
||||
addMetadataSortQuery(query, Collections.singletonList(metadataField), null);
|
||||
|
||||
Query hibernateQuery = createQuery(context, query.toString());
|
||||
hibernateQuery.setParameter(metadataField.toString(), metadataField.getFieldID());
|
||||
hibernateQuery.setParameter(metadataField.toString(), metadataField.getID());
|
||||
hibernateQuery.setParameter("in_archive", true);
|
||||
hibernateQuery.setParameter("submitter", eperson);
|
||||
hibernateQuery.setMaxResults(limit);
|
||||
|
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
package org.dspace.content.dao.impl;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.dao.MetadataValueDAO;
|
||||
@@ -41,7 +40,7 @@ public class MetadataValueDAOImpl extends AbstractHibernateDAO<MetadataValue> im
|
||||
{
|
||||
Criteria criteria = createCriteria(context, MetadataValue.class);
|
||||
criteria.add(
|
||||
Restrictions.eq("metadataField.id", metadataField.getFieldID())
|
||||
Restrictions.eq("metadataField.id", metadataField.getID())
|
||||
);
|
||||
criteria.setFetchMode("metadataField", FetchMode.JOIN);
|
||||
|
||||
@@ -83,11 +82,4 @@ public class MetadataValueDAOImpl extends AbstractHibernateDAO<MetadataValue> im
|
||||
return count(createQuery(context, "SELECT count(*) FROM MetadataValue"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, DSpaceObject dso) throws SQLException {
|
||||
String queryString = "delete from MetadataValue where dSpaceObject= :dso";
|
||||
Query query = createQuery(context, queryString);
|
||||
query.setParameter("dso", dso);
|
||||
query.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
@@ -82,14 +82,6 @@ public interface MetadataValueService {
|
||||
*/
|
||||
public void delete(Context context, MetadataValue metadataValue) throws SQLException;
|
||||
|
||||
/**
|
||||
* Delete all metadata fields for a specified dspace object
|
||||
* @param context dspace context
|
||||
* @param dso the dspace object
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void delete(Context context, DSpaceObject dso) throws SQLException;
|
||||
|
||||
public List<MetadataValue> findByValueLike(Context context, String value) throws SQLException;
|
||||
|
||||
public void deleteByMetadataField(Context context, MetadataField metadataField) throws SQLException;
|
||||
|
@@ -158,11 +158,6 @@ public class Context
|
||||
return dbConnection;
|
||||
}
|
||||
|
||||
public void enableBatchMode(boolean batchModeEnabled) throws SQLException {
|
||||
dbConnection.setOptimizedForBatchProcessing(batchModeEnabled);
|
||||
}
|
||||
|
||||
|
||||
public DatabaseConfigVO getDBConfig() throws SQLException
|
||||
{
|
||||
return dbConnection.getDatabaseConfig();
|
||||
@@ -371,6 +366,16 @@ public class Context
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the current transaction with the database, persisting any pending changes.
|
||||
* The database connection is not closed and can be reused afterwards.
|
||||
*
|
||||
* <b>WARNING: After calling this method all previously fetched entities are "detached" (pending
|
||||
* changes are not tracked anymore). You have to reload all entities you still want to work manually
|
||||
* after this method call (see {@link Context#reloadEntity(ReloadableEntity)}).</b>
|
||||
*
|
||||
* @throws SQLException When committing the transaction in the database fails.
|
||||
*/
|
||||
public void commit() throws SQLException
|
||||
{
|
||||
// If Context is no longer open/valid, just note that it has already been closed
|
||||
@@ -397,6 +402,7 @@ public class Context
|
||||
{
|
||||
//Commit our changes
|
||||
dbConnection.commit();
|
||||
reloadContextBoundEntities();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -624,21 +630,82 @@ public class Context
|
||||
dbConnection.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache of all object that have been read from the database so far. This will also free up
|
||||
* (heap space) memory. You should use this method when processing a large number of records.
|
||||
*
|
||||
* <b>WARNING: After calling this method all previously fetched entities are "detached" (pending
|
||||
* changes are not tracked anymore). You have to reload all entities you still want to work manually
|
||||
* after this method call (see {@link Context#reloadEntity(ReloadableEntity)}).</b>
|
||||
*
|
||||
* This method will take care of reloading the current user.
|
||||
*
|
||||
* @throws SQLException When clearing the entity cache fails
|
||||
*/
|
||||
public void clearCache() throws SQLException {
|
||||
if(log.isDebugEnabled()) {
|
||||
log.debug("Cache size before clear cache is " + getCacheSize());
|
||||
}
|
||||
|
||||
UUID epersonId = getCurrentUser().getID();
|
||||
|
||||
this.getDBConnection().clearCache();
|
||||
|
||||
if(epersonId != null) {
|
||||
setCurrentUser(EPersonServiceFactory.getInstance().getEPersonService().find(this, epersonId));
|
||||
}
|
||||
reloadContextBoundEntities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the cache of all object that have been read from the database so far. A larger number
|
||||
* means that more memory is consumed by the cache. This also has a negative impact on the query performance. In
|
||||
* that case you should consider clearing the cache (see {@link Context#clearCache() clearCache}).
|
||||
*
|
||||
* @throws SQLException When connecting to the active cache fails.
|
||||
*/
|
||||
public long getCacheSize() throws SQLException {
|
||||
return this.getDBConnection().getCacheSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable "batch processing mode" for this context.
|
||||
*
|
||||
* Enabling batch processing mode means that the database connection is configured so that it is optimized to
|
||||
* process a large number of records.
|
||||
*
|
||||
* Disabling batch processing mode restores the normal behaviour that is optimal for querying and updating a
|
||||
* small number of records.
|
||||
*
|
||||
* @param batchModeEnabled When true, batch processing mode will be enabled. If false, it will be disabled.
|
||||
* @throws SQLException When configuring the database connection fails.
|
||||
*/
|
||||
public void enableBatchMode(boolean batchModeEnabled) throws SQLException {
|
||||
dbConnection.setOptimizedForBatchProcessing(batchModeEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if "batch processing mode" is enabled for this context.
|
||||
* @return True if batch processing mode is enabled, false otherwise.
|
||||
*/
|
||||
public boolean isBatchModeEnabled() {
|
||||
return dbConnection.isOptimizedForBatchProcessing();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload an entity from the database into the cache. This method will return a reference to the "attached"
|
||||
* entity. This means changes to the entity will be tracked and persisted to the database.
|
||||
*
|
||||
* @param entity The entity to reload
|
||||
* @param <E> The class of the enity. The entity must implement the {@link ReloadableEntity} interface.
|
||||
* @return A (possibly) <b>NEW</b> reference to the entity that should be used for further processing.
|
||||
* @throws SQLException When reloading the entity from the database fails.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException {
|
||||
return (E) dbConnection.reloadEntity(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload all entities related to this context.
|
||||
* @throws SQLException When reloading one of the entities fails.
|
||||
*/
|
||||
private void reloadContextBoundEntities() throws SQLException {
|
||||
currentUser = reloadEntity(currentUser);
|
||||
}
|
||||
}
|
||||
|
@@ -44,5 +44,13 @@ public interface DBConnection<T> {
|
||||
|
||||
public void setOptimizedForBatchProcessing(boolean batchOptimized) throws SQLException;
|
||||
|
||||
public boolean isOptimizedForBatchProcessing();
|
||||
|
||||
public long getCacheSize() throws SQLException;
|
||||
|
||||
/**
|
||||
* Reload a DSpace object from the database. This will make sure the object is valid and stored in the cache.
|
||||
* @param entity The DSpace object to reload
|
||||
*/
|
||||
public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException;
|
||||
}
|
@@ -7,17 +7,20 @@
|
||||
*/
|
||||
package org.dspace.core;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.orm.hibernate4.SessionFactoryUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
@@ -124,12 +127,29 @@ public class HibernateDBConnection implements DBConnection<Session> {
|
||||
return getSession().getStatistics().getEntityCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E extends ReloadableEntity> E reloadEntity(final E entity) throws SQLException {
|
||||
if(entity == null) {
|
||||
return null;
|
||||
} else if(getSession().contains(entity)) {
|
||||
return entity;
|
||||
} else {
|
||||
return (E) getSession().get(HibernateProxyHelper.getClassWithoutInitializingProxy(entity), entity.getID());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptimizedForBatchProcessing(final boolean batchOptimized) throws SQLException {
|
||||
this.batchModeEnabled = batchOptimized;
|
||||
configureBatchMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptimizedForBatchProcessing() {
|
||||
return batchModeEnabled;
|
||||
}
|
||||
|
||||
private void configureBatchMode() throws SQLException {
|
||||
if(batchModeEnabled) {
|
||||
getSession().setFlushMode(FlushMode.ALWAYS);
|
||||
|
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Interface that has to be implemented by all entities that can be reloaded by the Context
|
||||
* (see {@link org.dspace.core.Context#reloadEntity(ReloadableEntity)} ])}
|
||||
*/
|
||||
public interface ReloadableEntity<T extends Serializable> {
|
||||
|
||||
T getID();
|
||||
|
||||
}
|
@@ -7,24 +7,19 @@
|
||||
*/
|
||||
package org.dspace.eperson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.Email;
|
||||
import org.dspace.core.I18nUtil;
|
||||
import org.dspace.core.Utils;
|
||||
import org.dspace.core.*;
|
||||
import org.dspace.eperson.service.AccountService;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.RegistrationDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* Methods for handling registration by email and forgotten passwords. When
|
||||
@@ -219,7 +214,7 @@ public class AccountServiceImpl implements AccountService
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Created callback "
|
||||
+ rd.getId()
|
||||
+ rd.getID()
|
||||
+ " with token " + rd.getToken()
|
||||
+ " with email \"" + email + "\"");
|
||||
}
|
||||
|
@@ -209,9 +209,6 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
|
||||
throw new AuthorizeException(new EPersonDeletionException(constraintList));
|
||||
}
|
||||
|
||||
// Delete the Dublin Core
|
||||
deleteMetadata(context, ePerson);
|
||||
|
||||
context.addEvent(new Event(Event.DELETE, Constants.EPERSON, ePerson.getID(), ePerson.getEmail(), getIdentifiers(context, ePerson)));
|
||||
|
||||
// XXX FIXME: This sidesteps the object model code so it won't
|
||||
|
@@ -361,8 +361,6 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
ePerson.getGroups().remove(group);
|
||||
}
|
||||
|
||||
deleteMetadata(context, group);
|
||||
|
||||
// empty out group2groupcache table (if we do it after we delete our object we get an issue with references)
|
||||
group2GroupCacheDAO.deleteAll(context);
|
||||
// Remove ourself
|
||||
@@ -467,7 +465,7 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
protected boolean epersonInGroup(Context context, String groupName, EPerson ePerson)
|
||||
throws SQLException
|
||||
{
|
||||
return groupDAO.findByNameAndEPerson(context, groupName, ePerson) != null;
|
||||
return groupDAO.findByNameAndMembership(context, groupName, ePerson) != null;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.eperson;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
@@ -19,13 +20,13 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="registrationdata")
|
||||
public class RegistrationData {
|
||||
public class RegistrationData implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="registrationdata_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="registrationdata_seq")
|
||||
@SequenceGenerator(name="registrationdata_seq", sequenceName="registrationdata_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "email", unique = true, length = 64)
|
||||
private String email;
|
||||
@@ -47,7 +48,7 @@ public class RegistrationData {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.eperson;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.dao.RegistrationDataDAO;
|
||||
@@ -14,6 +15,8 @@ import org.dspace.eperson.service.RegistrationDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service implementation for the RegistrationData object.
|
||||
@@ -61,8 +64,16 @@ public class RegistrationDataServiceImpl implements RegistrationDataService
|
||||
|
||||
@Override
|
||||
public void update(Context context, RegistrationData registrationData) throws SQLException, AuthorizeException {
|
||||
registrationDataDAO.save(context, registrationData);
|
||||
update(context, Collections.singletonList(registrationData));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<RegistrationData> registrationDataRecords) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(registrationDataRecords)) {
|
||||
for (RegistrationData registrationData : registrationDataRecords) {
|
||||
registrationDataDAO.save(context, registrationData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.eperson;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@@ -19,13 +20,13 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "subscription")
|
||||
public class Subscription {
|
||||
public class Subscription implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "subscription_id", unique = true, nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="subscription_seq")
|
||||
@SequenceGenerator(name="subscription_seq", sequenceName="subscription_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "collection_id")
|
||||
@@ -45,7 +46,7 @@ public class Subscription {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -126,6 +126,6 @@ public interface GroupDAO extends DSpaceObjectDAO<Group>, DSpaceObjectLegacySupp
|
||||
* @return The group with the specified name
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
Group findByNameAndEPerson(Context context, String groupName, EPerson ePerson) throws SQLException;
|
||||
Group findByNameAndMembership(Context context, String groupName, EPerson ePerson) throws SQLException;
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,6 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
Query query = createQuery(context,
|
||||
"SELECT p " +
|
||||
"FROM EPerson p " +
|
||||
"LEFT JOIN FETCH p.metadata " +
|
||||
"WHERE p.email = :email" );
|
||||
|
||||
query.setParameter("email", email.toLowerCase());
|
||||
@@ -59,7 +58,6 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
Query query = createQuery(context,
|
||||
"SELECT p " +
|
||||
"FROM EPerson p " +
|
||||
"LEFT JOIN FETCH p.metadata " +
|
||||
"WHERE p.netid = :netid" );
|
||||
|
||||
query.setParameter("netid", netid);
|
||||
@@ -70,8 +68,7 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
@Override
|
||||
public List<EPerson> search(Context context, String query, List<MetadataField> queryFields, List<MetadataField> sortFields, int offset, int limit) throws SQLException
|
||||
{
|
||||
String queryString = "SELECT " + EPerson.class.getSimpleName().toLowerCase() + " FROM EPerson as " + EPerson.class.getSimpleName().toLowerCase()
|
||||
+ " LEFT JOIN FETCH " + EPerson.class.getSimpleName().toLowerCase() + ".metadata ";
|
||||
String queryString = "SELECT " + EPerson.class.getSimpleName().toLowerCase() + " FROM EPerson as " + EPerson.class.getSimpleName().toLowerCase() + " ";
|
||||
|
||||
if(query != null) query= "%"+query.toLowerCase()+"%";
|
||||
Query hibernateQuery = getSearchQuery(context, queryString, query, queryFields, sortFields, null);
|
||||
@@ -98,8 +95,7 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
|
||||
@Override
|
||||
public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField) throws SQLException {
|
||||
String queryString = "SELECT " + EPerson.class.getSimpleName().toLowerCase() + " FROM EPerson as " + EPerson.class.getSimpleName().toLowerCase()
|
||||
+ " LEFT JOIN FETCH " + EPerson.class.getSimpleName().toLowerCase() + ".metadata ";
|
||||
String queryString = "SELECT " + EPerson.class.getSimpleName().toLowerCase() + " FROM EPerson as " + EPerson.class.getSimpleName().toLowerCase();
|
||||
|
||||
List<MetadataField> sortFields = ListUtils.EMPTY_LIST;
|
||||
|
||||
@@ -131,7 +127,6 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
Query query = createQuery(context,
|
||||
"SELECT p " +
|
||||
"FROM EPerson p " +
|
||||
"LEFT JOIN FETCH p.metadata " +
|
||||
"WHERE p.password IS NOT NULL AND p.digestAlgorithm IS NULL " );
|
||||
|
||||
return list(query);
|
||||
@@ -142,7 +137,6 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
Query query = createQuery(context,
|
||||
"SELECT p " +
|
||||
"FROM EPerson p " +
|
||||
"LEFT JOIN FETCH p.metadata " +
|
||||
"WHERE p.lastActive <= :date " );
|
||||
query.setParameter("date", date);
|
||||
|
||||
@@ -172,7 +166,7 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
query.setParameter("queryParam", "%"+queryParam.toLowerCase()+"%");
|
||||
}
|
||||
for (MetadataField metadataField : metadataFieldsToJoin) {
|
||||
query.setParameter(metadataField.toString(), metadataField.getFieldID());
|
||||
query.setParameter(metadataField.toString(), metadataField.getID());
|
||||
}
|
||||
|
||||
return query;
|
||||
@@ -180,7 +174,7 @@ public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements
|
||||
|
||||
@Override
|
||||
public List<EPerson> findAllSubscribers(Context context) throws SQLException {
|
||||
return list(createQuery(context, "SELECT DISTINCT e from Subscription s JOIN s.ePerson e LEFT JOIN FETCH e.metadata "));
|
||||
return list(createQuery(context, "SELECT DISTINCT e from Subscription s JOIN s.ePerson e "));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -47,7 +47,7 @@ public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements Grou
|
||||
addMetadataValueWhereQuery(queryBuilder, Collections.singletonList(metadataField), "=", null);
|
||||
|
||||
Query query = createQuery(context, queryBuilder.toString());
|
||||
query.setParameter(metadataField.toString(), metadataField.getFieldID());
|
||||
query.setParameter(metadataField.toString(), metadataField.getID());
|
||||
query.setParameter("queryParam", searchValue);
|
||||
|
||||
return list(query);
|
||||
@@ -65,7 +65,7 @@ public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements Grou
|
||||
|
||||
Query query = createQuery(context, queryBuilder.toString());
|
||||
for (MetadataField sortField : sortMetadataFields) {
|
||||
query.setParameter(sortField.toString(), sortField.getFieldID());
|
||||
query.setParameter(sortField.toString(), sortField.getID());
|
||||
}
|
||||
return list(query);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements Grou
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group findByNameAndEPerson(Context context, String groupName, EPerson ePerson) throws SQLException {
|
||||
public Group findByNameAndMembership(Context context, String groupName, EPerson ePerson) throws SQLException {
|
||||
if(groupName == null || ePerson == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
@@ -11,6 +11,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@@ -21,7 +22,7 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="handle")
|
||||
public class Handle {
|
||||
public class Handle implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="handle_id")
|
||||
@@ -53,7 +54,7 @@ public class Handle {
|
||||
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
*/
|
||||
package org.dspace.handle;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -22,6 +18,10 @@ import org.dspace.handle.dao.HandleDAO;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface to the <a href="http://www.handle.net" target=_new>CNRI Handle
|
||||
* System </a>.
|
||||
@@ -133,7 +133,7 @@ public class HandleServiceImpl implements HandleService
|
||||
throws SQLException
|
||||
{
|
||||
Handle handle = handleDAO.create(context, new Handle());
|
||||
String handleId = createId(handle.getId());
|
||||
String handleId = createId(handle.getID());
|
||||
|
||||
handle.setHandle(handleId);
|
||||
handle.setDSpaceObject(dso);
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.harvest;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
@@ -19,7 +20,7 @@ import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name="harvested_collection")
|
||||
public class HarvestedCollection
|
||||
public class HarvestedCollection implements ReloadableEntity<Integer>
|
||||
{
|
||||
@Id
|
||||
@Column(name="id")
|
||||
@@ -86,6 +87,10 @@ public class HarvestedCollection
|
||||
{
|
||||
}
|
||||
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function to set all harvesting-related parameters at once
|
||||
*/
|
||||
|
@@ -11,6 +11,7 @@ import java.util.Date;
|
||||
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@@ -19,13 +20,13 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="harvested_item")
|
||||
public class HarvestedItem
|
||||
public class HarvestedItem implements ReloadableEntity<Integer>
|
||||
{
|
||||
@Id
|
||||
@Column(name="id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="harvested_item_seq")
|
||||
@SequenceGenerator(name="harvested_item_seq", sequenceName="harvested_item_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name="item_id", unique = true)
|
||||
@@ -48,7 +49,7 @@ public class HarvestedItem
|
||||
{
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -215,6 +215,7 @@ public class OAIHarvester {
|
||||
*/
|
||||
public void runHarvest() throws SQLException, IOException, AuthorizeException
|
||||
{
|
||||
boolean originalMode = ourContext.isBatchModeEnabled();
|
||||
ourContext.enableBatchMode(true);
|
||||
|
||||
// figure out the relevant parameters
|
||||
@@ -436,7 +437,7 @@ public class OAIHarvester {
|
||||
log.info("Harvest from " + oaiSource + " successful. The process took " + timeTaken + " milliseconds. Harvested " + currentRecord + " items.");
|
||||
harvestedCollection.update(ourContext, harvestRow);
|
||||
|
||||
ourContext.enableBatchMode(false);
|
||||
ourContext.enableBatchMode(originalMode);
|
||||
}
|
||||
|
||||
private void intermediateCommit() throws SQLException {
|
||||
@@ -462,9 +463,9 @@ public class OAIHarvester {
|
||||
}
|
||||
|
||||
private void reloadRequiredEntities() throws SQLException {
|
||||
//Load our objects in our cache
|
||||
targetCollection = collectionService.find(ourContext, targetCollection.getID());
|
||||
harvestRow = harvestedCollection.find(ourContext, targetCollection);
|
||||
//Reload our objects in our cache
|
||||
targetCollection = ourContext.reloadEntity(targetCollection);
|
||||
harvestRow = ourContext.reloadEntity(harvestRow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.identifier;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@@ -21,7 +22,7 @@ import javax.persistence.*;
|
||||
@Entity
|
||||
@Table(name = "Doi" )
|
||||
public class DOI
|
||||
implements Identifier
|
||||
implements Identifier, ReloadableEntity<Integer>
|
||||
{
|
||||
public static final String SCHEME = "doi:";
|
||||
|
||||
@@ -55,7 +56,7 @@ public class DOI
|
||||
{
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -841,7 +841,7 @@ public class DOIIdentifierProvider
|
||||
// We need to generate a new DOI.
|
||||
doi = doiService.create(context);
|
||||
doiIdentifier = this.getPrefix() + "/" + this.getNamespaceSeparator() +
|
||||
doi.getId();
|
||||
doi.getID();
|
||||
}
|
||||
|
||||
// prepare new doiRow
|
||||
|
@@ -7,9 +7,6 @@
|
||||
*/
|
||||
package org.dspace.identifier;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -27,6 +24,10 @@ import org.dspace.versioning.service.VersioningService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Required;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marsa Haoua
|
||||
@@ -269,7 +270,7 @@ public class VersionedDOIIdentifierProvider extends DOIIdentifierProvider
|
||||
|
||||
// as we reuse the DOI ID, we do not have to check whether the DOI exists already.
|
||||
String identifier = this.getPrefix() + "/" + this.getNamespaceSeparator() +
|
||||
doi.getId().toString();
|
||||
doi.getID().toString();
|
||||
|
||||
if (version.getVersionNumber() > 1)
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface containing the simple CRUD methods so we don't have to add them over and again to every service which
|
||||
@@ -26,5 +27,7 @@ public interface DSpaceCRUDService<T> {
|
||||
|
||||
public void update(Context context, T t) throws SQLException, AuthorizeException;
|
||||
|
||||
public void update(Context context, List<T> t) throws SQLException, AuthorizeException;
|
||||
|
||||
public void delete(Context context, T t) throws SQLException, AuthorizeException;
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.versioning;
|
||||
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
@@ -24,13 +25,13 @@ import java.util.Date;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="versionitem")
|
||||
public class Version {
|
||||
public class Version implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="versionitem_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="versionitem_seq")
|
||||
@SequenceGenerator(name="versionitem_seq", sequenceName="versionitem_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "item_id")
|
||||
@@ -68,7 +69,7 @@ public class Version {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ public class Version {
|
||||
}
|
||||
|
||||
final Version that = (Version)o;
|
||||
if (this.getId() != that.getId())
|
||||
if (this.getID() != that.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -144,7 +145,7 @@ public class Version {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash=7;
|
||||
hash=79*hash+ this.getId();
|
||||
hash=79*hash+ this.getID();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.versioning;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
import javax.persistence.*;
|
||||
@@ -25,7 +26,7 @@ import org.apache.log4j.Logger;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="versionhistory")
|
||||
public class VersionHistory {
|
||||
public class VersionHistory implements ReloadableEntity<Integer> {
|
||||
|
||||
private static final Logger log = Logger.getLogger(VersionHistory.class);
|
||||
|
||||
@@ -33,7 +34,7 @@ public class VersionHistory {
|
||||
@Column(name="versionhistory_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="versionhistory_seq")
|
||||
@SequenceGenerator(name="versionhistory_seq", sequenceName="versionhistory_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
//We use fetchtype eager for versions since we always require our versions when loading the history
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "versionHistory")
|
||||
@@ -50,7 +51,7 @@ public class VersionHistory {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public class VersionHistory {
|
||||
}
|
||||
|
||||
final VersionHistory that = (VersionHistory)o;
|
||||
if (this.getId() != that.getId())
|
||||
if (this.getID() != that.getID())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -104,7 +105,7 @@ public class VersionHistory {
|
||||
public int hashCode()
|
||||
{
|
||||
int hash=7;
|
||||
hash=79*hash+ this.getId();
|
||||
hash=79*hash+ this.getID();
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@@ -7,17 +7,19 @@
|
||||
*/
|
||||
package org.dspace.versioning;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.versioning.dao.VersionHistoryDAO;
|
||||
import org.dspace.versioning.service.VersionHistoryService;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -52,8 +54,17 @@ public class VersionHistoryServiceImpl implements VersionHistoryService
|
||||
|
||||
@Override
|
||||
public void update(Context context, VersionHistory versionHistory) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(versionHistory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<VersionHistory> versionHistories) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(versionHistories)) {
|
||||
for (VersionHistory versionHistory : versionHistories) {
|
||||
versionHistoryDAO.save(context, versionHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, VersionHistory versionHistory) throws SQLException, AuthorizeException {
|
||||
|
@@ -8,18 +8,18 @@
|
||||
package org.dspace.versioning.dao.impl;
|
||||
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.versioning.Version;
|
||||
import org.dspace.versioning.VersionHistory;
|
||||
import org.dspace.versioning.dao.VersionDAO;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import org.dspace.versioning.VersionHistory;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.criterion.Order;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of the Database Access Object interface class for the Version object.
|
||||
@@ -51,7 +51,7 @@ public class VersionDAOImpl extends AbstractHibernateDAO<Version> implements Ver
|
||||
Query q = this.createQuery(c,
|
||||
"SELECT (COALESCE(MAX(versionNumber), 0) + 1) "
|
||||
+ "FROM Version WHERE versionHistory.id = :historyId");
|
||||
q.setParameter("historyId", vh.getId());
|
||||
q.setParameter("historyId", vh.getID());
|
||||
|
||||
int next = (Integer) q.uniqueResult();
|
||||
return next;
|
||||
|
@@ -7,15 +7,15 @@
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Class representing an item going through the workflow process in DSpace
|
||||
@@ -25,14 +25,14 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "workflowitem")
|
||||
public class BasicWorkflowItem implements WorkflowItem
|
||||
public class BasicWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>
|
||||
{
|
||||
|
||||
@Id
|
||||
@Column(name = "workflow_id", unique = true, nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="workflowitem_seq")
|
||||
@SequenceGenerator(name="workflowitem_seq", sequenceName="workflowitem_seq", allocationSize = 1)
|
||||
private int workflowitemId;
|
||||
private Integer workflowitemId;
|
||||
|
||||
|
||||
/** The item this workflow object pertains to */
|
||||
@@ -78,7 +78,7 @@ public class BasicWorkflowItem implements WorkflowItem
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public int getID()
|
||||
public Integer getID()
|
||||
{
|
||||
return workflowitemId;
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
import javax.persistence.*;
|
||||
@@ -19,7 +20,7 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tasklistitem")
|
||||
public class TaskListItem {
|
||||
public class TaskListItem implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "tasklist_id", unique = true, nullable = false)
|
||||
@@ -64,4 +65,8 @@ public class TaskListItem {
|
||||
void setWorkflowItem(BasicWorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public Integer getID() {
|
||||
return taskListItemId;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
import javax.persistence.*;
|
||||
@@ -22,14 +23,14 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_claimtask")
|
||||
public class ClaimedTask {
|
||||
public class ClaimedTask implements ReloadableEntity<Integer> {
|
||||
|
||||
|
||||
@Id
|
||||
@Column(name="claimtask_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_claimtask_seq")
|
||||
@SequenceGenerator(name="cwf_claimtask_seq", sequenceName="cwf_claimtask_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
@@ -64,7 +65,7 @@ public class ClaimedTask {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -15,6 +16,8 @@ import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,8 +51,17 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService
|
||||
|
||||
@Override
|
||||
public void update(Context context, ClaimedTask claimedTask) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(claimedTask));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<ClaimedTask> claimedTasks) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(claimedTasks)) {
|
||||
for (ClaimedTask claimedTask : claimedTasks) {
|
||||
claimedTaskDAO.save(context, claimedTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, ClaimedTask claimedTask) throws SQLException, AuthorizeException {
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
import javax.persistence.*;
|
||||
@@ -28,13 +29,13 @@ import java.sql.SQLException;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_collectionrole")
|
||||
public class CollectionRole {
|
||||
public class CollectionRole implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="collectionrole_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_collectionrole_seq")
|
||||
@SequenceGenerator(name="cwf_collectionrole_seq", sequenceName="cwf_collectionrole_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
// @Column(name = "role_id")
|
||||
// @Lob
|
||||
@@ -83,4 +84,7 @@ public class CollectionRole {
|
||||
return group;
|
||||
}
|
||||
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
import javax.persistence.*;
|
||||
@@ -22,13 +23,13 @@ import javax.persistence.*;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_in_progress_user")
|
||||
public class InProgressUser {
|
||||
public class InProgressUser implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="in_progress_user_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_in_progress_user_seq")
|
||||
@SequenceGenerator(name="cwf_in_progress_user_seq", sequenceName="cwf_in_progress_user_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name="user_id")
|
||||
@@ -51,7 +52,7 @@ public class InProgressUser {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -15,6 +16,7 @@ import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -71,8 +73,17 @@ public class InProgressUserServiceImpl implements InProgressUserService {
|
||||
|
||||
@Override
|
||||
public void update(Context context, InProgressUser inProgressUser) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(inProgressUser));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<InProgressUser> inProgressUsers) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(inProgressUsers)) {
|
||||
for (InProgressUser inProgressUser : inProgressUsers) {
|
||||
inProgressUserDAO.save(context, inProgressUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, InProgressUser inProgressUser) throws SQLException, AuthorizeException {
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
@@ -24,13 +25,13 @@ import java.sql.SQLException;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_pooltask")
|
||||
public class PoolTask {
|
||||
public class PoolTask implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="pooltask_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_pooltask_seq")
|
||||
@SequenceGenerator(name="cwf_pooltask_seq", sequenceName="cwf_pooltask_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
@@ -70,6 +71,10 @@ public class PoolTask {
|
||||
|
||||
}
|
||||
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setEperson(EPerson eperson){
|
||||
this.ePerson = eperson;
|
||||
}
|
||||
@@ -117,5 +122,4 @@ public class PoolTask {
|
||||
public String getActionID(){
|
||||
return this.actionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -133,8 +135,17 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
|
||||
@Override
|
||||
public void update(Context context, PoolTask poolTask) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(poolTask));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<PoolTask> poolTasks) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(poolTasks)) {
|
||||
for (PoolTask poolTask : poolTasks) {
|
||||
poolTaskDAO.save(context, poolTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, PoolTask poolTask) throws SQLException, AuthorizeException {
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
@@ -26,13 +27,13 @@ import java.sql.SQLException;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_workflowitemrole")
|
||||
public class WorkflowItemRole {
|
||||
public class WorkflowItemRole implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="workflowitemrole_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_workflowitemrole_seq")
|
||||
@SequenceGenerator(name="cwf_workflowitemrole_seq", sequenceName="cwf_workflowitemrole_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
// @Column(name = "role_id")
|
||||
// @Lob
|
||||
@@ -62,6 +63,10 @@ public class WorkflowItemRole {
|
||||
}
|
||||
|
||||
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setRoleId(String id){
|
||||
this.roleId = id;
|
||||
}
|
||||
@@ -93,5 +98,4 @@ public class WorkflowItemRole {
|
||||
public Group getGroup() throws SQLException {
|
||||
return group;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -15,6 +16,7 @@ import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,8 +74,17 @@ public class WorkflowItemRoleServiceImpl implements WorkflowItemRoleService {
|
||||
|
||||
@Override
|
||||
public void update(Context context, WorkflowItemRole workflowItemRole) throws SQLException, AuthorizeException {
|
||||
update(context, Collections.singletonList(workflowItemRole));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, List<WorkflowItemRole> workflowItemRoles) throws SQLException, AuthorizeException {
|
||||
if(CollectionUtils.isNotEmpty(workflowItemRoles)) {
|
||||
for (WorkflowItemRole workflowItemRole : workflowItemRoles) {
|
||||
workflowItemRoleDAO.save(context, workflowItemRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, WorkflowItemRole workflowItemRole) throws SQLException, AuthorizeException {
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.xmlworkflow.storedcomponents;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
@@ -26,13 +27,13 @@ import java.sql.SQLException;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="cwf_workflowitem")
|
||||
public class XmlWorkflowItem implements WorkflowItem {
|
||||
public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name="workflowitem_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="cwf_workflowitem_seq")
|
||||
@SequenceGenerator(name="cwf_workflowitem_seq", sequenceName="cwf_workflowitem_seq", allocationSize = 1)
|
||||
private int id;
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "collection_id")
|
||||
@@ -67,7 +68,7 @@ public class XmlWorkflowItem implements WorkflowItem {
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public int getID()
|
||||
public Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@ CREATE INDEX metadatafieldregistry_idx_element_qualifier on metadatafieldregistr
|
||||
|
||||
CREATE INDEX resourcepolicy_idx_rptype on resourcepolicy(rptype);
|
||||
|
||||
-- Clean up
|
||||
ALTER TABLE resourcepolicy DROP CONSTRAINT ResourcePolicy_dspace_object_fk;
|
||||
ALTER TABLE ResourcePolicy ADD CONSTRAINT ResourcePolicy_dspace_object_fk FOREIGN KEY (dspace_object) REFERENCES dspaceobject ON DELETE CASCADE;
|
||||
|
||||
-- Duplicates of INDEX metadatavalue_field_object (a composite index can also serve as a 'single field' index)
|
||||
DROP INDEX metadatavalue_field;
|
||||
DROP INDEX metadatavalue_field_fk_idx;
|
||||
ALTER TABLE metadatavalue DROP CONSTRAINT metadatavalue_dspace_object_id_fk;
|
||||
ALTER TABLE metadatavalue ADD CONSTRAINT metadatavalue_dspace_object_id_fk FOREIGN KEY (dspace_object_id) REFERENCES dspaceobject ON DELETE CASCADE;
|
||||
|
@@ -21,8 +21,16 @@ CREATE INDEX metadatafieldregistry_idx_element_qualifier on metadatafieldregistr
|
||||
|
||||
CREATE INDEX resourcepolicy_idx_rptype on resourcepolicy(rptype);
|
||||
|
||||
-- Clean up
|
||||
ALTER TABLE resourcepolicy
|
||||
DROP CONSTRAINT resourcepolicy_dspace_object_fkey,
|
||||
ADD CONSTRAINT resourcepolicy_dspace_object_fkey
|
||||
FOREIGN KEY (dspace_object)
|
||||
REFERENCES dspaceobject(uuid)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
-- Duplicates of INDEX metadatavalue_field_object (a composite index can also serve as a 'single field' index)
|
||||
DROP INDEX metadatavalue_field;
|
||||
DROP INDEX metadatavalue_field_fk_idx;
|
||||
ALTER TABLE metadatavalue
|
||||
DROP CONSTRAINT metadatavalue_dspace_object_id_fkey,
|
||||
ADD CONSTRAINT metadatavalue_dspace_object_id_fkey
|
||||
FOREIGN KEY (dspace_object)
|
||||
REFERENCES dspaceobject(uuid)
|
||||
ON DELETE CASCADE;
|
@@ -21,8 +21,22 @@ CREATE INDEX metadatafieldregistry_idx_element_qualifier on metadatafieldregistr
|
||||
|
||||
CREATE INDEX resourcepolicy_idx_rptype on resourcepolicy(rptype);
|
||||
|
||||
ALTER TABLE resourcepolicy
|
||||
DROP CONSTRAINT resourcepolicy_dspace_object_fkey,
|
||||
ADD CONSTRAINT resourcepolicy_dspace_object_fkey
|
||||
FOREIGN KEY (dspace_object)
|
||||
REFERENCES dspaceobject(uuid)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE metadatavalue
|
||||
DROP CONSTRAINT metadatavalue_dspace_object_id_fkey,
|
||||
ADD CONSTRAINT metadatavalue_dspace_object_id_fkey
|
||||
FOREIGN KEY (dspace_object)
|
||||
REFERENCES dspaceobject(uuid)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
-- Clean up
|
||||
|
||||
-- Duplicates of INDEX metadatavalue_field_object (a composite index can also serve as a 'single field' index)
|
||||
-- Duplicate of INDEX metadatavalue_field_object (a composite index can also serve as a 'single field' index)
|
||||
-- and metadatavalue_field_fk_idx. This index also does not exist for H2 or Oracle.
|
||||
DROP INDEX metadatavalue_field;
|
||||
DROP INDEX metadatavalue_field_fk_idx;
|
@@ -7,10 +7,6 @@
|
||||
*/
|
||||
package org.dspace;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
@@ -26,6 +22,10 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,8 @@ public class AbstractUnitTest extends AbstractDSpaceTest
|
||||
catch(SQLException se)
|
||||
{
|
||||
log.error("Error initializing database", se);
|
||||
fail("Error initializing database: " + se.getMessage());
|
||||
fail("Error initializing database: " + se.getMessage()
|
||||
+ (se.getCause() == null ? "" : ": " + se.getCause().getMessage()));
|
||||
}
|
||||
|
||||
// Initialize mock indexer (which does nothing, since Solr isn't running)
|
||||
|
@@ -7,26 +7,28 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import mockit.*;
|
||||
|
||||
import mockit.NonStrictExpectations;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.*;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.* ;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -88,6 +90,7 @@ public class InstallItemTest extends AbstractUnitTest
|
||||
context.turnOffAuthorisationSystem();
|
||||
communityService.delete(context, owningCommunity);
|
||||
context.restoreAuthSystemState();
|
||||
context.commit();
|
||||
} catch (SQLException | AuthorizeException | IOException ex) {
|
||||
log.error("SQL Error in destroy", ex);
|
||||
fail("SQL Error in destroy: " + ex.getMessage());
|
||||
|
@@ -8,18 +8,21 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import mockit.NonStrictExpectations;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.* ;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit Tests for class MetadataFieldTest
|
||||
@@ -136,7 +139,7 @@ public class MetadataFieldTest extends AbstractUnitTest
|
||||
@Test
|
||||
public void testGetFieldID()
|
||||
{
|
||||
assertTrue("testGetFieldID 0",mf.getFieldID() >= 0);
|
||||
assertTrue("testGetFieldID 0",mf.getID() >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,7 +224,7 @@ public class MetadataFieldTest extends AbstractUnitTest
|
||||
MetadataField m = metadataFieldService.create(context, dcSchema, elem, qual, null);
|
||||
|
||||
MetadataField found = metadataFieldService.findByElement(context, dcSchema, elem, qual);
|
||||
assertThat("testCreateAuth 0",found.getFieldID(), equalTo(m.getFieldID()));
|
||||
assertThat("testCreateAuth 0",found.getID(), equalTo(m.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +271,7 @@ public class MetadataFieldTest extends AbstractUnitTest
|
||||
{
|
||||
MetadataField found = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, element, qualifier);
|
||||
assertThat("testFindByElement 0",found, notNullValue());
|
||||
assertThat("testFindByElement 1",found.getFieldID(), equalTo(mf.getFieldID()));
|
||||
assertThat("testFindByElement 1",found.getID(), equalTo(mf.getID()));
|
||||
assertThat("testFindByElement 2",found.getElement(), equalTo(mf.getElement()));
|
||||
assertThat("testFindByElement 3",found.getQualifier(), equalTo(mf.getQualifier()));
|
||||
}
|
||||
@@ -334,7 +337,7 @@ public class MetadataFieldTest extends AbstractUnitTest
|
||||
metadataFieldService.update(context, m);
|
||||
|
||||
MetadataField found = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, elem, qual);
|
||||
assertThat("testUpdateAuth 0",found.getFieldID(), equalTo(m.getFieldID()));
|
||||
assertThat("testUpdateAuth 0",found.getID(), equalTo(m.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,11 +429,11 @@ public class MetadataFieldTest extends AbstractUnitTest
|
||||
@Test
|
||||
public void testFind() throws Exception
|
||||
{
|
||||
int id = mf.getFieldID();
|
||||
int id = mf.getID();
|
||||
|
||||
MetadataField found = metadataFieldService.find(context, id);
|
||||
assertThat("testFind 0",found, notNullValue());
|
||||
assertThat("testFind 1",found.getFieldID(), equalTo(mf.getFieldID()));
|
||||
assertThat("testFind 1",found.getID(), equalTo(mf.getID()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,18 +7,20 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import mockit.NonStrictExpectations;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.* ;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit Tests for class MetadataSchema
|
||||
@@ -120,7 +122,7 @@ public class MetadataSchemaTest extends AbstractUnitTest
|
||||
@Test
|
||||
public void testGetSchemaID() throws SQLException
|
||||
{
|
||||
assertThat("testGetSchemaID 0",ms.getSchemaID(), equalTo(metadataSchemaService.find(context, MetadataSchema.DC_SCHEMA).getSchemaID()));
|
||||
assertThat("testGetSchemaID 0",ms.getID(), equalTo(metadataSchemaService.find(context, MetadataSchema.DC_SCHEMA).getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +190,7 @@ public class MetadataSchemaTest extends AbstractUnitTest
|
||||
log.info(">>"+ms.getNamespace()+" "+ms.getName());
|
||||
MetadataSchema found = metadataSchemaService.findByNamespace(context, ms.getNamespace());
|
||||
assertThat("testFindByNamespace 0",found, notNullValue());
|
||||
assertThat("testFindByNamespace 1",found.getSchemaID(), equalTo(ms.getSchemaID()));
|
||||
assertThat("testFindByNamespace 1",found.getID(), equalTo(ms.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +212,7 @@ public class MetadataSchemaTest extends AbstractUnitTest
|
||||
metadataSchemaService.update(context, metadataSchema);
|
||||
|
||||
MetadataSchema found = metadataSchemaService.findByNamespace(context, namespace);
|
||||
assertThat("testUpdateAuth 0",found.getSchemaID(), equalTo(metadataSchema.getSchemaID()));
|
||||
assertThat("testUpdateAuth 0",found.getID(), equalTo(metadataSchema.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,9 +323,9 @@ public class MetadataSchemaTest extends AbstractUnitTest
|
||||
@Test
|
||||
public void testFind_Context_int() throws Exception
|
||||
{
|
||||
MetadataSchema found = metadataSchemaService.find(context, ms.getSchemaID());
|
||||
MetadataSchema found = metadataSchemaService.find(context, ms.getID());
|
||||
assertThat("testFind_Context_int 0",found, notNullValue());
|
||||
assertThat("testFind_Context_int 1",found.getSchemaID(), equalTo(ms.getSchemaID()));
|
||||
assertThat("testFind_Context_int 1",found.getID(), equalTo(ms.getID()));
|
||||
assertThat("testFind_Context_int 2",found.getName(), equalTo(ms.getName()));
|
||||
assertThat("testFind_Context_int 3",found.getNamespace(), equalTo(ms.getNamespace()));
|
||||
}
|
||||
@@ -337,7 +339,7 @@ public class MetadataSchemaTest extends AbstractUnitTest
|
||||
String shortName = ms.getName();
|
||||
MetadataSchema found = metadataSchemaService.find(context, shortName);
|
||||
assertThat("testFind_Context_String 0",found, notNullValue());
|
||||
assertThat("testFind_Context_String 1",found.getSchemaID(), equalTo(ms.getSchemaID()));
|
||||
assertThat("testFind_Context_String 1",found.getID(), equalTo(ms.getID()));
|
||||
assertThat("testFind_Context_String 2",found.getName(), equalTo(ms.getName()));
|
||||
assertThat("testFind_Context_String 3",found.getNamespace(), equalTo(ms.getNamespace()));
|
||||
|
||||
|
@@ -7,18 +7,21 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.*;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.AbstractUnitTest;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.*;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.* ;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit Tests for class MetadataValue
|
||||
@@ -132,9 +135,9 @@ public class MetadataValueTest extends AbstractUnitTest
|
||||
public void testGetFieldId()
|
||||
{
|
||||
MetadataValue instance = new MetadataValue();
|
||||
assertThat("testGetFieldId 0", instance.getValueId(), equalTo(0));
|
||||
assertThat("testGetFieldId 0", instance.getID(), equalTo(0));
|
||||
|
||||
assertThat("testGetFieldId 1", mv.getMetadataField().getFieldID(), equalTo(mf.getFieldID()));
|
||||
assertThat("testGetFieldId 1", mv.getMetadataField().getID(), equalTo(mf.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +195,7 @@ public class MetadataValueTest extends AbstractUnitTest
|
||||
@Test
|
||||
public void testGetValueId()
|
||||
{
|
||||
assertThat("testGetValueId 0",mv.getValueId(), notNullValue());
|
||||
assertThat("testGetValueId 0",mv.getID(), notNullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,10 +274,10 @@ public class MetadataValueTest extends AbstractUnitTest
|
||||
public void testFind() throws Exception
|
||||
{
|
||||
metadataValueService.create(context, it, mf);
|
||||
int id = mv.getValueId();
|
||||
int id = mv.getID();
|
||||
MetadataValue found = metadataValueService.find(context, id);
|
||||
assertThat("testFind 0",found, notNullValue());
|
||||
assertThat("testFind 1",found.getValueId(), equalTo(id));
|
||||
assertThat("testFind 1",found.getID(), equalTo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -58,4 +58,5 @@ log4j.logger.org.hibernate=INFO
|
||||
# For detailed Hibernate logging in Unit Tests, you can enable the following
|
||||
# setting which logs all JDBC bind parameter runtime arguments.
|
||||
# This will drastically increase the size of Unit Test logs though.
|
||||
#log4j.logger.org.hibernate.type=TRACE
|
||||
log4j.logger.org.hibernate.SQL=DEBUG, A1
|
||||
log4j.logger.org.hibernate.type=TRACE, A1
|
||||
|
@@ -7,15 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.webui.servlet;
|
||||
|
||||
import com.hp.hpl.jena.sparql.vocabulary.DOAP;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UIUtil;
|
||||
@@ -33,6 +24,13 @@ import org.dspace.versioning.factory.VersionServiceFactory;
|
||||
import org.dspace.versioning.service.VersionHistoryService;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Servlet for handling the operations in the version history page
|
||||
*
|
||||
@@ -98,7 +96,7 @@ public class VersionHistoryServlet extends DSpaceServlet
|
||||
Version version = versionHistoryService.getVersion(context, history, item);
|
||||
if (version != null)
|
||||
{
|
||||
versionID = String.valueOf(version.getId());
|
||||
versionID = String.valueOf(version.getID());
|
||||
}
|
||||
}
|
||||
String submit = UIUtil.getSubmitButton(request, "submit");
|
||||
|
@@ -7,27 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.webui.servlet.admin;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.fileupload.FileUploadBase.FileSizeLimitExceededException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.util.AuthorizeUtil;
|
||||
@@ -37,23 +16,11 @@ import org.dspace.app.webui.util.FileUploadRequest;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UIUtil;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.BitstreamFormat;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.*;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.dspace.content.service.*;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
@@ -62,6 +29,13 @@ import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.license.factory.LicenseServiceFactory;
|
||||
import org.dspace.license.service.CreativeCommonsService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Servlet for editing and deleting (expunging) items
|
||||
*
|
||||
@@ -479,7 +453,7 @@ public class EditItemServlet extends DSpaceServlet
|
||||
{
|
||||
String displayName = "";
|
||||
displayName = schemaName + "." + f.getElement() + (f.getQualifier() == null ? "" : "." + f.getQualifier());
|
||||
metadataFields.put(f.getFieldID(), displayName);
|
||||
metadataFields.put(f.getID(), displayName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -188,7 +188,7 @@
|
||||
<% if(hasVersionHistory) { %>
|
||||
<form method="get" action="<%= request.getContextPath() %>/tools/history">
|
||||
<input type="hidden" name="itemID" value="<%= item.getID() %>" />
|
||||
<input type="hidden" name="versionID" value="<%= versionHistoryService.getVersion(context, history, item)!=null?versionHistoryService.getVersion(context, history, item).getId():null %>" />
|
||||
<input type="hidden" name="versionID" value="<%= versionHistoryService.getVersion(context, history, item)!=null?versionHistoryService.getVersion(context, history, item).getID():null %>" />
|
||||
<input class="btn btn-info col-md-12" type="submit" name="submit" value="<fmt:message key="jsp.general.version.history.button"/>" />
|
||||
</form>
|
||||
<% } %>
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<%-- <P>This will result in an error if any items have values for this metadata field.</P> --%>
|
||||
<p class="alert alert-warning"><fmt:message key="jsp.dspace-admin.confirm-delete-mdfield.warning"/></p>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="dc_type_id" value="<%= type.getFieldID() %>">
|
||||
<input type="hidden" name="dc_type_id" value="<%= type.getID() %>">
|
||||
<div class="btn-group">
|
||||
<%-- <input type="submit" name="submit_confirm_delete" value="Delete"> --%>
|
||||
<input class="btn btn-danger" type="submit" name="submit_confirm_delete" value="<fmt:message key="jsp.dspace-admin.general.delete"/>" />
|
||||
|
@@ -48,7 +48,7 @@
|
||||
<p class="alert alert-warning"><fmt:message key="jsp.dspace-admin.confirm-delete-mdschema.warning"/></p>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schema.getSchemaID() %>">
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schema.getID() %>">
|
||||
<div class="btn-group">
|
||||
<%-- <input type="submit" name="submit_confirm_delete" value="Delete"> --%>
|
||||
<input class="btn btn-danger" type="submit" name="submit_confirm_delete" value="<fmt:message key="jsp.dspace-admin.general.delete"/>">
|
||||
|
@@ -92,7 +92,7 @@ if (error!=null) {
|
||||
<tr>
|
||||
<td>
|
||||
<form class="form-inline" method="post" action="">
|
||||
<span class="col-md-1"><%= types.get(i).getFieldID() %></span>
|
||||
<span class="col-md-1"><%= types.get(i).getID() %></span>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="element"><fmt:message key="jsp.dspace-admin.list-metadata-fields.element"/></label>
|
||||
@@ -109,7 +109,7 @@ if (error!=null) {
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
|
||||
<input type="hidden" name="dc_type_id" value="<%= types.get(i).getFieldID() %>"/>
|
||||
<input type="hidden" name="dc_type_id" value="<%= types.get(i).getID() %>"/>
|
||||
<input class="btn btn-primary" type="submit" name="submit_update" value="<fmt:message key="jsp.dspace-admin.general.update"/>"/>
|
||||
|
||||
<input class="btn btn-danger" type="submit" name="submit_delete" value="<fmt:message key="jsp.dspace-admin.general.delete-w-confirm"/>"/>
|
||||
@@ -125,7 +125,7 @@ if (error!=null) {
|
||||
</table>
|
||||
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schema.getSchemaID() %>"/>
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schema.getID() %>"/>
|
||||
<h2><fmt:message key="jsp.dspace-admin.list-metadata-fields.addfield"/></h2>
|
||||
<p class="alert alert-info"><fmt:message key="jsp.dspace-admin.list-metadata-fields.addfieldnote"/></p>
|
||||
|
||||
@@ -157,7 +157,7 @@ if (error!=null) {
|
||||
for (int i = 0; i < types.size(); i++)
|
||||
{
|
||||
String qualifier = (types.get(i).getQualifier() == null ? "" : "."+types.get(i).getQualifier());
|
||||
%> <option value="<%= types.get(i).getFieldID() %>"><%= types.get(i).getElement()+qualifier %></option>
|
||||
%> <option value="<%= types.get(i).getID() %>"><%= types.get(i).getElement()+qualifier %></option>
|
||||
<% }
|
||||
%>
|
||||
</select>
|
||||
@@ -166,9 +166,9 @@ if (error!=null) {
|
||||
<%
|
||||
for (int i = 0; i < schemas.size(); i++)
|
||||
{
|
||||
if (schemas.get(i).getSchemaID() != schema.getSchemaID())
|
||||
if (schemas.get(i).getID() != schema.getID())
|
||||
{
|
||||
%> <option value="<%= schemas.get(i).getSchemaID() %>"><%= schemas.get(i).getNamespace() %></option>
|
||||
%> <option value="<%= schemas.get(i).getID() %>"><%= schemas.get(i).getNamespace() %></option>
|
||||
<% }
|
||||
}
|
||||
%>
|
||||
|
@@ -70,18 +70,18 @@ if (error!=null) {
|
||||
{
|
||||
%>
|
||||
<tr>
|
||||
<td class="<%= row %>RowOddCol"><%= schemas.get(i).getSchemaID() %></td>
|
||||
<td class="<%= row %>RowOddCol"><%= schemas.get(i).getID() %></td>
|
||||
<td class="<%= row %>RowEvenCol">
|
||||
<a href="<%=request.getContextPath()%>/dspace-admin/metadata-field-registry?dc_schema_id=<%= schemas.get(i).getSchemaID() %>"><%= schemas.get(i).getNamespace() %></a>
|
||||
<a href="<%=request.getContextPath()%>/dspace-admin/metadata-field-registry?dc_schema_id=<%= schemas.get(i).getID() %>"><%= schemas.get(i).getNamespace() %></a>
|
||||
</td>
|
||||
<td class="<%= row %>RowOddCol">
|
||||
<%= schemas.get(i).getName() %>
|
||||
</td>
|
||||
<td class="<%= row %>RowOddCol">
|
||||
<% if ( schemas.get(i).getSchemaID() != 1 ) { %>
|
||||
<% if ( schemas.get(i).getID() != 1 ) { %>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schemas.get(i).getSchemaID() %>"/>
|
||||
<input class="btn btn-primary" type="button" name="submit_update" value="<fmt:message key="jsp.dspace-admin.general.update"/>" onclick="javascript:document.schema.namespace.value='<%= schemas.get(i).getNamespace() %>';document.schema.short_name.value='<%= schemas.get(i).getName() %>';document.schema.dc_schema_id.value='<%= schemas.get(i).getSchemaID() %>';return null;"/>
|
||||
<input type="hidden" name="dc_schema_id" value="<%= schemas.get(i).getID() %>"/>
|
||||
<input class="btn btn-primary" type="button" name="submit_update" value="<fmt:message key="jsp.dspace-admin.general.update"/>" onclick="javascript:document.schema.namespace.value='<%= schemas.get(i).getNamespace() %>';document.schema.short_name.value='<%= schemas.get(i).getName() %>';document.schema.dc_schema_id.value='<%= schemas.get(i).getID() %>';return null;"/>
|
||||
<input class="btn btn-danger" type="submit" name="submit_delete" value="<fmt:message key="jsp.dspace-admin.general.delete-w-confirm"/>"/>
|
||||
</form>
|
||||
<% } %>
|
||||
|
@@ -83,7 +83,7 @@
|
||||
<%
|
||||
for (int dc = 0; dc < dcTypes.size(); dc++)
|
||||
{ %>
|
||||
<option value="<%= dcTypes.get(dc).getFieldID() %>"><%= dcTypes.get(dc).getQualifier() == null ?
|
||||
<option value="<%= dcTypes.get(dc).getID() %>"><%= dcTypes.get(dc).getQualifier() == null ?
|
||||
dcTypes.get(dc).getMetadataSchema().getName() + "." + dcTypes.get(dc).getElement() : dcTypes.get(dc).getMetadataSchema().getName() + "." + dcTypes.get(dc).getElement() + "." + dcTypes.get(dc).getQualifier() %></option>
|
||||
<% } %>
|
||||
</select></td>
|
||||
|
@@ -486,7 +486,7 @@
|
||||
<select class="form-control" name="addfield_dctype">
|
||||
<% for (int i = 0; i < dcTypes.size(); i++)
|
||||
{
|
||||
Integer fieldID = new Integer(dcTypes.get(i).getFieldID());
|
||||
Integer fieldID = new Integer(dcTypes.get(i).getID());
|
||||
String displayName = (String)metadataFields.get(fieldID);
|
||||
%>
|
||||
<option value="<%= fieldID.intValue() %>"><%= displayName %></option>
|
||||
|
@@ -113,14 +113,14 @@ var j = jQuery.noConflict();
|
||||
|
||||
%>
|
||||
<tr>
|
||||
<td headers="t0"><input type="checkbox" class="remove" name="remove" value="<%=versRow.getId()%>"/></td>
|
||||
<td headers="t0"><input type="checkbox" class="remove" name="remove" value="<%=versRow.getID()%>"/></td>
|
||||
<td headers="t1" class="oddRowEvenCol"><%= versRow.getVersionNumber() %></td>
|
||||
<td headers="t2" class="oddRowOddCol"><a href="<%= url %>"><%= identifier %></a><%= item.getID()==versRow.getItem().getID()?"<span class=\"glyphicon glyphicon-asterisk\"></span>":""%></td>
|
||||
<% if (show_submitter) { %>
|
||||
<td headers="t3" class="oddRowEvenCol"><a href="mailto:<%= versRowPerson.getEmail() %>"><%=versRowPerson.getFullName() %></a></td>
|
||||
<% } %>
|
||||
<td headers="t4" class="oddRowOddCol"><%= versRow.getVersionDate() %></td>
|
||||
<td headers="t5" class="oddRowEvenCol"><%= versRow.getSummary() %><a class="btn btn-default pull-right" href="<%= request.getContextPath() %>/tools/version?itemID=<%= versRow.getItem().getID()%>&versionID=<%= versRow.getId() %>&submit_update_version"><span class="glyphicon glyphicon-pencil"></span> <fmt:message key="jsp.version.history.update"/></a></td>
|
||||
<td headers="t5" class="oddRowEvenCol"><%= versRow.getSummary() %><a class="btn btn-default pull-right" href="<%= request.getContextPath() %>/tools/version?itemID=<%= versRow.getItem().getID()%>&versionID=<%= versRow.getID() %>&submit_update_version"><span class="glyphicon glyphicon-pencil"></span> <fmt:message key="jsp.version.history.update"/></a></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</table>
|
||||
|
@@ -7,15 +7,15 @@
|
||||
*/
|
||||
package org.dspace.xoai.services.impl;
|
||||
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xoai.exceptions.InvalidMetadataFieldException;
|
||||
import org.dspace.xoai.services.api.FieldResolver;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.regex.Pattern;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
|
||||
public class DSpaceFieldResolver implements FieldResolver {
|
||||
private MetadataFieldCache metadataFieldCache = null;
|
||||
@@ -41,7 +41,7 @@ public class DSpaceFieldResolver implements FieldResolver {
|
||||
MetadataField metadataField = metadataFieldService.findByElement(context, schema, element, qualifier);
|
||||
if (null != metadataField)
|
||||
{
|
||||
metadataFieldCache.add(field, metadataField.getFieldID());
|
||||
metadataFieldCache.add(field, metadataField.getID());
|
||||
}
|
||||
else
|
||||
throw new InvalidMetadataFieldException();
|
||||
|
@@ -55,7 +55,7 @@ public class MetadataField {
|
||||
}
|
||||
|
||||
this.setName(sb.toString());
|
||||
this.setFieldId(field.getFieldID());
|
||||
this.setFieldId(field.getID());
|
||||
this.setElement(field.getElement());
|
||||
this.setQualifier(field.getQualifier());
|
||||
this.setDescription(field.getScopeNote());
|
||||
|
@@ -48,7 +48,7 @@ public class MetadataSchema {
|
||||
if(expand != null) {
|
||||
expandFields = Arrays.asList(expand.split(","));
|
||||
}
|
||||
this.setSchemaID(schema.getSchemaID());
|
||||
this.setSchemaID(schema.getID());
|
||||
this.setPrefix(schema.getName());
|
||||
this.setNamespace(schema.getNamespace());
|
||||
if (expandFields.contains("fields") || expandFields.contains("all")) {
|
||||
|
@@ -338,6 +338,9 @@ public class FlowContainerUtils
|
||||
*/
|
||||
public static FlowResult processReimportCollection(Context context, UUID collectionID, Request request) throws SQLException, IOException, AuthorizeException, CrosswalkException, ParserConfigurationException, SAXException, TransformerException, BrowseException
|
||||
{
|
||||
boolean originalMode = context.isBatchModeEnabled();
|
||||
context.enableBatchMode(true);
|
||||
|
||||
Collection collection = collectionService.find(context, collectionID);
|
||||
HarvestedCollection hc = harvestedCollectionService.find(context, collection);
|
||||
|
||||
@@ -357,6 +360,9 @@ public class FlowContainerUtils
|
||||
collectionService.update(context, collection);
|
||||
// update the context?
|
||||
//context.dispatchEvent() // not sure if this is required yet.ts();
|
||||
|
||||
context.enableBatchMode(originalMode);
|
||||
|
||||
return processRunCollectionHarvest(context, collectionID, request);
|
||||
}
|
||||
|
||||
|
@@ -7,13 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.utils.RequestUtils;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
@@ -30,6 +23,13 @@ import org.dspace.content.service.MetadataSchemaService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -112,7 +112,7 @@ public class FlowRegistryUtils
|
||||
result.setContinue(true);
|
||||
result.setOutcome(true);
|
||||
result.setMessage(T_add_metadata_schema_success_notice);
|
||||
result.setParameter("schemaID", schema.getSchemaID());
|
||||
result.setParameter("schemaID", schema.getID());
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -213,7 +213,7 @@ public class FlowRegistryUtils
|
||||
result.setContinue(true);
|
||||
result.setOutcome(true);
|
||||
result.setMessage(T_add_metadata_field_success_notice);
|
||||
result.setParameter("fieldID", field.getFieldID());
|
||||
result.setParameter("fieldID", field.getID());
|
||||
}
|
||||
catch (NonUniqueMetadataException nume)
|
||||
{
|
||||
@@ -269,7 +269,7 @@ public class FlowRegistryUtils
|
||||
|
||||
// Check to make sure the field is unique, sometimes the NonUniqueMetadataException is not thrown.
|
||||
MetadataField possibleDuplicate = metadataFieldService.findByElement(context, metadataSchemaService.find(context, schemaID), element, qualifier);
|
||||
if (possibleDuplicate != null && possibleDuplicate.getFieldID() != fieldID)
|
||||
if (possibleDuplicate != null && possibleDuplicate.getID() != fieldID)
|
||||
{
|
||||
result.addError("duplicate_field");
|
||||
}
|
||||
|
@@ -7,35 +7,15 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.item;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.Button;
|
||||
import org.dspace.app.xmlui.wing.element.Cell;
|
||||
import org.dspace.app.xmlui.wing.element.CheckBox;
|
||||
import org.dspace.app.xmlui.wing.element.Composite;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.Params;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Select;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.Text;
|
||||
import org.dspace.app.xmlui.wing.element.TextArea;
|
||||
import org.dspace.app.xmlui.wing.element.Value;
|
||||
import org.dspace.app.xmlui.wing.element.*;
|
||||
import org.dspace.content.*;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.authority.factory.ContentAuthorityServiceFactory;
|
||||
import org.dspace.content.authority.service.ChoiceAuthorityService;
|
||||
@@ -45,6 +25,12 @@ import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Display a list of all metadata available for this item and allow the user to
|
||||
* add, remove, or update it.
|
||||
@@ -176,7 +162,7 @@ public class EditItemMetadataForm extends AbstractDSpaceTransformer {
|
||||
java.util.List<MetadataField> fields = metadataFieldService.findAll(context);
|
||||
for (MetadataField field : fields)
|
||||
{
|
||||
int fieldID = field.getFieldID();
|
||||
int fieldID = field.getID();
|
||||
MetadataSchema schema = field.getMetadataSchema();
|
||||
String name = schema.getName() +"."+field.getElement();
|
||||
if (field.getQualifier() != null)
|
||||
|
@@ -7,24 +7,18 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.registries;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.*;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Prompt the user with a list of to-be-deleted metadata fields and
|
||||
@@ -108,7 +102,7 @@ public class DeleteMetadataFieldsConfirm extends AbstractDSpaceTransformer
|
||||
continue;
|
||||
}
|
||||
|
||||
String fieldID = String.valueOf(field.getFieldID());
|
||||
String fieldID = String.valueOf(field.getID());
|
||||
String fieldEelement = field.getElement();
|
||||
String fieldQualifier = field.getQualifier();
|
||||
|
||||
|
@@ -7,23 +7,18 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.registries;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.*;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Prompt the user to determin if they really want to delete the displayed schemas.
|
||||
*
|
||||
@@ -100,7 +95,7 @@ public class DeleteMetadataSchemaConfirm extends AbstractDSpaceTransformer
|
||||
for (MetadataSchema schema : schemas)
|
||||
{
|
||||
Row row = table.addRow();
|
||||
row.addCell().addContent(schema.getSchemaID());
|
||||
row.addCell().addContent(schema.getID());
|
||||
row.addCell().addContent(schema.getNamespace());
|
||||
row.addCell().addContent(schema.getName());
|
||||
}
|
||||
|
@@ -7,32 +7,21 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.registries;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.CheckBox;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.Highlight;
|
||||
import org.dspace.app.xmlui.wing.element.Item;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.Text;
|
||||
import org.dspace.app.xmlui.wing.element.TextArea;
|
||||
import org.dspace.app.xmlui.wing.element.*;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Edit a metadata schema by: listing all the existing fields in
|
||||
* the schema, prompt the user to add a new field. If a current
|
||||
@@ -177,7 +166,7 @@ public class EditMetadataSchema extends AbstractDSpaceTransformer
|
||||
|
||||
for (MetadataField field : fields)
|
||||
{
|
||||
String id = String.valueOf(field.getFieldID());
|
||||
String id = String.valueOf(field.getID());
|
||||
String fieldElement = field.getElement();
|
||||
String fieldQualifier = field.getQualifier();
|
||||
|
||||
@@ -188,7 +177,7 @@ public class EditMetadataSchema extends AbstractDSpaceTransformer
|
||||
}
|
||||
|
||||
boolean highlight = false;
|
||||
if (field.getFieldID() == highlightID)
|
||||
if (field.getID() == highlightID)
|
||||
{
|
||||
highlight = true;
|
||||
}
|
||||
@@ -320,7 +309,7 @@ public class EditMetadataSchema extends AbstractDSpaceTransformer
|
||||
|
||||
|
||||
Division newField = div.addDivision("edit-schema-update-field");
|
||||
newField.setHead(T_head4.parameterize(field.getFieldID()));
|
||||
newField.setHead(T_head4.parameterize(field.getID()));
|
||||
|
||||
List form = newField.addList("edit-schema-update-field-form",List.TYPE_FORM);
|
||||
|
||||
|
@@ -7,26 +7,19 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.registries;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.CheckBox;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.Text;
|
||||
import org.dspace.app.xmlui.wing.element.*;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This is the main entry point for managing the metadata registry. This transformer
|
||||
* shows the list of all current schemas and a form for adding new schema's to the
|
||||
@@ -134,7 +127,7 @@ public class MetadataRegistryMain extends AbstractDSpaceTransformer
|
||||
|
||||
for (MetadataSchema schema : schemas)
|
||||
{
|
||||
int schemaID = schema.getSchemaID();
|
||||
int schemaID = schema.getID();
|
||||
String namespace = schema.getNamespace();
|
||||
String name = schema.getName();
|
||||
String url = contextPath
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user