mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Applied patch for SF bug #1145527 Able to delete 'unknown' bitstream format
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1122 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -52,6 +52,9 @@
|
||||
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
|
||||
|
||||
<%@ page import="org.dspace.content.BitstreamFormat" %>
|
||||
<%@ page import="org.dspace.core.Context"%>
|
||||
<%@ page import="org.dspace.app.webui.util.UIUtil"%>
|
||||
|
||||
|
||||
<%
|
||||
BitstreamFormat[] formats =
|
||||
@@ -87,6 +90,8 @@
|
||||
</tr>
|
||||
|
||||
<%
|
||||
Context context = UIUtil.obtainContext(request);
|
||||
|
||||
String row = "even";
|
||||
for (int i = 0; i < formats.length; i++)
|
||||
{
|
||||
@@ -109,7 +114,14 @@
|
||||
<input type="text" name="mimetype" value="<%= formats[i].getMIMEType() %>" size=14>
|
||||
</td>
|
||||
<td class="<%= row %>RowOddCol">
|
||||
<input type="text" name="short_description" value="<%= formats[i].getShortDescription() %>" size=10>
|
||||
<%
|
||||
if (BitstreamFormat.findUnknown(context).getID() == formats[i].getID()) {
|
||||
%>
|
||||
<i><%= formats[i].getShortDescription() %></i>
|
||||
<% } else { %>
|
||||
<input type="text" name="short_description" value="<%= formats[i].getShortDescription() %>" size=10>
|
||||
<% } %>
|
||||
|
||||
</td>
|
||||
<td class="<%= row %>RowEvenCol">
|
||||
<input type="text" name="description" value="<%= formats[i].getDescription() %>" size=20>
|
||||
@@ -132,7 +144,13 @@
|
||||
<input type="submit" name="submit_update" value="Update">
|
||||
</td>
|
||||
<td class="<%= row %>RowOddCol">
|
||||
<%
|
||||
if (BitstreamFormat.findUnknown(context).getID() != formats[i].getID()) {
|
||||
%>
|
||||
<input type="submit" name="submit_delete" value="Delete...">
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
|
@@ -409,8 +409,12 @@ public class BitstreamFormat
|
||||
* the new short description
|
||||
*/
|
||||
public void setShortDescription(String s)
|
||||
throws SQLException
|
||||
{
|
||||
bfRow.setColumn("short_description", s);
|
||||
// You can not reset the unknown's registry's name
|
||||
BitstreamFormat unknown = findUnknown(bfContext);
|
||||
if (unknown.getID() != getID())
|
||||
bfRow.setColumn("short_description", s);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -562,12 +566,15 @@ public class BitstreamFormat
|
||||
"Only administrators can delete bitstream formats");
|
||||
}
|
||||
|
||||
// Remove from cache
|
||||
bfContext.removeCached(this, getID());
|
||||
|
||||
// Find "unknown" type
|
||||
BitstreamFormat unknown = findUnknown(bfContext);
|
||||
|
||||
if (unknown.getID() == getID())
|
||||
throw new IllegalArgumentException("The Unknown bitstream format may not be deleted.");
|
||||
|
||||
// Remove from cache
|
||||
bfContext.removeCached(this, getID());
|
||||
|
||||
// Set bitstreams with this format to "unknown"
|
||||
int numberChanged = DatabaseManager.updateQuery(bfContext,
|
||||
"UPDATE bitstream SET bitstream_format_id=" + unknown.getID()
|
||||
|
Reference in New Issue
Block a user