Subtype of {@link PublicationAsset}.
+ * @param Subtype of {@link Publication}
+ */
+public abstract class AbstractPublicationExtentedPropertiesStep, P extends Publication>
+ extends AbstractMvcAuthoringStep {
+
+ @Inject
+ private DocumentUi documentUi;
+
+ @Inject
+ private GlobalizationHelper globalizationHelper;
+
+ @Inject
+ private ItemPermissionChecker itemPermissionChecker;
+
+ @Inject
+ private PublicationExtendedPropertiesStepModel propertiesStepModel;
+
+ @Inject
+ private PublicationRepository publicationRepo;
+
+ @Inject
+ private SciPublicationsUiMessageBundle messageBundle;
+
+ @SuppressWarnings("unchecked")
+ protected T getPublicationItem() {
+ return (T) getDocument();
+ }
+
+ protected P getPublication() {
+ return getPublicationItem().getPublication();
+ }
+
+ @Override
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void init() throws ContentSectionNotFoundException,
+ DocumentNotFoundException {
+ super.init();
+
+ if (!(getDocument() instanceof PublicationItem)) {
+ throw new DocumentNotFoundException(
+ documentUi.showDocumentNotFound(
+ getContentSection(),
+ getDocumentPath()
+ )
+ );
+ }
+
+ final P publication = getPublication();
+
+ propertiesStepModel.setLanguageOfPublication(
+ publication.getLanguageOfPublication().toString()
+ );
+ propertiesStepModel.setPeerReviewed(publication.getPeerReviewed());
+ propertiesStepModel.setVolumeInSeries(
+ publication
+ .getSeries()
+ .stream()
+ .map(this::buildVolumeInSeriesRow)
+ .collect(Collectors.toList())
+ );
+ propertiesStepModel.setYearFirstPublished(
+ publication.getYearFirstPublished()
+ );
+ }
+
+ @GET
+ @Path("/")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ public String showStep(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getDocument())) {
+ return getStepTemplatePath();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getDocument(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @POST
+ @Path("/properties")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ public String updateProperties(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @FormParam("languageOfPublication")
+ final String languageOfPublicationParam,
+ @FormParam("peerReviewed")
+ final String peerReviewedParam,
+ @FormParam("yearFirstPublished")
+ final String yearFirstPublishedParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getDocument())) {
+ final Locale languageOfPublication = Optional
+ .ofNullable(languageOfPublicationParam)
+ .filter(param -> !param.isBlank())
+ .map(param -> new Locale(param))
+ .orElse(null);
+
+ final boolean peerReviewed = Optional
+ .ofNullable(peerReviewedParam)
+ .map(param -> "true".equals(param) || "on".equals(param))
+ .orElse(false);
+
+ final Integer yearFirstPublished = Optional
+ .ofNullable(yearFirstPublishedParam)
+ .filter(param -> !param.isBlank())
+ .filter(param -> param.matches("\\d*"))
+ .map(param -> Integer.parseInt(param))
+ .orElse(null);
+
+ final P publication = getPublication();
+ if (languageOfPublication != null) {
+ publication.setLanguageOfPublication(languageOfPublication);
+ }
+ publication.setPeerReviewed(peerReviewed);
+
+ if (yearFirstPublished != null) {
+ publication.setYearOfPublication(yearFirstPublished);
+ }
+
+ publicationRepo.save(publication);
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getDocument(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ protected abstract String getStepTemplatePath();
+
+ private VolumeInSeriesRow buildVolumeInSeriesRow(
+ final VolumeInSeries volume
+ ) {
+ final VolumeInSeriesRow row = new VolumeInSeriesRow();
+ row.setSeriesTitle(
+ globalizationHelper.getValueFromLocalizedString(
+ volume.getSeries().getTitle()
+ )
+ );
+ row.setSeriesUuid(volume.getSeries().getUuid());
+ row.setVolumeInSeries(volume.getVolumeOfSeries());
+ row.setVolumeInSeriesUuid(volume.getUuid());
+
+ return row;
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationPropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationPropertiesStep.java
index 24a61f8..33a2c13 100644
--- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationPropertiesStep.java
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationPropertiesStep.java
@@ -10,7 +10,6 @@ import org.librecms.contentsection.AssetRepository;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
-import org.librecms.ui.contentsections.assets.AssetNotFoundException;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
@@ -114,6 +113,10 @@ public abstract class AbstractPublicationPropertiesStep titleLocales = publication
.getTitle()
.getAvailableLocales();
@@ -177,22 +180,6 @@ public abstract class AbstractPublicationPropertiesStep param.isBlank())
+ .filter(param -> param.matches("\\d*"))
+ .map(param -> Integer.parseInt(param))
+ .orElse(null);
+
+ if (yearOfPublication != null) {
+ getPublication().setYearOfPublication(yearOfPublication);
+ publicationRepo.save(getPublication());
+ }
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getDocument(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
/**
* Updates a localized title of a publication.
*
@@ -696,6 +727,22 @@ public abstract class AbstractPublicationPropertiesStepJens Pelzetter
+ * @param Subtype of {@link PublicationWithPublisherItem}
+ * @param Subtype of {@link PublicationWithPublisher}.
+ */
+public abstract class AbstractPublicationWithPublisherExtendedPropertiesStep, P extends PublicationWithPublisher>
+ extends AbstractPublicationExtentedPropertiesStep {
+
+ @Inject
+ private DocumentUi documentUi;
+
+ @Inject
+ private ItemPermissionChecker itemPermissionChecker;
+
+ @Inject
+ private PublicationRepository publicationRepo;
+
+ @Inject
+ private PublicationWithPublisherExtendedPropertiesStepModel propertiesStepModel;
+
+ @Inject
+ private SciPublicationsUiMessageBundle messageBundle;
+
+ @Override
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void init() throws ContentSectionNotFoundException,
+ DocumentNotFoundException {
+ super.init();
+
+ final P publication = getPublication();
+
+ propertiesStepModel.setIsbn10(publication.getIsbn10());
+ propertiesStepModel.setIsbn13(publication.getIsbn13());
+ propertiesStepModel.setNumberOfPages(publication.getNumberOfPages());
+ propertiesStepModel.setNumberOfVolumes(
+ publication.getNumberOfVolumes()
+ );
+ propertiesStepModel.setVolume(publication.getVolume());
+ }
+
+ @POST
+ @Path("/properties")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ public String updateProperties(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @FormParam("languageOfPublication")
+ final String languageOfPublicationParam,
+ @FormParam("peerReviewed")
+ final String peerReviewedParam,
+ @FormParam("yearFirstPublished")
+ final String yearFirstPublishedParam,
+ @FormParam("isbn10")
+ final String isbn10,
+ @FormParam("isbn13")
+ final String isbn13,
+ @FormParam("numberOfPages")
+ final String numberOfPagesParam,
+ @FormParam("numberOfVolumes")
+ final String numberOfVolumesParam,
+ @FormParam("volume")
+ final String volumeParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getDocument())) {
+ super.updateProperties(
+ sectionIdentifier,
+ documentPath,
+ languageOfPublicationParam,
+ peerReviewedParam,
+ yearFirstPublishedParam
+ );
+
+ final P publication = getPublication();
+
+ publication.setIsbn10(isbn10);
+ publication.setIsbn13(isbn13);
+
+ final Integer numberOfPages = Optional
+ .ofNullable(numberOfPagesParam)
+ .filter(param -> param.matches("\\d*"))
+ .map(param -> Integer.parseInt(param))
+ .orElse(null);
+ publication.setNumberOfPages(numberOfPages);
+
+ final Integer numberOfVolumes = Optional
+ .ofNullable(numberOfVolumesParam)
+ .filter(param -> param.matches("\\d*"))
+ .map(param -> Integer.parseInt(param))
+ .orElse(null);
+ if (numberOfVolumes != null) {
+ publication.setNumberOfVolumes(numberOfVolumes);
+ }
+
+ final Integer volume = Optional
+ .ofNullable(volumeParam)
+ .filter(param -> param.matches("\\d*"))
+ .map(param -> Integer.parseInt(param))
+ .orElse(null);
+ if (volume != null) {
+ publication.setVolume(volume);
+ }
+
+ publicationRepo.save(publication);
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getDocument(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationWithPublisherPropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationWithPublisherPropertiesStep.java
index 4a7b2ca..ddee587 100644
--- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationWithPublisherPropertiesStep.java
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/AbstractPublicationWithPublisherPropertiesStep.java
@@ -6,7 +6,6 @@ import org.librecms.contentsection.Asset;
import org.librecms.contentsection.AssetRepository;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
-import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
@@ -31,31 +30,29 @@ import javax.ws.rs.PathParam;
* @param Subtype of {@link PublicationWithPublisherItem}
* @param Subtype of {@link PublicationWithPublisher}.
*/
-public abstract class AbstractPublicationWithPublisherPropertiesStep, P extends PublicationWithPublisher>
+public abstract class AbstractPublicationWithPublisherPropertiesStep, P extends PublicationWithPublisher>
extends AbstractPublicationPropertiesStep {
-
+
@Inject
private AssetRepository assetRepo;
-
+
@Inject
private DocumentUi documentUi;
-
+
@Inject
private IdentifierParser identifierParser;
-
+
@Inject
private ItemPermissionChecker itemPermissionChecker;
-
+
@Inject
private Models models;
-
+
@Inject
private PublisherManager publisherManager;
-
+
@Inject
private PublicationWithPublisherPropertiesStepModel propertiesStepModel;
-
-
@Override
@Transactional(Transactional.TxType.REQUIRED)
@@ -74,12 +71,12 @@ public abstract class AbstractPublicationWithPublisherPropertiesStep assetResult;
@@ -142,7 +139,7 @@ public abstract class AbstractPublicationWithPublisherPropertiesStep {
+
+ @Inject
+ private DocumentUi documentUi;
+
+ @Inject
+ private ItemPermissionChecker itemPermissionChecker;
+
+ @Inject
+ private MonographPropertiesStepModel propertiesStepModel;
+
+ @Inject
+ private SciPublicationsUiMessageBundle messageBundle;
-public class MonographPropertiesStep extends AbstractPublicationWithPublisherPropertiesStep{
-
@Override
public Class getStepClass() {
return MonographPropertiesStep.class;
}
-
+
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void init() throws ContentSectionNotFoundException,
DocumentNotFoundException {
super.init();
+ propertiesStepModel.setReviewed(
+ getPublication().getReviewed()
+ );
}
-
+
+ @Override
+ protected String getStepTemplatePath() {
+ return "/org/scientificcms/contenttypes/monograph/ui/edit-monograph.xhtml";
+ }
+
+ @POST()
+ @Path("/properties")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ public String updateProperties(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @FormParam("yearOfPublication")
+ final String yearOfPublicationParam,
+ @FormParam("reviewed")
+ final String reviewedParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getDocument())) {
+ updateProperties(
+ sectionIdentifier,
+ documentPath,
+ yearOfPublicationParam
+ );
+
+ getPublication().setReviewed(
+ Optional
+ .ofNullable(reviewedParam)
+ .map(param -> "true".equals(param) || "on".equals("param"))
+ .orElse(false)
+ );
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getDocument(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationAbstractStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationAbstractStep.java
new file mode 100644
index 0000000..cb37046
--- /dev/null
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationAbstractStep.java
@@ -0,0 +1,345 @@
+package org.scientificcms.publications.ui.contenttypes;
+
+import org.libreccm.l10n.GlobalizationHelper;
+import org.libreccm.security.AuthorizationRequired;
+import org.librecms.ui.contentsections.ContentSectionNotFoundException;
+import org.librecms.ui.contentsections.ItemPermissionChecker;
+import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
+import org.librecms.ui.contentsections.documents.CmsEditorUtil;
+import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
+import org.librecms.ui.contentsections.documents.DocumentUi;
+import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
+import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
+import org.scientificcms.publications.Publication;
+import org.scientificcms.publications.PublicationRepository;
+import org.scientificcms.publications.SciPublicationsConstants;
+import org.scientificcms.publications.contenttypes.PublicationItem;
+import org.scientificcms.publications.ui.SciPublicationsUiMessageBundle;
+
+import java.util.Locale;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.mvc.Controller;
+import javax.transaction.Transactional;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Path(MvcAuthoringSteps.PATH_PREFIX + "publication-abstract")
+@Controller
+@MvcAuthoringStepDef(
+ bundle = SciPublicationsConstants.BUNDLE,
+ descriptionKey = "authoringsteps.abstract.description",
+ labelKey = "authoringsteps.abstract.label",
+ supportedDocumentType = PublicationItem.class
+)
+public class PublicationAbstractStep extends AbstractMvcAuthoringStep {
+
+ @Inject
+ private DocumentUi documentUi;
+
+ @Inject
+ private GlobalizationHelper globalizationHelper;
+
+ @Inject
+ private ItemPermissionChecker itemPermissionChecker;
+
+ @Inject
+ private SciPublicationsUiMessageBundle messageBundle;
+
+ @Inject
+ private PublicationAbstractStepModel abstractStepModel;
+
+ @Inject
+ private PublicationRepository publicationRepo;
+
+ @Override
+ public Class getStepClass() {
+ return PublicationAbstractStep.class;
+ }
+
+ @GET
+ @Path("/")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String showStep(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ return "/org/scientificcms/contenttypes/publications/ui/publication/abstract.xhtml";
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @GET
+ @Path("/abstract/view/{locale}")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String viewAbstract(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @PathParam("locale") final String localeParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ abstractStepModel.setSelectedLocale(
+ new Locale(localeParam).toString()
+ );
+
+ return "/org/scientificcms/contenttypes/publications/ui/publication/abstract/view.xhtml";
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @POST
+ @Path("/abstract/add")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String addAbstractValue(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @FormParam("locale") final String localeParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ final String value;
+ if (getPublication().getPublicationAbstract().getAvailableLocales()
+ .isEmpty()) {
+ value = "";
+ } else {
+ value = globalizationHelper.getValueFromLocalizedString(
+ getPublication().getPublicationAbstract()
+ );
+ }
+
+ final Locale locale = new Locale(localeParam);
+ getPublication().getPublicationAbstract().putValue(locale, value);
+ publicationRepo.save(getPublication());
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @GET
+ @Path("/abstract/edit/{locale}")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String editAbstractValue(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @PathParam("locale") final String localeParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ abstractStepModel.setSelectedLocale(
+ new Locale(localeParam).toString()
+ );
+
+ return "/org/scientificcms/contenttypes/publications/ui/publication/abstract/edit.xhtml";
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @POST
+ @Path("/abstract/edit/{locale}")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String editAbstractValue(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @PathParam("locale") final String localeParam,
+ @FormParam("value")
+ final String value
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ final Locale locale = new Locale(localeParam);
+ getPublication().getPublicationAbstract().putValue(locale, value);
+ publicationRepo.save(getPublication());
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @POST
+ @Path("/abstract/remove/{locale}")
+ @Transactional(Transactional.TxType.REQUIRED)
+ @AuthorizationRequired
+ public String removeAbstractValue(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ @PathParam("locale") final String localeParam
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (DocumentNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (itemPermissionChecker.canEditItem(getPublicationItem())) {
+ final Locale locale = new Locale(localeParam);
+ getPublication().getPublicationAbstract().removeValue(locale);
+ publicationRepo.save(getPublication());
+
+ return buildRedirectPathForStep();
+ } else {
+ return documentUi.showAccessDenied(
+ getContentSection(),
+ getPublicationItem(),
+ messageBundle.getMessage("publication.edit.denied")
+ );
+ }
+ }
+
+ @Override
+ public void init() throws ContentSectionNotFoundException,
+ DocumentNotFoundException {
+ super.init();
+
+ final boolean canEdit = itemPermissionChecker.canEditItem(
+ getPublicationItem()
+ );
+ if (canEdit) {
+ abstractStepModel.setCanEdit(canEdit);
+ abstractStepModel.setAbstractValues(
+ getPublication()
+ .getPublicationAbstract()
+ .getValues()
+ .entrySet()
+ .stream()
+ .collect(
+ Collectors.toMap(
+ entry -> entry.getKey().toString(),
+ entry -> entry.getValue()
+ )
+ )
+ );
+ abstractStepModel.setVariants(
+ getPublication()
+ .getPublicationAbstract()
+ .getValues()
+ .entrySet()
+ .stream()
+ .map(CmsEditorUtil::buildVariantRow)
+ .collect(Collectors.toList())
+ );
+ }
+ final Set abstractLocales = getPublication()
+ .getPublicationAbstract()
+ .getAvailableLocales();
+ abstractStepModel.setUnusedLocales(
+ globalizationHelper
+ .getAvailableLocales()
+ .stream()
+ .filter(locale -> !abstractLocales.contains(locale))
+ .map(Locale::toString)
+ .collect(Collectors.toList())
+ );
+
+ }
+
+ private PublicationItem> getPublicationItem() {
+ return (PublicationItem>) getDocument();
+ }
+
+ private Publication getPublication() {
+ return getPublicationItem().getPublication();
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationPropertiesStepModel.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationPropertiesStepModel.java
index 3621683..bc0d43b 100644
--- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationPropertiesStepModel.java
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationPropertiesStepModel.java
@@ -25,6 +25,8 @@ public class PublicationPropertiesStepModel {
private List unusedTitleLocales;
+ private int yearOfPublication;
+
private Map shortDecriptionValues;
private List unusedShortDescriptionLocales;
@@ -54,6 +56,14 @@ public class PublicationPropertiesStepModel {
public void setUnusedTitleLocales(final List unusedTitleLocales) {
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
}
+
+ public int getYearOfPublication() {
+ return yearOfPublication;
+ }
+
+ public void setYearOfPublication(final int yearOfPublication) {
+ this.yearOfPublication = yearOfPublication;
+ }
public Map getShortDecriptionValues() {
return Collections.unmodifiableMap(shortDecriptionValues);
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtentedPropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtendedPropertiesStepModel.java
similarity index 94%
rename from sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtentedPropertiesStep.java
rename to sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtendedPropertiesStepModel.java
index 0f4e80c..1e2ceb8 100644
--- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtentedPropertiesStep.java
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/PublicationWithPublisherExtendedPropertiesStepModel.java
@@ -9,7 +9,7 @@ import javax.inject.Named;
*/
@RequestScoped
@Named("SciCmsPublicationWithPublisherExtendedPropertiesStep")
-public class PublicationWithPublisherExtentedPropertiesStep {
+public class PublicationWithPublisherExtendedPropertiesStepModel {
private String isbn10;
diff --git a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectDescriptionStep.java b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectDescriptionStep.java
index bfbf9b5..742e26b 100644
--- a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectDescriptionStep.java
+++ b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectDescriptionStep.java
@@ -186,8 +186,9 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
}
if (itemPermissionChecker.canEditItem(getProject())) {
- descriptionModel.setSelectedLocale(new Locale(localeParam)
- .toString());
+ descriptionModel.setSelectedLocale(
+ new Locale(localeParam).toString()
+ );
return "org/scientificcms/contenttypes/sciproject/ui/description/view.xhtml";
} else {