forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from TAMULib/229-proxy-license-step
[Issue 229] TAMU Proxy License Step
- Loading branch information
Showing
24 changed files
with
2,119 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
NOTE: PLACE YOUR OWN LICENSE HERE | ||
This sample license is provided for informational purposes only. | ||
|
||
NON-EXCLUSIVE DISTRIBUTION LICENSE | ||
|
||
By signing and submitting this license, you (the author(s) or copyright owner) grants to DSpace University (DSU) the non-exclusive right to reproduce, translate (as defined below), and/or distribute your submission (including the abstract) worldwide in print and electronic format and in any medium, including but not limited to audio or video. | ||
By signing and submitting this license, you (the author(s) or copyright owner) grant to Texas A&M University ("Institution"), your academic department ("Department"), and the Texas Digital Library ("TDL") the non-exclusive right to reproduce, transfer (as defined below), and/or distribute your submission (including the abstract) worldwide in print and electronic format and in any medium, including but not limited to audio or video. | ||
|
||
You agree that DSU may, without changing the content, translate the submission to any medium or format for the purpose of preservation. | ||
You agree that the Institution may, without changing the content, transfer the submission to any medium or format for the purpose of preservation. | ||
|
||
You also agree that DSU may keep more than one copy of this submission for purposes of security, back-up and preservation. | ||
You also agree that the Institution may keep more than one copy of this submission for purposes of security, back-up and preservation. | ||
|
||
You represent that the submission is your original work, and that you have the right to grant the rights contained in this license. You also represent that your submission does not, to the best of your knowledge, infringe upon anyone's copyright. | ||
|
||
If the submission contains material for which you do not hold copyright, you represent that you have obtained the unrestricted permission of the copyright owner to grant DSU the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. | ||
If the submission contains material for which you do not hold copyright, you represent that you have obtained the unrestricted permission of the copyright owner to grant the Institution the rights required by this license, and that such third-party owned material is clearly identified and acknowledged within the text or content of the submission. | ||
|
||
IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED BY AN AGENCY OR ORGANIZATION OTHER THAN DSU, YOU REPRESENT THAT YOU HAVE FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH CONTRACT OR AGREEMENT. | ||
IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED BY AN AGENCY OR ORGANIZATION OTHER THAN THE INSTITUTION, YOU REPRESENT THAT YOU HAVE FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH CONTRACT OR AGREEMENT. | ||
|
||
DSU will clearly identify your name(s) as the author(s) or owner(s) of the submission, and will not make any alteration, other than as allowed by this license, to your submission. | ||
The Institution will clearly identify your name(s) as the author(s) or owner(s) of the submission, and will not make any alteration, other than as allowed by this license, to your submission. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# TAMU Customization - proxy license step configuration | ||
license.default.label = I am the rights holder to this work | ||
license.open.label = I warrant this work is in the public domain | ||
license.proxy.label = I am authorized by the rights holder to submit this work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
I warrant that: | ||
|
||
(1) This work is in the Public Domain | ||
|
||
Based on this, I further warrant that to my knowledge: | ||
|
||
(2) The Work does not infringe any copyright, patent, or trade secrets of any third party, and | ||
(3) The Work does not contain and libelous matter, nor invade the privacy of any person or third party, and | ||
(4) That no right in the Work has been sold, mortgaged, or otherwise disposed of, and is free from all exclusive claims. | ||
|
||
I agree to hold Institution, Department, TDL, and their agents harmless for any liability arising from any breach of the above warranties or any claim of intellectual property infringement arising from the exercise of these non-exclusive granted rights. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
SUBMISSION COPYRIGHT STATEMENT | ||
|
||
I grant Texas A&M University ("Institution"), my academic department ("Department"), and the Texas Digital Library ("TDL") the non-exclusive rights to copy, display, perform, distribute, and publish the content I submit to this repository ("Work") and make the Work available in any format in perpetuity as part of an Institution, Department or TDL repository communication or distribution effort. | ||
|
||
I understand that once the Work is submitted, a bibliographic citation to the Work will remain visible in perpetuity, even if the Work is updated or moved. | ||
|
||
I understand that the Work's copyright owner(s) will continue to own copyright outside these non-exclusive granted rights. | ||
|
||
I warrant that: | ||
|
||
(1) Another party is the copyright owner and I have permission to submit the Work. | ||
|
||
Based on this, I further warrant that to my knowledge: | ||
|
||
(2) The Work does not infringe any copyright, patent, or trade secrets of any third party, and (3) The Work does not contain any libelous matter, nor invade the privacy of any person or third party, and (4) That no right in the Work has been sold, mortgaged, or otherwise disposed of, and is free from all exclusive claims. | ||
|
||
I agree to hold Institution, Department, TDL, and their agents harmless for any liability arising from any breach of the above warranties or any claim of intellectual property infringement arising from the exercise of these non-exclusive granted rights. |
119 changes: 119 additions & 0 deletions
119
dspace/modules/additions/src/main/java/org/dspace/content/ProxyLicenseUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright | ||
* detailed in the LICENSE and NOTICE files at the root of the source | ||
* tree and available online at | ||
* | ||
* http://www.dspace.org/license/ | ||
*/ | ||
package org.dspace.content; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.sql.SQLException; | ||
import java.util.List; | ||
|
||
import org.dspace.authorize.AuthorizeException; | ||
import org.dspace.content.factory.ContentServiceFactory; | ||
import org.dspace.content.service.BitstreamFormatService; | ||
import org.dspace.content.service.BitstreamService; | ||
import org.dspace.content.service.BundleService; | ||
import org.dspace.content.service.ItemService; | ||
import org.dspace.core.Constants; | ||
import org.dspace.core.Context; | ||
|
||
/** | ||
* TAMU Customization - Proxy license utilility for decoupling license selection from accepting licence | ||
*/ | ||
public class ProxyLicenseUtils { | ||
private static final BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); | ||
private static final BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance() | ||
.getBitstreamFormatService(); | ||
private static final BundleService bundleService = ContentServiceFactory.getInstance().getBundleService(); | ||
private static final ItemService itemService = ContentServiceFactory.getInstance().getItemService(); | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
private ProxyLicenseUtils() { } | ||
|
||
/** | ||
* Store a copy of the license as the user selected for the item. | ||
* | ||
* @param context the dspace context | ||
* @param item the item object of the license | ||
* @param selection the license the user selected | ||
* @param licenseText the license text | ||
* @throws SQLException if database error | ||
* @throws IOException if IO error | ||
* @throws AuthorizeException if authorization error | ||
*/ | ||
public static void addLicense(Context context, Item item, String selection, String licenseText) | ||
throws SQLException, IOException, AuthorizeException { | ||
|
||
// Store text as a bitstream | ||
byte[] licenseBytes = licenseText.getBytes("UTF-8"); | ||
ByteArrayInputStream is = new ByteArrayInputStream(licenseBytes); | ||
|
||
List<Bundle> licenseBundles = itemService.getBundles(item, Constants.LICENSE_BUNDLE_NAME); | ||
Bundle licenseBundle = licenseBundles.size() > 0 | ||
? licenseBundles.get(0) | ||
: bundleService.create(context, item, Constants.LICENSE_BUNDLE_NAME); | ||
|
||
Bitstream bitstream = bitstreamService.create(context, licenseBundle, is); | ||
|
||
// Now set the format and name of the bitstream | ||
bitstream.setName(context, Constants.LICENSE_BITSTREAM_NAME); | ||
bitstream.setSource(context, "Written by org.dspace.content.ProxyLicenseUtils"); | ||
|
||
// Find the License format | ||
BitstreamFormat bf = bitstreamFormatService.findByShortDescription(context, | ||
"License"); | ||
bitstream.setFormat(bf); | ||
|
||
bitstreamService | ||
.setMetadataSingleValue(context, bitstream, "dcterms", "alternative", null, null, selection); | ||
|
||
bitstreamService.update(context, bitstream); | ||
} | ||
|
||
/** | ||
* Grant license bitstream setting acceptance date, `dcterms.accessRights`. | ||
* | ||
* @param context the dspace context | ||
* @param item the item object of the license | ||
* @throws SQLException if database error | ||
* @throws IOException if IO error | ||
* @throws AuthorizeException if authorization error | ||
*/ | ||
public static void grantLicense(Context context, Item item) | ||
throws SQLException, IOException, AuthorizeException { | ||
|
||
Bitstream b = bitstreamService | ||
.getBitstreamByName(item, Constants.LICENSE_BUNDLE_NAME, Constants.LICENSE_BITSTREAM_NAME); | ||
|
||
bitstreamService.setMetadataSingleValue(context, b, "dcterms", "accessRights", null, null, | ||
DCDate.getCurrent().toString()); | ||
|
||
bitstreamService.update(context, b); | ||
} | ||
|
||
/** | ||
* Revoke license bitstream unsetting the acceptance date, `dcterms.accessRights`. | ||
* | ||
* @param context the dspace context | ||
* @param item the item object of the license | ||
* @throws SQLException if database error | ||
* @throws IOException if IO error | ||
* @throws AuthorizeException if authorization error | ||
*/ | ||
public static void revokeLicense(Context context, Item item) | ||
throws SQLException, IOException, AuthorizeException { | ||
|
||
Bitstream b = bitstreamService | ||
.getBitstreamByName(item, Constants.LICENSE_BUNDLE_NAME, Constants.LICENSE_BITSTREAM_NAME); | ||
|
||
bitstreamService.clearMetadata(context, b, "dcterms", "accessRights", null, null); | ||
|
||
bitstreamService.update(context, b); | ||
} | ||
} |
Oops, something went wrong.