More bugfixes

git-svn-id: https://svn.libreccm.org/ccm/trunk@5818 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-01-30 17:54:34 +00:00
parent 8d2060ec0e
commit bcae65f56b
2 changed files with 23 additions and 21 deletions

View File

@ -35,10 +35,11 @@ public class InternetArticleConverter extends AbstractRisConverter {
@Override @Override
public String convert(final Publication publication) { public String convert(final Publication publication) {
InternetArticle article; InternetArticle article;
System.err.printf("Converting publication %s as InternetArticle to RIS...%n", // System.err.printf("Converting publication %s as InternetArticle to RIS...%n",
Objects.toString(publication)); // Objects.toString(publication));
if (!(publication instanceof InternetArticle)) { if (!(publication instanceof InternetArticle)) {
throw new UnsupportedCcmTypeException( throw new UnsupportedCcmTypeException(
@ -54,29 +55,29 @@ public class InternetArticleConverter extends AbstractRisConverter {
publication.getClass().getName())); publication.getClass().getName()));
} }
System.err.printf("Casting to InternetArticle%n"); // System.err.printf("Casting to InternetArticle%n");
article = (InternetArticle) publication; article = (InternetArticle) publication;
System.err.printf("Setting RIS type to EJOUR...%n"); // System.err.printf("Setting RIS type to EJOUR...%n");
getRisBuilder().setType(RisType.EJOUR); getRisBuilder().setType(RisType.EJOUR);
System.err.printf("Converting authors...%n"); // System.err.printf("Converting authors...%n");
convertAuthors(publication); convertAuthors(publication);
System.err.printf("Converting title...%n"); // System.err.printf("Converting title...%n");
convertTitle(publication); convertTitle(publication);
System.err.printf("Converting year...%n"); // System.err.printf("Converting year...%n");
convertYear(publication); convertYear(publication);
System.err.printf("Converting reviewed...%n"); // System.err.printf("Converting reviewed...%n");
if (article.getReviewed() != null && article.getReviewed()) { if (article.getReviewed() != null && article.getReviewed()) {
getRisBuilder().addField(RisField.RI, ""); getRisBuilder().addField(RisField.RI, "");
} }
System.err.printf("Converting URL...%n"); // System.err.printf("Converting URL...%n");
if (article.getUrl() != null) { if (article.getUrl() != null) {
getRisBuilder().addField(RisField.UR, article.getUrl()); getRisBuilder().addField(RisField.UR, article.getUrl());
} }
System.err.printf("Building String%n"); // System.err.printf("Building String%n");
return getRisBuilder().toRis(); return getRisBuilder().toRis();
} }

View File

@ -27,11 +27,11 @@ import org.apache.log4j.Logger;
/** /**
* Implementation of {@link SciPublicationsExporter} which exports publications * Implementation of {@link SciPublicationsExporter} which exports publications
* in the RIS format. The RIS format is described at * in the RIS format. The RIS format is described at
* <a href="http://www.refman.com/support/risformat_intro.asp">http://www.refman.com/support/risformat_intro.asp</a> * <a href="http://www.refman.com/support/risformat_intro.asp">http://www.refman.com/support/risformat_intro.asp</a>
* and * and
* <a href="http://www.adeptscience.co.uk/kb/article/FE26">http://www.adeptscience.co.uk/kb/article/FE26</a>. * <a href="http://www.adeptscience.co.uk/kb/article/FE26">http://www.adeptscience.co.uk/kb/article/FE26</a>.
* The <code>RisExporter</code> uses implementations of the {@link RisConverter} * The <code>RisExporter</code> uses implementations of the {@link RisConverter}
* interface provided by the {@link RisConverters} class to convert the * interface provided by the {@link RisConverters} class to convert the
* publication content items from CCM to RIS references. * publication content items from CCM to RIS references.
* *
@ -45,11 +45,11 @@ public class RisExporter implements SciPublicationsExporter {
public PublicationFormat getSupportedFormat() { public PublicationFormat getSupportedFormat() {
try { try {
return new PublicationFormat("RIS", return new PublicationFormat("RIS",
new MimeType("text", "x-ris"), new MimeType("text", "x-ris"),
"ris"); "ris");
} catch(MimeTypeParseException ex) { } catch (MimeTypeParseException ex) {
logger.warn("Failed to create MimeType for PublicationFormat." logger.warn("Failed to create MimeType for PublicationFormat."
+ "Using null mimetype instead. Cause: ", ex); + "Using null mimetype instead. Cause: ", ex);
return new PublicationFormat("RIS", return new PublicationFormat("RIS",
null, null,
"ris"); "ris");
@ -59,9 +59,10 @@ public class RisExporter implements SciPublicationsExporter {
public String exportPublication(final Publication publication) { public String exportPublication(final Publication publication) {
return RisConverters.getInstance().convert(publication); return RisConverters.getInstance().convert(publication);
} }
@Override @Override
public String getPreamble() { public String getPreamble() {
return null; return "";
} }
} }