mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 04:23:13 +00:00
[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:
@@ -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
|
||||
|
Reference in New Issue
Block a user