mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
[DS-1229] @mire discovery contribution
This commit is contained in:
@@ -467,6 +467,8 @@ public class AuthorizeManager
|
||||
rp.setEPerson(e);
|
||||
|
||||
rp.update();
|
||||
|
||||
o.updateLastModified();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,6 +497,8 @@ public class AuthorizeManager
|
||||
rp.setGroup(g);
|
||||
|
||||
rp.update();
|
||||
|
||||
o.updateLastModified();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -710,6 +714,8 @@ public class AuthorizeManager
|
||||
// and write out new policy
|
||||
drp.update();
|
||||
}
|
||||
|
||||
dest.updateLastModified();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -725,6 +731,8 @@ public class AuthorizeManager
|
||||
public static void removeAllPolicies(Context c, DSpaceObject o)
|
||||
throws SQLException
|
||||
{
|
||||
o.updateLastModified();
|
||||
|
||||
// FIXME: authorization check?
|
||||
DatabaseManager.updateQuery(c, "DELETE FROM resourcepolicy WHERE "
|
||||
+ "resource_type_id= ? AND resource_id= ? ",
|
||||
@@ -748,6 +756,7 @@ public class AuthorizeManager
|
||||
public static void removePoliciesActionFilter(Context context,
|
||||
DSpaceObject dso, int actionID) throws SQLException
|
||||
{
|
||||
dso.updateLastModified();
|
||||
if (actionID == -1)
|
||||
{
|
||||
// remove all policies from object
|
||||
@@ -796,6 +805,8 @@ public class AuthorizeManager
|
||||
public static void removeGroupPolicies(Context c, DSpaceObject o, Group g)
|
||||
throws SQLException
|
||||
{
|
||||
o.updateLastModified();
|
||||
|
||||
DatabaseManager.updateQuery(c, "DELETE FROM resourcepolicy WHERE "
|
||||
+ "resource_type_id= ? AND resource_id= ? AND epersongroup_id= ? ",
|
||||
o.getType(), o.getID(), g.getID());
|
||||
@@ -817,6 +828,7 @@ public class AuthorizeManager
|
||||
public static void removeEPersonPolicies(Context c, DSpaceObject o, EPerson e)
|
||||
throws SQLException
|
||||
{
|
||||
o.updateLastModified();
|
||||
DatabaseManager.updateQuery(c, "DELETE FROM resourcepolicy WHERE "
|
||||
+ "resource_type_id= ? AND resource_id= ? AND eperson_id= ? ",
|
||||
o.getType(), o.getID(), e.getID());
|
||||
|
@@ -171,6 +171,16 @@ public class ResourcePolicy
|
||||
*/
|
||||
public void delete() throws SQLException
|
||||
{
|
||||
if(getResourceID() != -1 && getResourceType() != -1)
|
||||
{
|
||||
//A policy for a DSpace Object has been modified, fire a modify event on the DSpace object
|
||||
DSpaceObject dso = DSpaceObject.find(myContext, getResourceType(), getResourceID());
|
||||
if(dso != null)
|
||||
{
|
||||
dso.updateLastModified();
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: authorizations
|
||||
// Remove ourself
|
||||
DatabaseManager.delete(myContext, myRow);
|
||||
@@ -446,8 +456,15 @@ public class ResourcePolicy
|
||||
/**
|
||||
* Update the ResourcePolicy
|
||||
*/
|
||||
public void update() throws SQLException
|
||||
{
|
||||
public void update() throws SQLException, AuthorizeException {
|
||||
if(getResourceID() != -1 && getResourceType() != -1){
|
||||
//A policy for a DSpace Object has been modified, fire a modify event on the DSpace object
|
||||
DSpaceObject dso = DSpaceObject.find(myContext, getResourceType(), getResourceID());
|
||||
if(dso != null){
|
||||
dso.updateLastModified();
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Check authorisation
|
||||
DatabaseManager.update(myContext, myRow);
|
||||
}
|
||||
|
@@ -384,6 +384,12 @@ public class BrowseItem extends DSpaceObject
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isArchived()
|
||||
{
|
||||
return in_archive;
|
||||
|
@@ -735,4 +735,11 @@ public class Bitstream extends DSpaceObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
//Also fire a modified event since the bitstream HAS been modified
|
||||
bContext.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM, getID(), null));
|
||||
}
|
||||
}
|
||||
|
@@ -811,4 +811,10 @@ public class Bundle extends DSpaceObject
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1487,4 +1487,11 @@ public class Collection extends DSpaceObject
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
//Also fire a modified event since the collection HAS been modified
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION, getID(), null));
|
||||
}
|
||||
}
|
||||
|
@@ -1282,4 +1282,11 @@ public class Community extends DSpaceObject
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
//Also fire a modified event since the community HAS been modified
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY, getID(), null));
|
||||
}
|
||||
}
|
||||
|
@@ -161,4 +161,6 @@ public abstract class DSpaceObject
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void updateLastModified();
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.content;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -308,11 +309,18 @@ public class Item extends DSpaceObject
|
||||
|
||||
/**
|
||||
* Method that updates the last modified date of the item
|
||||
* The modified boolean will be set to true and the actual date update will occur on item.update().
|
||||
*/
|
||||
void updateLastModified()
|
||||
public void updateLastModified()
|
||||
{
|
||||
modified = true;
|
||||
try {
|
||||
Date lastModified = new Timestamp(new Date().getTime());
|
||||
itemRow.setColumn("last_modified", lastModified);
|
||||
DatabaseManager.updateQuery(ourContext, "UPDATE item SET last_modified = ? WHERE item_id= ? ", lastModified, getID());
|
||||
//Also fire a modified event since the item HAS been modified
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null));
|
||||
} catch (SQLException e) {
|
||||
log.error(LogManager.getHeader(ourContext, "Error while updating last modified timestamp", "Item: " + getID()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -105,6 +105,12 @@ public class Site extends DSpaceObject
|
||||
return ConfigurationManager.getProperty("dspace.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public String getURL()
|
||||
{
|
||||
return ConfigurationManager.getProperty("dspace.url");
|
||||
|
@@ -1103,4 +1103,10 @@ public class EPerson extends DSpaceObject
|
||||
return getEmail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1419,4 +1419,10 @@ public class Group extends DSpaceObject
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastModified()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user