Cleaned code and refactoring

This commit is contained in:
Pascarelli Luigi Andrea
2013-10-22 11:31:40 +02:00
parent cfd6749387
commit 8c445b0dd7
29 changed files with 315 additions and 254 deletions

View File

@@ -21,6 +21,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -34,11 +35,16 @@ import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author kstamatis
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*
*/
public class ArXivFileDataLoader extends FileDataLoader {
private static Logger log = Logger.getLogger(ArXivFileDataLoader.class);
Map<String, String> fieldMap; //mapping between service fields and local intermediate fields
/**
@@ -87,13 +93,13 @@ public class ArXivFileDataLoader extends FileDataLoader {
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (ParserConfigurationException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (SAXException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
return recordSet;

View File

@@ -19,10 +19,16 @@ import java.util.Set;
import org.apache.commons.httpclient.HttpException;
import org.dspace.core.Context;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class ArXivOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private ArXivService arXivService = new ArXivService();
private boolean searchProvider = true;
public void setArXivService(ArXivService arXivService) {
this.arXivService = arXivService;
}
@@ -32,29 +38,28 @@ public class ArXivOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
return Arrays.asList(new String[] { ARXIV, DOI });
}
public void setSearchProvider(boolean searchProvider)
{
this.searchProvider = searchProvider;
}
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 {
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) {
if (dois != null && dois.size() > 0) {
items.addAll(arXivService.getByDOIs(dois));
}
if (arxivids!=null && arxivids.size()>0) {
for (String arxivid : arxivids){
if (arxivids != null && arxivids.size() > 0) {
for (String arxivid : arxivids) {
items.add(arXivService.getByArXivIDs(arxivid));
}
}
@@ -67,13 +72,13 @@ public class ArXivOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
}
@Override
public List<Record> search(Context context, String title,
String author, int year) throws HttpException, IOException {
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

@@ -31,6 +31,12 @@ import org.dspace.core.ConfigurationManager;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class ArXivService
{
private int timeout = 1000;
@@ -127,7 +133,7 @@ public class ArXivService
catch (Exception e)
{
throw new RuntimeException(
"Identificativo arXiv non valido o inesistente");
"ArXiv identifier is not valid or not exist");
}
}
finally
@@ -173,7 +179,7 @@ public class ArXivService
catch (Exception e)
{
throw new RuntimeException(
"Identificativo arXiv non valido o inesistente");
"ArXiv identifier is not valid or not exist");
}
}
finally

View File

@@ -23,18 +23,15 @@ import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*
*/
public class ArxivUtils {
/**
*
*/
public ArxivUtils() {
// TODO Auto-generated constructor stub
}
public static Record convertArxixDomToRecord(Element dataRoot){
MutableRecord record = new SubmissionLookupPublication("");

View File

@@ -34,8 +34,10 @@ import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author kstamatis
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class CrossRefFileDataLoader extends FileDataLoader {

View File

@@ -23,6 +23,12 @@ import org.dspace.core.Context;
import org.jdom.JDOMException;
import org.xml.sax.SAXException;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class CrossRefOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private CrossRefService crossrefService = new CrossRefService();

View File

@@ -40,6 +40,12 @@ import org.xml.sax.SAXException;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class CrossRefService {
private static final Logger log = Logger.getLogger(CrossRefService.class);
@@ -81,7 +87,7 @@ public class CrossRefService {
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata http fallita: "
"Http call failed: "
+ method.getStatusLine());
}
@@ -106,7 +112,7 @@ public class CrossRefService {
context,
"retrieveRecordDOI",
record
+ " DOI non valido o inesistente: "
+ " DOI is not valid or not exist: "
+ e.getMessage()));
}
} finally {

View File

@@ -24,8 +24,10 @@ import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class CrossRefUtils {
@@ -36,157 +38,152 @@ public class CrossRefUtils {
// TODO Auto-generated constructor stub
}
public static Record convertCrossRefDomToRecord(Element dataRoot){
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 msg = XMLUtils.getElementValue(dataRoot, "msg");
String exMsg = status + " - " + msg;
throw new RuntimeException(exMsg);
}
String isbn = XMLUtils.getElementValue(dataRoot, "isbn");
if (isbn!=null)
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)
String editionNumber = XMLUtils.getElementValue(dataRoot,
"editionNumber");
if (editionNumber != null)
record.addValue("volume", new StringValue(editionNumber));
String volume = XMLUtils.getElementValue(dataRoot, "volume");
if (volume!=null)
String volume = XMLUtils.getElementValue(dataRoot, "volume");
if (volume != null)
record.addValue("volume", new StringValue(volume));
String issue = XMLUtils.getElementValue(dataRoot, "issue");
if (issue!=null)
String issue = XMLUtils.getElementValue(dataRoot, "issue");
if (issue != null)
record.addValue("issue", new StringValue(issue));
String year = XMLUtils.getElementValue(dataRoot, "year");
if (year!=null)
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)
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)
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)
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)
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)
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)
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)
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<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]));
for (String[] sArray : authors) {
values.add(new StringValue(sArray[1] + ", " + sArray[0]));
}
record.addField("authors", values);
}
if (editors.size()>0){
if (editors.size() > 0) {
List<Value> values = new LinkedList<Value>();
for (String[] sArray : editors){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
for (String[] sArray : editors) {
values.add(new StringValue(sArray[1] + ", " + sArray[0]));
}
record.addField("editors", values);
}
if (translators.size()>0){
if (translators.size() > 0) {
List<Value> values = new LinkedList<Value>();
for (String[] sArray : translators){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
for (String[] sArray : translators) {
values.add(new StringValue(sArray[1] + ", " + sArray[0]));
}
record.addField("translators", values);
}
if (chairs.size()>0){
if (chairs.size() > 0) {
List<Value> values = new LinkedList<Value>();
for (String[] sArray : chairs){
values.add(new StringValue(sArray[1]+", "+sArray[0]));
for (String[] sArray : chairs) {
values.add(new StringValue(sArray[1] + ", " + sArray[0]));
}
record.addField("chairs", values);
}

View File

@@ -40,7 +40,10 @@ import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
@@ -55,10 +58,6 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
private List<String> extraMetadataToKeep;
public DSpaceWorkspaceItemOutputGenerator() {
}
@Override
public List<String> generateOutput(RecordSet recordSet) {
@@ -82,14 +81,11 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
witems.add(wi);
} catch (AuthorizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
@@ -183,55 +179,11 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
try {
item.update();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage(), e);
} catch (AuthorizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage(), e);
}
// 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,
@@ -296,7 +248,7 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
}
return getDCInput(formName, md[0], md[1], md[2])!=null;
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
return false;
}

View File

@@ -16,17 +16,23 @@ import gr.ekt.bte.core.Value;
import java.util.List;
import java.util.Map;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class FieldMergeModifier extends AbstractModifier {
private Map<String, List<String>> merge_field_map;
private Map<String, List<String>> mergeFieldMap;
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);
if (mergeFieldMap!=null){
for (String target_field : mergeFieldMap.keySet()) {
List<String> source_fields = mergeFieldMap.get(target_field);
for (String source_field : source_fields) {
List<Value> values = rec.getValues(source_field);
if (values != null && values.size() > 0) {
@@ -45,14 +51,14 @@ public class FieldMergeModifier extends AbstractModifier {
* @return the merge_field_map
*/
public Map<String, List<String>> getMergeFieldMap() {
return merge_field_map;
return mergeFieldMap;
}
/**
* @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;
this.mergeFieldMap = merge_field_map;
}
}

View File

@@ -10,6 +10,12 @@ package org.dspace.submit.lookup;
import java.util.ArrayList;
import java.util.List;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class LookupProvidersCheck {
private List<String> providersOk = new ArrayList<String>();
private List<String> providersErr = new ArrayList<String>();

View File

@@ -21,8 +21,10 @@ import gr.ekt.bte.core.StringValue;
import gr.ekt.bte.core.Value;
/**
*
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class MapConverterModifier extends AbstractModifier {

View File

@@ -26,8 +26,10 @@ import gr.ekt.bte.dataloader.FileDataLoader;
import gr.ekt.bte.exceptions.MalformedSourceException;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
*
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class MultipleSubmissionLookupDataLoader implements DataLoader {

View File

@@ -31,6 +31,12 @@ import org.dspace.core.Context;
import org.dspace.submit.util.SubmissionLookupPublication;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public abstract class NetworkSubmissionLookupDataLoader implements SubmissionLookupDataLoader {
Map<String, Set<String>> identifiers; //Searching by identifiers (DOI ...)

View File

@@ -34,8 +34,10 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* @author kstamatis
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class PubmedFileDataLoader extends FileDataLoader {

View File

@@ -21,6 +21,12 @@ import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class PubmedOnlineDataLoader extends NetworkSubmissionLookupDataLoader {
private boolean searchProvider = true;
private static Logger log = Logger.getLogger(PubmedOnlineDataLoader.class);

View File

@@ -26,13 +26,23 @@ 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.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class PubmedService {
private static Logger log = Logger.getLogger(PubmedService.class);
private int timeout = 1000;
public void setTimeout(int timeout) {
@@ -98,7 +108,7 @@ public class PubmedService {
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata al webservice fallita: "
"WS call failed: "
+ method.getStatusLine());
}
@@ -125,7 +135,7 @@ public class PubmedService {
e.printStackTrace();
}
catch (SAXException e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
}
} finally {
if (method != null) {
@@ -190,7 +200,7 @@ public class PubmedService {
if (statusCode != HttpStatus.SC_OK) {
throw new RuntimeException(
"Chiamata al webservice fallita: "
"WS call failed: "
+ method.getStatusLine());
}
@@ -214,7 +224,7 @@ public class PubmedService {
results.add(pubmedItem);
} catch (Exception e) {
throw new RuntimeException(
"PubmedID non valido o inesistente: "+e.getMessage(), e);
"PubmedID is not valid or not exist: "+e.getMessage(), e);
}
}
@@ -252,7 +262,7 @@ public class PubmedService {
results.add(pubmedItem);
} catch (Exception e) {
throw new RuntimeException(
"PubmedID non valido o inesistente: "+e.getMessage(), e);
"PubmedID is not valid or not exist: "+e.getMessage(), e);
}
}

View File

@@ -26,18 +26,13 @@ import org.dspace.submit.util.SubmissionLookupPublication;
import org.w3c.dom.Element;
/**
* @author kstamatis
*
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class PubmedUtils {
/**
*
*/
public PubmedUtils() {
// TODO Auto-generated constructor stub
}
public static Record convertCrossRefDomToRecord(Element pubArticle){
MutableRecord record = new SubmissionLookupPublication("");

View File

@@ -20,11 +20,10 @@ 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/
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class RemoveLastDotModifier extends AbstractModifier {
@@ -35,7 +34,6 @@ public class RemoveLastDotModifier extends AbstractModifier {
*/
public RemoveLastDotModifier(String name) {
super(name);
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)

View File

@@ -21,6 +21,9 @@ import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionItemDataLoader implements DataLoader {

View File

@@ -19,6 +19,12 @@ import gr.ekt.bte.core.DataLoader;
import gr.ekt.bte.core.Record;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public interface SubmissionLookupDataLoader extends DataLoader {
public final static String DOI = "doi";

View File

@@ -22,6 +22,9 @@ import org.dspace.submit.util.ItemSubmissionLookupDTO;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupOutputGenerator implements OutputGenerator {
@@ -65,9 +68,6 @@ public class SubmissionLookupOutputGenerator implements OutputGenerator {
dtoList.add(dto);
}
//Print debug messages
return new ArrayList<String>();
}

View File

@@ -22,6 +22,12 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.dspace.submit.util.SubmissionLookupDTO;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupService {
public static final String SL_NAMESPACE_PREFIX = "http://www.dspace.org/sl/";

View File

@@ -22,6 +22,12 @@ import org.dspace.content.MetadataSchema;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupUtils {
private static Logger log = Logger.getLogger(SubmissionLookupUtils.class);

View File

@@ -20,6 +20,12 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class ValueConcatenationModifier extends AbstractModifier {
private String field;
private String separator = ",";

View File

@@ -22,6 +22,12 @@ import java.util.UUID;
import org.dspace.submit.lookup.SubmissionLookupDataLoader;
import org.dspace.submit.lookup.SubmissionLookupService;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class ItemSubmissionLookupDTO implements Serializable {
private static final long serialVersionUID = 1;

View File

@@ -11,6 +11,12 @@ import java.io.Serializable;
import java.util.List;
import java.util.UUID;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupDTO implements Serializable {
private static final long serialVersionUID = 1;

View File

@@ -21,6 +21,12 @@ import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.dspace.submit.lookup.SubmissionLookupDataLoader;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupPublication implements MutableRecord, Serializable {
private String providerName;
@@ -30,7 +36,7 @@ public class SubmissionLookupPublication implements MutableRecord, Serializable
this.providerName = providerName;
}
// necessario per poter effettuare la serializzazione in JSON dei dati
// needed to serialize it with JSON
public Map<String, List<String>> getStorage() {
return storage;
}

View File

@@ -56,6 +56,12 @@ import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
/**
* @author Andrea Bollini
* @author Kostas Stamatis
* @author Luigi Andrea Pascarelli
* @author Panagiotis Koutsourakis
*/
public class SubmissionLookupJSONRequest extends JSONRequest {
private SubmissionLookupService service = new DSpace().getServiceManager()
@@ -109,9 +115,9 @@ public class SubmissionLookupJSONRequest extends JSONRequest {
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
} catch (MalformedSourceException e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
}
}
@@ -155,9 +161,9 @@ public class SubmissionLookupJSONRequest extends JSONRequest {
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
} catch (MalformedSourceException e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
}
}
@@ -232,9 +238,9 @@ public class SubmissionLookupJSONRequest extends JSONRequest {
.getOutputGenerator();
result = outputGenerator.getDtoList();
} catch (BadTransformationSpec e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
} catch (MalformedSourceException e1) {
e1.printStackTrace();
log.error(e1.getMessage(), e1);
}
file.delete();