Merge pull request #346 from EKT/DS-1252-bte

[DS-1252] Integrate external bibliographic services in DSpace submission process - Integration with BTE
This commit is contained in:
Andrea Bollini
2013-10-21 15:13:10 -07:00
53 changed files with 6532 additions and 14 deletions

3
.gitignore vendored
View File

@@ -26,3 +26,6 @@ META-INF/
## Ignore all *.properties file in root folder, EXCEPT build.properties (the default)
/*.properties
!/build.properties
##Mac noise
.DS_Store

View File

@@ -438,21 +438,16 @@
<artifactId>bte-core</artifactId>
<version>0.9.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>gr.ekt.bte</groupId>
<artifactId>bte-io</artifactId>
<version>0.9.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
@@ -517,6 +512,24 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -189,4 +189,4 @@ public class XMLUtils
}
return result;
}
}
}

View File

@@ -0,0 +1,94 @@
/**
* 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.submit.importer;
import java.util.List;
public class ImportResultBean
{
private boolean scheduled;
private int tot;
private int failure;
private int success;
private int warning;
private List<SingleImportResultBean> details;
public boolean isScheduled()
{
return scheduled;
}
public void setScheduled(boolean scheduled)
{
this.scheduled = scheduled;
}
public int getTot()
{
return tot;
}
public void setTot(int tot)
{
this.tot = tot;
}
public int getFailure()
{
return failure;
}
public int getSuccess()
{
return success;
}
public int getWarning()
{
return warning;
}
public List<SingleImportResultBean> getDetails()
{
return details;
}
public void setDetails(List<SingleImportResultBean> details)
{
this.details = details;
int success = 0;
int failure = 0;
int warning = 0;
if (details != null)
{
for (SingleImportResultBean result : details)
{
switch (result.getStatus())
{
case SingleImportResultBean.ERROR:
failure++;
break;
case SingleImportResultBean.WARNING:
warning++;
break;
case SingleImportResultBean.SUCCESS:
success++;
break;
}
}
}
this.failure = failure;
this.success = success;
this.warning = warning;
}
}

View File

@@ -0,0 +1,15 @@
/**
* 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.submit.importer;
import org.dspace.eperson.EPerson;
public interface Importer
{
public ImportResultBean ingest(String data, EPerson eperson);
}

View File

@@ -0,0 +1,49 @@
/**
* 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.submit.importer;
public class ImporterException extends RuntimeException {
private int total;
private int limit;
private String pluginName;
public ImporterException(String cause, int tot, int limit, String pluginName) {
super(cause);
this.total = tot;
this.limit = limit;
this.pluginName = pluginName;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getPluginName() {
return pluginName;
}
public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
}

View File

@@ -0,0 +1,24 @@
/**
* 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.submit.importer;
/*
* Per ogni item che viene importato viene effettuato
* il set del metadato dc.identifier.source e il nome
* della classe istanziata.
* Tutti gli _importer estendono questa classe.
*/
public interface ItemImport {
public void setSource(String source);
public String getSource();
public void setRecord(String record);
public String getRecord();
}

View File

@@ -0,0 +1,64 @@
/**
* 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.submit.importer;
public class SingleImportResultBean
{
public static final int ERROR = 2;
public static final int WARNING = 1;
public static final int SUCCESS = 0;
private int status;
private int witemId;
private String message;
private String importIdentifier;
private String importData;
public SingleImportResultBean(int status, int itemId, String message,
String importIdentifier, String importData)
{
super();
this.status = status;
this.witemId = itemId;
this.message = message;
this.importIdentifier = importIdentifier;
this.importData = importData;
}
public int getStatus()
{
return status;
}
public int getWitemId()
{
return witemId;
}
public String getMessage()
{
return message;
}
public String getImportIdentifier()
{
return importIdentifier;
}
public String getImportData()
{
return importData;
}
}

View File

@@ -0,0 +1,138 @@
/**
* 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.submit.lookup;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.Value;
import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author kstamatis
*
*/
public class ArXivFileDataLoader extends FileDataLoader {
Map<String, String> fieldMap; //mapping between service fields and local intermediate fields
/**
* Empty constructor
*/
public ArXivFileDataLoader() {
}
/**
* @param filename
*/
public ArXivFileDataLoader(String filename) {
super(filename);
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords()
*/
@Override
public RecordSet getRecords() throws MalformedSourceException {
RecordSet recordSet = new RecordSet();
try {
InputStream inputStream = new FileInputStream(new File(filename));
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document inDoc = db.parse(inputStream);
Element xmlRoot = inDoc.getDocumentElement();
List<Element> dataRoots = XMLUtils.getElementList(xmlRoot,
"entry");
for (Element dataRoot : dataRoots)
{
Record record = ArxivUtils.convertArxixDomToRecord(dataRoot);
if (record != null)
{
recordSet.addRecord(convertFields(record));
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return recordSet;
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords(gr.ekt.bte.core.DataLoadingSpec)
*/
@Override
public RecordSet getRecords(DataLoadingSpec spec)
throws MalformedSourceException {
return getRecords();
}
public Record convertFields(Record publication) {
for (String fieldName : fieldMap.keySet()) {
String md = null;
if (fieldMap!=null){
md = this.fieldMap.get(fieldName);
}
if (StringUtils.isBlank(md)) {
continue;
} else {
md = md.trim();
}
if (publication.isMutable()){
List<Value> values = publication.getValues(fieldName);
publication.makeMutable().removeField(fieldName);
publication.makeMutable().addField(md, values);
}
}
return publication;
}
public void setFieldMap(Map<String, String> fieldMap) {
this.fieldMap = fieldMap;
}
}

View File

@@ -0,0 +1,79 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.httpclient.HttpException;
import org.dspace.core.Context;
public class ArXivOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private ArXivService arXivService = new ArXivService();
private boolean searchProvider = true;
public void setArXivService(ArXivService arXivService) {
this.arXivService = arXivService;
}
@Override
public List<String> getSupportedIdentifiers() {
return Arrays.asList(new String[] { ARXIV, DOI });
}
public void setSearchProvider(boolean searchProvider)
{
this.searchProvider = searchProvider;
}
@Override
public boolean isSearchProvider() {
return searchProvider;
}
@Override
public List<Record> getByIdentifier(
Context context, Map<String, Set<String>> keys) throws HttpException, IOException {
List<Record> results = new ArrayList<Record>();
if (keys != null) {
Set<String> dois = keys.get(DOI);
Set<String> arxivids = keys.get(ARXIV);
List<Record> items = new ArrayList<Record>();
if (dois!=null && dois.size()>0) {
items.addAll(arXivService.getByDOIs(dois));
}
if (arxivids!=null && arxivids.size()>0) {
for (String arxivid : arxivids){
items.add(arXivService.getByArXivIDs(arxivid));
}
}
for (Record item : items) {
results.add(convertFields(item));
}
}
return results;
}
@Override
public List<Record> search(Context context, String title,
String author, int year) throws HttpException, IOException {
List<Record> results = new ArrayList<Record>();
List<Record> items = arXivService.searchByTerm(title, author, year);
for (Record item : items) {
results.add(convertFields(item));
}
return results;
}
}

View File

@@ -0,0 +1,212 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.dspace.core.ConfigurationManager;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class ArXivService
{
private int timeout = 1000;
public void setTimeout(int timeout)
{
this.timeout = timeout;
}
public List<Record> getByDOIs(Set<String> dois) throws HttpException,
IOException
{
if (dois != null && dois.size() > 0)
{
String doisQuery = StringUtils.join(dois.iterator(), " OR ");
return search(doisQuery, null, 100);
}
return null;
}
public List<Record> searchByTerm(String title, String author, int year)
throws HttpException, IOException
{
StringBuffer query = new StringBuffer();
if (StringUtils.isNotBlank(title))
{
query.append("ti:\"").append(title).append("\"");
}
if (StringUtils.isNotBlank(author))
{
// [FAU]
if (query.length() > 0)
query.append(" AND ");
query.append("au:\"").append(author).append("\"");
}
return search(query.toString(), "", 10);
}
private List<Record> search(String query, String arxivid, int max_result)
throws IOException, HttpException
{
List<Record> results = new ArrayList<Record>();
if (!ConfigurationManager.getBooleanProperty("remoteservice.demo"))
{
GetMethod method = null;
try
{
HttpClient client = new HttpClient();
client.setTimeout(timeout);
method = new GetMethod("http://export.arxiv.org/api/query");
NameValuePair id = new NameValuePair("id_list", arxivid);
NameValuePair queryParam = new NameValuePair("search_query",
query);
NameValuePair count = new NameValuePair("max_results",
String.valueOf(max_result));
method.setQueryString(new NameValuePair[] { id, queryParam,
count });
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK)
{
if (statusCode == HttpStatus.SC_BAD_REQUEST)
throw new RuntimeException("Query arXiv non valida");
else
throw new RuntimeException("Chiamata http fallita: "
+ method.getStatusLine());
}
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document inDoc = db.parse(method.getResponseBodyAsStream());
Element xmlRoot = inDoc.getDocumentElement();
List<Element> dataRoots = XMLUtils.getElementList(xmlRoot,
"entry");
for (Element dataRoot : dataRoots)
{
Record crossitem = ArxivUtils.convertArxixDomToRecord(dataRoot);
if (crossitem != null)
{
results.add(crossitem);
}
}
}
catch (Exception e)
{
throw new RuntimeException(
"Identificativo arXiv non valido o inesistente");
}
}
finally
{
if (method != null)
{
method.releaseConnection();
}
}
}
else
{
InputStream stream = null;
try
{
File file = new File(
ConfigurationManager.getProperty("dspace.dir")
+ "/config/crosswalks/demo/arxiv.xml");
stream = new FileInputStream(file);
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document inDoc = db.parse(stream);
Element xmlRoot = inDoc.getDocumentElement();
List<Element> dataRoots = XMLUtils.getElementList(xmlRoot,
"entry");
for (Element dataRoot : dataRoots)
{
Record crossitem = ArxivUtils.convertArxixDomToRecord(dataRoot);
if (crossitem != null)
{
results.add(crossitem);
}
}
}
catch (Exception e)
{
throw new RuntimeException(
"Identificativo arXiv non valido o inesistente");
}
}
finally
{
if (stream != null)
{
stream.close();
}
}
}
return results;
}
public Record getByArXivIDs(String raw) throws HttpException,
IOException
{
if (StringUtils.isNotBlank(raw))
{
raw = raw.trim();
if (raw.startsWith("http://arxiv.org/abs/"))
{
raw = raw.substring("http://arxiv.org/abs/".length());
}
else if (raw.toLowerCase().startsWith("arxiv:"))
{
raw = raw.substring("arxiv:".length());
}
List<Record> result = search("", raw, 1);
if (result != null && result.size() > 0)
{
return result.get(0);
}
}
return null;
}
}

View File

@@ -0,0 +1,175 @@
/**
* 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.submit.lookup;
import java.util.LinkedList;
import java.util.List;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import org.dspace.app.util.XMLUtils;
import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
*/
public class ArxivUtils {
/**
*
*/
public ArxivUtils() {
// TODO Auto-generated constructor stub
}
public static Record convertArxixDomToRecord(Element dataRoot){
MutableRecord record = new SubmissionLookupPublication("");
String articleTitle = XMLUtils.getElementValue(dataRoot, "title");
if (articleTitle!=null)
record.addValue("articleTitle", new StringValue(articleTitle));
String summary = XMLUtils.getElementValue(dataRoot, "summary");
if (summary!=null)
record.addValue("summary", new StringValue(summary));
String year = XMLUtils.getElementValue(dataRoot, "published");
if (year!=null)
record.addValue("year", new StringValue(year));
String splashPageUrl = XMLUtils.getElementValue(dataRoot, "id");
if (splashPageUrl!=null)
record.addValue("splashPageUrl", new StringValue(splashPageUrl));
String comment = XMLUtils.getElementValue(dataRoot, "arxiv:comment");
if (comment!=null)
record.addValue("comment", new StringValue(comment));
List<Element> links = XMLUtils.getElementList(dataRoot, "link");
if (links != null)
{
for (Element link : links)
{
if ("related".equals(link.getAttribute("rel")) && "pdf".equals(link.getAttribute("title")))
{
String pdfUrl = link.getAttribute("href");
if (pdfUrl!=null)
record.addValue("pdfUrl", new StringValue(pdfUrl));
}
}
}
String doi = XMLUtils.getElementValue(dataRoot, "arxiv:doi");
if (doi!=null)
record.addValue("doi", new StringValue(doi));
String journalRef = XMLUtils.getElementValue(dataRoot, "arxiv:journal_ref");
if (journalRef!=null)
record.addValue("journalRef", new StringValue(journalRef));
List<String> primaryCategory = new LinkedList<String>();
List<Element> primaryCategoryList = XMLUtils.getElementList(dataRoot, "arxiv:primary_category");
if (primaryCategoryList != null)
{
for (Element primaryCategoryElement : primaryCategoryList)
{
primaryCategory.add(primaryCategoryElement.getAttribute("term"));
}
}
if (primaryCategory.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : primaryCategory){
values.add(new StringValue(s));
}
record.addField("primaryCategory", values);
}
List<String> category = new LinkedList<String>();
List<Element> categoryList = XMLUtils.getElementList(dataRoot, "category");
if (categoryList != null)
{
for (Element categoryElement : categoryList)
{
category.add(categoryElement.getAttribute("term"));
}
}
if (category.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : category){
values.add(new StringValue(s));
}
record.addField("category", values);
}
List<String[]> authors = new LinkedList<String[]>();
List<Element> authorList = XMLUtils.getElementList(dataRoot, "author");
if (authorList != null)
{
for (Element authorElement : authorList)
{
String nomeCompleto = authorElement.getTextContent();
String[] nomeSplit = nomeCompleto.split("\\s+");
String nome = "";
String cognome = "";
if (nomeSplit.length > 2)
{
String senzaPunti = nomeCompleto.replace("\\.", "");
String[] tmp = senzaPunti.split("\\s+");
int start = 1;
if (tmp.length == nomeSplit.length)
{
for (int idx = 2; idx < tmp.length; idx++)
{
if (tmp[idx].length() > 1)
{
start = idx;
}
}
}
for (int i = 0; i < start; i++)
{
nome += nomeSplit[i];
}
for (int i = start; i < nomeSplit.length; i++)
{
cognome += nomeSplit[i];
}
}
else if (nomeSplit.length == 2)
{
nome = nomeSplit[0];
cognome = nomeSplit[1];
}
else
{
cognome = nomeCompleto;
}
authors.add(new String[]{nome, cognome});
}
}
if (authors.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : authors){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("authors", values);
}
return record;
}
}

View File

@@ -0,0 +1,132 @@
/**
* 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.submit.lookup;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.Value;
import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author kstamatis
*
*/
public class CrossRefFileDataLoader extends FileDataLoader {
Map<String, String> fieldMap; //mapping between service fields and local intermediate fields
/**
*
*/
public CrossRefFileDataLoader() {
}
/**
* @param filename
*/
public CrossRefFileDataLoader(String filename) {
super(filename);
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords()
*/
@Override
public RecordSet getRecords() throws MalformedSourceException {
RecordSet recordSet = new RecordSet();
try {
InputStream inputStream = new FileInputStream(new File(filename));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document inDoc = db.parse(inputStream);
Element xmlRoot = inDoc.getDocumentElement();
Element dataRoot = XMLUtils.getSingleElement(xmlRoot, "query");
Record record = CrossRefUtils.convertCrossRefDomToRecord(dataRoot);
recordSet.addRecord(convertFields(record));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return recordSet;
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords(gr.ekt.bte.core.DataLoadingSpec)
*/
@Override
public RecordSet getRecords(DataLoadingSpec spec)
throws MalformedSourceException {
return getRecords();
}
public Record convertFields(Record publication) {
for (String fieldName : fieldMap.keySet()) {
String md = null;
if (fieldMap!=null){
md = this.fieldMap.get(fieldName);
}
if (StringUtils.isBlank(md)) {
continue;
} else {
md = md.trim();
}
if (publication.isMutable()){
List<Value> values = publication.getValues(fieldName);
publication.makeMutable().removeField(fieldName);
publication.makeMutable().addField(md, values);
}
}
return publication;
}
public void setFieldMap(Map<String, String> fieldMap) {
this.fieldMap = fieldMap;
}
}

View File

@@ -0,0 +1,80 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.httpclient.HttpException;
import org.dspace.core.Context;
import org.jdom.JDOMException;
import org.xml.sax.SAXException;
public class CrossRefOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private CrossRefService crossrefService = new CrossRefService();
private boolean searchProvider = true;
public void setSearchProvider(boolean searchProvider)
{
this.searchProvider = searchProvider;
}
public void setCrossrefService(CrossRefService crossrefService) {
this.crossrefService = crossrefService;
}
@Override
public List<String> getSupportedIdentifiers() {
return Arrays.asList(new String[] { DOI });
}
@Override
public List<Record> getByIdentifier(Context context,
Map<String, Set<String>> keys) throws HttpException, IOException {
if (keys != null && keys.containsKey(DOI)) {
Set<String> dois = keys.get(DOI);
List<Record> items = null;
List<Record> results = new ArrayList<Record>();
try {
items = crossrefService.search(context, dois);
} catch (JDOMException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (ParserConfigurationException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (SAXException e) {
throw new RuntimeException(e.getMessage(), e);
}
for (Record record : items){
results.add(convertFields(record));
}
return results;
}
return null;
}
@Override
public List<Record> search(Context context, String title,
String author, int year) throws HttpException, IOException {
List<Record> items = crossrefService.search(context, title, author, year, 10);
return items;
}
@Override
public boolean isSearchProvider() {
return searchProvider;
}
}

View File

@@ -0,0 +1,181 @@
/**
* 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.submit.lookup;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.XMLUtils;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.jdom.JDOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import flexjson.JSONDeserializer;
import gr.ekt.bte.core.Record;
public class CrossRefService {
private static final Logger log = Logger.getLogger(CrossRefService.class);
private int timeout = 1000;
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public List<Record> search(Context context, Set<String> dois) throws HttpException,
IOException, JDOMException, ParserConfigurationException,
SAXException {
List<Record> results = new ArrayList<Record>();
if (dois != null && dois.size() > 0) {
for (String record : dois) {
try
{
if (!ConfigurationManager
.getBooleanProperty("remoteservice.demo")) {
GetMethod method = null;
try {
String apiKey = ConfigurationManager
.getProperty("crossref.api-key");
HttpClient client = new HttpClient();
client.setConnectionTimeout(timeout);
method = new GetMethod(
"http://www.crossref.org/openurl/");
NameValuePair pid = new NameValuePair("pid", apiKey);
NameValuePair noredirect = new NameValuePair(
"noredirect", "true");
NameValuePair id = new NameValuePair("id", record);
method.setQueryString(new NameValuePair[] { pid,
noredirect, id });
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata http fallita: "
+ method.getStatusLine());
}
Record crossitem;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document inDoc = db.parse(method.getResponseBodyAsStream());
Element xmlRoot = inDoc.getDocumentElement();
Element dataRoot = XMLUtils.getSingleElement(xmlRoot, "query");
crossitem = CrossRefUtils.convertCrossRefDomToRecord(dataRoot);
results.add(crossitem);
} catch (Exception e) {
log.warn(LogManager
.getHeader(
context,
"retrieveRecordDOI",
record
+ " DOI non valido o inesistente: "
+ e.getMessage()));
}
} finally {
if (method != null) {
method.releaseConnection();
}
}
}
}
catch (RuntimeException rt)
{
rt.printStackTrace();
}
}
}
return results;
}
public NameValuePair[] buildQueryPart(String title, String author, int year, int count) {
StringBuffer sb = new StringBuffer();
if (StringUtils.isNotBlank(title)) {
sb.append(title);
}
sb.append(" ");
if (StringUtils.isNotBlank(author)) {
sb.append(author);
}
String q = sb.toString().trim();
NameValuePair qParam = new NameValuePair("q", title);
NameValuePair yearParam = new NameValuePair("year",
year != -1?String.valueOf(year):"");
NameValuePair countParam = new NameValuePair("rows",
count!= -1?String.valueOf(count):"");
NameValuePair[] query = new NameValuePair[] { qParam,
yearParam, countParam };
return query;
}
public List<Record> search(Context context, String title, String authors, int year,
int count) throws IOException, HttpException {
GetMethod method = null;
try {
NameValuePair[] query = buildQueryPart(title, authors, year, count);
HttpClient client = new HttpClient();
client.setTimeout(timeout);
method = new GetMethod("http://search.labs.crossref.org/dois");
method.setQueryString(query);
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException("Chiamata http fallita: "
+ method.getStatusLine());
}
JSONDeserializer<List<Map>> des = new JSONDeserializer<List<Map>>();
List<Map> json = des.deserialize(method.getResponseBodyAsString());
Set<String> dois = new HashSet<String>();
for (Map r : json) {
dois.add(SubmissionLookupUtils.normalizeDOI((String) r.get("doi")));
}
method.releaseConnection();
return search(context, dois);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (method != null) {
method.releaseConnection();
}
}
}
}

View File

@@ -0,0 +1,195 @@
/**
* 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.submit.lookup;
import java.util.LinkedList;
import java.util.List;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
*/
public class CrossRefUtils {
/**
*
*/
public CrossRefUtils() {
// TODO Auto-generated constructor stub
}
public static Record convertCrossRefDomToRecord(Element dataRoot){
MutableRecord record = new SubmissionLookupPublication("");
String status = dataRoot.getAttribute("status");
if (!"resolved".equals(status)) {
String msg = XMLUtils.getElementValue(dataRoot, "msg");
String exMsg = status + " - " + msg;
throw new RuntimeException(exMsg);
}
String doi = XMLUtils.getElementValue(dataRoot, "doi");
if (doi!=null)
record.addValue("doi", new StringValue(doi));
String itemType = doi != null ? XMLUtils.getElementAttribute(dataRoot, "doi",
"type") : "unspecified";
if (itemType!=null)
record.addValue("itemType", new StringValue(itemType));
List<Element> identifier = XMLUtils.getElementList(dataRoot, "issn");
for (Element ident : identifier)
{
if ("print".equalsIgnoreCase(ident.getAttribute("type"))
|| StringUtils.isNotBlank(ident.getAttribute("type")))
{
String issn = ident.getTextContent().trim();
if (issn!=null)
record.addValue("issn", new StringValue(issn));
}
else
{
String eissn = ident.getTextContent().trim();
if (eissn!=null)
record.addValue("eissn", new StringValue(eissn));
}
}
String isbn = XMLUtils.getElementValue(dataRoot, "isbn");
if (isbn!=null)
record.addValue("isbn", new StringValue(isbn));
String editionNumber = XMLUtils.getElementValue(dataRoot, "editionNumber");
if (editionNumber!=null)
record.addValue("volume", new StringValue(editionNumber));
String volume = XMLUtils.getElementValue(dataRoot, "volume");
if (volume!=null)
record.addValue("volume", new StringValue(volume));
String issue = XMLUtils.getElementValue(dataRoot, "issue");
if (issue!=null)
record.addValue("issue", new StringValue(issue));
String year = XMLUtils.getElementValue(dataRoot, "year");
if (year!=null)
record.addValue("year", new StringValue(year));
String firstPage = XMLUtils.getElementValue(dataRoot, "first_page");
if (firstPage!=null)
record.addValue("firstPage", new StringValue(firstPage));
String lastPage = XMLUtils.getElementValue(dataRoot, "last_page");
if (lastPage!=null)
record.addValue("lastPage", new StringValue(lastPage));
String seriesTitle = XMLUtils.getElementValue(dataRoot, "series_title");
if (seriesTitle!=null)
record.addValue("seriesTitle", new StringValue(seriesTitle));
String journalTitle = XMLUtils.getElementValue(dataRoot, "journal_title");
if (journalTitle!=null)
record.addValue("journalTitle", new StringValue(journalTitle));
String volumeTitle = XMLUtils.getElementValue(dataRoot, "volume_title");
if (volumeTitle!=null)
record.addValue("volumeTitle", new StringValue(volumeTitle));
String articleTitle = XMLUtils.getElementValue(dataRoot, "article_title");
if (articleTitle!=null)
record.addValue("articleTitle", new StringValue(articleTitle));
String publicationType = XMLUtils.getElementValue(dataRoot, "pubblication_type");
if (publicationType!=null)
record.addValue("publicationType", new StringValue(publicationType));
List<String[]> authors = new LinkedList<String[]>();
List<String[]> editors = new LinkedList<String[]>();
List<String[]> translators = new LinkedList<String[]>();
List<String[]> chairs = new LinkedList<String[]>();
List<Element> contributors = XMLUtils.getElementList(dataRoot, "contributors");
List<Element> contributor = null;
if (contributors != null && contributors.size() > 0)
{
contributor = XMLUtils.getElementList(contributors.get(0), "contributor");
for (Element contrib : contributor) {
String givenName = XMLUtils.getElementValue(contrib, "given_name");
String surname = XMLUtils.getElementValue(contrib, "surname");
if ("editor".equalsIgnoreCase(contrib
.getAttribute("contributor_role")))
{
editors.add(new String[] { givenName, surname });
}
else if ("chair".equalsIgnoreCase(contrib
.getAttribute("contributor_role")))
{
chairs.add(new String[] { givenName, surname });
}
else if ("translator".equalsIgnoreCase(contrib
.getAttribute("contributor_role")))
{
translators.add(new String[] { givenName, surname });
}
else
{
authors.add(new String[] { givenName, surname });
}
}
}
if (authors.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : authors){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("authors", values);
}
if (editors.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : editors){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("editors", values);
}
if (translators.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : translators){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("translators", values);
}
if (chairs.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : chairs){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("chairs", values);
}
return record;
}
}

View File

@@ -0,0 +1,392 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataOutputSpec;
import gr.ekt.bte.core.OutputGenerator;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.Value;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.DCInput;
import org.dspace.app.util.DCInputSet;
import org.dspace.app.util.DCInputsReader;
import org.dspace.app.util.DCInputsReaderException;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema;
import org.dspace.content.WorkspaceItem;
import org.dspace.core.Context;
import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Kostas Stamatis
*/
public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
private static Logger log = Logger.getLogger(DSpaceWorkspaceItemOutputGenerator.class);
private Context context;
private String formName;
private List<WorkspaceItem> witems;
private ItemSubmissionLookupDTO dto;
private Collection collection;
Map<String, String> outputMap;
private List<String> extraMetadataToKeep;
public DSpaceWorkspaceItemOutputGenerator() {
}
@Override
public List<String> generateOutput(RecordSet recordSet) {
log.info("BTE OutputGenerator started. Records to output: " + recordSet.getRecords().size());
//Printing debug message
String totalString = "";
for (Record record : recordSet.getRecords()){
totalString += SubmissionLookupUtils.getPrintableString(record)+"\n";
}
log.debug("Records to output:\n"+totalString);
witems = new ArrayList<WorkspaceItem>();
for(Record rec : recordSet.getRecords()) {
try {
WorkspaceItem wi = WorkspaceItem.create(context, collection, true);
merge(formName, wi.getItem(), rec);
witems.add(wi);
} catch (AuthorizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return new ArrayList<String>();
}
@Override
public List<String> generateOutput(RecordSet records, DataOutputSpec spec) {
return generateOutput(records);
}
public List<WorkspaceItem> getWitems() {
return witems;
}
public void setContext(Context context) {
this.context = context;
}
public void setFormName(String formName) {
this.formName = formName;
}
public void setDto(ItemSubmissionLookupDTO dto) {
this.dto = dto;
}
public void setOutputMap(Map<String, String> outputMap) {
this.outputMap = outputMap;
}
public void setCollection(Collection collection) {
this.collection = collection;
}
public void setExtraMetadataToKeep(List<String> extraMetadataToKeep) {
this.extraMetadataToKeep = extraMetadataToKeep;
}
//Methods
public void merge(String formName, Item item, Record record) {
Record itemLookup = record;
Set<String> addedMetadata = new HashSet<String>();
for (String field : itemLookup.getFields()) {
String metadata = getMetadata(formName, itemLookup, field);
if (StringUtils.isBlank(metadata)) {
continue;
}
if (item.getMetadata(metadata).length == 0
|| addedMetadata.contains(metadata)) {
addedMetadata.add(metadata);
String[] md = splitMetadata(metadata);
if (isValidMetadata(formName, md)) { //if in extra metadata or in the spefific form
List<Value> values = itemLookup.getValues(field);
if (values != null && values.size()>0){
if (isRepeatableMetadata(formName, md)) { //if metadata is repeatable in form
for (Value value : values) {
String[] splitValue = splitValue(value.getAsString());
if (splitValue[3] != null) {
item.addMetadata(md[0], md[1], md[2], md[3],
splitValue[0], splitValue[1],
Integer.parseInt(splitValue[2]));
} else {
item.addMetadata(md[0], md[1], md[2], md[3],
value.getAsString());
}
}
} else {
String value = values.iterator().next().getAsString();
String[] splitValue = splitValue(value);
if (splitValue[3] != null) {
item.addMetadata(md[0], md[1], md[2], md[3],
splitValue[0], splitValue[1],
Integer.parseInt(splitValue[2]));
} else {
item.addMetadata(md[0], md[1], md[2], md[3], value);
}
}
}
}
}
}
try {
item.update();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AuthorizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// creo un nuovo context per il check di esistenza dei metadata di cache
/*Context context = null;
try {
context = new Context();
for (Record pub : dto.getPublications()) {
String providerName = SubmissionLookupService.getProviderName(pub);
if (providerName != SubmissionLookupService.MANUAL_USER_INPUT) {
for (String field : pub.getFields()) {
String metadata = getMetadata(formName, pub, field);
if (StringUtils.isBlank(metadata)) {
continue;
}
String[] md = splitMetadata(metadata);
if (isValidMetadata(formName, md)) {
makeSureMetadataExist(context, providerName, md[1],
md[2]);
if (isRepeatableMetadata(formName, md)) {
for (Value value : pub.getValues(field)) {
String[] splitValue = splitValue(value.getAsString());
item.addMetadata(providerName, md[1],
md[2], md[3], splitValue[0],
splitValue[1],
Integer.parseInt(splitValue[2]));
}
} else {
String[] splitValue = splitValue(SubmissionLookupUtils.getFirstValue(pub, field));
item.addMetadata(providerName, md[1], md[2],
md[3], splitValue[0], splitValue[1],
Integer.parseInt(splitValue[2]));
}
}
}
}
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (context != null && context.isValid()) {
context.abort();
}
}*/
}
private String getMetadata(String formName,
Record itemLookup, String name) {
String type = SubmissionLookupService.getType(itemLookup);
String md = outputMap.get(type + "." + name);
if (StringUtils.isBlank(md)){
md = outputMap.get(formName + "." + name);
if (StringUtils.isBlank(md)){
md = outputMap.get(name);
}
}
//KSTA:ToDo: Make this a modifier
if (md != null && md.contains("|")) {
String[] cond = md.trim().split("\\|");
for (int idx = 1; idx < cond.length; idx++) {
boolean temp = itemLookup.getFields().contains(cond[idx]);
if (temp) {
return null;
}
}
return cond[0];
}
return md;
}
private String[] splitMetadata(String metadata) {
String[] mdSplit = new String[3];
if (StringUtils.isNotBlank(metadata)) {
String tmpSplit[] = metadata.split("\\.");
if (tmpSplit.length == 4) {
mdSplit = new String[4];
mdSplit[0] = tmpSplit[0];
mdSplit[1] = tmpSplit[1];
mdSplit[2] = tmpSplit[2];
mdSplit[3] = tmpSplit[3];
} else if (tmpSplit.length == 3) {
mdSplit = new String[4];
mdSplit[0] = tmpSplit[0];
mdSplit[1] = tmpSplit[1];
mdSplit[2] = tmpSplit[2];
mdSplit[3] = null;
} else if (tmpSplit.length == 2) {
mdSplit = new String[4];
mdSplit[0] = tmpSplit[0];
mdSplit[1] = tmpSplit[1];
mdSplit[2] = null;
mdSplit[3] = null;
}
}
return mdSplit;
}
private boolean isValidMetadata(String formName, String[] md) {
try {
if (extraMetadataToKeep != null
&& extraMetadataToKeep.contains(StringUtils.join(
Arrays.copyOfRange(md, 0, 3), "."))) {
return true;
}
return getDCInput(formName, md[0], md[1], md[2])!=null;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private DCInput getDCInput(String formName, String schema,
String element, String qualifier) throws DCInputsReaderException
{
DCInputSet dcinputset = new DCInputsReader().getInputs(formName);
for (int idx = 0; idx < dcinputset.getNumberPages(); idx++)
{
for (DCInput dcinput : dcinputset.getPageRows(idx, true, true))
{
if (dcinput.getSchema().equals(schema)
&& dcinput.getElement().equals(element)
&& (dcinput.getQualifier() != null && dcinput
.getQualifier().equals(qualifier))
|| (dcinput.getQualifier() == null && qualifier == null))
{
return dcinput;
}
}
}
return null;
}
private boolean isRepeatableMetadata(String formName, String[] md) {
try {
DCInput dcinput = getDCInput(formName, md[0], md[1], md[2]);
if (dcinput != null) {
return dcinput.isRepeatable();
}
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private String[] splitValue(String value) {
String[] splitted = value.split(SubmissionLookupService.SEPARATOR_VALUE_REGEX);
String[] result = new String[6];
result[0] = splitted[0];
result[2] = "-1";
result[3] = "-1";
result[4] = "-1";
if (splitted.length > 1) {
result[5] = "splitted";
if (StringUtils.isNotBlank(splitted[1])) {
result[1] = splitted[1];
}
if (splitted.length > 2) {
result[2] = String.valueOf(Integer.parseInt(splitted[2]));
if (splitted.length > 3) {
result[3] = String.valueOf(Integer.parseInt(splitted[3]));
if (splitted.length > 4) {
result[4] = String.valueOf(Integer
.parseInt(splitted[4]));
}
}
}
}
return result;
}
private void makeSureMetadataExist(Context context, String schema,
String element, String qualifier) {
try {
context.turnOffAuthorisationSystem();
boolean create = false;
MetadataSchema mdschema = MetadataSchema.find(context, schema);
MetadataField mdfield = null;
if (mdschema == null) {
mdschema = new MetadataSchema(SubmissionLookupService.SL_NAMESPACE_PREFIX + schema,
schema);
mdschema.create(context);
create = true;
} else {
mdfield = MetadataField.findByElement(context,
mdschema.getSchemaID(), element, qualifier);
}
if (mdfield == null) {
mdfield = new MetadataField(mdschema, element, qualifier,
"Campo utilizzato per la cache del provider submission-lookup: "
+ schema);
mdfield.create(context);
create = true;
}
if (create) {
context.commit();
}
context.restoreAuthSystemState();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,58 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.AbstractModifier;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.Value;
import java.util.List;
import java.util.Map;
public class FieldMergeModifier extends AbstractModifier {
private Map<String, List<String>> merge_field_map;
public FieldMergeModifier() {
super("FieldMergeModifier");
}
@Override
public Record modify(MutableRecord rec) {
if (merge_field_map!=null){
for (String target_field : merge_field_map.keySet()) {
List<String> source_fields = merge_field_map.get(target_field);
for (String source_field : source_fields) {
List<Value> values = rec.getValues(source_field);
if (values != null && values.size() > 0) {
for (Value value : values) {
rec.addValue(target_field, value);
}
}
//rec.removeField(source_field);
}
}
}
return rec;
}
/**
* @return the merge_field_map
*/
public Map<String, List<String>> getMergeFieldMap() {
return merge_field_map;
}
/**
* @param merge_field_map the merge_field_map to set
*/
public void setMergeFieldMap(Map<String, List<String>> merge_field_map) {
this.merge_field_map = merge_field_map;
}
}

View File

@@ -0,0 +1,29 @@
/**
* 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.submit.lookup;
import java.util.ArrayList;
import java.util.List;
public class LookupProvidersCheck {
private List<String> providersOk = new ArrayList<String>();
private List<String> providersErr = new ArrayList<String>();
public List<String> getProvidersOk() {
return providersOk;
}
public void setProvidersOk(List<String> providersOk) {
this.providersOk = providersOk;
}
public List<String> getProvidersErr() {
return providersErr;
}
public void setProvidersErr(List<String> providersErr) {
this.providersErr = providersErr;
}
}

View File

@@ -0,0 +1,131 @@
/**
* 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.submit.lookup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import gr.ekt.bte.core.AbstractModifier;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
/**
*
*
*/
public class MapConverterModifier extends AbstractModifier {
String filename; //The properties filename
Map<String, String> mapping;
String defaultValue = "";
List<String> fieldKeys;
private Map<String, String> regexConfig = new HashMap<String, String>();
public final String REGEX_PREFIX = "regex.";
/**
* @param name
*/
public MapConverterModifier(String name) {
super(name);
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.AbstractModifier#modify(gr.ekt.bte.core.MutableRecord)
*/
@Override
public Record modify(MutableRecord record) {
if (mapping != null && fieldKeys != null) {
for (String key : fieldKeys){
List<Value> values = record.getValues(key);
if (values==null) continue;
List<Value> newValues = new ArrayList<Value>();
for (Value value : values){
String stringValue = value.getAsString();
String tmp = "";
if (mapping.containsKey(stringValue))
{
tmp = mapping.get(stringValue);
}
else
{
tmp = defaultValue;
for (String regex : regexConfig.keySet())
{
if (stringValue != null && stringValue.matches(regex))
{
tmp = stringValue.replaceAll(regex, regexConfig.get(regex));
}
}
}
if ("@@ident@@".equals(tmp))
{
newValues.add(new StringValue(stringValue));
}
else if (StringUtils.isNotBlank(tmp))
{
newValues.add(new StringValue(tmp));
}
else
newValues.add(new StringValue(stringValue));
}
record.updateField(key, newValues);
}
}
return record;
}
public void setMapping(Map<String, String> mapping) {
this.mapping = mapping;
for (String keyS : mapping.keySet())
{
if (keyS.startsWith(REGEX_PREFIX))
{
String regex = keyS.substring(REGEX_PREFIX.length());
String regReplace = mapping.get(keyS);
if (regReplace == null)
{
regReplace = "";
}
else if (regReplace.equalsIgnoreCase("@ident@"))
{
regReplace = "$0";
}
regexConfig.put(regex,regReplace);
}
}
}
public void setFilename(String filename) {
this.filename = filename;
}
public void setFieldKeys(List<String> fieldKeys) {
this.fieldKeys = fieldKeys;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
}

View File

@@ -0,0 +1,254 @@
/**
* 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.submit.lookup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author Kostas Stamatis
*
*/
public class MultipleSubmissionLookupDataLoader implements DataLoader {
private static Logger log = Logger.getLogger(MultipleSubmissionLookupDataLoader.class);
private static final String NOT_FOUND_DOI = "NOT-FOUND-DOI";
Map<String, DataLoader> dataloadersMap;
//Depending on these values, the multiple data loader loads data from the appropriate providers
Map<String, Set<String>> identifiers = null; //Searching by identifiers (DOI ...)
Map<String, Set<String>> searchTerms = null; //Searching by author, title, date
String filename = null; //Uploading file
String type = null; //the type of the upload file (bibtex, etc.)
/**
* Default constructor
*/
public MultipleSubmissionLookupDataLoader() {
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords()
*/
@Override
public RecordSet getRecords() throws MalformedSourceException {
RecordSet recordSet = new RecordSet();
//KSTA:ToDo: Support timeout (problematic) providers
//List<String> timeoutProviders = new ArrayList<String>();
for (String providerName : filterProviders().keySet()) {
DataLoader provider = dataloadersMap.get(providerName);
RecordSet subRecordSet = provider.getRecords();
recordSet.addAll(subRecordSet);
//Add in each record the provider name... a new provider doesn't need to know about it!
for (Record record: subRecordSet.getRecords()){
if (record.isMutable()){
record.makeMutable().addValue(SubmissionLookupService.PROVIDER_NAME_FIELD, new StringValue(providerName));
}
}
}
//Question: Do we want that in case of file data loader?
//for each publication in the record set, if it has a DOI, try to find extra pubs from the other providers
if (searchTerms!=null || (identifiers!=null && !identifiers.containsKey(SubmissionLookupDataLoader.DOI))){ //Extend
Map<String, Set<String>> provider2foundDOIs = new HashMap<String, Set<String>>();
List<String> foundDOIs = new ArrayList<String>();
for (Record publication : recordSet.getRecords()) {
String providerName = SubmissionLookupUtils.getFirstValue(publication, SubmissionLookupService.PROVIDER_NAME_FIELD);
String doi = null;
if (publication.getValues(SubmissionLookupDataLoader.DOI) != null && publication.getValues(SubmissionLookupDataLoader.DOI).size()>0)
doi = publication.getValues(SubmissionLookupDataLoader.DOI).iterator().next().getAsString();
if (doi == null) {
doi = NOT_FOUND_DOI;
} else {
doi = SubmissionLookupUtils.normalizeDOI(doi);
if (!foundDOIs.contains(doi))
{
foundDOIs.add(doi);
}
Set<String> tmp = provider2foundDOIs.get(providerName);
if (tmp == null) {
tmp = new HashSet<String>();
provider2foundDOIs.put(providerName, tmp);
}
tmp.add(doi);
}
}
for (String providerName : dataloadersMap.keySet()) {
DataLoader genProvider = dataloadersMap.get(providerName);
if (! (genProvider instanceof SubmissionLookupDataLoader)){
continue;
}
SubmissionLookupDataLoader provider = (SubmissionLookupDataLoader)genProvider;
//Provider must support DOI
if (provider.getSupportedIdentifiers().contains(SubmissionLookupDataLoader.DOI)){
continue;
}
//if (evictProviders != null
// && evictProviders.contains(provider.getShortName())) {
// continue;
//}
Set<String> doiToSearch = new HashSet<String>();
Set<String> alreadyFoundDOIs = provider2foundDOIs.get(providerName);
for (String doi : foundDOIs) {
if (alreadyFoundDOIs == null
|| !alreadyFoundDOIs.contains(doi)) {
doiToSearch.add(doi);
}
}
List<Record> pPublications = null;
try {
if (doiToSearch.size() > 0) {
pPublications = provider
.getByDOIs(null, doiToSearch);
}
} catch (Exception e) {
e.printStackTrace();
}
if (pPublications != null) {
for (Record rec : pPublications){
recordSet.addRecord(rec);
}
}
}
}
log.info("BTE DataLoader finished. Items loaded: " + recordSet.getRecords().size());
//Printing debug message
String totalString = "";
for (Record record : recordSet.getRecords()){
totalString += SubmissionLookupUtils.getPrintableString(record)+"\n";
}
log.debug("Records loaded:\n"+totalString);
return recordSet;
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords(gr.ekt.bte.core.DataLoadingSpec)
*/
@Override
public RecordSet getRecords(DataLoadingSpec loadingSpec)
throws MalformedSourceException {
if (loadingSpec.getOffset()>0) //Identify the end of loading
return new RecordSet();
return getRecords();
}
public Map<String, DataLoader> getProvidersMap() {
return dataloadersMap;
}
public void setDataloadersMap(Map<String, DataLoader> providersMap) {
this.dataloadersMap = providersMap;
}
public void setIdentifiers(Map<String, Set<String>> identifiers) {
this.identifiers = identifiers;
this.filename = null;
this.searchTerms = null;
if (dataloadersMap!=null){
for (String providerName : dataloadersMap.keySet()) {
DataLoader provider = dataloadersMap.get(providerName);
if (provider instanceof NetworkSubmissionLookupDataLoader){
((NetworkSubmissionLookupDataLoader)provider).setIdentifiers(identifiers);
}
}
}
}
public void setSearchTerms(Map<String, Set<String>> searchTerms) {
this.searchTerms = searchTerms;
this.identifiers = null;
this.filename = null;
if (dataloadersMap!=null){
for (String providerName : dataloadersMap.keySet()) {
DataLoader provider = dataloadersMap.get(providerName);
if (provider instanceof NetworkSubmissionLookupDataLoader){
((NetworkSubmissionLookupDataLoader)provider).setSearchTerms(searchTerms);
}
}
}
}
public void setFile(String filename, String type) {
this.filename = filename;
this.type = type;
this.identifiers = null;
this.searchTerms = null;
if (dataloadersMap!=null){
for (String providerName : dataloadersMap.keySet()) {
DataLoader provider = dataloadersMap.get(providerName);
if (provider instanceof FileDataLoader){
((FileDataLoader)provider).setFilename(filename);
}
}
}
}
public Map<String, DataLoader> filterProviders(){
Map<String, DataLoader> result = new HashMap<String, DataLoader>();
for (String providerName : dataloadersMap.keySet()) {
DataLoader dataLoader = dataloadersMap.get(providerName);
if (searchTerms != null && identifiers == null && filename == null){
if (dataLoader instanceof SubmissionLookupDataLoader &&
((SubmissionLookupDataLoader)dataLoader).isSearchProvider()){
result.put(providerName, dataLoader);
}
}
else if (searchTerms == null && identifiers != null && filename == null){
if (dataLoader instanceof SubmissionLookupDataLoader){
result.put(providerName, dataLoader);
}
}
else if (searchTerms == null && identifiers == null && filename != null){
if (dataLoader instanceof FileDataLoader){
if (providerName.endsWith(type)) //add only the one that we are interested in
result.put(providerName, dataLoader);
}
}
}
return result;
}
}

View File

@@ -0,0 +1,144 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.lang.StringUtils;
import org.dspace.core.Context;
import org.dspace.submit.util.SubmissionLookupPublication;
public abstract class NetworkSubmissionLookupDataLoader implements SubmissionLookupDataLoader {
Map<String, Set<String>> identifiers; //Searching by identifiers (DOI ...)
Map<String, Set<String>> searchTerms; //Searching by author, title, date
Map<String, String> fieldMap; //mapping between service fields and local intermediate fields
String providerName;
@Override
public List<Record> getByDOIs(Context context, Set<String> doiToSearch)
throws HttpException, IOException {
Map<String, Set<String>> keys = new HashMap<String, Set<String>>();
keys.put(DOI, doiToSearch);
return getByIdentifier(context, keys);
}
//BTE Data Loader interface methods
@Override
public RecordSet getRecords() throws MalformedSourceException {
RecordSet recordSet = new RecordSet();
List<Record> results = null;
try {
if (getIdentifiers()!=null){ //Search by identifiers
results = getByIdentifier(null, getIdentifiers());
}
else {
String title = getSearchTerms().get("title")!=null?getSearchTerms().get("title").iterator().next():null;
String authors = getSearchTerms().get("authors")!=null?getSearchTerms().get("authors").iterator().next():null;
String year = getSearchTerms().get("year")!=null?getSearchTerms().get("year").iterator().next():null;
int yearInt = Integer.parseInt(year);
results = search(null, title, authors, yearInt);
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (results != null){
for (Record record : results){
recordSet.addRecord(record);
}
}
return recordSet;
}
@Override
public RecordSet getRecords(DataLoadingSpec arg0)
throws MalformedSourceException {
return getRecords();
}
public Map<String, Set<String>> getIdentifiers() {
return identifiers;
}
public void setIdentifiers(Map<String, Set<String>> identifiers) {
this.identifiers = identifiers;
}
public Map<String, Set<String>> getSearchTerms() {
return searchTerms;
}
public void setSearchTerms(Map<String, Set<String>> searchTerms) {
this.searchTerms = searchTerms;
}
public Map<String, String> getFieldMap() {
return fieldMap;
}
public void setFieldMap(Map<String, String> fieldMap) {
this.fieldMap = fieldMap;
}
public void setProviderName(String providerName) {
this.providerName = providerName;
}
public Record convertFields(Record publication) {
for (String fieldName : fieldMap.keySet()) {
String md = null;
if (fieldMap!=null){
md = this.fieldMap.get(fieldName);
}
if (StringUtils.isBlank(md)) {
continue;
} else {
md = md.trim();
}
if (publication.isMutable()){
List<Value> values = publication.getValues(fieldName);
publication.makeMutable().removeField(fieldName);
publication.makeMutable().addField(md, values);
}
}
return publication;
}
}

View File

@@ -0,0 +1,140 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.Value;
import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* @author kstamatis
*
*/
public class PubmedFileDataLoader extends FileDataLoader {
Map<String, String> fieldMap; //mapping between service fields and local intermediate fields
/**
*
*/
public PubmedFileDataLoader() {
}
/**
* @param filename
*/
public PubmedFileDataLoader(String filename) {
super(filename);
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords()
*/
@Override
public RecordSet getRecords() throws MalformedSourceException {
RecordSet recordSet = new RecordSet();
try {
InputStream inputStream = new FileInputStream(new File(filename));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document inDoc = builder.parse(inputStream);
Element xmlRoot = inDoc.getDocumentElement();
List<Element> pubArticles = XMLUtils
.getElementList(xmlRoot, "PubmedArticle");
for (Element xmlArticle : pubArticles)
{
Record record = null;
try {
record = PubmedUtils.convertCrossRefDomToRecord(xmlArticle);
recordSet.addRecord(convertFields(record));
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return recordSet;
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.DataLoader#getRecords(gr.ekt.bte.core.DataLoadingSpec)
*/
@Override
public RecordSet getRecords(DataLoadingSpec spec)
throws MalformedSourceException {
return getRecords();
}
public Record convertFields(Record publication) {
for (String fieldName : fieldMap.keySet()) {
String md = null;
if (fieldMap!=null){
md = this.fieldMap.get(fieldName);
}
if (StringUtils.isBlank(md)) {
continue;
} else {
md = md.trim();
}
if (publication.isMutable()){
List<Value> values = publication.getValues(fieldName);
publication.makeMutable().removeField(fieldName);
publication.makeMutable().addField(md, values);
}
}
return publication;
}
public void setFieldMap(Map<String, String> fieldMap) {
this.fieldMap = fieldMap;
}
}

View File

@@ -0,0 +1,111 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.httpclient.HttpException;
import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
public class PubmedOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private boolean searchProvider = true;
private static Logger log = Logger.getLogger(PubmedOnlineDataLoader.class);
private PubmedService pubmedService = new PubmedService();
public void setPubmedService(PubmedService pubmedService) {
this.pubmedService = pubmedService;
}
@Override
public List<String> getSupportedIdentifiers() {
return Arrays.asList(new String[] { PUBMED, DOI });
}
public void setSearchProvider(boolean searchProvider)
{
this.searchProvider = searchProvider;
}
@Override
public boolean isSearchProvider() {
return searchProvider;
}
@Override
public List<Record> getByIdentifier(Context context,
Map<String, Set<String>> keys) throws HttpException, IOException {
Set<String> pmids = keys != null ? keys.get(PUBMED) : null;
Set<String> dois = keys != null ? keys.get(DOI) : null;
List<Record> results = new ArrayList<Record>();
if (pmids != null && pmids.size()>0 && (dois == null || dois.size()==0)) {
for (String pmid : pmids){
Record p = null;
try
{
p = pubmedService.getByPubmedID(pmid);
}
catch (Exception e)
{
log.error(LogManager.getHeader(context, "getByIdentifier", "pmid="+pmid), e);
}
if (p != null)
results.add(convertFields(p));
}
}
else if (dois != null && dois.size()>0 && (pmids == null || pmids.size()==0)) {
StringBuffer query = new StringBuffer();
for (String d : dois) {
if (query.length() > 0) {
query.append(" OR ");
}
query.append(d).append("[AI]");
}
List<Record> pubmedResults = pubmedService.search(query.toString());
for (Record p : pubmedResults) {
results.add(convertFields(p));
}
}
else if (dois != null && dois.size()>0 && pmids != null && pmids.size()>0)
{
//EKT:ToDo: support list of dois and pmids in the search method of pubmedService
List<Record> pubmedResults = pubmedService.search(dois.iterator().next(), pmids.iterator().next());
if (pubmedResults != null) {
for (Record p : pubmedResults) {
results.add(convertFields(p));
}
}
}
return results;
}
@Override
public List<Record> search(Context context, String title,
String author, int year) throws HttpException, IOException {
List<Record> pubmedResults = pubmedService.search(title, author,
year);
List<Record> results = new ArrayList<Record>();
if (pubmedResults != null) {
for (Record p : pubmedResults) {
results.add(convertFields(p));
}
}
return results;
}
}

View File

@@ -0,0 +1,284 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.dspace.core.ConfigurationManager;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
public class PubmedService {
private int timeout = 1000;
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public Record getByPubmedID(String pubmedid) throws HttpException,
IOException, ParserConfigurationException, SAXException {
List<String> ids = new ArrayList<String>();
ids.add(pubmedid.trim());
List<Record> items = getByPubmedIDs(ids);
if (items != null && items.size() > 0)
{
return items.get(0);
}
return null;
}
public List<Record> search(String title, String author, int year)
throws HttpException, IOException {
StringBuffer query = new StringBuffer();
if (StringUtils.isNotBlank(title)) {
query.append("((").append(title).append("[TI]) OR (");
// [TI] non funziona sempre, titolo di capitoli di libro
query.append("(").append(title).append("[book]))");
}
if (StringUtils.isNotBlank(author)) {
// [FAU]
if (query.length() > 0)
query.append(" AND ");
query.append("(").append(author).append("[AU])");
}
if (year != -1)
{
// [DP]
if (query.length() > 0)
query.append(" AND ");
query.append(year).append("[DP]");
}
return search(query.toString());
}
public List<Record> search(String query) throws IOException,
HttpException {
List<Record> results = null;
if (!ConfigurationManager.getBooleanProperty("remoteservice.demo")) {
GetMethod method = null;
try {
HttpClient client = new HttpClient();
client.setTimeout(timeout);
method = new GetMethod(
"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi");
NameValuePair db = new NameValuePair("db", "pubmed");
NameValuePair datetype = new NameValuePair("datetype", "edat");
NameValuePair retmax = new NameValuePair("retmax", "10");
NameValuePair queryParam = new NameValuePair("term",
query.toString());
method.setQueryString(new NameValuePair[] { db, queryParam,
retmax, datetype });
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata al webservice fallita: "
+ method.getStatusLine());
}
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
Document inDoc = builder.parse(method
.getResponseBodyAsStream());
Element xmlRoot = inDoc.getDocumentElement();
Element idList = XMLUtils.getSingleElement(xmlRoot,
"IdList");
List<String> pubmedIDs = XMLUtils.getElementValueList(
idList, "Id");
results = getByPubmedIDs(pubmedIDs);
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
catch (SAXException e1) {
e1.printStackTrace();
}
} finally {
if (method != null) {
method.releaseConnection();
}
}
} else {
InputStream stream = null;
try {
File file = new File(
ConfigurationManager.getProperty("dspace.dir")
+ "/config/crosswalks/demo/pubmed-search.xml");
stream = new FileInputStream(file);
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document inDoc = builder.parse(stream);
Element xmlRoot = inDoc.getDocumentElement();
Element idList = XMLUtils.getSingleElement(xmlRoot, "IdList");
List<String> pubmedIDs = XMLUtils.getElementValueList(idList,
"Id");
results = getByPubmedIDs(pubmedIDs);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return results;
}
public List<Record> getByPubmedIDs(List<String> pubmedIDs)
throws HttpException, IOException, ParserConfigurationException, SAXException {
List<Record> results = new ArrayList<Record>();
if (!ConfigurationManager.getBooleanProperty("remoteservice.demo")) {
GetMethod method = null;
try {
HttpClient client = new HttpClient();
client.setTimeout(5 * timeout);
method = new GetMethod(
"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi");
NameValuePair db = new NameValuePair("db", "pubmed");
NameValuePair retmode = new NameValuePair("retmode", "xml");
NameValuePair rettype = new NameValuePair("rettype", "full");
NameValuePair id = new NameValuePair("id", StringUtils.join(pubmedIDs.iterator(), ","));
method.setQueryString(new NameValuePair[] { db, retmode,
rettype, id });
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata al webservice fallita: "
+ method.getStatusLine());
}
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document inDoc = builder.parse(method.getResponseBodyAsStream());
Element xmlRoot = inDoc.getDocumentElement();
List<Element> pubArticles = XMLUtils
.getElementList(xmlRoot, "PubmedArticle");
for (Element xmlArticle : pubArticles)
{
Record pubmedItem = null;
try {
pubmedItem = PubmedUtils.convertCrossRefDomToRecord(xmlArticle);
results.add(pubmedItem);
} catch (Exception e) {
throw new RuntimeException(
"PubmedID non valido o inesistente: "+e.getMessage(), e);
}
}
return results;
} finally {
if (method != null) {
method.releaseConnection();
}
}
} else {
InputStream stream = null;
try {
File file = new File(
ConfigurationManager.getProperty("dspace.dir")
+ "/config/crosswalks/demo/pubmed.xml");
stream = new FileInputStream(file);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document inDoc = builder.parse(stream);
Element xmlRoot = inDoc.getDocumentElement();
List<Element> pubArticles = XMLUtils
.getElementList(xmlRoot, "PubmedArticle");
for (Element xmlArticle : pubArticles)
{
Record pubmedItem = null;
try {
pubmedItem = PubmedUtils.convertCrossRefDomToRecord(xmlArticle);
results.add(pubmedItem);
} catch (Exception e) {
throw new RuntimeException(
"PubmedID non valido o inesistente: "+e.getMessage(), e);
}
}
return results;
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (stream != null) {
stream.close();
}
}
}
}
public List<Record> search(String doi, String pmid) throws HttpException, IOException {
StringBuffer query = new StringBuffer();
if (StringUtils.isNotBlank(doi)) {
query.append(doi);
query.append("[AID]");
}
if (StringUtils.isNotBlank(pmid)) {
// [FAU]
if (query.length() > 0)
query.append(" OR ");
query.append(pmid).append("[PMID]");
}
return search(query.toString());
}
}

View File

@@ -0,0 +1,302 @@
/**
* 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.submit.lookup;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.util.XMLUtils;
import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
*/
public class PubmedUtils {
/**
*
*/
public PubmedUtils() {
// TODO Auto-generated constructor stub
}
public static Record convertCrossRefDomToRecord(Element pubArticle){
MutableRecord record = new SubmissionLookupPublication("");
Map<String, String> mounthToNum = new HashMap<String, String>();
mounthToNum.put("Jan", "01");
mounthToNum.put("Feb", "02");
mounthToNum.put("Mar", "03");
mounthToNum.put("Apr", "04");
mounthToNum.put("May", "05");
mounthToNum.put("Jun", "06");
mounthToNum.put("Jul", "07");
mounthToNum.put("Aug", "08");
mounthToNum.put("Sep", "09");
mounthToNum.put("Oct", "10");
mounthToNum.put("Nov", "11");
mounthToNum.put("Dec", "12");
Element medline = XMLUtils.getSingleElement(pubArticle, "MedlineCitation");
Element article = XMLUtils.getSingleElement(medline, "Article");
Element pubmed = XMLUtils.getSingleElement(pubArticle, "PubmedData");
Element identifierList = XMLUtils.getSingleElement(pubmed, "ArticleIdList");
if (identifierList != null)
{
List<Element> identifiers = XMLUtils.getElementList(identifierList, "ArticleId");
if (identifiers != null)
{
for (Element id : identifiers)
{
if ("pubmed".equals(id.getAttribute("IdType")))
{
String pubmedID = id.getTextContent().trim();
if (pubmedID!=null)
record.addValue("pubmedID", new StringValue(pubmedID));
}
else if ("doi".equals(id.getAttribute("IdType")))
{
String doi = id.getTextContent().trim();
if (doi!=null)
record.addValue("doi", new StringValue(doi));
}
}
}
}
String status = XMLUtils.getElementValue(pubmed, "PublicationStatus");
if (status!=null)
record.addValue("status", new StringValue(status));
String pubblicationModel = XMLUtils.getElementAttribute(medline, "Article", "PubModel");
if (pubblicationModel!=null)
record.addValue("pubblicationModel", new StringValue(pubblicationModel));
String title = XMLUtils.getElementValue(article, "ArticleTitle");
if (title!=null)
record.addValue("title", new StringValue(title));
Element abstractElement = XMLUtils.getSingleElement(medline, "Abstract");
if (abstractElement == null)
{
abstractElement = XMLUtils.getSingleElement(medline, "OtherAbstract");
}
if (abstractElement != null)
{
String summary = XMLUtils.getElementValue(abstractElement, "AbstractText");
if (summary!=null)
record.addValue("summary", new StringValue(summary));
}
List<String[]> authors = new LinkedList<String[]>();
Element authorList = XMLUtils.getSingleElement(article, "AuthorList");
if (authorList != null)
{
List<Element> authorsElement = XMLUtils.getElementList(authorList, "Author");
if (authorsElement != null)
{
for (Element author : authorsElement)
{
if (StringUtils.isBlank(XMLUtils.getElementValue(author, "CollectiveName")))
{
authors.add(new String[]{XMLUtils.getElementValue(author, "ForeName"),XMLUtils.getElementValue(author, "LastName")});
}
}
}
}
if (authors.size()>0){
List<Value> values = new LinkedList<Value>();
for (String[] sArray : authors){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
}
record.addField("authors", values);
}
Element journal = XMLUtils.getSingleElement(article, "Journal");
if (journal != null)
{
List<Element> jnumbers = XMLUtils.getElementList(journal, "ISSN");
if (jnumbers != null)
{
for (Element jnumber : jnumbers)
{
if ("Print".equals(jnumber.getAttribute("IssnType")))
{
String issn = jnumber.getTextContent().trim();
if (issn!=null)
record.addValue("issn", new StringValue(issn));
}
else
{
String eissn = jnumber.getTextContent().trim();
if (eissn!=null)
record.addValue("eissn", new StringValue(eissn));
}
}
}
String journalTitle = XMLUtils.getElementValue(journal, "Title");
if (journalTitle!=null)
record.addValue("journalTitle", new StringValue(journalTitle));
Element journalIssueElement = XMLUtils.getSingleElement(journal, "JournalIssue");
if (journalIssueElement != null)
{
String volume = XMLUtils.getElementValue(journalIssueElement, "Volume");
if (volume!=null)
record.addValue("volume", new StringValue(volume));
String issue = XMLUtils.getElementValue(journalIssueElement, "Issue");
if (issue!=null)
record.addValue("issue", new StringValue(issue));
Element pubDataElement = XMLUtils.getSingleElement(journalIssueElement, "PubDate");
String year = null;
if (pubDataElement != null)
{
year = XMLUtils.getElementValue(pubDataElement, "Year");
String mounth = XMLUtils.getElementValue(pubDataElement, "Month");
String day = XMLUtils.getElementValue(pubDataElement, "Day");
if (StringUtils.isNotBlank(mounth) && mounthToNum.containsKey(mounth))
{
year += "-" + mounthToNum.get(mounth);
if (StringUtils.isNotBlank(day))
{
year += "-" + (day.length() == 1 ? "0" + day : day);
}
}
}
if (year!=null)
record.addValue("year", new StringValue(year));
}
String language = XMLUtils.getElementValue(article, "Language");
if (language!=null)
record.addValue("language", new StringValue(language));
List<String> type = new LinkedList<String>();
Element publicationTypeList = XMLUtils.getSingleElement(article, "PublicationTypeList");
if (publicationTypeList != null)
{
List<Element> publicationTypes = XMLUtils.getElementList(publicationTypeList, "PublicationType");
for (Element publicationType : publicationTypes)
{
type.add(publicationType.getTextContent().trim());
}
}
if (type.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : type){
values.add(new StringValue(s));
}
record.addField("type", values);
}
List<String> primaryKeywords = new LinkedList<String>();
List<String> secondaryKeywords = new LinkedList<String>();
Element keywordsList = XMLUtils.getSingleElement(medline, "KeywordList");
if (keywordsList != null)
{
List<Element> keywords = XMLUtils.getElementList(keywordsList, "Keyword");
for (Element keyword : keywords)
{
if ("Y".equals(keyword.getAttribute("MajorTopicYN")))
{
primaryKeywords.add(keyword.getTextContent().trim());
}
else
{
secondaryKeywords.add(keyword.getTextContent().trim());
}
}
}
if (primaryKeywords.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : primaryKeywords){
values.add(new StringValue(s));
}
record.addField("primaryKeywords", values);
}
if (secondaryKeywords.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : secondaryKeywords){
values.add(new StringValue(s));
}
record.addField("secondaryKeywords", values);
}
List<String> primaryMeshHeadings = new LinkedList<String>();
List<String> secondaryMeshHeadings = new LinkedList<String>();
Element meshHeadingsList = XMLUtils.getSingleElement(medline, "MeshHeadingList");
if (meshHeadingsList != null)
{
List<Element> meshHeadings = XMLUtils.getElementList(meshHeadingsList, "MeshHeading");
for (Element meshHeading : meshHeadings)
{
if ("Y".equals(XMLUtils.getElementAttribute(meshHeading, "DescriptorName", "MajorTopicYN")))
{
primaryMeshHeadings.add(XMLUtils.getElementValue(meshHeading, "DescriptorName"));
}
else
{
secondaryMeshHeadings.add(XMLUtils.getElementValue(meshHeading, "DescriptorName"));
}
}
}
if (primaryMeshHeadings.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : primaryMeshHeadings){
values.add(new StringValue(s));
}
record.addField("primaryMeshHeadings", values);
}
if (secondaryMeshHeadings.size()>0){
List<Value> values = new LinkedList<Value>();
for (String s : secondaryMeshHeadings){
values.add(new StringValue(s));
}
record.addField("secondaryMeshHeadings", values);
}
Element paginationElement = XMLUtils.getSingleElement(article, "Pagination");
if (paginationElement != null)
{
String startPage = XMLUtils.getElementValue(paginationElement, "StartPage");
String endPage = XMLUtils.getElementValue(paginationElement, "EndPage");
if (StringUtils.isBlank(startPage))
{
startPage = XMLUtils.getElementValue(paginationElement, "MedlinePgn");
}
if (startPage!=null)
record.addValue("startPage", new StringValue(startPage));
if (endPage!=null)
record.addValue("endPage", new StringValue(endPage));
}
}
return record;
}
}

View File

@@ -0,0 +1,76 @@
/**
* 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.submit.lookup;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import gr.ekt.bte.core.AbstractModifier;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
/**
* 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/
*/
public class RemoveLastDotModifier extends AbstractModifier {
List<String> fieldKeys;
/**
* @param name
*/
public RemoveLastDotModifier(String name) {
super(name);
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see gr.ekt.bte.core.AbstractModifier#modify(gr.ekt.bte.core.MutableRecord)
*/
@Override
public Record modify(MutableRecord record) {
if (fieldKeys != null) {
for (String key : fieldKeys){
List<Value> values = record.getValues(key);
List<Value> newValues = new ArrayList<Value>();
if (values != null){
for (Value value : values){
String valueString = value.getAsString();
if (StringUtils.isNotBlank(valueString) && valueString.endsWith("."))
{
newValues.add(new StringValue(valueString.substring(0, valueString.length() - 1)));
}
else
{
newValues.add(new StringValue(valueString));
}
}
record.updateField(key, newValues);
}
}
}
return record;
}
public void setFieldKeys(List<String> fieldKeys) {
this.fieldKeys = fieldKeys;
}
}

View File

@@ -0,0 +1,97 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.DataLoadingSpec;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.util.List;
import org.apache.log4j.Logger;
import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Panagiotis Koutsourakis
*/
public class SubmissionItemDataLoader implements DataLoader {
private List<ItemSubmissionLookupDTO> dtoList;
List<DataLoader> providers;
private static Logger log = Logger.getLogger(SubmissionItemDataLoader.class);
public SubmissionItemDataLoader() {
dtoList = null;
providers = null;
}
@Override
public RecordSet getRecords() throws MalformedSourceException {
if (dtoList == null) {
throw new MalformedSourceException("dtoList not initialized");
}
RecordSet ret = new RecordSet();
for (ItemSubmissionLookupDTO dto : dtoList) {
Record rec = dto.getTotalPublication(providers);
ret.addRecord(rec);
}
log.info("BTE DataLoader finished. Items loaded: " + ret.getRecords().size());
//Printing debug message
String totalString = "";
for (Record record : ret.getRecords()){
totalString += SubmissionLookupUtils.getPrintableString(record)+"\n";
}
log.debug("Records loaded:\n"+totalString);
return ret;
}
@Override
public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
if(spec.getOffset() > 0) {
return new RecordSet();
}
return getRecords();
}
/**
* @return the dtoList
*/
public List<ItemSubmissionLookupDTO> getDtoList() {
return dtoList;
}
/**
* @param dtoList the dtoList to set
*/
public void setDtoList(List<ItemSubmissionLookupDTO> dtoList) {
this.dtoList = dtoList;
}
/**
* @return the providers
*/
public List<DataLoader> getProviders() {
return providers;
}
/**
* @param providers the providers to set
*/
public void setProviders(List<DataLoader> providers) {
this.providers = providers;
}
}

View File

@@ -0,0 +1,43 @@
/**
* 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.submit.lookup;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.httpclient.HttpException;
import org.dspace.core.Context;
import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.Record;
public interface SubmissionLookupDataLoader extends DataLoader {
public final static String DOI = "doi";
public final static String PUBMED = "pubmed";
public final static String ARXIV = "arxiv";
public final static String REPEC = "repec";
public final static String SCOPUSEID = "scopuseid";
public final static String TYPE = "type";
List<String> getSupportedIdentifiers();
boolean isSearchProvider();
List<Record> search(Context context, String title, String author,
int year) throws HttpException, IOException;
List<Record> getByIdentifier(Context context, Map<String, Set<String>> keys)
throws HttpException, IOException;
List<Record> getByDOIs(Context context, Set<String> doiToSearch) throws HttpException, IOException;
}

View File

@@ -0,0 +1,92 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataOutputSpec;
import gr.ekt.bte.core.OutputGenerator;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.RecordSet;
import gr.ekt.bte.core.Value;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupOutputGenerator implements OutputGenerator {
private List<ItemSubmissionLookupDTO> dtoList;
private static final String DOI_FIELD = "doi";
private static final String NOT_FOUND_DOI = "NOT-FOUND-DOI";
public SubmissionLookupOutputGenerator() {
}
@Override
public List<String> generateOutput(RecordSet records) {
dtoList = new ArrayList<ItemSubmissionLookupDTO>();
Map<String, List<Record>> record_sets = new HashMap<String, List<Record>>();
int counter = 0;
for(Record rec : records) {
String current_doi = NOT_FOUND_DOI;
List<Value> values = rec.getValues(DOI_FIELD);
if (values != null && values.size() > 0) {
current_doi = values.get(0).getAsString();
}
else {
current_doi = NOT_FOUND_DOI + "_" + counter;
}
if(record_sets.keySet().contains(current_doi)) {
record_sets.get(current_doi).add(rec);
}
else {
ArrayList<Record> publication = new ArrayList<Record>();
publication.add(rec);
record_sets.put(current_doi, publication);
}
counter++;
}
for(Map.Entry<String, List<Record>> entry : record_sets.entrySet()) {
ItemSubmissionLookupDTO dto = new ItemSubmissionLookupDTO(entry.getValue());
dtoList.add(dto);
}
//Print debug messages
return new ArrayList<String>();
}
@Override
public List<String> generateOutput(RecordSet records, DataOutputSpec spec) {
return generateOutput(records);
}
/**
* @return the items
*/
public List<ItemSubmissionLookupDTO> getDtoList() {
return dtoList;
}
/**
* @param items the items to set
*/
public void setDtoList(List<ItemSubmissionLookupDTO> items) {
this.dtoList = items;
}
}

View File

@@ -0,0 +1,172 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.TransformationEngine;
import gr.ekt.bte.dataloader.FileDataLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.dspace.submit.util.SubmissionLookupDTO;
public class SubmissionLookupService {
public static final String SL_NAMESPACE_PREFIX = "http://www.dspace.org/sl/";
public static final String MANUAL_USER_INPUT = "manual";
public static final String PROVIDER_NAME_FIELD = "provider_name_field";
private static Logger log = Logger.getLogger(SubmissionLookupService.class);
public static final String SEPARATOR_VALUE = "#######";
public static final String SEPARATOR_VALUE_REGEX = SEPARATOR_VALUE;
private List<DataLoader> providers;
private Map<String, List<String>> idents2provs;
private List<String> searchProviders;
private List<String> fileProviders;
private TransformationEngine phase1TransformationEngine;
private TransformationEngine phase2TransformationEngine;
public void setPhase2TransformationEngine(TransformationEngine phase2TransformationEngine) {
this.phase2TransformationEngine = phase2TransformationEngine;
}
public void setPhase1TransformationEngine(TransformationEngine phase1TransformationEngine) {
this.phase1TransformationEngine = phase1TransformationEngine;
MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader)phase1TransformationEngine.getDataLoader();
this.idents2provs = new HashMap<String, List<String>>();
this.searchProviders = new ArrayList<String>();
this.fileProviders = new ArrayList<String>();
if (providers == null) {
this.providers = new ArrayList<DataLoader>();
for (String providerName : dataLoader.getProvidersMap().keySet()) {
DataLoader p = dataLoader.getProvidersMap().get(providerName);
this.providers.add(p);
//Do not do that for file providers
if (p instanceof FileDataLoader){
this.fileProviders.add(providerName);
}
else if (p instanceof NetworkSubmissionLookupDataLoader){
NetworkSubmissionLookupDataLoader p2 = (NetworkSubmissionLookupDataLoader)p;
p2.setProviderName(providerName);
if (p2.isSearchProvider()) {
searchProviders.add(providerName);
}
List<String> suppIdentifiers = p2.getSupportedIdentifiers();
if (suppIdentifiers != null) {
for (String ident : suppIdentifiers) {
List<String> tmp = idents2provs
.get(ident);
if (tmp == null) {
tmp = new ArrayList<String>();
idents2provs.put(ident, tmp);
}
tmp.add(providerName);
}
}
}
}
}
}
public TransformationEngine getPhase1TransformationEngine() {
return phase1TransformationEngine;
}
public TransformationEngine getPhase2TransformationEngine() {
return phase2TransformationEngine;
}
public List<String> getIdentifiers() {
List<String> allSupportedIdentifiers = new ArrayList<String>();
MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader)phase1TransformationEngine.getDataLoader();
for (String providerName : dataLoader.getProvidersMap().keySet()) {
DataLoader provider = dataLoader.getProvidersMap().get(providerName);
if (provider instanceof SubmissionLookupDataLoader){
for (String identifier : ((SubmissionLookupDataLoader)provider).getSupportedIdentifiers()){
if (!allSupportedIdentifiers.contains(identifier)){
allSupportedIdentifiers.add(identifier);
}
}
}
}
return allSupportedIdentifiers;
}
public Map<String, List<String>> getProvidersIdentifiersMap() {
return idents2provs;
}
public SubmissionLookupDTO getSubmissionLookupDTO(
HttpServletRequest request, String uuidSubmission) {
SubmissionLookupDTO dto = (SubmissionLookupDTO) request.getSession()
.getAttribute("submission_lookup_" + uuidSubmission);
if (dto == null) {
dto = new SubmissionLookupDTO();
storeDTOs(request, uuidSubmission, dto);
}
return dto;
}
public void invalidateDTOs(HttpServletRequest request, String uuidSubmission) {
request.getSession().removeAttribute(
"submission_lookup_" + uuidSubmission);
}
public void storeDTOs(HttpServletRequest request, String uuidSubmission,
SubmissionLookupDTO dto) {
request.getSession().setAttribute(
"submission_lookup_" + uuidSubmission, dto);
}
public List<String> getSearchProviders() {
return searchProviders;
}
public List<DataLoader> getProviders() {
return providers;
}
public static String getProviderName(Record rec) {
return SubmissionLookupUtils.getFirstValue(rec, SubmissionLookupService.PROVIDER_NAME_FIELD);
}
public static String getType(Record rec) {
return SubmissionLookupUtils.getFirstValue(rec, SubmissionLookupDataLoader.TYPE);
}
public List<String> getFileProviders() {
return this.fileProviders;
}
}

View File

@@ -0,0 +1,139 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.Value;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.MetadataSchema;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
public class SubmissionLookupUtils {
private static Logger log = Logger.getLogger(SubmissionLookupUtils.class);
/** Location of config file */
private static final String configFilePath = ConfigurationManager
.getProperty("dspace.dir")
+ File.separator
+ "config"
+ File.separator + "crosswalks" + File.separator;
// Patter to extract the converter name if any
private static final Pattern converterPattern = Pattern
.compile(".*\\((.*)\\)");
public static LookupProvidersCheck getProvidersCheck(Context context,
Item item, String dcSchema, String dcElement, String dcQualifier) {
try {
LookupProvidersCheck check = new LookupProvidersCheck();
MetadataSchema[] schemas = MetadataSchema.findAll(context);
DCValue[] values = item.getMetadata(dcSchema, dcElement, dcQualifier, Item.ANY);
for (MetadataSchema schema : schemas)
{
boolean error = false;
if (schema.getNamespace().startsWith(SubmissionLookupService.SL_NAMESPACE_PREFIX))
{
DCValue[] slCache = item.getMetadata(schema.getName(), dcElement, dcQualifier, Item.ANY);
if (slCache.length == 0)
continue;
if (slCache.length != values.length)
{
error = true;
}
else
{
for (int idx = 0; idx < values.length; idx++)
{
DCValue v = values[idx];
DCValue sl = slCache[idx];
// FIXME gestire authority e possibilita' multiple:
// match non sicuri, affiliation, etc.
if (!v.value.equals(sl.value))
{
error = true;
break;
}
}
}
if (error)
{
check.getProvidersErr().add(schema.getName());
}
else
{
check.getProvidersOk().add(schema.getName());
}
}
}
return check;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
public static String normalizeDOI(String doi) {
if (doi != null)
{
return doi.trim().replaceAll("^http://dx.doi.org/", "")
.replaceAll("^doi:", "");
}
return null;
}
public static String getFirstValue(Record rec, String field) {
List<Value> values = rec.getValues(field);
String value = null;
if (values != null && values.size() > 0) {
value = values.get(0).getAsString();
}
return value;
}
public static List<String> getValues(Record rec, String field) {
List<String> result = new ArrayList<String>();
List<Value> values = rec.getValues(field);
if (values != null && values.size() > 0) {
for (Value value : values){
result.add( value.getAsString());
}
}
return result;
}
public static String getPrintableString(Record record){
StringBuilder result = new StringBuilder();
result.append("\nPublication {\n");
for (String field: record.getFields()){
result.append("--"+field + ":\n");
List<Value> values = record.getValues(field);
for (Value value : values){
result.append("\t"+value.getAsString()+"\n");
}
}
result.append("}\n");
return result.toString();
}
}

View File

@@ -0,0 +1,90 @@
/**
* 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.submit.lookup;
import gr.ekt.bte.core.AbstractModifier;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
public class ValueConcatenationModifier extends AbstractModifier {
private String field;
private String separator = ",";
private boolean whitespaceAfter = true;
public ValueConcatenationModifier() {
super("ValueConcatenationModifier");
}
@Override
public Record modify(MutableRecord rec) {
List<Value> values = rec.getValues(field);
if(values != null) {
List<String> converted_values = new ArrayList<String>();
for (Value val : values) {
converted_values.add(val.getAsString());
}
List<Value> final_value = new ArrayList<Value>();
String v = StringUtils.join(converted_values.iterator(), separator + (whitespaceAfter ? " " : ""));
final_value.add(new StringValue(v));
rec.updateField(field, final_value);
}
return rec;
}
/**
* @return the field
*/
public String getField() {
return field;
}
/**
* @param field the field to set
*/
public void setField(String field) {
this.field = field;
}
/**
* @return the separator
*/
public String getSeparator() {
return separator;
}
/**
* @param separator the separator to set
*/
public void setSeparator(String separator) {
this.separator = separator;
}
/**
* @return the whiteSpaceAfter
*/
public boolean isWhitespaceAfter() {
return whitespaceAfter;
}
/**
* @param whiteSpaceAfter the whiteSpaceAfter to set
*/
public void setWhitespaceAfter(boolean whiteSpaceAfter) {
this.whitespaceAfter = whiteSpaceAfter;
}
}

View File

@@ -0,0 +1,283 @@
/**
* 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.submit.step;
import edu.emory.mathcs.backport.java.util.Arrays;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.TransformationEngine;
import gr.ekt.bte.core.TransformationSpec;
import gr.ekt.bte.exceptions.BadTransformationSpec;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.hwpf.model.Ffn;
import org.dspace.app.util.DCInputSet;
import org.dspace.app.util.DCInputsReader;
import org.dspace.app.util.SubmissionInfo;
import org.dspace.app.util.Util;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.WorkspaceItem;
import org.dspace.core.Context;
import org.dspace.submit.AbstractProcessingStep;
import org.dspace.submit.lookup.DSpaceWorkspaceItemOutputGenerator;
import org.dspace.submit.lookup.SubmissionItemDataLoader;
import org.dspace.submit.lookup.SubmissionLookupService;
import org.dspace.submit.util.ItemSubmissionLookupDTO;
import org.dspace.submit.util.SubmissionLookupDTO;
import org.dspace.submit.util.SubmissionLookupPublication;
import org.dspace.utils.DSpace;
/**
* SelectCollection Step which processes the collection that the user selected
* in that step of the DSpace Submission process
* <P>
* This class performs all the behind-the-scenes processing that
* this particular step requires. This class's methods are utilized
* by both the JSP-UI and the Manakin XML-UI
*
* @see org.dspace.app.util.SubmissionConfig
* @see org.dspace.app.util.SubmissionStepConfig
* @see org.dspace.submit.AbstractProcessingStep
*
* @author Tim Donohue
* @version $Revision: 3738 $
*/
public class StartSubmissionLookupStep extends AbstractProcessingStep
{
/***************************************************************************
* STATUS / ERROR FLAGS (returned by doProcessing() if an error occurs or
* additional user interaction may be required)
*
* (Do NOT use status of 0, since it corresponds to STATUS_COMPLETE flag
* defined in the JSPStepManager class)
**************************************************************************/
// no collection was selected
public static final int STATUS_NO_COLLECTION = 1;
// invalid collection or error finding collection
public static final int STATUS_INVALID_COLLECTION = 2;
public static final int STATUS_NO_SUUID = 3;
public static final int STATUS_SUBMISSION_EXPIRED = 4;
private SubmissionLookupService slService = new DSpace()
.getServiceManager().getServiceByName(
SubmissionLookupService.class.getCanonicalName(),
SubmissionLookupService.class);
/** log4j logger */
private static Logger log = Logger.getLogger(StartSubmissionLookupStep.class);
/**
* Do any processing of the information input by the user, and/or perform
* step processing (if no user interaction required)
* <P>
* It is this method's job to save any data to the underlying database, as
* necessary, and return error messages (if any) which can then be processed
* by the appropriate user interface (JSP-UI or XML-UI)
* <P>
* NOTE: If this step is a non-interactive step (i.e. requires no UI), then
* it should perform *all* of its processing in this method!
*
* @param context
* current DSpace context
* @param request
* current servlet request object
* @param response
* current servlet response object
* @param subInfo
* submission info object
* @return Status or error flag which will be processed by
* doPostProcessing() below! (if STATUS_COMPLETE or 0 is returned,
* no errors occurred!)
*/
public int doProcessing(Context context, HttpServletRequest request,
HttpServletResponse response, SubmissionInfo subInfo)
throws ServletException, IOException, SQLException,
AuthorizeException
{
// First we find the collection which was selected
int id = Util.getIntParameter(request, "collectionid");
String titolo = request.getParameter("search_title");
String date = request.getParameter("search_year");
String autori = request.getParameter("search_authors");
String uuidSubmission = request.getParameter("suuid");
String uuidLookup = request.getParameter("iuuid");
String fuuidLookup = request.getParameter("fuuid");
if (StringUtils.isBlank(uuidSubmission))
{
return STATUS_NO_SUUID;
}
SubmissionLookupDTO submissionDTO = slService.getSubmissionLookupDTO(
request, uuidSubmission);
if (submissionDTO == null)
{
return STATUS_SUBMISSION_EXPIRED;
}
ItemSubmissionLookupDTO itemLookup = null;
if (fuuidLookup == null || fuuidLookup.isEmpty()) {
if (StringUtils.isNotBlank(uuidLookup)) {
itemLookup = submissionDTO.getLookupItem(uuidLookup);
if (itemLookup == null) {
return STATUS_SUBMISSION_EXPIRED;
}
}
}
// if the user didn't select a collection,
// send him/her back to "select a collection" page
if (id < 0)
{
return STATUS_NO_COLLECTION;
}
// try to load the collection
Collection col = Collection.find(context, id);
// Show an error if the collection is invalid
if (col == null)
{
return STATUS_INVALID_COLLECTION;
}
else
{
// create our new Workspace Item
DCInputSet inputSet = null;
try {
inputSet = new DCInputsReader().getInputs(col.getHandle());
} catch (Exception e) {
e.printStackTrace();
}
List<ItemSubmissionLookupDTO> dto = new ArrayList<ItemSubmissionLookupDTO>();
if (itemLookup != null)
{
dto.add(itemLookup);
} else if (fuuidLookup != null) {
String[] ss = fuuidLookup.split(",");
for(String s : ss) {
itemLookup = submissionDTO.getLookupItem(s);
if (itemLookup == null) {
return STATUS_SUBMISSION_EXPIRED;
}
dto.add(itemLookup);
}
} else {
SubmissionLookupPublication manualPub = new SubmissionLookupPublication(
SubmissionLookupService.MANUAL_USER_INPUT);
manualPub.add("title", titolo);
manualPub.add("year", date);
manualPub.add("allauthors", autori);
Enumeration e = request.getParameterNames();
while (e.hasMoreElements()) {
String parameterName = (String) e.nextElement();
String parameterValue = request.getParameter(parameterName);
if (parameterName.startsWith("identifier_")
&& StringUtils.isNotBlank(parameterValue)) {
manualPub.add(
parameterName.substring("identifier_".length()),
parameterValue);
}
}
List<Record> publications = new ArrayList<Record>();
publications.add(manualPub);
dto.add(new ItemSubmissionLookupDTO(publications));
}
List<WorkspaceItem> result = null;
TransformationEngine transformationEngine = slService.getPhase2TransformationEngine();
if (transformationEngine != null){
SubmissionItemDataLoader dataLoader = (SubmissionItemDataLoader)transformationEngine.getDataLoader();
dataLoader.setDtoList(dto);
//dataLoader.setProviders()
DSpaceWorkspaceItemOutputGenerator outputGenerator = (DSpaceWorkspaceItemOutputGenerator)transformationEngine.getOutputGenerator();
outputGenerator.setCollection(col);
outputGenerator.setContext(context);
outputGenerator.setFormName(inputSet.getFormName());
outputGenerator.setDto(dto.get(0));
try {
transformationEngine.transform(new TransformationSpec());
result = outputGenerator.getWitems();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
} catch (MalformedSourceException e1) {
e1.printStackTrace();
}
}
if (result != null && result.size()>0) {
// update Submission Information with this Workspace Item
subInfo.setSubmissionItem(result.iterator().next());
}
// commit changes to database
context.commit();
// need to reload current submission process config,
// since it is based on the Collection selected
subInfo.reloadSubmissionConfig(request);
}
slService.invalidateDTOs(request, uuidSubmission);
// no errors occurred
return STATUS_COMPLETE;
}
/**
* Retrieves the number of pages that this "step" extends over. This method
* is used to build the progress bar.
* <P>
* This method may just return 1 for most steps (since most steps consist of
* a single page). But, it should return a number greater than 1 for any
* "step" which spans across a number of HTML pages. For example, the
* configurable "Describe" step (configured using input-forms.xml) overrides
* this method to return the number of pages that are defined by its
* configuration file.
* <P>
* Steps which are non-interactive (i.e. they do not display an interface to
* the user) should return a value of 1, so that they are only processed
* once!
*
* @param request
* The HTTP Request
* @param subInfo
* The current submission information object
*
* @return the number of pages in this step
*/
public int getNumberOfPages(HttpServletRequest request,
SubmissionInfo subInfo) throws ServletException
{
// there is always just one page in the "select a collection" step!
return 1;
}
}

View File

@@ -0,0 +1,95 @@
/**
* 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.submit.util;
import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.Value;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.dspace.submit.lookup.SubmissionLookupDataLoader;
import org.dspace.submit.lookup.SubmissionLookupService;
public class ItemSubmissionLookupDTO implements Serializable {
private static final long serialVersionUID = 1;
private static final String MERGED_PUBLICATION_PROVIDER = "merged";
private static final String UNKNOWN_PROVIDER_STRING = "UNKNOWN-PROVIDER";
private List<Record> publications;
private String uuid;
public ItemSubmissionLookupDTO(List<Record> publications) {
this.uuid = UUID.randomUUID().toString();
this.publications = publications;
}
public List<Record> getPublications() {
return publications;
}
public Set<String> getProviders() {
Set<String> orderedProviders = new LinkedHashSet<String>();
for (Record p : publications)
{
orderedProviders.add(SubmissionLookupService.getProviderName(p));
}
return orderedProviders;
}
public String getUUID() {
return uuid;
}
public Record getTotalPublication(List<DataLoader> providers) {
if (publications == null)
{
return null;
}
else if (publications.size() == 1)
{
return publications.get(0);
}
else
{
MutableRecord pub = new SubmissionLookupPublication(MERGED_PUBLICATION_PROVIDER);
//for (SubmissionLookupProvider prov : providers)
//{
for (Record p : publications)
{
//if (!SubmissionLookupService.getProviderName(p).equals(prov.getShortName()))
//{
// continue;
//}
for (String field : p.getFields())
{
List<Value> values = p.getValues(field);
if (values != null && values.size() > 0)
{
if (!pub.getFields().contains(field))
{
for (Value v : values)
{
pub.addValue(field, v);
}
}
}
}
}
//}
return pub;
}
}
}

View File

@@ -0,0 +1,42 @@
/**
* 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.submit.util;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
public class SubmissionLookupDTO implements Serializable {
private static final long serialVersionUID = 1;
private String uuid;
private List<ItemSubmissionLookupDTO> items;
public SubmissionLookupDTO() {
this.uuid = UUID.randomUUID().toString();
}
public void setItems(List<ItemSubmissionLookupDTO> items) {
this.items = items;
}
public ItemSubmissionLookupDTO getLookupItem(String uuidLookup) {
if (items != null)
{
for (ItemSubmissionLookupDTO item : items)
{
if (item.getUUID().equals(uuidLookup))
{
return item;
}
}
}
return null;
}
}

View File

@@ -0,0 +1,187 @@
/**
* 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.submit.util;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.dspace.submit.lookup.SubmissionLookupDataLoader;
public class SubmissionLookupPublication implements MutableRecord, Serializable {
private String providerName;
private Map<String, List<String>> storage = new HashMap<String, List<String>>();
public SubmissionLookupPublication(String providerName) {
this.providerName = providerName;
}
// necessario per poter effettuare la serializzazione in JSON dei dati
public Map<String, List<String>> getStorage() {
return storage;
}
public Set<String> getFields() {
return storage.keySet();
}
public List<String> remove(String md) {
return storage.remove(md);
}
public void add(String md, String nValue) {
if (StringUtils.isNotBlank(nValue))
{
List<String> tmp = storage.get(md);
if (tmp == null) {
tmp = new ArrayList<String>();
storage.put(md, tmp);
}
tmp.add(nValue);
}
}
public String getFirstValue(String md) {
List<String> tmp = storage.get(md);
if (tmp == null || tmp.size() == 0) {
return null;
}
return tmp.get(0);
}
public String getProviderName() {
return providerName;
}
public String getType() {
return getFirstValue(SubmissionLookupDataLoader.TYPE);
}
//BTE Record interface methods
@Override
public boolean hasField(String md) {
return storage.containsKey(md);
}
@Override
public List<Value> getValues(String md) {
List<String> stringValues = storage.get(md);
if (stringValues == null){
return null;
}
List<Value> values = new ArrayList<Value>();
for (String value : stringValues){
values.add(new StringValue(value));
}
return values;
}
@Override
public boolean isMutable() {
return true;
}
@Override
public MutableRecord makeMutable() {
return this;
}
@Override
public boolean addField(String md, List<Value> values) {
if (storage.containsKey(md)){
List<String> stringValues = storage.get(md);
if (values != null){
for (Value value : values){
stringValues.add(value.getAsString());
}
}
}
else {
List<String> tmp = new ArrayList<String>();
if (values != null){
for (Value value : values){
tmp.add(value.getAsString());
}
}
storage.put(md, tmp);
}
return true;
}
@Override
public boolean addValue(String md, Value value) {
if (storage.containsKey(md)){
List<String> stringValues = storage.get(md);
stringValues.add(value.getAsString());
}
else {
List<String> tmp = new ArrayList<String>();
tmp.add(value.getAsString());
storage.put(md, tmp);
}
return true;
}
@Override
public boolean removeField(String md) {
if (storage.containsKey(md)){
storage.remove(md);
}
return false;
}
@Override
public boolean removeValue(String md, Value value) {
if (storage.containsKey(md)){
List<String> stringValues = storage.get(md);
stringValues.remove(value.getAsString());
}
return true;
}
@Override
public boolean updateField(String md, List<Value> values) {
List<String> stringValues = new ArrayList<String>();
for (Value value : values){
stringValues.add(value.getAsString());
}
storage.put(md, stringValues);
return true;
}
@Override
public boolean updateValue(String md, Value valueOld, Value valueNew) {
if (storage.containsKey(md)){
List<String> stringValues = storage.get(md);
List<String> newStringValues = storage.get(md);
for (String s : stringValues){
if (s.equals(valueOld.getAsString())){
newStringValues.add(valueNew.getAsString());
}
else {
newStringValues.add(s);
}
}
storage.put(md, newStringValues);
}
return true;
}
}

View File

@@ -1684,6 +1684,54 @@ jsp.layout.navbar-admin.accesscontrol = Access Control
jsp.layout.navbar-admin.contents = Content
jsp.layout.navbar-admin.settings = General Settings
jsp.submit.start-lookup-submission.title = New submission
jsp.submit.start-lookup-submission.heading = New submission: get data from bibliographic external service
jsp.submit.start-lookup-submission.tabs.search = Search Form
jsp.submit.start-lookup-submission.tabs.result = Results
jsp.submit.start-lookup-submission.identifiers = Search for identifier
jsp.submit.start-lookup-submission.identifiers.hints = Fill in publication identifiers (DOI is preferable) and then press "Search". A list of all matching publications will be shown to you to select in order to proceed with the submission process.
jsp.submit.start-lookup-submission.identifier-doi = DOI (Digital Object Identifier)
jsp.submit.start-lookup-submission.identifier-doi.hint = e.g. 10.1392/dironix
jsp.submit.start-lookup-submission.identifier-pubmed = PubMed ID
jsp.submit.start-lookup-submission.identifier-pubmed.hint = e.g. 20524090
jsp.submit.start-lookup-submission.identifier-arxiv = arXiv ID
jsp.submit.start-lookup-submission.identifier-arxiv.hint = e.g. arXiv:1302.1497
jsp.submit.start-lookup-submission.search = Free search
jsp.submit.start-lookup-submission.search.hints = Insert base info about publication: either <b>title</b> or <b>author/year</b> is required.<br/>If you know any unique identifier about publication like <b>DOI</b>, <b>Pubmed</b>, or <b>arXiv</b> you can switch on the <span id="link-ricerca-identificatore">identifier search mode</span>.
jsp.submit.start-lookup-submission.search.title = Title
jsp.submit.start-lookup-submission.search.year = Year
jsp.submit.start-lookup-submission.search.authors = Authors/Publishers
jsp.submit.start-lookup-submission.identifier.lookup = Search
jsp.submit.start-lookup-submission.search-go = Search
jsp.submit.start-lookup-submission.exit = Exit
jsp.submit.start-lookup-submission.search-loading.title = Loading...
jsp.submit.start-lookup-submission.search-loading.hint = Quering the external service to retrieve the requested publications. Please, wait for the request to complete. if you close this window, the request will be aborted.
jsp.submit.edit-metadata.affiliation.select = Multiple possible matches, please select one to proceed!
jsp.submit.edit-metadata.affiliation.other = Other
jsp.submit.start-lookup-submission.no-collection = No collection selected
jsp.submit.start-lookup-submission.no-collection-warn.title = Warning, no collection
jsp.submit.start-lookup-submission.no-collection-warn.hint = The collection of the publication is required.
jsp.submit.start-lookup-submission.manual-submission = Default mode Submission
jsp.submit.start-lookup-submission.button.manual-submission = Manual submission
jsp.submit.start-lookup-submission.select.collection.label = Select collections:
jsp.submit.start-lookup-submission.select.collection.defaultoption = Select...
jsp.submit.start-lookup-submission.noresult = No results available!
jsp.submit.start-lookup-submission.js.errormessage = Sorry, an error occurred. Try again. If this message shows again, please, contact administrators and continue to insert the submission manually. Thank you!
jsp.submit.start-lookup-submission.js.detailsbuttonmessage = See details
jsp.submit.start-lookup-submission.js.filldataandstartbuttonmessage = Fill data and start submission
jsp.submit.start-lookup-submission.js.titlepopupmessage = Publication details
jsp.submit.start-lookup-submission.no-collection.dialog.return = I understand
jsp.submit.start-lookup-submission.byfile = Upload a file
jsp.submit.start-lookup-submission.byfile.hints = Select a file to upload and its type from the drop-down menu. If "Preview Mode" is enabled, the list of the publications in the file will be shown to you to select the one for submission. If it is disabled, all publications will be imported in your MyDSpace page as "Unfinished Submissions" while the first one will go through the submission process.
jsp.submit.start-lookup-submission.byfile.chooseprovider = Select data type
jsp.submit.start-lookup-submission.byfile.file = File
jsp.submit.start-lookup-submission.byfile.filepreview = Preview mode
jsp.submit.start-lookup-submission.byfile.filecollection = Collection
#Versioning
jsp.general.version.button = Create version of this item
jsp.general.version.history.button = Show version history
@@ -1719,3 +1767,4 @@ jsp.version.notice.new_version_head = Notice
jsp.version.notice.new_version_help = This is not the latest version of this item. The latest version can be found at:
jsp.version.notice.workflow_version_head = Notice
jsp.version.notice.workflow_version_help = A more recent version of this item is in the Workflow.

View File

@@ -0,0 +1,478 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean class="org.dspace.submit.lookup.SubmissionLookupService"
name="org.dspace.submit.lookup.SubmissionLookupService">
<property name="phase1TransformationEngine" ref="phase1TransformationEngine"/>
<property name="phase2TransformationEngine" ref="phase2TransformationEngine"/>
</bean>
<bean name="phase1TransformationEngine" class="gr.ekt.bte.core.TransformationEngine">
<property name="dataLoader" ref="multipleDataLoader"/>
<property name="workflow" ref="linearWorkflow"/>
<property name="outputGenerator" ref="org.dspace.submit.lookup.SubmissionLookupOutputGenerator"/>
</bean>
<bean name="multipleDataLoader" class="org.dspace.submit.lookup.MultipleSubmissionLookupDataLoader">
<property name="dataloadersMap">
<map>
<entry key="pubmed" value-ref="pubmedOnlineDataLoader"/>
<entry key="crossref" value-ref="crossRefOnlineDataLoader"/>
<entry key="arxiv" value-ref="arXivOnlineDataLoader"/>
<entry key="pubmed-file" value-ref="pubmedFileDataLoader"/>
<entry key="crossref-file" value-ref="crossRefFileDataLoader"/>
<entry key="arxiv-file" value-ref="arXivFileDataLoader"/>
<entry key="bibtex" value-ref="bibTeXDataLoader"/>
<entry key="ris" value-ref="risDataLoader"/>
<entry key="endnote" value-ref="endnoteDataLoader"/>
<entry key="csv" value-ref="csvDataLoader"/>
<entry key="tsv" value-ref="tsvDataLoader"/>
</map>
</property>
</bean>
<bean name="org.dspace.submit.lookup.SubmissionLookupOutputGenerator" class="org.dspace.submit.lookup.SubmissionLookupOutputGenerator"/>
<!-- Specify here any filters or modifiers to run before the output -->
<bean name="linearWorkflow" class="gr.ekt.bte.core.LinearWorkflow">
<property name="process">
<list>
<ref bean="mapConverter_arxivSubject"/>
<ref bean="mapConverter_pubstatusPubmed"/>
<ref bean="removeLastDot"/>
</list>
</property>
</bean>
<bean name="mapConverter_arxivSubject" class="org.dspace.submit.lookup.MapConverterModifier">
<constructor-arg value="apConverter_arxivSubject Modifier"/>
<property name="mapping">
<map>
<entry key="stat.AP" value="Statistics - Applications" />
<entry key="stat.CO" value="Statistics - Computation" />
<entry key="stat.ML" value="Statistics - Machine Learning" />
<entry key="stat.ME" value="Statistics - Methodology" />
<entry key="stat.TH" value="Statistics - Theory" />
<entry key="q-bio.BM" value="Quantitative Biology - Biomolecules" />
<entry key="q-bio.CB" value="Quantitative Biology - Cell Behavior" />
<entry key="q-bio.GN" value="Quantitative Biology - Genomics" />
<entry key="q-bio.MN" value="Quantitative Biology - Molecular Networks" />
<entry key="q-bio.NC" value="Quantitative Biology - Neurons and Cognition" />
<entry key="q-bio.OT" value="Quantitative Biology - Other" />
<entry key="q-bio.PE" value="Quantitative Biology - Populations and Evolution" />
<entry key="q-bio.QM" value="Quantitative Biology - Quantitative Methods" />
<entry key="q-bio.SC" value="Quantitative Biology - Subcellular Processes" />
<entry key="q-bio.TO" value="Quantitative Biology - Tissues and Organs" />
<entry key="cs.AR" value="Computer Science - Architecture" />
<entry key="cs.AI" value="Computer Science - Artificial Intelligence" />
<entry key="cs.CL" value="Computer Science - Computation and Language" />
<entry key="cs.CC" value="Computer Science - Computational Complexity" />
<entry key="cs.CE" value="Computer Science - Computational Engineering; Finance; and Science" />
<entry key="cs.CG" value="Computer Science - Computational Geometry" />
<entry key="cs.GT" value="Computer Science - Computer Science and Game Theory" />
<entry key="cs.CV" value="Computer Science - Computer Vision and Pattern Recognition" />
<entry key="cs.CY" value="Computer Science - Computers and Society" />
<entry key="cs.CR" value="Computer Science - Cryptography and Security" />
<entry key="cs.DS" value="Computer Science - Data Structures and Algorithms" />
<entry key="cs.DB" value="Computer Science - Databases" />
<entry key="cs.DL" value="Computer Science - Digital Libraries" />
<entry key="cs.DM" value="Computer Science - Discrete Mathematics" />
<entry key="cs.DC" value="Computer Science - Distributed; Parallel; and Cluster Computing" />
<entry key="cs.GL" value="Computer Science - General Literature" />
<entry key="cs.GR" value="Computer Science - Graphics" />
<entry key="cs.HC" value="Computer Science - Human-Computer Interaction" />
<entry key="cs.IR" value="Computer Science - Information Retrieval" />
<entry key="cs.IT" value="Computer Science - Information Theory" />
<entry key="cs.LG" value="Computer Science - Learning" />
<entry key="cs.LO" value="Computer Science - Logic in Computer Science" />
<entry key="cs.MS" value="Computer Science - Mathematical Software" />
<entry key="cs.MA" value="Computer Science - Multiagent Systems" />
<entry key="cs.MM" value="Computer Science - Multimedia" />
<entry key="cs.NI" value="Computer Science - Networking and Internet Architecture" />
<entry key="cs.NE" value="Computer Science - Neural and Evolutionary Computing" />
<entry key="cs.NA" value="Computer Science - Numerical Analysis" />
<entry key="cs.OS" value="Computer Science - Operating Systems" />
<entry key="cs.OH" value="Computer Science - Other" />
<entry key="cs.PF" value="Computer Science - Performance" />
<entry key="cs.PL" value="Computer Science - Programming Languages" />
<entry key="cs.RO" value="Computer Science - Robotics" />
<entry key="cs.SE" value="Computer Science - Software Engineering" />
<entry key="cs.SD" value="Computer Science - Sound" />
<entry key="cs.SC" value="Computer Science - Symbolic Computation" />
<entry key="nlin.AO" value="Nonlinear Sciences - Adaptation and Self-Organizing Systems" />
<entry key="nlin.CG" value="Nonlinear Sciences - Cellular Automata and Lattice Gases" />
<entry key="nlin.CD" value="Nonlinear Sciences - Chaotic Dynamics" />
<entry key="nlin.SI" value="Nonlinear Sciences - Exactly Solvable and Integrable Systems" />
<entry key="nlin.PS" value="Nonlinear Sciences - Pattern Formation and Solitons" />
<entry key="math.AG" value="Mathematics - Algebraic Geometry" />
<entry key="math.AT" value="Mathematics - Algebraic Topology" />
<entry key="math.AP" value="Mathematics - Analysis of PDEs" />
<entry key="math.CT" value="Mathematics - Category Theory" />
<entry key="math.CA" value="Mathematics - Classical Analysis and ODEs" />
<entry key="math.CO" value="Mathematics - Combinatorics" />
<entry key="math.AC" value="Mathematics - Commutative Algebra" />
<entry key="math.CV" value="Mathematics - Complex Variables" />
<entry key="math.DG" value="Mathematics - Differential Geometry" />
<entry key="math.DS" value="Mathematics - Dynamical Systems" />
<entry key="math.FA" value="Mathematics - Functional Analysis" />
<entry key="math.GM" value="Mathematics - General Mathematics" />
<entry key="math.GN" value="Mathematics - General Topology" />
<entry key="math.GT" value="Mathematics - Geometric Topology" />
<entry key="math.GR" value="Mathematics - Group Theory" />
<entry key="math.HO" value="Mathematics - History and Overview" />
<entry key="math.IT" value="Mathematics - Information Theory" />
<entry key="math.KT" value="Mathematics - K-Theory and Homology" />
<entry key="math.LO" value="Mathematics - Logic" />
<entry key="math.MP" value="Mathematics - Mathematical Physics" />
<entry key="math.MG" value="Mathematics - Metric Geometry" />
<entry key="math.NT" value="Mathematics - Number Theory" />
<entry key="math.NA" value="Mathematics - Numerical Analysis" />
<entry key="math.OA" value="Mathematics - Operator Algebras" />
<entry key="math.OC" value="Mathematics - Optimization and Control" />
<entry key="math.PR" value="Mathematics - Probability" />
<entry key="math.QA" value="Mathematics - Quantum Algebra" />
<entry key="math.RT" value="Mathematics - Representation Theory" />
<entry key="math.RA" value="Mathematics - Rings and Algebras" />
<entry key="math.SP" value="Mathematics - Spectral Theory" />
<entry key="math.ST" value="Mathematics - Statistics" />
<entry key="math.SG" value="Mathematics - Symplectic Geometry" />
<entry key="astro-ph" value="Astrophysics" />
<entry key="cond-mat.dis-nn" value="Physics - Disordered Systems and Neural Networks" />
<entry key="cond-mat.mes-hall" value="Physics - Mesoscopic Systems and Quantum Hall Effect" />
<entry key="cond-mat.mtrl-sci" value="Physics - Materials Science" />
<entry key="cond-mat.other" value="Physics - Other" />
<entry key="cond-mat.soft" value="Physics - Soft Condensed Matter" />
<entry key="cond-mat.stat-mech" value="Physics - Statistical Mechanics" />
<entry key="cond-mat.str-el" value="Physics - Strongly Correlated Electrons" />
<entry key="cond-mat.supr-con" value="Physics - Superconductivity" />
<entry key="gr-qc" value="General Relativity and Quantum Cosmology" />
<entry key="hep-ex" value="High Energy Physics - Experiment" />
<entry key="hep-lat" value="High Energy Physics - Lattice" />
<entry key="hep-ph" value="High Energy Physics - Phenomenology" />
<entry key="hep-th" value="High Energy Physics - Theory" />
<entry key="math-ph" value="Mathematical Physics" />
<entry key="nucl-ex" value="Nuclear Experiment" />
<entry key="nucl-th" value="Nuclear Theory" />
<entry key="physics.acc-ph" value="Physics - Accelerator Physics" />
<entry key="physics.ao-ph" value="Physics - Atmospheric and Oceanic Physics" />
<entry key="physics.atom-ph" value="Physics - Atomic Physics" />
<entry key="physics.atm-clus" value="Physics - Atomic and Molecular Clusters" />
<entry key="physics.bio-ph" value="Physics - Biological Physics" />
<entry key="physics.chem-ph" value="Physics - Chemical Physics" />
<entry key="physics.class-ph" value="Physics - Classical Physics" />
<entry key="physics.comp-ph" value="Physics - Computational Physics" />
<entry key="physics.data-an" value="Physics - Data Analysis; Statistics and Probability" />
<entry key="physics.flu-dyn" value="Physics - Fluid Dynamics" />
<entry key="physics.gen-ph" value="Physics - General Physics" />
<entry key="physics.geo-ph" value="Physics - Geophysics" />
<entry key="physics.hist-ph" value="Physics - History of Physics" />
<entry key="physics.ins-det" value="Physics - Instrumentation and Detectors" />
<entry key="physics.med-ph" value="Physics - Medical Physics" />
<entry key="physics.optics" value="Physics - Optics" />
<entry key="physics.ed-ph" value="Physics - Physics Education" />
<entry key="physics.soc-ph" value="Physics - Physics and Society" />
<entry key="physics.plasm-ph" value="Physics - Plasma Physics" />
<entry key="physics.pop-ph" value="Physics - Popular Physics" />
<entry key="physics.space-ph" value="Physics - Space Physics" />
<entry key="quant-ph" value="Quantum Physics" />
</map>
</property>
<property name="fieldKeys">
<list>
<value>arxivCategory</value>
</list>
</property>
</bean>
<bean name="mapConverter_pubstatusPubmed" class="org.dspace.submit.lookup.MapConverterModifier">
<constructor-arg value="mapConverter_pubstatusPubmed Modifier"/>
<property name="defaultValue" value="Subjected to Journal"/>
<property name="mapping">
<map>
<entry key="ppublish" value="Published" />
<entry key="epublish" value="Published" />
</map>
</property>
<property name="fieldKeys">
<list>
<value>publicationstatus</value>
</list>
</property>
</bean>
<bean name="removeLastDot" class="org.dspace.submit.lookup.RemoveLastDotModifier">
<constructor-arg value="removeLastDot Modifier"/>
<property name="fieldKeys">
<list>
<value>title</value>
</list>
</property>
</bean>
<!-- PubMed Data Loaders -->
<bean class="org.dspace.submit.lookup.PubmedOnlineDataLoader" name="pubmedOnlineDataLoader">
<property name="searchProvider" value="false" />
<property name="fieldMap" ref="pubmedInputMap"/>
</bean>
<bean class="org.dspace.submit.lookup.PubmedFileDataLoader" name="pubmedFileDataLoader">
<property name="fieldMap" ref="pubmedInputMap"/>
</bean>
<bean name="pubmedInputMap" class="java.util.HashMap" scope="prototype" >
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.String">
<entry key="pubmedID" value="pmid" />
<entry key="doi" value="doi" />
<entry key="issn" value="issn" />
<entry key="eissn" value="eissn" />
<entry key="journalTitle" value="journal" />
<entry key="title" value="title" />
<entry key="pubblicationModel" value="" />
<entry key="year" value="issued" />
<entry key="volume" value="volume" />
<entry key="issue" value="issue" />
<entry key="language" value="language" />
<entry key="type" value="subtype" />
<entry key="primaryKeywords" value="keywords" />
<entry key="secondaryKeywords" value="keywords" />
<entry key="primaryMeshHeadings" value="mesh" />
<entry key="secondaryMeshHeadings" value="mesh" />
<entry key="startPage" value="firstpage" />
<entry key="endPage" value="lastpage" />
<entry key="summary" value="abstract" />
<entry key="status" value="publicationstatus" />
<entry key="authors" value="authors" />
</map>
</constructor-arg>
</bean>
<!-- Arxiv Data Loaders -->
<bean class="org.dspace.submit.lookup.ArXivOnlineDataLoader" name="arXivOnlineDataLoader">
<property name="searchProvider" value="false" />
<property name="fieldMap" ref="arxivInputMap"/>
</bean>
<bean class="org.dspace.submit.lookup.ArXivFileDataLoader" name="arXivFileDataLoader">
<property name="fieldMap" ref="arxivInputMap"/>
</bean>
<bean name="arxivInputMap" class="java.util.HashMap" scope="prototype" >
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.String">
<entry key="journalRef" value="journal" />
<entry key="doi" value="doi" />
<entry key="authors" value="authors" />
<entry key="comment" value="note" />
<entry key="year" value="issued" />
<entry key="articleTitle" value="title" />
<entry key="summary" value="abstract" />
<entry key="splashPageUrl" value="url" />
<entry key="pdfUrl" value="fulltextUrl" />
<entry key="primaryCategory" value="arxivCategory" />
<entry key="category" value="arxivCategory" />
<entry key="source" value="arxivID" />
</map>
</constructor-arg>
</bean>
<!-- CrossRef Data Loaders -->
<bean class="org.dspace.submit.lookup.CrossRefOnlineDataLoader" name="crossRefOnlineDataLoader">
<property name="searchProvider" value="false" />
<property name="fieldMap" ref="crossrefInputMap"/>
</bean>
<bean class="org.dspace.submit.lookup.CrossRefFileDataLoader" name="crossRefFileDataLoader">
<property name="fieldMap" ref="crossrefInputMap"/>
</bean>
<bean name="crossrefInputMap" class="java.util.HashMap" scope="prototype" >
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.String">
<entry key="journalRef" value="journal" />
<entry key="doi" value="doi" />
<entry key="authors" value="authors" />
<entry key="comment" value="note" />
<entry key="year" value="issued" />
<entry key="articleTitle" value="title" />
<entry key="summary" value="abstract" />
<entry key="splashPageUrl" value="url" />
<entry key="pdfUrl" value="fulltextUrl" />
<entry key="primaryCategory" value="arxivCategory" />
<entry key="category" value="arxivCategory" />
<entry key="source" value="arxivID" />
</map>
</constructor-arg>
</bean>
<!-- Phase2 transformation engine -->
<bean name="phase2TransformationEngine" class="gr.ekt.bte.core.TransformationEngine">
<property name="dataLoader" ref="submissionItemDataLoader"/>
<property name="workflow" ref="phase2linearWorkflow"/>
<property name="outputGenerator" ref="org.dspace.submit.lookup.DSpaceWorkspaceItemOutputGenerator"/>
</bean>
<bean name="submissionItemDataLoader" class="org.dspace.submit.lookup.SubmissionItemDataLoader"/>
<!-- Specify here any filters or modifiers to run before the output -->
<bean name="phase2linearWorkflow" class="gr.ekt.bte.core.LinearWorkflow">
<property name="process">
<list>
<ref bean="fieldMergeModifier"/>
<ref bean="valueConcatenationModifier"/>
</list>
</property>
</bean>
<bean name="fieldMergeModifier" class="org.dspace.submit.lookup.FieldMergeModifier">
<property name="mergeFieldMap">
<map>
<entry key="allauthors">
<list>
<value>authors</value>
</list>
</entry>
<entry key="allkeywords">
<list>
<value>keywords</value>
<value>mesh</value>
</list>
</entry>
</map>
</property>
</bean>
<bean name="valueConcatenationModifier" class="org.dspace.submit.lookup.ValueConcatenationModifier">
<property name="field" value="allkeywords"/>
<property name="separator" value=";" />
<property name="whitespaceAfter" value="true" />
</bean>
<bean name="org.dspace.submit.lookup.DSpaceWorkspaceItemOutputGenerator" class="org.dspace.submit.lookup.DSpaceWorkspaceItemOutputGenerator">
<property name="outputMap">
<map>
<entry key="pmid" value="dc.identifier.pmid"/>
<entry key="doi" value="dc.identifier.doi"/>
<entry key="jissn" value="dc.relation.issn"/>
<entry key="jeissn" value="dc.relation.eissn"/>
<entry key="journal" value="dc.relation.ispartofjournal"/>
<entry key="title" value="dc.title"/>
<entry key="issued" value="dc.date.issued"/>
<entry key="volume" value="dc.relation.volume"/>
<entry key="issue" value="dc.relation.issue"/>
<entry key="language" value="dc.language.iso"/>
<entry key="subtype" value="dc.type.contribution"/>
<!-- <entry key="keywords" value="dc.subject"/> -->
<entry key="mesh" value="dc.subject"/>
<entry key="firstpage" value="dc.relation.firstpage"/>
<entry key="lastpage" value="dc.relation.lastpage"/>
<entry key="abstract" value="dc.description.abstract"/>
<entry key="publicationstatus" value="dc.type.publicationstatus"/>
<!-- <entry key="authorsWithAffiliations" value="dc.contributor.author"/> -->
<!-- <entry key="authors" value="dc.contributor.author|authorsWithAffiliations"/> -->
<entry key="authorsWithAffiliations" value=""/>
<entry key="authors" value=""/>
<entry key="articleNumber" value="dc.relation.article"/>
<entry key="firstpage" value="dc.relation.firstpage"/>
<entry key="firstpage" value="dc.relation.firstpage"/>
</map>
</property>
<property name="extraMetadataToKeep">
<list>
<value>dc.import.contributorauthor</value>
<value>dc.import.contributoreditor</value>
<value>dc.import.contributortranslator</value>
<!-- <value>dc.description.scopusurl</value>
<value>dc.description.scopuscitationcount</value>
<value>dc.description.scopuscitationurl</value>-->
</list>
</property>
</bean>
<!-- BTE core data loaders -->
<bean id="bibTeXDataLoader" class="gr.ekt.bteio.loaders.BibTeXDataLoader">
<property name="fieldMap">
<map>
<entry key="title" value="title"/>
<entry key="author" value="authors"/>
<entry key="journal" value="journal"/>
<entry key="year" value="issued"/>
<entry key="ISSN" value="jissn"/>
</map>
</property>
</bean>
<bean id="csvDataLoader" class="gr.ekt.bteio.loaders.CSVDataLoader">
<property name="fieldMap">
<map>
<entry key="1" value="title"/>
<entry key="0" value="authors"/>
<entry key="2" value="issued"/>
<entry key="3" value="journal"/>
<entry key="14" value="abstract"/>
<entry key="31" value="jissn"/>
<entry key="38" value="subtype"/>
</map>
</property>
<property name="skipLines" value="1"/>
</bean>
<bean id="tsvDataLoader" class="gr.ekt.bteio.loaders.CSVDataLoader">
<property name="fieldMap">
<map>
<entry key="7" value="title"/>
<entry key="1" value="authors"/>
<entry key="37" value="issued"/>
<entry key="8" value="journal"/>
<entry key="19" value="abstract"/>
<entry key="31" value="jissn"/>
<entry key="0" value="subtype"/>
</map>
</property>
<!-- This makes the CSV data loader able to load TSV data -->
<property name="separator" value="\u0009"/>
<property name="skipLines" value="1"/>
</bean>
<bean id="risDataLoader" class="gr.ekt.bteio.loaders.RISDataLoader">
<property name="fieldMap">
<map>
<entry key="T1" value="title"/>
<entry key="AU" value="authors"/>
<entry key="SO" value="journal"/>
<entry key="PY" value="issued"/>
<entry key="SN" value="jissn"/>
<entry key="PT" value="subtype"/>
<entry key="AB" value="abstract"/>
</map>
</property>
</bean>
<bean id="endnoteDataLoader" class="gr.ekt.bteio.loaders.EndnoteDataLoader">
<property name="fieldMap">
<map>
<entry key="TI" value="title"/>
<entry key="AU" value="authors"/>
<entry key="AB" value="abstract"/>
<entry key="PY" value="issued"/>
<entry key="SO" value="journal"/>
</map>
</property>
</bean>
</beans>

View File

@@ -129,8 +129,7 @@
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>2.1</version>
<artifactId>flexjson</artifactId>
</dependency>
</dependencies>

View File

@@ -0,0 +1,336 @@
/**
* 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.app.webui.json;
import flexjson.JSONSerializer;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.TransformationEngine;
import gr.ekt.bte.core.TransformationSpec;
import gr.ekt.bte.exceptions.BadTransformationSpec;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.util.Streams;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.I18nUtil;
import org.dspace.core.Utils;
import org.dspace.submit.lookup.MultipleSubmissionLookupDataLoader;
import org.dspace.submit.lookup.SubmissionLookupOutputGenerator;
import org.dspace.submit.lookup.SubmissionLookupService;
import org.dspace.submit.lookup.SubmissionLookupUtils;
import org.dspace.submit.util.ItemSubmissionLookupDTO;
import org.dspace.submit.util.SubmissionLookupDTO;
import org.dspace.utils.DSpace;
public class SubmissionLookupJSONRequest extends JSONRequest {
private SubmissionLookupService service = new DSpace().getServiceManager()
.getServiceByName(SubmissionLookupService.class.getName(),
SubmissionLookupService.class);
private static Logger log = Logger
.getLogger(SubmissionLookupJSONRequest.class);
@Override
public void doJSONRequest(Context context, HttpServletRequest req,
HttpServletResponse resp) throws AuthorizeException, IOException {
String suuid = req.getParameter("s_uuid");
SubmissionLookupDTO subDTO = service.getSubmissionLookupDTO(req, suuid);
// Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(req);
if ("identifiers".equalsIgnoreCase(req.getParameter("type"))) {
Map<String, Set<String>> identifiers = new HashMap<String, Set<String>>();
Enumeration e = req.getParameterNames();
while (e.hasMoreElements()) {
String parameterName = (String) e.nextElement();
String parameterValue = req.getParameter(parameterName);
if (parameterName.startsWith("identifier_")
&& StringUtils.isNotBlank(parameterValue)) {
Set<String> set = new HashSet<String>();
set.add(parameterValue);
identifiers.put(
parameterName.substring("identifier_".length()),
set);
}
}
List<ItemSubmissionLookupDTO> result = new ArrayList<ItemSubmissionLookupDTO>();
TransformationEngine transformationEngine = service
.getPhase1TransformationEngine();
if (transformationEngine != null) {
MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader) transformationEngine
.getDataLoader();
dataLoader.setIdentifiers(identifiers);
try {
log.debug("BTE transformation is about to start!");
transformationEngine.transform(new TransformationSpec());
log.debug("BTE transformation finished!");
SubmissionLookupOutputGenerator outputGenerator = (SubmissionLookupOutputGenerator) transformationEngine
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
} catch (MalformedSourceException e1) {
e1.printStackTrace();
}
}
subDTO.setItems(result);
service.storeDTOs(req, suuid, subDTO);
List<Map<String, Object>> dto = getLightResultList(result);
JSONSerializer serializer = new JSONSerializer();
serializer.rootName("result");
serializer.deepSerialize(dto, resp.getWriter());
} else if ("search".equalsIgnoreCase(req.getParameter("type"))) {
String title = req.getParameter("title");
String author = req.getParameter("authors");
int year = UIUtil.getIntParameter(req, "year");
Map<String, Set<String>> searchTerms = new HashMap<String, Set<String>>();
Set<String> tmp1 = new HashSet<String>();
tmp1.add(title);
Set<String> tmp2 = new HashSet<String>();
tmp2.add(author);
Set<String> tmp3 = new HashSet<String>();
tmp3.add(String.valueOf(year));
searchTerms.put("title", tmp1);
searchTerms.put("authors", tmp2);
searchTerms.put("year", tmp3);
List<ItemSubmissionLookupDTO> result = new ArrayList<ItemSubmissionLookupDTO>();
TransformationEngine transformationEngine = service
.getPhase1TransformationEngine();
if (transformationEngine != null) {
MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader) transformationEngine
.getDataLoader();
dataLoader.setSearchTerms(searchTerms);
try {
transformationEngine.transform(new TransformationSpec());
SubmissionLookupOutputGenerator outputGenerator = (SubmissionLookupOutputGenerator) transformationEngine
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
} catch (MalformedSourceException e1) {
e1.printStackTrace();
}
}
subDTO.setItems(result);
service.storeDTOs(req, suuid, subDTO);
List<Map<String, Object>> dto = getLightResultList(result);
JSONSerializer serializer = new JSONSerializer();
serializer.rootName("result");
serializer.deepSerialize(dto, resp.getWriter());
} else if ("details".equalsIgnoreCase(req.getParameter("type"))) {
String i_uuid = req.getParameter("i_uuid");
JSONSerializer serializer = new JSONSerializer();
serializer.rootName("result");
Map<String, Object> dto = getDetails(subDTO.getLookupItem(i_uuid),
context);
serializer.deepSerialize(dto, resp.getWriter());
} else if (isMultipart) {
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
Map<String, String> valueMap = new HashMap<String, String>();
InputStream io = null;
// Parse the request
List<FileItem> iter;
String filename = null;
try {
iter = upload.parseRequest(req);
for(FileItem item : iter) {
String name = item.getFieldName();
InputStream stream = item.getInputStream();
if (item.isFormField()) {
String value = Streams.asString(stream);
valueMap.put(name, value);
} else {
io = stream;
}
}
} catch (FileUploadException e) {
throw new IOException(e);
}
suuid = valueMap.get("s_uuid");
subDTO = service.getSubmissionLookupDTO(req, suuid);
List<ItemSubmissionLookupDTO> result = new ArrayList<ItemSubmissionLookupDTO>();
TransformationEngine transformationEngine = service
.getPhase1TransformationEngine();
if (transformationEngine != null) {
MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader) transformationEngine
.getDataLoader();
String tempDir = (ConfigurationManager.getProperty("upload.temp.dir") != null)
? ConfigurationManager.getProperty("upload.temp.dir") : System.getProperty("java.io.tmpdir");
File file = new File(tempDir + System.getProperty("file.separator") + "submissionlookup-loader.temp");
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(file));
Utils.bufferedCopy(io, out);
dataLoader.setFile(file.getAbsolutePath(), valueMap.get("provider_loader"));
try {
transformationEngine.transform(new TransformationSpec());
SubmissionLookupOutputGenerator outputGenerator = (SubmissionLookupOutputGenerator) transformationEngine
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
} catch (MalformedSourceException e1) {
e1.printStackTrace();
}
file.delete();
}
subDTO.setItems(result);
service.storeDTOs(req, suuid, subDTO);
List<Map<String, Object>> dto = getLightResultList(result);
if (valueMap.containsKey("skip_loader")) {
if (valueMap.get("skip_loader").equals("true")) {
Map<String, Object> skip = new HashMap<String, Object>();
skip.put(
"skip",
Boolean.TRUE);
skip.put(
"uuid",
valueMap.containsKey("s_uuid") ? suuid
: -1);
skip.put(
"collectionid",
valueMap.containsKey("select-collection-file") ? valueMap
.get("select-collection-file") : -1);
dto.add(skip);
}
}
JSONSerializer serializer = new JSONSerializer();
serializer.rootName("result");
serializer.deepSerialize(dto, resp.getWriter());
resp.setContentType("text/plain");
}
}
private Map<String, Object> getDetails(ItemSubmissionLookupDTO item,
Context context) {
List<String> fieldOrder = getFieldOrderFromConfiguration();
Record totalData = item.getTotalPublication(service.getProviders());
Set<String> availableFields = totalData.getFields();
List<String[]> fieldsLabels = new ArrayList<String[]>();
for (String f : fieldOrder) {
if (availableFields.contains(f)) {
try {
fieldsLabels.add(new String[] {
f,
I18nUtil.getMessage("jsp.submission-lookup.detail."
+ f, context) });
} catch (MissingResourceException e) {
fieldsLabels.add(new String[] { f, f });
}
}
}
Map<String, Object> data = new HashMap<String, Object>();
String uuid = item.getUUID();
Record pub = item.getTotalPublication(service.getProviders());
Map<String, List<String>> publication1 = new HashMap<String, List<String>>();
for (String field : pub.getFields()){
publication1.put(field, SubmissionLookupUtils.getValues(pub, field));
}
data.put("uuid", uuid);
data.put("providers", item.getProviders());
data.put("publication", publication1);
data.put("fieldsLabels", fieldsLabels);
return data;
}
private List<String> getFieldOrderFromConfiguration() {
String config = ConfigurationManager
.getProperty("submission-lookup.detail.fields");
if (config == null) {
config = "title,authors,editors,years,doi,pmid,eid,arxiv,journal,jissn,jeissn,volume,issue,serie,sissn,seissn,abstract,mesh,keywords,subtype";
}
List<String> result = new ArrayList<String>();
String[] split = config.split(",");
for (String s : split) {
if (StringUtils.isNotBlank(s)) {
result.add(s.trim());
}
}
return result;
}
private List<Map<String, Object>> getLightResultList(
List<ItemSubmissionLookupDTO> result) {
List<Map<String, Object>> publications = new ArrayList<Map<String, Object>>();
if (result != null && result.size() > 0) {
for (ItemSubmissionLookupDTO item : result) {
String uuid = item.getUUID();
Record pub = item.getTotalPublication(service.getProviders());
Map<String, Object> data = new HashMap<String, Object>();
data.put("uuid", uuid);
data.put("providers", item.getProviders());
data.put("title",
SubmissionLookupUtils.getFirstValue(pub, "title"));
data.put(
"authors",
pub.getValues("authors") != null ? StringUtils.join(
SubmissionLookupUtils.getValues(pub, "authors")
.iterator(), ", ") : "");
data.put("issued",
SubmissionLookupUtils.getFirstValue(pub, "issued"));
publications.add(data);
}
}
return publications;
}
}

View File

@@ -0,0 +1,280 @@
/**
* 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.app.webui.submit.step;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.dspace.app.util.SubmissionInfo;
import org.dspace.app.webui.submit.JSPStep;
import org.dspace.app.webui.submit.JSPStepManager;
import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.submit.lookup.SubmissionLookupDataLoader;
import org.dspace.submit.lookup.SubmissionLookupService;
import org.dspace.submit.step.StartSubmissionLookupStep;
import org.dspace.utils.DSpace;
/**
* Step which controls selecting an item from external database service to auto fill metadata
* for DSpace JSP-UI
* <P>
* This JSPStep class works with the SubmissionController servlet
* for the JSP-UI
* <P>
* The following methods are called in this order:
* <ul>
* <li>Call doPreProcessing() method</li>
* <li>If showJSP() was specified from doPreProcessing(), then the JSP
* specified will be displayed</li>
* <li>If showJSP() was not specified from doPreProcessing(), then the
* doProcessing() method is called an the step completes immediately</li>
* <li>Call doProcessing() method on appropriate AbstractProcessingStep after the user returns from the JSP, in order
* to process the user input</li>
* <li>Call doPostProcessing() method to determine if more user interaction is
* required, and if further JSPs need to be called.</li>
* <li>If there are more "pages" in this step then, the process begins again
* (for the new page).</li>
* <li>Once all pages are complete, control is forwarded back to the
* SubmissionController, and the next step is called.</li>
* </ul>
*
* @see org.dspace.app.webui.servlet.SubmissionController
* @see org.dspace.app.webui.submit.JSPStep
* @see org.dspace.submit.step.StartSubmissionLookupStep
*
* @author Andrea Bollini
* @version $Revision$
*/
public class JSPStartSubmissionLookupStep extends JSPStep
{
/** JSP which displays HTML for this Class * */
private static final String START_LOOKUP_JSP = "/submit/start-lookup-submission.jsp";
/** log4j logger */
private static Logger log = Logger.getLogger(JSPStartSubmissionLookupStep.class);
SubmissionLookupService slService = new DSpace().getServiceManager()
.getServiceByName(
SubmissionLookupService.class.getCanonicalName(),
SubmissionLookupService.class);
/**
* Do any pre-processing to determine which JSP (if any) is used to generate
* the UI for this step. This method should include the gathering and
* validating of all data required by the JSP. In addition, if the JSP
* requires any variable to passed to it on the Request, this method should
* set those variables.
* <P>
* If this step requires user interaction, then this method must call the
* JSP to display, using the "showJSP()" method of the JSPStepManager class.
* <P>
* If this step doesn't require user interaction OR you are solely using
* Manakin for your user interface, then this method may be left EMPTY,
* since all step processing should occur in the doProcessing() method.
*
* @param context
* current DSpace context
* @param request
* current servlet request object
* @param response
* current servlet response object
* @param subInfo
* submission info object
*/
public void doPreProcessing(Context context, HttpServletRequest request,
HttpServletResponse response, SubmissionInfo subInfo)
throws ServletException, IOException, SQLException,
AuthorizeException
{
if (request.getAttribute("no.collection") == null
|| !(Boolean) request.getAttribute("no.collection"))
{
request.setAttribute("s_uuid", UUID.randomUUID().toString());
}
/*
* Possible parameters from JSP:
*
* collection= <collection_id> - a collection that has already been
* selected (to use as preference! it is not the final choice!!!)
*
* collectionid = the FINAL chosed collection!!!
*
* With no parameters, this servlet prepares for display of the Select
* Collection JSP.
*/
int collectionID = UIUtil.getIntParameter(request, "collectionid");
Collection col = null;
if (collectionID != -1)
{
col = Collection.find(context, collectionID);
}
// if we already have a valid collection, then we can forward directly
// to post-processing
if (col != null)
{
log.debug("Select Collection page skipped, since a Collection ID was already found. Collection ID="
+ collectionID);
}
else
{
// gather info for JSP page
Community com = UIUtil.getCommunityLocation(request);
Collection[] collections;
if (com != null)
{
// In a community. Show collections in that community only.
collections = Collection.findAuthorized(context, com,
Constants.ADD);
}
else
{
// Show all collections
collections = Collection.findAuthorized(context, null,
Constants.ADD);
}
// This is a special case, where the user came back to this
// page after not selecting a collection. This will display
// the "Please select a collection" message to the user
if (collectionID == -1)
{
// specify "no collection" error message should be displayed
request.setAttribute("no.collection", Boolean.TRUE);
}
// save collections to request for JSP
request.setAttribute("collections", collections);
request.setAttribute("collectionID", collectionID);
Map<String, List<String>> identifiers2providers = slService
.getProvidersIdentifiersMap();
List<String> searchProviders = slService
.getSearchProviders();
List<String> fileProviders = slService
.getFileProviders();
request.setAttribute("identifiers2providers", identifiers2providers);
request.setAttribute("searchProviders", searchProviders);
request.setAttribute("fileLoaders", fileProviders);
request.setAttribute("identifiers", slService.getIdentifiers());
// we need to load the select collection JSP
JSPStepManager
.showJSP(request, response, subInfo, START_LOOKUP_JSP);
}
}
/**
* Do any post-processing after the step's backend processing occurred (in
* the doProcessing() method).
* <P>
* It is this method's job to determine whether processing completed
* successfully, or display another JSP informing the users of any potential
* problems/errors.
* <P>
* If this step doesn't require user interaction OR you are solely using
* Manakin for your user interface, then this method may be left EMPTY,
* since all step processing should occur in the doProcessing() method.
*
* @param context
* current DSpace context
* @param request
* current servlet request object
* @param response
* current servlet response object
* @param subInfo
* submission info object
* @param status
* any status/errors reported by doProcessing() method
*/
public void doPostProcessing(Context context, HttpServletRequest request,
HttpServletResponse response, SubmissionInfo subInfo, int status)
throws ServletException, IOException, SQLException,
AuthorizeException
{
// if the user didn't select a collection,
// send him/her back to "select a collection" page
if (status == StartSubmissionLookupStep.STATUS_NO_COLLECTION)
{
// specify "no collection" error message should be displayed
request.setAttribute("no.collection", new Boolean(true));
// reload this page, by re-calling doPreProcessing()
doPreProcessing(context, request, response, subInfo);
}
else if (status == StartSubmissionLookupStep.STATUS_INVALID_COLLECTION)
{
JSPManager.showInvalidIDError(request, response, request
.getParameter("collectionid"), Constants.COLLECTION);
}
else if (status == StartSubmissionLookupStep.STATUS_NO_SUUID)
{
// specify "no suuid" error message should be displayed
request.setAttribute("no.suuid", new Boolean(true));
// reload this page, by re-calling doPreProcessing()
doPreProcessing(context, request, response, subInfo);
}
else if (status == StartSubmissionLookupStep.STATUS_SUBMISSION_EXPIRED)
{
// specify "no collection" error message should be displayed
request.setAttribute("expired", new Boolean(true));
// reload this page, by re-calling doPreProcessing()
doPreProcessing(context, request, response, subInfo);
}
else if (status != StartSubmissionLookupStep.STATUS_COMPLETE)
{
// specify "no suuid" error message should be displayed
request.setAttribute("no.suuid", new Boolean(true));
// reload this page, by re-calling doPreProcessing()
doPreProcessing(context, request, response, subInfo);
}
}
/**
* Return the URL path (e.g. /submit/review-metadata.jsp) of the JSP
* which will review the information that was gathered in this Step.
* <P>
* This Review JSP is loaded by the 'Verify' Step, in order to dynamically
* generate a submission verification page consisting of the information
* gathered in all the enabled submission steps.
*
* @param context
* current DSpace context
* @param request
* current servlet request object
* @param response
* current servlet response object
* @param subInfo
* submission info object
*/
public String getReviewJSP(Context context, HttpServletRequest request,
HttpServletResponse response, SubmissionInfo subInfo)
{
return NO_JSP; //at this time, you cannot review what collection you selected.
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,279 @@
/*
* 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/
*/
submissionLookupIdentifiers = function(identInputs){
var mydata = new Object();
mydata['s_uuid'] = j('#suuid-identifier').val();
mydata['type'] = 'identifiers';
for (var i=0;i<identInputs.length;i++)
{
mydata[j(identInputs[i]).attr('id')] = j(identInputs[i]).val();
}
var ajaxCall = j.ajax({url: dspaceContextPath+"/json/submissionLookup",
type: "POST",
dataType: "json",
async: true,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
data: mydata,
error: function(info){
j('#loading-search-result').modal("hide");
var message = j('#jserrormessage').text();
alert(message);
},
success: function(info) {
if (info == null || info.result == null || info.result.length == 0)
{
j('#result-list').hide();
j('#empty-result').show();
}
else
{
submissionLookupShowResult(info, "-identifier");
}
j('#loading-search-result').modal("hide");
j('#tabs').find('a[href="#tabs-result"]').click();
}
});
j('#loading-search-result').data('ajaxCall', ajaxCall);
j('#loading-search-result').modal("show");
}
submissionLookupSearch = function(){
var mydata = new Object();
mydata['s_uuid'] = j('#suuid-search').val();
mydata['type'] = 'search';
mydata['title'] = j('#search_title').val();
mydata['authors'] = j('#search_authors').val();
mydata['year'] = j('#search_year').val();
var ajaxCall = j.ajax({url: dspaceContextPath+"/json/submissionLookup",
type: "POST",
dataType: "json",
async: true,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
data: mydata,
error: function(info){
j('#loading-search-result').modal('hide');
var message = j('#jserrormessage').text();
alert(message);
},
success: function(info) {
if (info == null || info.result == null || info.result.length == 0)
{
j('#result-list').hide();
j('#empty-result').show();
}
else
{
submissionLookupShowResult(info, "-search");
}
j('#loading-search-result').modal('hide');
j('#tabs').find('a[href="#tabs-result"]').click();
}
});
j('#loading-search-result').data('ajaxCall', ajaxCall);
j('#loading-search-result').modal('show');
}
submissionLookupDetails = function(button, suffixID){
var uuid = j(button).data('uuid');
var mydata = new Object();
var suuidID = 'suuid' + suffixID
mydata['s_uuid'] = j('#'+suuidID).val();
mydata['type'] = 'details';
mydata['i_uuid'] = uuid;
j.ajax({url: dspaceContextPath+"/json/submissionLookup",
type: "POST",
dataType: "json",
async: false,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
data: mydata,
error: function(info){var message = j('#jserrormessage').text();alert(message);},
success: function(info) {
if (info == null || info.result == null || info.result.uuid != uuid)
{
var message = j('#jserrormessage').text();
alert(message);
}
else
{
submissionLookupShowDetails(info.result);
}
j('#tabs').find('a[href="#tabs-result"]').click();
}
});
}
submissionLookupShowResult = function(info, suffixID){
j('#result-list').show();
j('#empty-result').hide();
j('#result-list').html(" ");
for (var i=0;i<info.result.length;i++)
{
var bt = j('<button class="btn btn-info" type="button">').append(j('#jsseedetailsbuttonmessage').text());
var par = j('<p class="sl-result">');
var divImg = j('<div class="submission-lookup-providers">');
par.append(divImg);
for (var k=0;k<info.result[i].providers.length;k++)
{
var prov = info.result[i].providers[k];
divImg.append(j('<img src="'+dspaceContextPath+'/image/submission-lookup-small-'+prov+'.jpg">'));
}
par
.append(j('<span class="sl-result-title">').text(info.result[i].title))
.append(j('<span class="sl-result-authors">').text(info.result[i].authors))
.append(j('<span class="sl-result-date">').text(info.result[i].issued))
.append(bt);
j('#result-list').append(par);
bt.button();
bt.data({uuid: info.result[i].uuid});
bt.click(function(){
submissionLookupDetails(this, suffixID);
});
}
}
submissionLookupShowDetails = function(info){
var modalbody = j('#loading-details .modal-body');
var divImg = j('<div class="submission-lookup-providers">');
for (var k=0;k<info.providers.length;k++)
{
var prov = info.providers[k];
divImg.append(j('<img class="img-thumbnail" src="'+dspaceContextPath+'/image/submission-lookup-small-'+prov+'.jpg">'));
}
modalbody.append(divImg);
var detailsDiv = j('<div class="submission-lookup-details">');
var details = j('<table class="table">');
detailsDiv.append(details);
for (var i=0;i<info.fieldsLabels.length;i++)
{
var fieldName = info.fieldsLabels[i][0];
var fieldLabel = info.fieldsLabels[i][1];
var values = info.publication[fieldName];
var tr = j('<tr>');
tr.append(j('<td class="submission-lookup-label">').append(fieldLabel));
var td = j('<td>');
tr.append(td);
for (var k=0;k<values.length;k++)
{
td.append(j('<span>').text(values[k]));
if (k != values.length-1)
{
td.append('<br>');
}
}
details.append(tr);
}
modalbody.append(detailsDiv);
modalbody.append(j('#select-collection-div'));
j('#select-collection').val(info.collection);
var modalfooter = j('#loading-details .modal-footer');
var start = j('<button class="btn btn-success" type="button">');
start.append(j('#jsfilldatabuttonmessage').text());
start.button();
start.click(function(){
j('#collectionid').val(j('#select-collection').val());
j('#iuuid').val(info.uuid);
j('#form-submission').submit();
});
modalfooter.append(start);
j('#loading-details').modal('show');
};
submissionLookupFile = function(form){
var suuidVal = j('#suuid-loader').val();
var suuid = j('<input type="hidden" name="s_uuid" value="'+suuidVal+'">');
var collectionidVal = j('#select-collection-file').val();
var collectionid = j('<input type="hidden" name="collectionid" value="'+collectionidVal+'">');
var preview_loader = "";
if(j('#preview_loader').is (':checked')) {
preview_loader = j('<input type="hidden" name="skip_loader" value="false">');
}
else {
preview_loader = j('<input type="hidden" name="skip_loader" value="true">');
}
var provider_loaderVal = j('#provider_loader').val();
var provider_loader = j('<input type="hidden" name="provider_loader" value="'+provider_loaderVal+'">');
// Create the iframe...
var iframe = j('<iframe name="upload_iframe" id="upload_iframe" style="display: none" />');
// Add to document...
j("body").append(iframe);
// Add event...
var eventHandler = function () {
j('#upload_iframe').off();
var clickResultTab = true;
var index = 0;
var iindex = new Array();
// Message from server...
var json = j.parseJSON(j('#upload_iframe').contents().find('body').text());
if (json == null || json.result == null || json.result.length == 0)
{
j('#result-list').hide();
j('#empty-result').show();
}
else
{
for (var i = 0; i < json.result.length; i++) {
if (json.result[i].skip == true) {
clickResultTab = false;
index = i;
break;
}
iindex[i] = json.result[i].uuid;
}
}
if (clickResultTab) {
submissionLookupShowResult(json, "-loader");
j('#loading-file-result').modal("hide");
j('#tabs').find('a[href="#tabs-result"]').click();
} else {
// skip details
j('#collectionid').val(json.result[index].collectionid);
j('#suuid').val(json.result[index].uuid);
j('#fuuid').val(iindex);
j('#form-submission').submit();
return false;
}
// Del the iframe...
j('upload_iframe').empty();
};
j('#upload_iframe').on("load", eventHandler);
// Set properties of form...
form.attr("target", "upload_iframe");
form.attr("action", dspaceContextPath+"/json/submissionLookup");
form.attr("method", "post");
form.attr("enctype", "multipart/form-data");
form.attr("encoding", "multipart/form-data");
form.attr("target", "upload_iframe");
form.attr("file", j('#file_upload').val());
j(form).append(suuid);
j(form).append(collectionid);
j(form).append(preview_loader);
j(form).append(provider_loader);
// Submit the form...
form.submit();
j('#loading-file-result').modal("show");
};

View File

@@ -0,0 +1,468 @@
<%--
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/
--%>
<%--
- UI page for start of a submission with lookup on external sources.
-
- Required attributes:
- collections - Array of collection objects to show in the drop-down.
collectionID - the collection ID of preference for the user
identifiers2providers
searchProviders
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="org.dspace.content.Collection" %>
<%@ page import="java.lang.Boolean" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"
prefix="fmt" %>
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
<%
String contextPath = "/dspace-jspui";
request.setAttribute("LanguageSwitch", "hide");
//get collections to choose from
Collection[] collections =
(Collection[]) request.getAttribute("collections");
//get community handle
int communityId = (Integer) request.getAttribute("collectionID");
//check if we need to display the "no collection selected" error
Boolean noCollection = (Boolean) request.getAttribute("no.collection");
Boolean nosuuid = (Boolean) request.getAttribute("nouuid");
Boolean expired = (Boolean) request.getAttribute("expired");
Map<String, List<String>> identifiers2providers = (Map<String, List<String>>) request.getAttribute("identifiers2providers");
List<String> searchProviders = (List<String>) request.getAttribute("searchProviders");
List<String> fileLoaders = (List<String>) request.getAttribute("fileLoaders");
List<String> identifiers = (List<String>) request.getAttribute("identifiers");
String uuid = (String) request.getAttribute("s_uuid");
%>
<c:set var="dspace.layout.head" scope="request">
<style type="text/css">
#link-ricerca-identificatore {cursor: pointer; font-weight: bold; color: #FF6600;}
.sl-result {padding: 10px;}
.sl-result:HOVER {background-color: #5C9CCC;}
.sl-result-title, .sl-result-authors, .sl-result-date {display: block;}
.sl-result-title {font-weight: bold;}
.sl-result-authors {font-style: italic;}
.sl-result-date {margin-bottom: 10px;}
.invalid-value {border: 1px solid #FF6600;}
</style>
<script type='text/javascript'>var dspaceContextPath = "<%=request.getContextPath()%>";</script>
</c:set>
<c:set var="dspace.layout.head.last" scope="request">
<script type="text/javascript" src="<%= request.getContextPath() %>/static/js/submission-lookup.js"></script>
</c:set>
<dspace:layout style="submission" locbar="off"
navbar="off"
titlekey="jsp.submit.start-lookup-submission.title"
nocache="true">
<h1><fmt:message key="jsp.submit.start-lookup-submission.heading"/></h1>
<div id="jserrormessage" style="display: none"><fmt:message key="jsp.submit.start-lookup-submission.js.errormessage"/></div>
<div id="jsseedetailsbuttonmessage" style="display: none"><fmt:message key="jsp.submit.start-lookup-submission.js.detailsbuttonmessage"/></div>
<div id="jsfilldatabuttonmessage" style="display: none"><fmt:message key="jsp.submit.start-lookup-submission.js.filldataandstartbuttonmessage"/></div>
<% if (collections.length > 0)
{
//if no collection was selected, display an error
if((noCollection != null) && (noCollection.booleanValue()==true))
{
%>
<div class="alert alert-warning">
<p><fmt:message key="jsp.submit.start-lookup-submission.no-collection"/></p>
</div>
<%
}
//if no collection was selected, display an error
if((nosuuid != null) && (nosuuid.booleanValue()==true))
{
%>
<div class="alert alert-warning">
<p><fmt:message key="jsp.submit.start-lookup-submission.nosuuid"/></p>
</div>
<%
}
//if no collection was selected, display an error
if((expired != null) && (expired.booleanValue()==true))
{
%>
<div class="alert alert-warning">
<p><fmt:message key="jsp.submit.start-lookup-submission.expired"/></p>
</div>
<%
}
%>
<div id="tabs">
<ul class="nav nav-tabs">
<li class="active"><a href="#tabs-search"><fmt:message key="jsp.submit.start-lookup-submission.tabs.search" /></a></li>
<li><a href="#tabs-result"><fmt:message key="jsp.submit.start-lookup-submission.tabs.result" /></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="tabs-search">
<div id="tabs-search-accordion">
<%
if (searchProviders != null && searchProviders.size() > 0) {
%>
<h3><a href="#"><fmt:message key="jsp.submit.start-lookup-submission.search"/></a></h3>
<div>
<form class="form-horizontal" id="form-submission-search" action="" method="post">
<input type="hidden" id="suuid-search" name="suuid" value="<%= uuid %>"/>
<input type="hidden" id="iuuid-search" name="iuuid" value=""/>
<input type="hidden" id="fuuid-search" name="fuuid" value=""/>
<input type="hidden" id="collectionid-search" name="collectionid" value=""/>
<%
for (String provider : searchProviders)
{
%>
<img class="img-thumbnail" src="<%= request.getContextPath() %>/image/submission-lookup-small-<%= provider %>.jpg" />
<%
}
%>
<p class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.search.hints"/></p>
<div class="form-group">
<label for="search_title"><fmt:message key="jsp.submit.start-lookup-submission.search.title"/>:</label>
<textarea class="form-control submission-lookup-search" name="search_title" id="search_title" cols="50" row="4"></textarea>
</div>
<div class="form-group">
<label for="search_year"><fmt:message key="jsp.submit.start-lookup-submission.search.year"/>:</label>
<input class="form-control submission-lookup-search" type="text" size="7" name="search_year" id="search_year" />
</div>
<div class="form-group">
<label for="search_authors"><fmt:message key="jsp.submit.start-lookup-submission.search.authors"/>:</label>
<textarea class="form-control submission-lookup-search" name="search_authors" id="search_authors"cols="50" row="4"></textarea>
</div>
<div class="btn-group col-md-offset-5">
<button type="button" class="btn btn-primary" id="search_go"><fmt:message key="jsp.submit.start-lookup-submission.search-go"/></button>
<button type="button" class="btn btn-default exit"><fmt:message key="jsp.submit.start-lookup-submission.exit"/></button>
</div>
</form>
</div>
<% } %>
<h3><a href="#"><fmt:message key="jsp.submit.start-lookup-submission.identifiers"/></a></h3>
<div>
<form class="form-horizontal" id="form-submission-identifier" action="" method="post">
<input type="hidden" id="suuid-identifier" name="suuid" value="<%= uuid %>"/>
<input type="hidden" id="iuuid-identifier" name="iuuid" value=""/>
<input type="hidden" id="fuuid-identifier" name="fuuid" value=""/>
<input type="hidden" id="collectionid-identifier" name="collectionid" value=""/>
<% if (identifiers != null && identifiers.size()>0) {
%>
<p class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.identifiers.hints"/></p>
<%
for (String identifier : identifiers)
{
%>
<c:set var="identifier"><%= identifier %></c:set>
<div class="form-group">
<label class="col-md-3" for="identifier_<%= identifier%>"><span class="submission-lookup-label"><fmt:message key="jsp.submit.start-lookup-submission.identifier-${identifier}"/>:</span>
<span class="help-block submission-lookup-hint"><fmt:message key="jsp.submit.start-lookup-submission.identifier-${identifier}.hint"/></span></label>
<div class="col-md-9">
<div class="col-md-4">
<input class="form-control submission-lookup-identifier" type="text" name="identifier_<%= identifier%>" id="identifier_<%= identifier%>" />
</div>
<div class="col-md-7">
<%
for (String provider : identifiers2providers.get(identifier))
{
%>
<img class="img-thumbnail" src="<%= request.getContextPath() %>/image/submission-lookup-small-<%= provider %>.jpg" />
<%
}
%></div></div></div><%
} %>
<div class="btn-group col-md-offset-5">
<button class="btn btn-primary" type="button" id="lookup_idenfifiers"><fmt:message key="jsp.submit.start-lookup-submission.identifier.lookup"/></button>
<button type="button" class="btn btn-default exit"><fmt:message key="jsp.submit.start-lookup-submission.exit"/></button></td></tr>
</div>
</form>
</div>
<%
} %>
<% if (fileLoaders != null && fileLoaders.size()>0) {
%>
<h3><a href="#"><fmt:message key="jsp.submit.start-lookup-submission.byfile"/></a></h3>
<div id="file-accordion" class="container">
<form class="form-horizontal" id="form-submission-loader" action="" method="post">
<input type="hidden" id="suuid-loader" name="suuid" value="<%= uuid %>"/>
<input type="hidden" id="iuuid-loader" name="iuuid" value=""/>
<input type="hidden" id="fuuid-loader" name="fuuid" value=""/>
<input type="hidden" id="collectionid-loader" name="collectionid" value=""/>
<p class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.byfile.hints"/></p>
<div class="form-group">
<label class="col-md-3" for="provider_loader"><span class="submission-lookup-label"><fmt:message key="jsp.submit.start-lookup-submission.byfile.chooseprovider"/>:</span></label>
<div class="col-md-6">
<select class="form-control submission-file-loader" name="provider_loader" id="provider_loader">
<option value="-1"><fmt:message key="jsp.submit.start-lookup-submission.select.collection.defaultoption"/></option>
<%
for (String dataLoader : fileLoaders)
{
%>
<option value="<%= dataLoader %>"><%= dataLoader %></option>
<%
}
%>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3" for="file_upload"><fmt:message key="jsp.submit.start-lookup-submission.byfile.file"/>:</label>
<div class="col-md-7">
<input class="form-control submission-file-loader" type="file" name="file_upload" id="file_upload" />
</div>
</div>
<div class="container checkbox">
<input class="submission-file-loader submission-preview-loader" type="checkbox" name="preview_loader" id="preview_loader" value="<%= Boolean.TRUE%>"/><span class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.byfile.filepreview"/></span>
</div>
<div class="form-group" id="select-collection-file-div">
<label class="col-md-3" for="select-collection-file"><fmt:message key="jsp.submit.start-lookup-submission.byfile.filecollection"/>:</label>
<div class="col-md-6">
<select class="form-control submission-file-loader" name="select-collection-file" id="select-collection-file">
<% for (Collection c : collections) { %>
<option value="<%= c.getID() %>"><%= c.getName() %></option>
<% } %>
</select>
</div>
</div>
<div class="btn-group col-md-offset-5">
<button class="btn btn-primary" type="button" id="loadfile_go"><fmt:message key="jsp.submit.start-lookup-submission.identifier.lookup"/></button>
<button type="button" class="btn btn-default exit"><fmt:message key="jsp.submit.start-lookup-submission.exit"/></button>
</div>
</form>
</div>
<%
} %>
<h3><a href="#"><fmt:message key="jsp.submit.start-lookup-submission.manual-submission"/></a></h3>
<div id="manual-accordion">&nbsp;</div>
</div>
</div>
<div class="tab-pane" id="tabs-result">
<div id="empty-result">
<p class="alert alert-warning"><fmt:message key="jsp.submit.start-lookup-submission.noresult"/></p>
</div>
<div id="result-list"></div>
<div id="manual-submission">
<div class="form-group">
<div class="col-md-3">
<label for="select-collection-manual"><fmt:message key="jsp.submit.start-lookup-submission.select.collection.label"/></label>
</div>
<div class="col-md-7">
<select class="form-control" id="select-collection-manual">
<option value="-1"><fmt:message key="jsp.submit.start-lookup-submission.select.collection.defaultoption"/></option>
<% for (Collection c : collections) { %>
<option value="<%= c.getID() %>"><%= c.getName() %></option>
<% } %>
</select>
</div>
</div>
<form class="form-horizontal" id="form-submission" action="" method="post">
<input type="hidden" id="iuuid" name="iuuid" value=""/>
<input type="hidden" id="fuuid" name="fuuid" value=""/>
<input type="hidden" id="suuid" name="suuid" value="<%= uuid %>"/>
<input type="hidden" id="collectionid" name="collectionid" value=""/>
<div class="btn-group">
<button class="btn btn-success col-md-offset-5" id="manual-submission-button" type="button"><fmt:message key="jsp.submit.start-lookup-submission.button.manual-submission"/> </button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="hidden-area" style="display: none;">
<div id="select-collection-div">
<select class="form-control" id="select-collection">
<% for (Collection c : collections) { %>
<option value="<%= c.getID() %>"><%= c.getName() %></option>
<% } %>
</select>
</div>
</div>
<div id="no-collection-warn" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><fmt:message key="jsp.submit.start-lookup-submission.no-collection-warn.title" /></h4>
</div>
<div class="modal-body">
<p class="alert alert-warning"><fmt:message key="jsp.submit.start-lookup-submission.no-collection-warn.hint" /></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="jsp.submit.start-lookup-submission.no-collection.dialog.return" /></button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="loading-search-result" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><fmt:message key="jsp.submit.start-lookup-submission.search-loading.title" /></h4>
</div>
<div class="modal-body">
<p class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.search-loading.hint" /></p>
</div>
<div class="modal-footer">
<img src="<%= request.getContextPath() %>/sherpa/image/ajax-loader-big.gif"/>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="loading-file-result" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><fmt:message key="jsp.submit.start-lookup-submission.search-loading.title" /></h4>
</div>
<div class="modal-body">
<p class="help-block"><fmt:message key="jsp.submit.start-lookup-submission.search-loading.hint" /></p>
</div>
<div class="modal-footer">
<img src="<%= request.getContextPath() %>/sherpa/image/ajax-loader-big.gif"/>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="loading-details" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><fmt:message key="jsp.submit.start-lookup-submission.js.titlepopupmessage" /></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<% } else { %>
<p class="submitFormWarn"><fmt:message key="jsp.submit.select-collection.none-authorized"/></p>
<% } %>
<p><fmt:message key="jsp.general.goto"/><br />
<a href="<%= request.getContextPath() %>"><fmt:message key="jsp.general.home"/></a><br />
<a href="<%= request.getContextPath() %>/mydspace"><fmt:message key="jsp.general.mydspace" /></a>
</p>
<script type="text/javascript"><!--
var j = jQuery.noConflict();
j("#tabs").tabs({
beforeActivate: function( event, ui ) {
if ('tabs-result' == j(ui.newPanel).attr('id'))
{
j('#manual-submission').appendTo(j(ui.newPanel));
}
else
{
j('#manual-submission').appendTo(j('#manual-accordion'));
}
}
});
j('#tabs-search-accordion').accordion({
beforeActivate: function( event, ui ) {
if ('manual-accordion' == ui.newPanel.attr('id'))
{
j('#manual-submission').appendTo(ui.newPanel);
}
}
});
j('#link-ricerca-identificatore').click(function(){
j('#tabs-search-accordion').accordion({'active': 1});
});
j('button').button();
j('#manual-submission-button').click(function(event){
var colman = j('#select-collection-manual').val();
if (colman != -1)
{
j('#collectionid-manual').val(colman);
j('#form-submission').submit();
}
else
{
j('#no-collection-warn').modal('show');
}
});
j('#lookup_idenfifiers').click(function(){
submissionLookupIdentifiers(j('input.submission-lookup-identifier'));
});
j('#search_go').click(function(){
submissionLookupSearch(j('.submission-lookup-search'));
});
j('#loadfile_go').click(function(){
j('#select-collection').val(j('#select-collection-file').val());
submissionLookupFile(j('#form-submission-loader'));
});
j('button.exit').click(function(event){
event.preventDefault();
window.location = "<%= request.getContextPath() %>/mydspace";
});
j('#loading-search-result').on('hide.bs.modal', function () {
j(this).data('ajaxCall').abort();
});
j('#loading-details').on('hidden.bs.modal', function () {
j('#hidden-area').append(j('#select-collection-div'));
j('#loading-details .modal-body').empty();
j('#loading-details .modal-footer').empty();
});
j(".submission-preview-loader").click(function() {
if(j(this).is (':checked')) {
j("#select-collection-file-div").hide();
}
else {
j("#select-collection-file-div").show();
}
});
--></script>
</dspace:layout>

View File

@@ -1278,6 +1278,7 @@ plugin.sequence.org.dspace.plugin.SiteHomeProcessor = \
# comment out this line if you disable Discovery
plugin.named.org.dspace.app.webui.json.JSONRequest = \
org.dspace.app.webui.discovery.DiscoveryJSONRequest = discovery,\
org.dspace.app.webui.json.SubmissionLookupJSONRequest = submissionLookup,\
org.dspace.app.webui.json.UploadProgressJSON = uploadProgress
@@ -1819,7 +1820,6 @@ webui.suggest.enable = false
# _uacct = "UA-XXXXXXX-X"
# Take this key (just the UA-XXXXXX-X part) and place it here in this parameter.
# jspui.google.analytics.key=UA-XXXXXX-X
#---------------------------------------------------------------#
#--------------XMLUI SPECIFIC CONFIGURATIONS--------------------#

View File

@@ -87,6 +87,15 @@
<xmlui-binding>org.dspace.app.xmlui.aspect.submission.submit.SelectCollectionStep</xmlui-binding>
<workflow-editable>false</workflow-editable>
</step>
<!-- Uncomment this to make available the bibliographic import from external source - note ONLY for JSPUI -->
<!-- <step id="collection">
<heading></heading> can specify heading, if you want it to appear in Progress Bar
<processing-class>org.dspace.submit.step.StartSubmissionLookupStep</processing-class>
<jspui-binding>org.dspace.app.webui.submit.step.JSPStartSubmissionLookupStep</jspui-binding>
<xmlui-binding>org.dspace.app.xmlui.aspect.submission.submit.SelectCollectionStep</xmlui-binding>
<workflow-editable>false</workflow-editable>
</step> -->
<!-- The "complete" step is a "special step" which is *REQUIRED* to be-->
<!-- in this section! In DSpace, when a submission is completed, -->

View File

@@ -1004,6 +1004,11 @@
<version>1.06</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
</dependencyManagement>