[DS-217] Hardcoded String in the license bitstream

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4644 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Andrea Bollini
2009-12-22 21:10:30 +00:00
parent 96da9e0c34
commit e1d2da5f1b
14 changed files with 308 additions and 61 deletions

View File

@@ -1443,42 +1443,6 @@ public class Item extends DSpaceObject
return bsArray;
}
/**
* Store a copy of the license a user granted in this item.
*
* @param license
* the license the user granted
* @param eperson
* the eperson who granted the license
* @throws SQLException
* @throws IOException
* @throws AuthorizeException
*/
public void licenseGranted(String license, EPerson eperson)
throws SQLException, IOException, AuthorizeException
{
// Put together text to store
String licenseText = "License granted by " + eperson.getFullName()
+ " (" + eperson.getEmail() + ") on "
+ DCDate.getCurrent().toString() + " (GMT):\n\n" + license;
// Store text as a bitstream
byte[] licenseBytes = licenseText.getBytes();
ByteArrayInputStream bais = new ByteArrayInputStream(licenseBytes);
Bitstream b = createSingleBitstream(bais, "LICENSE");
// Now set the format and name of the bitstream
b.setName("license.txt");
b.setSource("Written by org.dspace.content.Item");
// Find the License format
BitstreamFormat bf = BitstreamFormat.findByShortDescription(ourContext,
"License");
b.setFormat(bf);
b.update();
}
/**
* Remove just the DSpace license from an item This is useful to update the
* current DSpace license, in case the user must accept the DSpace license