Adaption because of changes in libreccm/librecms
parent
1129e7e61d
commit
2745426835
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.assets;
|
|
||||||
|
|
||||||
import org.librecms.contentsection.Asset;
|
|
||||||
import org.librecms.pagemodel.assets.AbstractAssetRenderer;
|
|
||||||
import org.librecms.pagemodel.assets.AssetRenderer;
|
|
||||||
import org.scientificcms.publications.Journal;
|
|
||||||
import org.scientificcms.publications.assets.JournalAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@AssetRenderer(renders = JournalAsset.class)
|
|
||||||
public class JournalAssetRenderer extends AbstractAssetRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderAsset(
|
|
||||||
final Asset asset,
|
|
||||||
final Locale language,
|
|
||||||
final Map<String, Object> result
|
|
||||||
) {
|
|
||||||
final JournalAsset journalAsset;
|
|
||||||
if (asset instanceof JournalAsset) {
|
|
||||||
journalAsset = (JournalAsset) asset;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Journal journal = journalAsset.getJournal();
|
|
||||||
final Map<String, Object> journalData = new HashMap<>();
|
|
||||||
journalData.put(
|
|
||||||
"description", journal.getDescription().getValue(language)
|
|
||||||
);
|
|
||||||
journalData.put("firstYear", journal.getFirstYear());
|
|
||||||
journalData.put("issn", journal.getIssn());
|
|
||||||
journalData.put("journalId", journal.getJournalId());
|
|
||||||
journalData.put("lastYear", journal.getLastYear());
|
|
||||||
journalData.put("symbol", journal.getSymbol());
|
|
||||||
journalData.put("title", journal.getTitle());
|
|
||||||
journalData.put("uuid", journal.getUuid());
|
|
||||||
|
|
||||||
result.put("journal", journalData);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.assets;
|
|
||||||
|
|
||||||
import org.librecms.contentsection.Asset;
|
|
||||||
import org.librecms.pagemodel.assets.AbstractAssetRenderer;
|
|
||||||
import org.librecms.pagemodel.assets.AssetRenderer;
|
|
||||||
import org.scientificcms.publications.Publisher;
|
|
||||||
import org.scientificcms.publications.assets.PublisherAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@AssetRenderer(renders = PublisherAsset.class)
|
|
||||||
public class PublisherAssetRenderer extends AbstractAssetRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderAsset(
|
|
||||||
final Asset asset,
|
|
||||||
final Locale language,
|
|
||||||
final Map<String, Object> result
|
|
||||||
) {
|
|
||||||
final PublisherAsset publisherAsset;
|
|
||||||
if (asset instanceof PublisherAsset) {
|
|
||||||
publisherAsset = (PublisherAsset) asset;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Publisher publisher = publisherAsset.getPublisher();
|
|
||||||
final Map<String, Object> publisherData = new HashMap<>();
|
|
||||||
publisherData.put("publisherId", publisher.getPublisherId());
|
|
||||||
publisherData.put("uuid", publisher.getUuid());
|
|
||||||
publisherData.put("name", publisher.getName());
|
|
||||||
publisherData.put("place", publisher.getPlace());
|
|
||||||
|
|
||||||
result.put("publisher", publisherData);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.assets;
|
|
||||||
|
|
||||||
import org.librecms.contentsection.Asset;
|
|
||||||
import org.librecms.pagemodel.assets.AbstractAssetRenderer;
|
|
||||||
import org.librecms.pagemodel.assets.AssetRenderer;
|
|
||||||
import org.scientificcms.publications.Series;
|
|
||||||
import org.scientificcms.publications.assets.SeriesAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@AssetRenderer(renders = SeriesAsset.class)
|
|
||||||
public class SeriesAssetRenderer extends AbstractAssetRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderAsset(
|
|
||||||
final Asset asset,
|
|
||||||
final Locale language,
|
|
||||||
final Map<String, Object> result
|
|
||||||
) {
|
|
||||||
final SeriesAsset seriesAsset;
|
|
||||||
if (asset instanceof SeriesAsset) {
|
|
||||||
seriesAsset = (SeriesAsset) asset;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Series series = seriesAsset.getSeries();
|
|
||||||
|
|
||||||
final Map<String, Object> seriesData = new HashMap<>();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* 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())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.assets;
|
package org.scientificcms.publications.assets;
|
||||||
|
|
||||||
import org.scientificcms.publications.assets.ui.JournalForm;
|
|
||||||
|
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
import org.librecms.assets.AssetType;
|
import org.librecms.assets.AssetType;
|
||||||
|
|
@ -32,7 +31,6 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||||
@Table(name = "JOURNAL_ASSETS", schema = DB_SCHEMA)
|
@Table(name = "JOURNAL_ASSETS", schema = DB_SCHEMA)
|
||||||
@Audited
|
@Audited
|
||||||
@AssetType(
|
@AssetType(
|
||||||
assetForm = JournalForm.class,
|
|
||||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||||
labelKey = "journal.label",
|
labelKey = "journal.label",
|
||||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.librecms.assets.AssetType;
|
||||||
import org.librecms.contentsection.Asset;
|
import org.librecms.contentsection.Asset;
|
||||||
import org.scientificcms.publications.Publisher;
|
import org.scientificcms.publications.Publisher;
|
||||||
import org.scientificcms.publications.SciPublicationsConstants;
|
import org.scientificcms.publications.SciPublicationsConstants;
|
||||||
import org.scientificcms.publications.assets.ui.PublisherForm;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -32,7 +31,6 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||||
@Table(name = "PUBLISHER_ASSETS", schema = DB_SCHEMA)
|
@Table(name = "PUBLISHER_ASSETS", schema = DB_SCHEMA)
|
||||||
@Audited
|
@Audited
|
||||||
@AssetType(
|
@AssetType(
|
||||||
assetForm = PublisherForm.class,
|
|
||||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||||
labelKey = "publisher.label",
|
labelKey = "publisher.label",
|
||||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.librecms.assets.AssetType;
|
||||||
import org.librecms.contentsection.Asset;
|
import org.librecms.contentsection.Asset;
|
||||||
import org.scientificcms.publications.SciPublicationsConstants;
|
import org.scientificcms.publications.SciPublicationsConstants;
|
||||||
import org.scientificcms.publications.Series;
|
import org.scientificcms.publications.Series;
|
||||||
import org.scientificcms.publications.assets.ui.SeriesForm;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -30,7 +29,6 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
||||||
@Table(name = "SERIES_ASSETS", schema = DB_SCHEMA)
|
@Table(name = "SERIES_ASSETS", schema = DB_SCHEMA)
|
||||||
@Audited
|
@Audited
|
||||||
@AssetType(
|
@AssetType(
|
||||||
assetForm = SeriesForm.class,
|
|
||||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||||
labelKey = "journal.label",
|
labelKey = "journal.label",
|
||||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||||
|
|
|
||||||
|
|
@ -1,208 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.bebop.event.ParameterEvent;
|
|
||||||
import com.arsdigita.bebop.event.ParameterListener;
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterData;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
|
|
||||||
import com.arsdigita.cms.ui.assets.AssetPane;
|
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.SciPublicationsConstants;
|
|
||||||
import org.scientificcms.publications.assets.JournalAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class JournalForm extends AbstractAssetForm<JournalAsset> {
|
|
||||||
|
|
||||||
private TextField symbolField;
|
|
||||||
|
|
||||||
private TextField issnField;
|
|
||||||
|
|
||||||
private TextField firstYearField;
|
|
||||||
|
|
||||||
private TextField lastYearField;
|
|
||||||
|
|
||||||
private TextArea descriptionArea;
|
|
||||||
|
|
||||||
public JournalForm(final AssetPane assetPane) {
|
|
||||||
super(assetPane);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
|
|
||||||
super.addWidgets();
|
|
||||||
|
|
||||||
final ParameterModel symbolModel = new StringParameter(
|
|
||||||
JournalFormController.SYMBOL
|
|
||||||
);
|
|
||||||
symbolField = new TextField(symbolModel);
|
|
||||||
symbolField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.journal.symbol",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(symbolField);
|
|
||||||
|
|
||||||
final ParameterModel issnParam = new StringParameter(
|
|
||||||
JournalFormController.ISSN
|
|
||||||
);
|
|
||||||
issnField = new TextField(issnParam);
|
|
||||||
issnField.addValidationListener(new ParameterListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(final ParameterEvent event) throws
|
|
||||||
FormProcessException {
|
|
||||||
final ParameterData data = event.getParameterData();
|
|
||||||
String value = (String) data.getValue();
|
|
||||||
|
|
||||||
if (value.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = value.replace("-", "");
|
|
||||||
|
|
||||||
if (value.length() != 8) {
|
|
||||||
data.invalidate();
|
|
||||||
data.addError(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.invalid_issn",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
final Long num = Long.parseLong(value);
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
data.invalidate();
|
|
||||||
data.addError(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.invalid_issn",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
issnField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.journal.issn", SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(issnField);
|
|
||||||
|
|
||||||
final ParameterModel firstYearParam = new IntegerParameter(
|
|
||||||
JournalFormController.FIRST_YEAR
|
|
||||||
);
|
|
||||||
firstYearField = new TextField(firstYearParam);
|
|
||||||
firstYearField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.journal.firstYearOfPublication",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(firstYearField);
|
|
||||||
|
|
||||||
final ParameterModel lastYearParam = new IntegerParameter(
|
|
||||||
JournalFormController.LAST_YEAR
|
|
||||||
);
|
|
||||||
lastYearField = new TextField(lastYearParam);
|
|
||||||
lastYearField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.journal.lastYearOfPublication",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(lastYearField);
|
|
||||||
|
|
||||||
final ParameterModel descriptionParam = new StringParameter(
|
|
||||||
JournalFormController.DESCRIPTION
|
|
||||||
);
|
|
||||||
descriptionArea = new TextArea(descriptionParam);
|
|
||||||
descriptionArea.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.journal.abstract",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
descriptionArea.setCols(60);
|
|
||||||
descriptionArea.setRows(18);
|
|
||||||
add(descriptionArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<JournalAsset> getAssetClass() {
|
|
||||||
return JournalAsset.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showLocale(final PageState state) {
|
|
||||||
final Long selectedAssetId = getSelectedAssetId(state);
|
|
||||||
|
|
||||||
if (selectedAssetId != null) {
|
|
||||||
final Map<String, Object> data = getController()
|
|
||||||
.getAssetData(
|
|
||||||
selectedAssetId, getAssetClass(), getSelectedLocale(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
descriptionArea
|
|
||||||
.setValue(
|
|
||||||
state,
|
|
||||||
data.get(JournalFormController.DESCRIPTION)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> collectData(
|
|
||||||
final FormSectionEvent event) throws FormProcessException {
|
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
|
||||||
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
JournalFormController.DESCRIPTION, descriptionArea.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
JournalFormController.FIRST_YEAR, firstYearField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
JournalFormController.ISSN, issnField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
JournalFormController.LAST_YEAR, lastYearField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
JournalFormController.SYMBOL, symbolField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetFormController;
|
|
||||||
import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.Journal;
|
|
||||||
import org.scientificcms.publications.assets.JournalAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@IsControllerForAssetType(JournalAsset.class)
|
|
||||||
public class JournalFormController
|
|
||||||
extends AbstractAssetFormController<JournalAsset> {
|
|
||||||
|
|
||||||
protected static final String SYMBOL = "symbol";
|
|
||||||
|
|
||||||
protected static final String ISSN = "issn";
|
|
||||||
|
|
||||||
protected static final String FIRST_YEAR = "firstYear";
|
|
||||||
|
|
||||||
protected static final String LAST_YEAR = "lastYear";
|
|
||||||
|
|
||||||
protected static final String DESCRIPTION = "description";
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> getAssetData(
|
|
||||||
final JournalAsset asset, final Locale selectedLocale
|
|
||||||
) {
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
final Journal journal = asset.getJournal();
|
|
||||||
|
|
||||||
data.put(SYMBOL, journal.getSymbol());
|
|
||||||
data.put(ISSN, journal.getIssn());
|
|
||||||
data.put(FIRST_YEAR, journal.getFirstYear());
|
|
||||||
data.put(LAST_YEAR, journal.getLastYear());
|
|
||||||
data.put(DESCRIPTION, journal.getDescription().getValue(selectedLocale));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateAssetProperties(
|
|
||||||
final JournalAsset asset,
|
|
||||||
final Locale selectedLocale,
|
|
||||||
final Map<String, Object> data
|
|
||||||
) {
|
|
||||||
final Journal journal = asset.getJournal();
|
|
||||||
|
|
||||||
if (data.containsKey(SYMBOL)) {
|
|
||||||
journal.setSymbol((String) data.get(SYMBOL));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.containsKey(ISSN)) {
|
|
||||||
journal.setIssn((String) data.get(ISSN));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.containsKey(FIRST_YEAR)) {
|
|
||||||
journal.setFirstYear((Integer) data.get(FIRST_YEAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.containsKey(LAST_YEAR)) {
|
|
||||||
journal.setLastYear((Integer) data.get(LAST_YEAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.containsKey(DESCRIPTION)) {
|
|
||||||
journal.getDescription().putValue(
|
|
||||||
selectedLocale, (String) data.get(DESCRIPTION)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
|
|
||||||
import com.arsdigita.cms.ui.assets.AssetPane;
|
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.SciPublicationsConstants;
|
|
||||||
import org.scientificcms.publications.assets.PublisherAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class PublisherForm extends AbstractAssetForm<PublisherAsset> {
|
|
||||||
|
|
||||||
private TextField nameField;
|
|
||||||
|
|
||||||
private TextField placeField;
|
|
||||||
|
|
||||||
public PublisherForm(final AssetPane assetPane) {
|
|
||||||
super(assetPane);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
final ParameterModel nameParam = new StringParameter(
|
|
||||||
PublisherFormController.NAME
|
|
||||||
);
|
|
||||||
nameField = new TextField(nameParam);
|
|
||||||
nameField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.publisher.name",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
nameField.addValidationListener(new NotNullValidationListener());
|
|
||||||
nameField.addValidationListener(new NotEmptyValidationListener());
|
|
||||||
add(nameField);
|
|
||||||
|
|
||||||
final ParameterModel placeParam = new StringParameter(
|
|
||||||
PublisherFormController.PLACE
|
|
||||||
);
|
|
||||||
placeField = new TextField(placeParam);
|
|
||||||
placeField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.publisher.place",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(placeField);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<PublisherAsset> getAssetClass() {
|
|
||||||
return PublisherAsset.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showLocale(final PageState state) {
|
|
||||||
// Nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> collectData(final FormSectionEvent event)
|
|
||||||
throws FormProcessException {
|
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
|
||||||
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
PublisherFormController.NAME, nameField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
PublisherFormController.PLACE, placeField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetFormController;
|
|
||||||
import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.Publisher;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.assets.PublisherAsset;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@IsControllerForAssetType(PublisherAsset.class)
|
|
||||||
public class PublisherFormController
|
|
||||||
extends AbstractAssetFormController<PublisherAsset> {
|
|
||||||
|
|
||||||
protected static final String NAME = "name";
|
|
||||||
|
|
||||||
protected static final String PLACE = "place";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> getAssetData(
|
|
||||||
final PublisherAsset asset,
|
|
||||||
final Locale selectedLocale
|
|
||||||
) {
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
final Publisher publisher = asset.getPublisher();
|
|
||||||
|
|
||||||
data.put(NAME, publisher.getName());
|
|
||||||
data.put(PLACE, publisher.getPlace());
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateAssetProperties(
|
|
||||||
final PublisherAsset asset,
|
|
||||||
final Locale selectedLocale,
|
|
||||||
final Map<String, Object> data
|
|
||||||
) {
|
|
||||||
final Publisher publisher = asset.getPublisher();
|
|
||||||
|
|
||||||
publisher.setName((String) data.get(NAME));
|
|
||||||
publisher.setPlace((String) data.get(PLACE));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
|
|
||||||
import com.arsdigita.cms.ui.assets.AssetPane;
|
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.SciPublicationsConstants;
|
|
||||||
import org.scientificcms.publications.assets.SeriesAsset;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class SeriesForm extends AbstractAssetForm<SeriesAsset> {
|
|
||||||
|
|
||||||
private TextField titleField;
|
|
||||||
|
|
||||||
private TextArea descriptionArea;
|
|
||||||
|
|
||||||
public SeriesForm(final AssetPane assetPane) {
|
|
||||||
super(assetPane);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
super.addWidgets();
|
|
||||||
|
|
||||||
final ParameterModel titleParam = new StringParameter(
|
|
||||||
SeriesFormController.TITLE
|
|
||||||
);
|
|
||||||
titleField = new TextField(titleParam);
|
|
||||||
titleField.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.series.title",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
add(titleField);
|
|
||||||
|
|
||||||
final ParameterModel descriptionParam = new StringParameter(
|
|
||||||
SeriesFormController.DESCRIPTION
|
|
||||||
);
|
|
||||||
descriptionArea = new TextArea(descriptionParam);
|
|
||||||
descriptionArea.setLabel(
|
|
||||||
new GlobalizedMessage(
|
|
||||||
"publications.ui.series.abstract",
|
|
||||||
SciPublicationsConstants.BUNDLE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
descriptionArea.setCols(60);
|
|
||||||
descriptionArea.setRows(18);
|
|
||||||
add(descriptionArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<SeriesAsset> getAssetClass() {
|
|
||||||
return SeriesAsset.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showLocale(final PageState state) {
|
|
||||||
final Long selectedAssetId = getSelectedAssetId(state);
|
|
||||||
|
|
||||||
if (selectedAssetId != null) {
|
|
||||||
final Map<String, Object> data = getController()
|
|
||||||
.getAssetData(
|
|
||||||
selectedAssetId, getAssetClass(), getSelectedLocale(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
titleField.setValue(
|
|
||||||
state,
|
|
||||||
data.get(SeriesFormController.TITLE)
|
|
||||||
);
|
|
||||||
|
|
||||||
descriptionArea.setValue(
|
|
||||||
state,
|
|
||||||
data.get(SeriesFormController.DESCRIPTION)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> collectData(FormSectionEvent event)
|
|
||||||
throws FormProcessException {
|
|
||||||
final PageState state = event.getPageState();
|
|
||||||
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
SeriesFormController.DESCRIPTION, descriptionArea.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.put(
|
|
||||||
SeriesFormController.TITLE, titleField.getValue(state)
|
|
||||||
);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.publications.assets.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.assets.AbstractAssetFormController;
|
|
||||||
import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.Series;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
import org.scientificcms.publications.assets.SeriesAsset;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
@IsControllerForAssetType(SeriesAsset.class)
|
|
||||||
public class SeriesFormController
|
|
||||||
extends AbstractAssetFormController<SeriesAsset> {
|
|
||||||
|
|
||||||
protected static final String TITLE = "title";
|
|
||||||
|
|
||||||
protected static final String DESCRIPTION = "description";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, Object> getAssetData(
|
|
||||||
final SeriesAsset asset,
|
|
||||||
final Locale selectedLocale
|
|
||||||
) {
|
|
||||||
final Series series = asset.getSeries();
|
|
||||||
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
|
||||||
|
|
||||||
data.put(TITLE, series.getTitle().getValue(selectedLocale));
|
|
||||||
data.put(DESCRIPTION, series.getDescription().getValue(selectedLocale));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateAssetProperties(
|
|
||||||
final SeriesAsset asset,
|
|
||||||
final Locale selectedLocale,
|
|
||||||
final Map<String, Object> data
|
|
||||||
) {
|
|
||||||
final Series series = asset.getSeries();
|
|
||||||
|
|
||||||
series.getTitle().putValue(selectedLocale, (String) data.get(TITLE));
|
|
||||||
series.getDescription().putValue(
|
|
||||||
selectedLocale, (String) data.get(DESCRIPTION)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scene Scope="Project" version="2">
|
||||||
|
<Scope Scope="Faces Configuration Only"/>
|
||||||
|
<Scope Scope="Project"/>
|
||||||
|
<Scope Scope="All Faces Configurations"/>
|
||||||
|
</Scene>
|
||||||
|
|
@ -224,6 +224,14 @@
|
||||||
<include>scripts/</include>
|
<include>scripts/</include>
|
||||||
</includes>
|
</includes>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
<overlay>
|
||||||
|
<groupId>org.scientificcms</groupId>
|
||||||
|
<artifactId>sci-types-project</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<includes>
|
||||||
|
<include>assets/</include>
|
||||||
|
</includes>
|
||||||
|
</overlay>
|
||||||
</overlays>
|
</overlays>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
libreccm.http.port=8080
|
||||||
|
libreccm.https.port=8180
|
||||||
|
libreccm.debug.port=8787
|
||||||
|
libreccm.debug.suspend=n
|
||||||
|
|
||||||
|
libreccm.database.host=localhost
|
||||||
|
libreccm.database.port=5432
|
||||||
|
libreccm.database.name=libreccm-devel
|
||||||
|
libreccm.database.user=libreccm
|
||||||
|
libreccm.database.password=libreccm
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
libreccm.debug.suspend=n
|
||||||
|
|
||||||
|
libreccm.database.host=localhost
|
||||||
|
libreccm.database.port=5432
|
||||||
|
libreccm.database.name=ccm-devel
|
||||||
|
libreccm.database.user=ccm
|
||||||
|
libreccm.database.password=ccm47web
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
-->
|
-->
|
||||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
|
||||||
<jta-data-source>java:/comp/env/jdbc/scientificcms/db</jta-data-source>
|
<jta-data-source>java:/comp/env/jdbc/libreccm/db</jta-data-source>
|
||||||
|
|
||||||
<jar-file>lib/ccm-core-7.0.0-SNAPSHOT.jar</jar-file>
|
<jar-file>lib/ccm-core-7.0.0-SNAPSHOT.jar</jar-file>
|
||||||
<jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
|
<jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,8 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||||
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
|
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
|
||||||
|
<application>
|
||||||
|
<resource-handler>org.libreccm.mvc.facelets.CcmViewResourceHandler</resource-handler>
|
||||||
|
</application>
|
||||||
</faces-config>
|
</faces-config>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<jboss-web>
|
||||||
|
<context-root>/libreccm</context-root>
|
||||||
|
<default-encoding>UTF-8</default-encoding>
|
||||||
|
</jboss-web>
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
<param-name>ccm.distribution</param-name>
|
<param-name>ccm.distribution</param-name>
|
||||||
<param-value>scientificcms</param-value>
|
<param-value>scientificcms</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>resteasy.resources</param-name>
|
||||||
|
<param-value>org.jboss.resteasy.plugins.stats.RegistryStatsResource</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
<!-- No JSESSIONID!!! -->
|
<!-- No JSESSIONID!!! -->
|
||||||
<session-config>
|
<session-config>
|
||||||
|
|
@ -39,7 +43,6 @@
|
||||||
<!-- JAX-RS -->
|
<!-- JAX-RS -->
|
||||||
<!-- <servlet>
|
<!-- <servlet>
|
||||||
<servlet-name>javax.ws.rs.core.Application</servlet-name>
|
<servlet-name>javax.ws.rs.core.Application</servlet-name>
|
||||||
|
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>javax.ws.rs.core.Application</servlet-name>
|
<servlet-name>javax.ws.rs.core.Application</servlet-name>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue