Merge branch 'DS-1229'

Conflicts:
	dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/themes/Mirage/lib/css/style.css
This commit is contained in:
kevin
2012-08-20 09:06:24 +02:00
87 changed files with 4455 additions and 4398 deletions

View File

@@ -490,6 +490,8 @@ public class AuthorizeManager
rp.setRpType(type);
rp.update();
o.updateLastModified();
}
/**
@@ -543,6 +545,8 @@ public class AuthorizeManager
rp.setRpType(type);
rp.update();
o.updateLastModified();
}
/**
@@ -805,6 +809,8 @@ public class AuthorizeManager
// and write out new policy
drp.update();
}
dest.updateLastModified();
}
/**
@@ -820,6 +826,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= ? ",
@@ -882,6 +890,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
@@ -929,6 +938,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());
@@ -950,6 +961,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());

View File

@@ -180,6 +180,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);
@@ -455,8 +465,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);
}

View File

@@ -384,6 +384,12 @@ public class BrowseItem extends DSpaceObject
}
}
@Override
public void updateLastModified()
{
}
public boolean isArchived()
{
return in_archive;

View File

@@ -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));
}
}

View File

@@ -811,4 +811,10 @@ public class Bundle extends DSpaceObject
return null;
}
}
@Override
public void updateLastModified()
{
}
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -161,4 +161,6 @@ public abstract class DSpaceObject
{
return null;
}
public abstract void updateLastModified();
}

View File

@@ -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;
@@ -326,11 +327,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()));
}
}
/**

View File

@@ -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");

View File

@@ -1103,4 +1103,10 @@ public class EPerson extends DSpaceObject
return getEmail();
}
@Override
public void updateLastModified()
{
}
}

View File

@@ -1419,4 +1419,10 @@ public class Group extends DSpaceObject
}
return null;
}
@Override
public void updateLastModified()
{
}
}