Support Metadata On All DSpaceObjects

This commit is contained in:
KevinVdV
2014-09-24 16:16:06 +02:00
parent ca090a8e8a
commit 87cd7145c9
63 changed files with 2721 additions and 1683 deletions

View File

@@ -42,9 +42,6 @@ public class Bundle extends DSpaceObject
/** log4j logger */
private static Logger log = Logger.getLogger(Bundle.class);
/** Our context */
private Context ourContext;
/** The table row corresponding to this bundle */
private TableRow bundleRow;
@@ -54,9 +51,6 @@ public class Bundle extends DSpaceObject
/** Flag set when data is modified, for events */
private boolean modified;
/** Flag set when metadata is modified, for events */
private boolean modifiedMetadata;
/**
* Construct a bundle object with the given table row
*
@@ -67,7 +61,7 @@ public class Bundle extends DSpaceObject
*/
Bundle(Context context, TableRow row) throws SQLException
{
ourContext = context;
super(context);
bundleRow = row;
bitstreams = new ArrayList<Bitstream>();
String bitstreamOrderingField = ConfigurationManager.getProperty("webui.bitstream.order.field");
@@ -134,7 +128,6 @@ public class Bundle extends DSpaceObject
context.cache(this, row.getIntColumn("bundle_id"));
modified = false;
modifiedMetadata = false;
}
/**
@@ -226,7 +219,7 @@ public class Bundle extends DSpaceObject
*/
public String getName()
{
return bundleRow.getStringColumn("name");
return getMetadataFirstValue(MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
}
/**
@@ -238,8 +231,7 @@ public class Bundle extends DSpaceObject
*/
public void setName(String name)
{
bundleRow.setColumn("name", name);
modifiedMetadata = true;
setMetadataSingleValue(MetadataSchema.DC_SCHEMA, "title", null, null, name);
}
/**
@@ -611,6 +603,8 @@ public class Bundle extends DSpaceObject
log.info(LogManager.getHeader(ourContext, "update_bundle", "bundle_id="
+ getID()));
DatabaseManager.update(ourContext, bundleRow);
if (modified)
{
ourContext.addEvent(new Event(Event.MODIFY, Constants.BUNDLE, getID(),
@@ -619,12 +613,9 @@ public class Bundle extends DSpaceObject
}
if (modifiedMetadata)
{
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.BUNDLE,
getID(), null, getIdentifiers(ourContext)));
modifiedMetadata = false;
updateMetadata();
clearDetails();
}
DatabaseManager.update(ourContext, bundleRow);
}
/**
@@ -656,6 +647,8 @@ public class Bundle extends DSpaceObject
// Remove ourself
DatabaseManager.delete(ourContext, bundleRow);
removeMetadataFromDatabase();
}
/**