Fix authentication problem in SwordV2 implementation (DS-3310).

This commit is contained in:
gressho
2018-01-04 10:59:35 +01:00
parent 258b4f00e9
commit bda2f8709c
2 changed files with 69 additions and 51 deletions

View File

@@ -271,6 +271,31 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport
return bundles;
}
/**
* Get the bundles matching a bundle name (name corresponds roughly to type)
*
* @param name
* name of bundle (ORIGINAL/TEXT/THUMBNAIL)
*
* @return the bundles in an unordered array
*/
public List<Bundle> getBundles(String name)
{
List<Bundle> matchingBundles = new ArrayList<Bundle>();
// now only keep bundles with matching names
List<Bundle> bunds = getBundles();
for (Bundle bundle : bunds)
{
if (name.equals(bundle.getName()))
{
matchingBundles.add(bundle);
}
}
return matchingBundles;
}
/**
* Add a bundle to the item, should not be made public since we don't want to skip business logic
* @param bundle the bundle to be added
@@ -298,35 +323,35 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport
* @return <code>true</code> if object passed in represents the same item
* as this object
*/
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(obj);
if (this.getClass() != objClass)
{
return false;
}
final Item otherItem = (Item) obj;
if (!this.getID().equals(otherItem.getID()))
{
return false;
}
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(obj);
if (this.getClass() != objClass)
{
return false;
}
final Item otherItem = (Item) obj;
if (!this.getID().equals(otherItem.getID()))
{
return false;
}
return true;
}
return true;
}
@Override
public int hashCode()
{
int hash = 5;
hash += 71 * hash + getType();
hash += 71 * hash + getID().hashCode();
return hash;
}
@Override
public int hashCode()
{
int hash = 5;
hash += 71 * hash + getType();
hash += 71 * hash + getID().hashCode();
return hash;
}
/**
* return type found in Constants