- Integrated UMLGraph (http://www.umlgraph.org) into the JavaDoc build target

- Progress on the BibTeXExporter for SciPublications module.


git-svn-id: https://svn.libreccm.org/ccm/trunk@733 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-02-04 19:19:08 +00:00
parent 4156e06a6f
commit 34aa8f72ec
17 changed files with 665 additions and 26 deletions

View File

@ -0,0 +1 @@
com.arsdigita.cms.scipublications.exporter.bibtex.BibTeXExporter

View File

@ -0,0 +1,7 @@
com.arsdigita.cms.scipublications.exporter.bibtex.builders.ArticleBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.BookBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.InCollectionBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.InProceedingsBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.MiscBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.ProceedingsBuilder
com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnPublishedBuilder

View File

@ -0,0 +1,13 @@
com.arsdigita.cms.scipublications.exporter.bibtex.converters.ArticleInCollectedVolumeConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.ArticleInJournalConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.CollectedVolumeConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.ExpertiseConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.GreyLiteratureConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.InProceedingsConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.InternetArticleConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.MonographConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.ProceedingsConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.PublicationConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.PublicationWithPublisherConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.ReviewConverter
com.arsdigita.cms.scipublications.exporter.bibtex.converters.WorkingPaperConverter

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.scipublications.exporter.bibtex.builders;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;
import org.apache.log4j.Logger;
/**
*
@ -10,6 +11,7 @@ import java.util.ServiceLoader;
*/
public class BibTeXBuilders {
private static final Logger logger = Logger.getLogger(BibTeXBuilders.class);
private Map<String, BibTeXBuilder> builders =
new HashMap<String, BibTeXBuilder>();
@ -33,6 +35,22 @@ public class BibTeXBuilders {
}
public BibTeXBuilder getBibTeXBuilderForType(final String type) {
return builders.get(type);
if (builders.containsKey(type)) {
try {
return builders.get(type).getClass().newInstance();
} catch (InstantiationException ex) {
logger.warn(String.format("Failed to create BibTeXBuilder "
+ "for type '%s'.", type),
ex);
return null;
} catch (IllegalAccessException ex) {
logger.warn(String.format("Failed to create BibTeXBuilder "
+ "for type '%s'.", type),
ex);
return null;
}
} else {
return null;
}
}
}

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.AuthorshipCollection;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
import com.arsdigita.cms.contenttypes.SeriesCollection;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilders;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXField;
@ -48,8 +49,20 @@ public abstract class AbstractBibTeXConverter implements BibTeXConverter {
protected void convertPublisher(final PublicationWithPublisher publication)
throws UnsupportedFieldException {
if (publication.getPublisher() != null) {
getBibTeXBuilder().setField(BibTeXField.PUBLISHER,
publication.getPublisher().getTitle());
if ((publication.getPublisher().getPlace() == null)
&& publication.getPublisher().getPlace().isEmpty()) {
getBibTeXBuilder().setField(BibTeXField.PUBLISHER,
publication.getPublisher().getTitle());
} else {
getBibTeXBuilder().setField(BibTeXField.PUBLISHER,
String.format("%s, %s",
publication.
getPublisher().
getTitle(),
publication.
getPublisher().
getPlace()));
}
}
}
@ -76,11 +89,26 @@ public abstract class AbstractBibTeXConverter implements BibTeXConverter {
publication.getEdition());
}
}
protected void convertSeries(final Publication publication)
throws UnsupportedFieldException {
SeriesCollection seriesColl =
publication.getSeries();
if ((seriesColl != null) && (seriesColl.size() > 0)) {
seriesColl.next();
getBibTeXBuilder().setField(BibTeXField.SERIES,
seriesColl.getSeries().getTitle());
seriesColl.close();
}
}
protected BibTeXBuilder getBibTeXBuilder() {
if (bibTeXBuilder == null) {
bibTeXBuilder = BibTeXBuilders.getInstance().getBibTeXBuilderForType(
getBibTeXType());
bibTeXBuilder = BibTeXBuilders.getInstance().
getBibTeXBuilderForType(getBibTeXType());
}
return bibTeXBuilder;

View File

@ -48,32 +48,36 @@ public class ArticleInCollectedVolumeConverter extends AbstractBibTeXConverter {
convertTitle(publication);
convertYear(publication);
builder.setField(BibTeXField.BOOKTITLE,
article.getCollectedVolume().getTitle());
if (article.getCollectedVolume().getPublisher() == null) {
builder.setField(BibTeXField.PUBLISHER, "");
if (article.getCollectedVolume() != null) {
builder.setField(BibTeXField.BOOKTITLE,
article.getCollectedVolume().getTitle());
if (article.getCollectedVolume().getPublisher() == null) {
builder.setField(BibTeXField.PUBLISHER, "");
}
if (article.getCollectedVolume().getVolume() != null) {
builder.setField(BibTeXField.VOLUME,
article.getCollectedVolume().getVolume().
toString());
}
SeriesCollection seriesColl =
article.getCollectedVolume().getSeries();
if ((seriesColl != null) && (seriesColl.size() > 0)) {
seriesColl.next();
builder.setField(BibTeXField.SERIES,
seriesColl.getSeries().getTitle());
seriesColl.close();
}
} else {
builder.setField(BibTeXField.PUBLISHER,
article.getCollectedVolume().getPublisher().
getTitle());
}
if (article.getCollectedVolume().getVolume() != null) {
builder.setField(BibTeXField.VOLUME,
article.getCollectedVolume().getVolume().
toString());
}
SeriesCollection seriesColl =
article.getCollectedVolume().getSeries();
if ((seriesColl != null) && (seriesColl.size() > 0)) {
seriesColl.next();
builder.setField(BibTeXField.SERIES,
seriesColl.getSeries().getTitle());
seriesColl.close();
}
if (article.getChapter() != null) {
builder.setField(BibTeXField.CHAPTER, article.getChapter());

View File

@ -0,0 +1,84 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.ArticleInJournal;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXField;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class ArticleInJournalConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
ArticleInJournalConverter.class);
@Override
protected String getBibTeXType() {
return "article";
}
public String convert(final Publication publication) {
ArticleInJournal article;
BibTeXBuilder builder;
if (!(publication instanceof ArticleInJournal)) {
throw new UnsupportedCcmTypeException(
String.format("The ArticleInJournalConverter only "
+ "supports publication types which are of the"
+ "type ArticleInJournal or which are "
+ "extending "
+ "ArticleInJournal. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "ArticleInJournal and does not "
+ "extends ArticleInJournal.",
publication.getClass().getName()));
}
article = (ArticleInJournal) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
if (article.getJournal() == null) {
builder.setField(BibTeXField.JOURNAL, "");
} else {
builder.setField(BibTeXField.JOURNAL,
article.getJournal().getTitle());
}
if (article.getVolume() != null) {
builder.setField(BibTeXField.VOLUME,
article.getVolume().toString());
}
if (article.getIssue() != null) {
builder.setField(BibTeXField.NUMBER,
article.getIssue());
}
if (article.getPagesFrom() != null) {
builder.setField(BibTeXField.PAGES,
String.format("%s - %s",
article.getPagesFrom(),
article.getPagesTo()));
}
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return ArticleInJournal.class.getName();
}
}

View File

@ -0,0 +1,57 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.CollectedVolume;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class CollectedVolumeConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
CollectedVolumeConverter.class);
@Override
protected String getBibTeXType() {
return "book";
}
public String convert(final Publication publication) {
CollectedVolume collectedVolume;
if (!(publication instanceof CollectedVolume)) {
throw new UnsupportedCcmTypeException(
String.format("The PublicationWithPublicationConverter only "
+ "supports publication types which are "
+ "extending CollectedVolume. The "
+ "provided publication is of type '%s' which "
+ "does not extends "
+ "CollectedVolume.",
publication.getClass().getName()));
}
collectedVolume = (CollectedVolume) publication;
convertAuthors(publication);
try {
convertTitle(publication);
convertYear(publication);
convertPublisher(collectedVolume);
convertISBN(collectedVolume);
convertEdition(collectedVolume);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return getBibTeXBuilder().toBibTeX();
}
public String getCcmType() {
return CollectedVolume.class.getName();
}
}

View File

@ -0,0 +1,59 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.Expertise;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class ExpertiseConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(ExpertiseConverter.class);
@Override
protected String getBibTeXType() {
return "misc";
}
public String convert(Publication publication) {
BibTeXBuilder builder;
Expertise expertise;
if (!(publication instanceof Expertise)) {
throw new UnsupportedCcmTypeException(
String.format("The ExpertiseConverter only "
+ "supports publication types which are of the"
+ "type Expertise or which are "
+ "extending "
+ "Expertise. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "Expertise and does not "
+ "extends Expertise.",
publication.getClass().getName()));
}
expertise = (Expertise) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return Expertise.class.getName();
}
}

View File

@ -0,0 +1,59 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.GreyLiterature;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class GreyLiteratureConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(GreyLiteratureConverter.class);
@Override
protected String getBibTeXType() {
return "misc";
}
public String convert(Publication publication) {
BibTeXBuilder builder;
GreyLiterature greyLiterature;
if (!(publication instanceof GreyLiterature)) {
throw new UnsupportedCcmTypeException(
String.format("The GreyLiteratureConverter only "
+ "supports publication types which are of the"
+ "type GreyLiterature or which are "
+ "extending "
+ "GreyLiterature. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "GreyLiterature and does not "
+ "extends GreyLiterature.",
publication.getClass().getName()));
}
greyLiterature = (GreyLiterature) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return GreyLiterature.class.getName();
}
}

View File

@ -0,0 +1,90 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.InProceedings;
import com.arsdigita.cms.contenttypes.Proceedings;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.SeriesCollection;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXField;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class InProceedingsConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
InProceedingsConverter.class);
@Override
protected String getBibTeXType() {
return "inproceedings";
}
public String convert(final Publication publication) {
BibTeXBuilder builder;
InProceedings inProceedings;
if (!(publication instanceof InProceedings)) {
throw new UnsupportedCcmTypeException(
String.format("The InProceedingsConverter only "
+ "supports publication types which are of the"
+ "type InProceedings or which are "
+ "extending "
+ "InProceedings. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "InProceedings and does not "
+ "extends InProceedings.",
publication.getClass().getName()));
}
inProceedings = (InProceedings) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
if (inProceedings.getPagesFrom() != null) {
builder.setField(BibTeXField.PAGES,
String.format("%s - %s",
inProceedings.getPagesFrom(),
inProceedings.getPagesTo()));
}
if (inProceedings.getProceedings() == null) {
builder.setField(BibTeXField.BOOKTITLE, "");
} else {
Proceedings proceedings;
proceedings = inProceedings.getProceedings();
builder.setField(BibTeXField.BOOKTITLE,
proceedings.getTitle());
convertVolume(proceedings);
convertSeries(publication);
if (proceedings.getOrganizerOfConference() != null) {
builder.setField(BibTeXField.ORGANIZATION,
proceedings.getOrganizerOfConference().getTitle());
}
convertPublisher(proceedings);
}
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return InProceedings.class.getName();
}
}

View File

@ -0,0 +1,60 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.InternetArticle;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXField;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class InternetArticleConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
InternetArticleConverter.class);
@Override
protected String getBibTeXType() {
return "misc";
}
public String convert(final Publication publication) {
BibTeXBuilder builder;
InternetArticle article;
if (!(publication instanceof InternetArticle)) {
throw new UnsupportedCcmTypeException(
String.format("The InternetArticleConverter only "
+ "supports publication types which are of the"
+ "type InternetArticle or which are "
+ "extending "
+ "InternetArticle. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "InternetArticle and does not "
+ "extends InternetArticle.",
publication.getClass().getName()));
}
article = (InternetArticle) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return InternetArticle.class.getName();
}
}

View File

@ -0,0 +1,72 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.Proceedings;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXField;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class ProceedingsConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
ProceedingsConverter.class);
@Override
protected String getBibTeXType() {
return "proceedings";
}
public String convert(final Publication publication) {
BibTeXBuilder builder;
Proceedings proceedings;
if (!(publication instanceof Proceedings)) {
throw new UnsupportedCcmTypeException(
String.format("The ProceedingsConverter only "
+ "supports publication types which are of the"
+ "type Proceedings or which are "
+ "extending "
+ "Proceedings. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "Proceedings and does not "
+ "extends Proceedings.",
publication.getClass().getName()));
}
proceedings = (Proceedings) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
convertVolume(proceedings);
convertSeries(publication);
if (proceedings.getOrganizerOfConference() != null) {
builder.setField(BibTeXField.ORGANIZATION,
proceedings.getOrganizerOfConference().
getTitle());
}
convertPublisher(proceedings);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return Proceedings.class.getName();
}
}

View File

@ -0,0 +1,16 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.Review;
/**
*
* @author jensp
*/
public class ReviewConverter extends ArticleInJournalConverter {
@Override
public String getCcmType() {
return Review.class.getName();
}
}

View File

@ -0,0 +1,59 @@
package com.arsdigita.cms.scipublications.exporter.bibtex.converters;
import com.arsdigita.cms.contenttypes.WorkingPaper;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.BibTeXBuilder;
import com.arsdigita.cms.scipublications.exporter.bibtex.builders.UnsupportedFieldException;
import org.apache.log4j.Logger;
/**
*
* @author jensp
*/
public class WorkingPaperConverter extends AbstractBibTeXConverter {
private static final Logger logger = Logger.getLogger(
WorkingPaperConverter.class);
@Override
protected String getBibTeXType() {
return "misc";
}
public String convert(Publication publication) {
BibTeXBuilder builder;
WorkingPaper workingPaper;
if (!(publication instanceof WorkingPaper)) {
throw new UnsupportedCcmTypeException(
String.format("The WorkingPaperConverter only "
+ "supports publication types which are of the"
+ "type WorkingPaper or which are "
+ "extending "
+ "WorkingPaper. The "
+ "provided publication is of type '%s' which "
+ "is not of type "
+ "WorkingPaper and does not "
+ "extends WorkingPaper.",
publication.getClass().getName()));
}
workingPaper = (WorkingPaper) publication;
convertAuthors(publication);
builder = getBibTeXBuilder();
try {
convertTitle(publication);
convertYear(publication);
} catch (UnsupportedFieldException ex) {
logger.warn("Tried to set unsupported BibTeX field while "
+ "converting a publication");
}
return builder.toBibTeX();
}
public String getCcmType() {
return WorkingPaper.class.getName();
}
}

View File

@ -1883,6 +1883,18 @@
<classpath refid="server.build.classpath"/>
<link href="http://java.sun.com/j2se/1.4/docs/api/"/>
<link href="http://java.sun.com/j2ee/tutorial/api/"/>
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="tools-ng/devel/lib/UmlGraph.jar">
<param name="-inferrel"/>
<param name="-inferdep"/>
<param name="-hide" value="java.*"/>
<param name="-collpackages" value="java.util.*"/>
<param name="-qualify"/>
<param name="-postfixpackage"/>
<param name="-nodefontsize" value="9"/>
<param name="-nodefontpackagesize" value="7"/>
<param name="-link" value="http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec"/>
<param name="-link" value="http://java.sun.com/j2se/1.5/docs/api"/>
</doclet>
</javadoc>
</target>

Binary file not shown.