ContentItemRenderers for Publications
parent
f523107589
commit
9d16eeb580
|
|
@ -45,10 +45,11 @@ public class SeriesAssetRenderer extends AbstractAssetRenderer {
|
|||
seriesData.put(
|
||||
"description", series.getDescription().getValue(language)
|
||||
);
|
||||
|
||||
seriesData.put("seriesId", series.getSeriesId());
|
||||
seriesData.put("title", series.getTitle().getValue(language));
|
||||
seriesData.put("uuid", series.getUuid());
|
||||
|
||||
|
||||
result.put("series", seriesData);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.assets.Organization;
|
||||
import org.librecms.assets.Person;
|
||||
import org.librecms.assets.PersonName;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.pagemodel.assets.AssetRenderers;
|
||||
import org.librecms.pagemodel.contentitems.AbstractContentItemRenderer;
|
||||
import org.scientificcms.publications.Authorship;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.Publisher;
|
||||
import org.scientificcms.publications.Series;
|
||||
import org.scientificcms.publications.VolumeInSeries;
|
||||
import org.scientificcms.publications.contenttypes.PublicationItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public abstract class AbstractPublicationRenderer
|
||||
extends AbstractContentItemRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Inject
|
||||
private AssetRenderers assetRenderers;
|
||||
|
||||
@Override
|
||||
protected void renderItem(
|
||||
final ContentItem item,
|
||||
final Locale language,
|
||||
final Map<String, Object> result
|
||||
) {
|
||||
final PublicationItem<?> publicationItem;
|
||||
if (item instanceof PublicationItem) {
|
||||
publicationItem = (PublicationItem<?>) item;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
final Publication publication = publicationItem.getPublication();
|
||||
|
||||
final Map<String, Object> publicationData = new HashMap<>();
|
||||
|
||||
publicationData.put(
|
||||
"authorships",
|
||||
publication
|
||||
.getAuthorships()
|
||||
.stream()
|
||||
.map(this::renderAuthorship)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
publicationData.put(
|
||||
"languageOfPublication",
|
||||
publication.getLanguageOfPublication().toString()
|
||||
);
|
||||
publicationData.put(
|
||||
"misc",
|
||||
publication.getMisc().getValue(language)
|
||||
);
|
||||
publicationData.put(
|
||||
"peerReviewed",
|
||||
publication.getPeerReviewed()
|
||||
);
|
||||
publicationData.put(
|
||||
"abstract",
|
||||
publication.getPublicationAbstract().getValue(language)
|
||||
);
|
||||
publicationData.put("publicationId", publication.getPublicationId());
|
||||
publicationData.put(
|
||||
"series",
|
||||
publication
|
||||
.getSeries()
|
||||
.stream()
|
||||
.map(volume -> renderVolume(volume, language))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
publicationData.put(
|
||||
"shortDescription",
|
||||
publication.getShortDescription().getValue(language)
|
||||
);
|
||||
publicationData.put(
|
||||
"title",
|
||||
publication.getTitle().getValue(language)
|
||||
);
|
||||
publicationData.put("uuid", publication.getUuid());
|
||||
publicationData.put(
|
||||
"yearFirstPublished", publication.getYearFirstPublished()
|
||||
);
|
||||
publicationData.put(
|
||||
"yearOfPublication", publication.getYearOfPublication()
|
||||
);
|
||||
|
||||
renderPublication(publication, language, publicationData);
|
||||
|
||||
result.put("publication", publicationData);
|
||||
}
|
||||
|
||||
protected abstract void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
);
|
||||
|
||||
@Override
|
||||
public AssetRenderers getAssetRenderers() {
|
||||
return assetRenderers;
|
||||
}
|
||||
|
||||
protected Map<String, Object> renderAuthorship(final Authorship authorship) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("author", renderPerson(authorship.getAuthor()));
|
||||
data.put("authorOrder", authorship.getAuthorOrder());
|
||||
data.put("authorshipId", authorship.getAuthorshipId());
|
||||
data.put("uuid", authorship.getUuid());
|
||||
data.put("isEditor", authorship.isEditor());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected Map<String, Object> renderPublisher(final Publisher publisher) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("name", publisher.getName());
|
||||
data.put("place", publisher.getPlace());
|
||||
data.put("publisherId", publisher.getPublisherId());
|
||||
data.put("uuid", publisher.getUuid());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected Map<String, Object> renderOrganization(
|
||||
final Organization organization
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("", organization.getName());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private Map<String, Object> renderPerson(final Person person) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
final PersonName personName = person.getPersonName();
|
||||
|
||||
data.put("givenName", personName.getGivenName());
|
||||
data.put("surname", personName.getSurname());
|
||||
data.put("prefix", personName.getPrefix());
|
||||
data.put("suffix", personName.getSuffix());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private Map<String, Object> renderVolume(
|
||||
final VolumeInSeries volume, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("series", renderSeries(volume.getSeries(), language));
|
||||
data.put("uuid", volume.getUuid());
|
||||
data.put("volumeId", volume.getVolumeId());
|
||||
data.put("volumeOfSeries", volume.getVolumeOfSeries());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private Map<String, Object> renderSeries(
|
||||
final Series series, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("description", series.getDescription().getValue(language));
|
||||
data.put("seriesId", series.getSeriesId());
|
||||
data.put("title", series.getTitle().getValue(language));
|
||||
data.put("uuid", series.getUuid());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.PublicationWithPublisher;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public abstract class AbstractPublicationWithPublisherRenderer
|
||||
extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected final void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final PublicationWithPublisher publicationWithPublisher;
|
||||
if (publication instanceof PublicationWithPublisher) {
|
||||
publicationWithPublisher = (PublicationWithPublisher) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put(
|
||||
"edition", publicationWithPublisher.getEdition().getValue(language)
|
||||
);
|
||||
publicationData.put("isbn10", publicationWithPublisher.getIsbn10());
|
||||
publicationData.put("isbn13", publicationWithPublisher.getIsbn13());
|
||||
publicationData.put(
|
||||
"numberOfPages", publicationWithPublisher.getNumberOfPages()
|
||||
);
|
||||
publicationData.put(
|
||||
"numberOfVolumes", publicationWithPublisher.getNumberOfVolumes()
|
||||
);
|
||||
publicationData.put(
|
||||
"publisher",
|
||||
renderPublisher(publicationWithPublisher.getPublisher())
|
||||
);
|
||||
|
||||
renderPublicationWithPublisher(
|
||||
publicationWithPublisher, language, publicationData
|
||||
);
|
||||
}
|
||||
|
||||
protected abstract void renderPublicationWithPublisher(
|
||||
final PublicationWithPublisher publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.UnPublished;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public abstract class AbstractUnPublishedRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected final void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final UnPublished unPublished;
|
||||
if (publication instanceof UnPublished) {
|
||||
unPublished = (UnPublished) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("number", unPublished.getNumber());
|
||||
publicationData.put("numberOfPages", unPublished.getNumberOfPages());
|
||||
publicationData.put(
|
||||
"organization", renderOrganization(unPublished.getOrganization())
|
||||
);
|
||||
publicationData.put("place", unPublished.getPlace());
|
||||
|
||||
renderUnPublished(unPublished, language, publicationData);
|
||||
}
|
||||
|
||||
protected abstract void renderUnPublished(
|
||||
final UnPublished unPublished,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.ArticleInCollectedVolume;
|
||||
import org.scientificcms.publications.CollectedVolume;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = ArticleInCollectedVolumeItem.class)
|
||||
public class ArticleInCollectedVolumeRenderer
|
||||
extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final ArticleInCollectedVolume article;
|
||||
if (publication instanceof ArticleInCollectedVolume) {
|
||||
article = (ArticleInCollectedVolume) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
publicationData.put("chapter", article.getChapter());
|
||||
publicationData.put(
|
||||
"collectedVolume",
|
||||
renderCollectedVolume(article.getCollectedVolume(), language)
|
||||
);
|
||||
publicationData.put("endPage", article.getEndPage());
|
||||
publicationData.put("startPage", article.getStartPage());
|
||||
}
|
||||
|
||||
private Map<String, Object> renderCollectedVolume(
|
||||
final CollectedVolume collectedVolume,
|
||||
final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(
|
||||
"authors",
|
||||
collectedVolume
|
||||
.getAuthorships()
|
||||
.stream()
|
||||
.map(this::renderAuthorship)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
data.put("edition", collectedVolume.getEdition().getValue(language));
|
||||
data.put("isbn10", collectedVolume.getIsbn10());
|
||||
data.put("isbn13", collectedVolume.getIsbn13());
|
||||
data.put(
|
||||
"languageOfPublication",
|
||||
collectedVolume.getLanguageOfPublication().toString()
|
||||
);
|
||||
data.put("misc", collectedVolume.getMisc().getValue(language));
|
||||
data.put("numberOfPages", collectedVolume.getNumberOfPages());
|
||||
data.put("numberOfVolumes", collectedVolume.getNumberOfVolumes());
|
||||
data.put(
|
||||
"abstract",
|
||||
collectedVolume.getPublicationAbstract().getValue(language)
|
||||
);
|
||||
data.put("publicationId", collectedVolume.getPublicationId());
|
||||
data.put("publisher", renderPublisher(collectedVolume.getPublisher()));
|
||||
data.put(
|
||||
"shortDescription",
|
||||
collectedVolume.getShortDescription().getValue(language)
|
||||
);
|
||||
data.put("title", collectedVolume.getTitle().getValue(language));
|
||||
data.put("uuid", collectedVolume.getUuid());
|
||||
data.put("volume", collectedVolume.getVolume());
|
||||
data.put(
|
||||
"yearFirstPublished",
|
||||
collectedVolume.getYearFirstPublished()
|
||||
);
|
||||
data.put("yearOfPublication", collectedVolume.getYearOfPublication());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.Journal;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = ArticleInJournalItem.class)
|
||||
public class ArticleInJournalRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final ArticleInJournal article;
|
||||
if (publication instanceof ArticleInJournal) {
|
||||
article = (ArticleInJournal) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("endPage", article.getEndPage());
|
||||
publicationData.put("issue", article.getIssue());
|
||||
publicationData.put(
|
||||
"journal", renderJournal(article.getJournal(), language)
|
||||
);
|
||||
publicationData.put("publicationDate", article.getPublicationDate());
|
||||
publicationData.put("startPage", article.getStartPage());
|
||||
publicationData.put("volume", article.getVolume());
|
||||
}
|
||||
|
||||
private Map<String, Object> renderJournal(
|
||||
final Journal journal, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("description", journal.getDescription().getValue(language));
|
||||
data.put("firstYear", journal.getFirstYear());
|
||||
data.put("issn", journal.getIssn());
|
||||
data.put("journalId", journal.getJournalId());
|
||||
data.put("lastYear", journal.getLastYear());
|
||||
data.put("symbol", journal.getSymbol());
|
||||
data.put("title", journal.getTitle());
|
||||
data.put("uuid", journal.getUuid());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.ArticleInCollectedVolume;
|
||||
import org.scientificcms.publications.CollectedVolume;
|
||||
import org.scientificcms.publications.PublicationWithPublisher;
|
||||
import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = CollectedVolumeItem.class)
|
||||
public class CollectedVolumeRenderer
|
||||
extends AbstractPublicationWithPublisherRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublicationWithPublisher(
|
||||
final PublicationWithPublisher publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final CollectedVolume collectedVolume;
|
||||
if (publication instanceof CollectedVolume) {
|
||||
collectedVolume = (CollectedVolume) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put(
|
||||
"articles",
|
||||
collectedVolume
|
||||
.getArticles()
|
||||
.stream()
|
||||
.map(article -> renderArticle(article, language))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
private Map<String, Object> renderArticle(
|
||||
final ArticleInCollectedVolume article, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(
|
||||
"authors",
|
||||
article
|
||||
.getAuthorships()
|
||||
.stream()
|
||||
.map(this::renderAuthorship)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
data.put("chapter", article.getChapter());
|
||||
data.put("endPage", article.getEndPage());
|
||||
data.put(
|
||||
"languageOfPublication",
|
||||
article.getLanguageOfPublication().toString()
|
||||
);
|
||||
data.put("misc", article.getMisc().getValue(language));
|
||||
data
|
||||
.put("abstract", article.getPublicationAbstract().getValue(language));
|
||||
data.put("publicationId", article.getPublicationId());
|
||||
data.put(
|
||||
"shortDescription",
|
||||
article.getShortDescription().getValue(language)
|
||||
);
|
||||
data.put("startPage", article.getStartPage());
|
||||
data.put("title", article.getTitle().getValue(language));
|
||||
data.put("uuid", article.getUuid());
|
||||
data.put("yearFirstPublished", article.getYearFirstPublished());
|
||||
data.put("yearOfPublication", article.getYearOfPublication());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.Expertise;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.ExpertiseItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = ExpertiseItem.class)
|
||||
public class ExpertiseRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final Expertise expertise;
|
||||
if (publication instanceof Expertise) {
|
||||
expertise = (Expertise) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("numberOfPages", expertise.getNumberOfPages());
|
||||
publicationData.put("place", expertise.getPlace());
|
||||
publicationData.put(
|
||||
"orderer", renderOrganization(expertise.getOrderer())
|
||||
);
|
||||
publicationData.put(
|
||||
"organization", renderOrganization(expertise.getOrganization())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.GreyLiterature;
|
||||
import org.scientificcms.publications.UnPublished;
|
||||
import org.scientificcms.publications.contenttypes.GreyLiteratureItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = GreyLiteratureItem.class)
|
||||
public class GreyLiteratureRenderer extends AbstractUnPublishedRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderUnPublished(
|
||||
final UnPublished unPublished,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final GreyLiterature greyLiterature;
|
||||
if (unPublished instanceof GreyLiterature) {
|
||||
greyLiterature = (GreyLiterature) unPublished;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("startPage", greyLiterature.getStartPage());
|
||||
publicationData.put("endPage", greyLiterature.getEndPage());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.InProceedings;
|
||||
import org.scientificcms.publications.Proceedings;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.InProceedingsItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = InProceedingsItem.class)
|
||||
public class InProceedingsRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final InProceedings paper;
|
||||
if (publication instanceof InProceedings) {
|
||||
paper = (InProceedings) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("", paper.getEndPage());
|
||||
publicationData.put(
|
||||
"proceedings", renderProceedings(paper.getProceedings(), language)
|
||||
);
|
||||
publicationData.put("", paper.getStartPage());
|
||||
}
|
||||
|
||||
private Map<String, Object> renderProceedings(
|
||||
final Proceedings proceedings, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(
|
||||
"authors",
|
||||
proceedings
|
||||
.getAuthorships()
|
||||
.stream()
|
||||
.map(this::renderAuthorship)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
data.put("edition", proceedings.getEdition());
|
||||
data.put("endDate", proceedings.getEndDate());
|
||||
data.put("isbn10", proceedings.getIsbn10());
|
||||
data.put("isbn13", proceedings.getIsbn13());
|
||||
data.put(
|
||||
"languageOfPublication",
|
||||
proceedings.getLanguageOfPublication().toString()
|
||||
);
|
||||
data.put("misc", proceedings.getMisc().getValue(language));
|
||||
data.put("nameOfConference", proceedings.getNameOfConference());
|
||||
data.put("numberOfPages", proceedings.getNumberOfPages());
|
||||
data.put("numberOfVolumes", proceedings.getNumberOfVolumes());
|
||||
data.put("organizer", renderOrganization(proceedings.getOrganizer()));
|
||||
data.put("peerReviewed", proceedings.getPeerReviewed());
|
||||
data.put("placeOfConference", proceedings.getPlaceOfConference());
|
||||
data.put(
|
||||
"abstract", proceedings.getPublicationAbstract().getValue(language)
|
||||
);
|
||||
data.put("publicationId", proceedings.getPublicationId());
|
||||
data.put("publisher", renderPublisher(proceedings.getPublisher()));
|
||||
data.put(
|
||||
"shortDescription",
|
||||
proceedings.getShortDescription().getValue(language)
|
||||
);
|
||||
data.put("startDate", proceedings.getStartDate());
|
||||
data.put("title", proceedings.getTitle().getValue(language));
|
||||
data.put("uuid", proceedings.getUuid());
|
||||
data.put("volume", proceedings.getVolume());
|
||||
data.put("yearFirstPublished", proceedings.getYearFirstPublished());
|
||||
data.put("yearOfPublication", proceedings.getYearOfPublication());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.InternetArticle;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.contenttypes.InternetArticleItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = InternetArticleItem.class)
|
||||
public class InternetArticleRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final InternetArticle article;
|
||||
if (publication instanceof InternetArticle) {
|
||||
article = (InternetArticle) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
publicationData.put("doi", article.getDoi());
|
||||
publicationData.put("edition", article.getEdition());
|
||||
publicationData.put("issn", article.getIssn());
|
||||
publicationData.put("lastAccessed", article.getLastAccessed());
|
||||
publicationData.put("number", article.getNumber());
|
||||
publicationData.put("numberOfPages", article.getNumberOfPages());
|
||||
publicationData.put(
|
||||
"organization", renderOrganization(article.getOrganization())
|
||||
);
|
||||
publicationData.put("place", article.getPlace());
|
||||
publicationData.put("publicationDate", article.getPublicationDate());
|
||||
publicationData.put("url", article.getUrl());
|
||||
publicationData.put("urn", article.getUrn());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.Monograph;
|
||||
import org.scientificcms.publications.PublicationWithPublisher;
|
||||
import org.scientificcms.publications.contenttypes.MonographItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = MonographItem.class)
|
||||
public class MonographRenderer extends AbstractPublicationWithPublisherRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublicationWithPublisher(
|
||||
final PublicationWithPublisher publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final Monograph monograph;
|
||||
if (publication instanceof Monograph) {
|
||||
monograph = (Monograph) publication;
|
||||
}else {
|
||||
return;
|
||||
}
|
||||
publicationData.put("reviewed", monograph.getReviewed());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.InProceedings;
|
||||
import org.scientificcms.publications.Proceedings;
|
||||
import org.scientificcms.publications.PublicationWithPublisher;
|
||||
import org.scientificcms.publications.contenttypes.ProceedingsItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = ProceedingsItem.class)
|
||||
public class ProceedingsRenderer
|
||||
extends AbstractPublicationWithPublisherRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublicationWithPublisher(
|
||||
final PublicationWithPublisher publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final Proceedings proceedings;
|
||||
if (publication instanceof Proceedings) {
|
||||
proceedings = (Proceedings) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("endDate", proceedings.getEndDate());
|
||||
publicationData.put(
|
||||
"nameOfConference", proceedings.getNameOfConference()
|
||||
);
|
||||
publicationData.put(
|
||||
"organizer", renderOrganization(proceedings.getOrganizer())
|
||||
);
|
||||
publicationData.put(
|
||||
"papers",
|
||||
proceedings
|
||||
.getPapers()
|
||||
.stream()
|
||||
.map(paper -> renderPaper(paper, language))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
publicationData.put(
|
||||
"placeOfConference", proceedings.getPlaceOfConference()
|
||||
);
|
||||
publicationData.put("startDate", proceedings.getStartDate());
|
||||
}
|
||||
|
||||
private Map<String, Object> renderPaper(
|
||||
final InProceedings paper, final Locale language
|
||||
) {
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(
|
||||
"authors",
|
||||
paper
|
||||
.getAuthorships()
|
||||
.stream()
|
||||
.map(this::renderAuthorship)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
data.put("endPage", paper.getEndPage());
|
||||
data.put(
|
||||
"languageOfPublication",
|
||||
paper.getLanguageOfPublication().toString()
|
||||
);
|
||||
data.put("misc", paper.getMisc().getValue(language));
|
||||
data.put("peerReviewed", paper.getPeerReviewed());
|
||||
data.put("abstract", paper.getPublicationAbstract().getValue(language));
|
||||
data.put("publicationId", paper.getPublicationId());
|
||||
data.put(
|
||||
"shortDescription", paper.getShortDescription().getValue(language)
|
||||
);
|
||||
data.put("startPage", paper.getStartPage());
|
||||
data.put("title", paper.getTitle().getValue(language));
|
||||
data.put("uuid", paper.getUuid());
|
||||
data.put("yearFirstPublished", paper.getYearFirstPublished());
|
||||
data.put("yearOfPublication", paper.getYearOfPublication());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.Publication;
|
||||
import org.scientificcms.publications.Talk;
|
||||
import org.scientificcms.publications.contenttypes.TalkItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = TalkItem.class)
|
||||
public class TalkRenderer extends AbstractPublicationRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderPublication(
|
||||
final Publication publication,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
final Talk talk;
|
||||
if (publication instanceof Talk) {
|
||||
talk = (Talk) publication;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationData.put("dateOfTalk", talk.getDateOfTalk());
|
||||
publicationData.put("event", talk.getEvent());
|
||||
publicationData.put("place", talk.getPlace());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.scientificcms.pagemodel.contentitems;
|
||||
|
||||
import org.librecms.pagemodel.contentitems.ContentItemRenderer;
|
||||
import org.scientificcms.publications.UnPublished;
|
||||
import org.scientificcms.publications.contenttypes.WorkingPaperItem;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ContentItemRenderer(renders = WorkingPaperItem.class)
|
||||
public class WorkingPaperRenderer extends AbstractUnPublishedRenderer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void renderUnPublished(
|
||||
final UnPublished unPublished,
|
||||
final Locale language,
|
||||
final Map<String, Object> publicationData
|
||||
) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.scientificcms.publications;
|
||||
|
||||
import org.hibernate.annotations.CollectionId;
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
|
|
|||
Loading…
Reference in New Issue