Page History
Table of Contents |
---|
Tutorial
Info | ||
---|---|---|
| ||
The following repository contains a tutorial demonstrating the usage of the REST Base Report Tools: https://github.com/terrywbrady/restReportTutorial/blob/master/README.md |
Summary
These reports utilize the DSpace REST API to provide a Collection Manager with
...
Installing in DSpace 6
This feature code is scheduled to be a part of the DSpace 6 code base.See https://github.com/DSpace/DSpace/pull/1086
Disabling the REST Reports
...
Code Block | ||
---|---|---|
| ||
# Enable/disable authorization for the reporting tools. # By default, the DSpace REST API will only return communities/collections/items that are accessible to a particular user. # If the REST API has been deployed in a protected manner, the reporting tools can be configured to bypass authorization checks. # This will allow all items/collections/communities to be returned to the report user. # Set the rest-reporting-authenticate option to false to bypass authorization rest-.reporting-authenticate = false |
...
Code Block |
---|
# Configure the report pages that can be requested by name # Create a map of named reports that are available to a report tool user # Each map entry should be prefixed with rest-report-url # The map key is a name for a report # The map value is a URL to a report page # A list of available reports will be available with the call /rest/reports. # If a request is sent to /rest/reports/[report key], the request will be re-directed to the specified URL # # This project currently contains 2 sample reports. Eventually, additional reports could be introduced through this mechanism. rest-.report-url.collections = /rest/static/index.html rest-.report-url.item-query = /rest/static/query.html |
Configure Item handle resolution
Enable the appropriate path to use to resolve an item handle restReport.js. (Depends on https://github.com/DSpace/DSpace/pull/1366/files)
Code Block | ||||
---|---|---|---|---|
| ||||
this.ROOTPATH = "/xmlui/handle/"
//this.ROOTPATH = "/jspui/handle/"
//this.ROOTPATH = "/handle/"
|
Enable User Authentication (Password AuthN only) for REST reports
Override the following function in your report file to enable/disable password AuthN for the REST reports. (Depends on https://github.com/DSpace/DSpace/pull/1369)
This setting can be found in restReport.js
Code Block | ||||
---|---|---|---|---|
| ||||
//disable this setting if Password Authentication is not supported
this.makeAuthLink = function(){return true;}; |
Configure the database-specific format for a regex expression
Code Block |
---|
# The REST Report Tools may pass a regular expression test to the database. # The following configuration setting will construct a SQL regular expression test appropriate to your database engine rest-.regex-clause = text_value ~ ? |
...
- Install sortable.js http://www.kryogenix.org/code/browser/sorttable/
- Add to /dspace/modules/rest/src/main/webapp/static/reports
Include sortable.js in index.html and query.html
Code Block language xml title Uncomment the following in index.html and query.html <!-- <script src="sorttable.js"></script> -->
Enable sortable in the report code in restCollReport.js and restQueryReport.js
Code Block language js title CHANGE var CollReport = function() { Report.call(this); //If sortable.js is included, uncomment the following //this.hasSorttable = function(){return true;} var QueryReport = function() { Report.call(this); //If sortable.js is included, uncomment the following //this.hasSorttable = function(){return true;}
Code Block language js title CHANGE TO var CollReport = function() { Report.call(this); //If sortable.js is included, uncomment the following this.hasSorttable = function(){return true;} var QueryReport = function() { Report.call(this); //If sortable.js is included, uncomment the following this.hasSorttable = function(){return true;}
Troubleshooting
Normalizing Metadata Language Field for Bulk Edit
The report tools allow a user to export query results as a CSV file that can be input with the Batch Metadata Editing tool.
If your repository has *unintentionally* tagged metadata fields with language codes, you may need want to normalize the language values in use.
Non-normalized View
Code Block | ||||
---|---|---|---|---|
| ||||
id,collection,subject[en],subject[en_us],subject[en_US]
111-222-333,123456789/1,cat,,
111-222-333,123456789/2,,dog,
111-222-333,123456789/3,,,bird |
Normalized View
Code Block | ||||
---|---|---|---|---|
| ||||
id,collection,subject[en]
111-222-333,123456789/1,cat
111-222-333,123456789/2,dog
111-222-333,123456789/3,bird |
The report tools contain a function that can be overridden to explicitly set a default language. Use this with caution in a multi lingual DSpace deployment.
Code Block | ||
---|---|---|
| ||
this.getLangSuffix = function(){
return "[en]";
} |
The following SQL might be helpful in this instance.
Code Block | ||
---|---|---|
| ||
update metadatavalue set text_lang='en'
where text_lang is null and dspace_object_id in (select uuid from item);
update metadatavalue set text_lang='en'
where text_lang in ('','en_US', 'en-US','en_us')
and dspace_object_id in (select uuid from item); |
Installing in DSpace 5
This feature is not a part of the DSpace 5 code base. Please see the following notes to enable a DSpace 5 compatible version of these reports.
Install Install https://github.com/DSpace/DSpace/pull/1062
This code also exists at https://github.com/Georgetown-University-Libraries/DSpace/tree/rest-reports-for-5_xChange the following code into restCollReport.js and restQuery.js to pull the correct id for each DSpace Object
Code Block language js title Change the following in restCollReport.js and restQuery.js var CollReport = function() { Report.call(this); var QueryReport = function() { Report.call(this);
Code Block language js title Change TO var CollReport = function() { Report.call(this); this.getId = function(obj) {return obj.id;} var QueryReport = function() { Report.call(this); this.getId = function(obj) {return obj.id;}