From 6c0986d70b5e97bf3106e5f3c0adbbdd47b32fbb Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Thu, 21 Jul 2022 20:24:26 +0200 Subject: [PATCH] Additional authoring steps for Collected Volume and Article in Collected Volume (Java Part) --- .../ArticleInCollectedVolumeItem.java | 15 + .../contenttypes/CollectedVolumeItem.java | 23 +- ...rticleInCollectedVolumeItemCreateStep.java | 55 ++ ...rticleInCollectedVolumePropertiesStep.java | 499 ++++++++++++++++++ ...eInCollectedVolumePropertiesStepModel.java | 54 ++ .../CollectedVolumeItemCreateStep.java | 55 ++ .../contenttypes/MonographPropertiesStep.java | 12 +- .../ui/SciPublicationsBundle.properties | 2 + .../ui/SciPublicationsBundle_de.properties | 2 + 9 files changed, 705 insertions(+), 12 deletions(-) create mode 100644 sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeItemCreateStep.java create mode 100644 sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java create mode 100644 sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStepModel.java create mode 100644 sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumeItemCreateStep.java diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ArticleInCollectedVolumeItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ArticleInCollectedVolumeItem.java index fd38093..09714eb 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ArticleInCollectedVolumeItem.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/ArticleInCollectedVolumeItem.java @@ -8,7 +8,13 @@ package org.scientificcms.publications.contenttypes; import org.hibernate.envers.Audited; import org.librecms.contenttypes.ContentTypeDescription; +import org.librecms.ui.contentsections.documents.MvcAuthoringKit; import org.scientificcms.publications.ArticleInCollectedVolume; +import org.scientificcms.publications.ui.contenttypes.ArticleInCollectedVolumeExtendedPropertiesStep; +import org.scientificcms.publications.ui.contenttypes.ArticleInCollectedVolumeItemCreateStep; +import org.scientificcms.publications.ui.contenttypes.ArticleInCollectedVolumePropertiesStep; +import org.scientificcms.publications.ui.contenttypes.PublicationAbstractStep; +import org.scientificcms.publications.ui.contenttypes.PublicationMiscStep; import javax.persistence.Entity; import javax.persistence.Table; @@ -26,6 +32,15 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; labelBundle = "org.scientificcms.publications.contenttypes.ArticleInCollectedVolume", descriptionBundle = "org.scientificcms.publications.contenttypes.ArticleInCollectedVolume" ) +@MvcAuthoringKit( + createStep = ArticleInCollectedVolumeItemCreateStep.class, + authoringSteps = { + ArticleInCollectedVolumePropertiesStep.class, + ArticleInCollectedVolumeExtendedPropertiesStep.class, + PublicationAbstractStep.class, + PublicationMiscStep.class + } +) public class ArticleInCollectedVolumeItem extends PublicationItem { diff --git a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java index 5d1de06..1c42c35 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/contenttypes/CollectedVolumeItem.java @@ -5,10 +5,15 @@ */ package org.scientificcms.publications.contenttypes; - import org.hibernate.envers.Audited; import org.librecms.contenttypes.ContentTypeDescription; +import org.librecms.ui.contentsections.documents.MvcAuthoringKit; import org.scientificcms.publications.CollectedVolume; +import org.scientificcms.publications.ui.contenttypes.CollectedVolumeExtendedPropertiesStep; +import org.scientificcms.publications.ui.contenttypes.CollectedVolumeItemCreateStep; +import org.scientificcms.publications.ui.contenttypes.CollectedVolumePropertiesStep; +import org.scientificcms.publications.ui.contenttypes.PublicationAbstractStep; +import org.scientificcms.publications.ui.contenttypes.PublicationMiscStep; import javax.persistence.Entity; import javax.persistence.Table; @@ -24,7 +29,17 @@ import static org.scientificcms.publications.SciPublicationsConstants.*; @Audited @ContentTypeDescription( labelBundle = "org.scientificcms.publications.contenttypes.CollectedVolume", - descriptionBundle = "org.scientificcms.publications.contenttypes.CollectedVolume" + descriptionBundle + = "org.scientificcms.publications.contenttypes.CollectedVolume" +) +@MvcAuthoringKit( + createStep = CollectedVolumeItemCreateStep.class, + authoringSteps = { + CollectedVolumePropertiesStep.class, + CollectedVolumeExtendedPropertiesStep.class, + PublicationAbstractStep.class, + PublicationMiscStep.class + } ) public class CollectedVolumeItem extends PublicationWithPublisherItem { @@ -48,7 +63,6 @@ public class CollectedVolumeItem // protected void setPublication(final CollectedVolume collectedVolume) { // this.collectedVolume = collectedVolume; // } - @Override public int hashCode() { int hash = super.hashCode(); @@ -75,7 +89,7 @@ public class CollectedVolumeItem // return false; // } // return Objects.equals(collectedVolume, other.getPublication()); -return other.canEqual(this); + return other.canEqual(this); } @Override @@ -89,5 +103,4 @@ return other.canEqual(this); // Objects.toString(collectedVolume), // data)); // } - } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeItemCreateStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeItemCreateStep.java new file mode 100644 index 0000000..202a51c --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeItemCreateStep.java @@ -0,0 +1,55 @@ +package org.scientificcms.publications.ui.contenttypes; + +import org.libreccm.l10n.GlobalizationHelper; +import org.scientificcms.publications.ArticleInCollectedVolume; +import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("SciPublicationsArticleInCollectedVolumeCreateStep") +public class ArticleInCollectedVolumeItemCreateStep +extends AbstractPublicationItemCreateStep{ + + @Inject + private GlobalizationHelper globalizationHelper; + + @Override + public String getDocumentType() { + return ArticleInCollectedVolumeItem.class.getName(); + } + + @Override + public String getDescription() { + return globalizationHelper + .getLocalizedTextsUtil(getBundle()) + .getText("articleincollectedvolumeitem.createstep.description"); + } + + @Override + public String showCreateStep() { + return "org/scientificcms/contenttypes/ui/articleincollectedvolume/create-articleincollectedvolume.xhtml"; + } + + @Override + public Class getPublicationItemClass() { + return ArticleInCollectedVolumeItem.class; + } + + @Override + public ArticleInCollectedVolume createPublication() { + return new ArticleInCollectedVolume(); + } + + @Override + protected String getEditStepName() { + return ArticleInCollectedVolumePropertiesStep.EDIT_STEP_URL_FRAGMENT; + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java new file mode 100644 index 0000000..3e5c809 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java @@ -0,0 +1,499 @@ +package org.scientificcms.publications.ui.contenttypes; + +import org.libreccm.api.Identifier; +import org.libreccm.api.IdentifierParser; +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.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.ArticleInCollectedVolume; +import org.scientificcms.publications.ArticleInCollectedVolumeManager; +import org.scientificcms.publications.CollectedVolume; +import org.scientificcms.publications.PublicationRepository; +import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem; +import org.scientificcms.publications.ui.SciPublicationsUiConstants; +import org.scientificcms.publications.ui.SciPublicationsUiMessageBundle; + +import java.util.Optional; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.mvc.Controller; +import javax.mvc.Models; +import javax.transaction.Transactional; +import javax.ws.rs.DefaultValue; +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 + + ArticleInCollectedVolumePropertiesStep.EDIT_STEP_URL_FRAGMENT +) +@Controller +@MvcAuthoringStepDef( + bundle = SciPublicationsUiConstants.BUNDLE, + descriptionKey = "authoringsteps.basicproperties.description", + labelKey = "authoringsteps.basicproperties.label", + supportedDocumentType = ArticleInCollectedVolumeItem.class +) +public class ArticleInCollectedVolumePropertiesStep + extends AbstractPublicationPropertiesStep { + + public static final String EDIT_STEP_URL_FRAGMENT + = "articleincollectedvolume"; + + @Inject + private ArticleInCollectedVolumeManager articleManager; + + @Inject + private DocumentUi documentUi; + + @Inject + private GlobalizationHelper globalizationHelper; + + @Inject + private IdentifierParser identifierParser; + + @Inject + private ItemPermissionChecker itemPermissionChecker; + + @Inject + private Models models; + + @Inject + private ArticleInCollectedVolumePropertiesStepModel propertiesStepModel; + + @Inject + private PublicationRepository publicationRepo; + + @Inject + private SciPublicationsUiMessageBundle messageBundle; + + @Override + public Class getStepClass() { + return ArticleInCollectedVolumePropertiesStep.class; + } + + @Override + protected String getEditStepUrlFragment() { + return EDIT_STEP_URL_FRAGMENT; + } + + @Override + protected String getStepTemplatePath() { + return "org/scientificcms/contenttypes/ui/articleincollectedvolume/edit-articleincollectedvolume.xhtml"; + } + + @Override + public Class getPublicationClass() { + return ArticleInCollectedVolume.class; + } + + @Override + @Transactional(Transactional.TxType.REQUIRED) + protected void init() throws ContentSectionNotFoundException, + DocumentNotFoundException { + super.init(); + + propertiesStepModel.setChapter(getPublication().getChapter()); + + propertiesStepModel.setCollectedVolumeTitle( + globalizationHelper.getValueFromLocalizedString( + getPublication().getTitle()) + ); + + propertiesStepModel.setEndPage(getPublication().getEndPage()); + propertiesStepModel.setStartPage(getPublication().getStartPage()); + } + + @GET + @Path("/") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String showStep( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath + ) { + return super.showStep(sectionIdentifier, documentPath); + } + + @POST + @Path("/name") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String updateName( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @FormParam("name") @DefaultValue("") + final String name + ) { + return super.updateName(sectionIdentifier, documentPath, name); + } + + @POST + @Path("/title/@add") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String addTitle( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @FormParam("locale") final String localeParam, + @FormParam("value") final String value + ) { + return super.addTitle( + sectionIdentifier, + documentPath, + localeParam, + value + ); + } + + @POST + @Path("/title/@edit/{locale}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String editTitle( + @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 + ) { + return super.editTitle( + sectionIdentifier, + documentPath, + localeParam, + value + ); + } + + @POST + @Path("/title/@remove/{locale}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String removeTitle( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @PathParam("locale") final String localeParam + ) { + return super.removeTitle(sectionIdentifier, documentPath, localeParam); + } + + @POST + @Path("/shortdescription/@add") + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String addShortDescription( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @FormParam("locale") final String localeParam, + @FormParam("value") final String value + ) { + return super.addShortDescription( + sectionIdentifier, + documentPath, + localeParam, + value + ); + } + + @POST + @Path("/shortdescription/@edit/{locale}") + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String editShortDescription( + @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 + ) { + return super.editShortDescription( + sectionIdentifier, + documentPath, + localeParam, + value + ); + } + + @POST + @Path("/shortdescription/@remove/{locale}") + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String removeShortDescription( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @PathParam("locale") final String localeParam + ) { + return super.removeShortDescription( + sectionIdentifier, + documentPath, + localeParam + ); + } + + @POST + @Path("/authors") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String addAuthor( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @FormParam("authorIdentifier") + final String authorIdentifier, + @FormParam("editor") + final String editorParam + ) { + return super.addAuthor( + sectionIdentifier, + documentPath, + authorIdentifier, + editorParam + ); + } + + @POST + @Path("/authors/{authorshipUuid}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String editAuthorship( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @PathParam("authorshipUuid") + final String authorshipUuid, + @FormParam("editor") + final String editorParam + ) { + return super.editAuthorship( + sectionIdentifier, + documentPath, + authorshipUuid, + editorParam + ); + } + + @POST + @Path("/authors/{authorshipUuid}/remove") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String removeAuthorship( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @PathParam("authorshipUuid") + final String authorshipUuid + ) { + return super.removeAuthorship( + sectionIdentifier, + documentPath, + authorshipUuid + ); + } + + @POST + @Path("/collectedvolume") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String setCollectedVolume( + @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) + final String documentPath, + @FormParam("collectedVolumeIdentifier") + final String collectedVolumeIdentifier + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (DocumentNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (itemPermissionChecker.canEditItem(getDocument())) { + final Identifier identifier = identifierParser.parseIdentifier( + collectedVolumeIdentifier + ); + final Optional collectedVolumeResult; + switch (identifier.getType()) { + case ID: + collectedVolumeResult = publicationRepo.findByIdAndType( + Long.parseLong(identifier.getIdentifier()), + CollectedVolume.class + ); + break; + case UUID: + collectedVolumeResult = publicationRepo + .findByUuidAndType( + identifier.getIdentifier(), + CollectedVolume.class + ); + break; + default: + collectedVolumeResult = Optional.empty(); + break; + } + + if (collectedVolumeResult.isEmpty()) { + return showCollectedVolumeNotFound( + sectionIdentifier, + documentPath, + collectedVolumeIdentifier + ); + } + + final CollectedVolume collectedVolume = collectedVolumeResult.get(); + articleManager.setCollectedVolume( + getPublication(), + collectedVolume + ); + + return buildRedirectPathForStep(); + } else { + return documentUi.showAccessDenied( + getContentSection(), + getDocument(), + getLabel() + ); + } + } + + @POST + @Path("/collectedvolume/remove") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String removeArticle( + @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())) { + articleManager.unsetCollectedVolume(getPublication()); + + return buildRedirectPathForStep(); + } else { + return documentUi.showAccessDenied( + getContentSection(), + getDocument(), + getLabel() + ); + } + } + + @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, + @FormParam("chapter") + final String chapter, + @FormParam("startPage") + final String startPageParam, + @FormParam("endPage") + final String endPageParam + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (DocumentNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (itemPermissionChecker.canEditItem(getDocument())) { + updateProperties( + sectionIdentifier, + documentPath, + yearOfPublicationParam + ); + + getPublication().setChapter(chapter); + + if (endPageParam.matches("\\d*")) { + getPublication().setEndPage( + Integer.parseInt(endPageParam) + ); + } + + if (startPageParam.matches("\\d*")) { + getPublication().setStartPage( + Integer.parseInt(startPageParam) + ); + } + + return buildRedirectPathForStep(); + } else { + return documentUi.showAccessDenied( + getContentSection(), + getDocument(), + messageBundle.getMessage("publication.edit.denied") + ); + } + } + + private String showCollectedVolumeNotFound( + final String sectionIdentifier, + final String documentPath, + final String collectedVolumeIdentifier + ) { + models.put("articleNotFound", collectedVolumeIdentifier); + return showStep(sectionIdentifier, documentPath); + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStepModel.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStepModel.java new file mode 100644 index 0000000..5b4def4 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStepModel.java @@ -0,0 +1,54 @@ +package org.scientificcms.publications.ui.contenttypes; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("SciCmsArticleInCollectedVolumePropertiesStepModel") +public class ArticleInCollectedVolumePropertiesStepModel { + + private String collectedVolumeTitle; + + private Integer startPage; + + private Integer endPage; + + private String chapter; + + public String getCollectedVolumeTitle() { + return collectedVolumeTitle; + } + + public void setCollectedVolumeTitle(final String collectedVolumeTitle) { + this.collectedVolumeTitle = collectedVolumeTitle; + } + + public Integer getStartPage() { + return startPage; + } + + public void setStartPage(final Integer startPage) { + this.startPage = startPage; + } + + public Integer getEndPage() { + return endPage; + } + + public void setEndPage(final Integer endPage) { + this.endPage = endPage; + } + + public String getChapter() { + return chapter; + } + + public void setChapter(final String chapter) { + this.chapter = chapter; + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumeItemCreateStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumeItemCreateStep.java new file mode 100644 index 0000000..d5a1fd8 --- /dev/null +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumeItemCreateStep.java @@ -0,0 +1,55 @@ +package org.scientificcms.publications.ui.contenttypes; + +import org.libreccm.l10n.GlobalizationHelper; +import org.scientificcms.publications.CollectedVolume; +import org.scientificcms.publications.contenttypes.CollectedVolumeItem; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("SciPublicationsCollecetedVolumeCreateStep") +public class CollectedVolumeItemCreateStep + extends AbstractPublicationWithPublisherItemCreateStep { + + @Inject + private GlobalizationHelper globalizationHelper; + + @Override + public String getDocumentType() { + return CollectedVolumeItem.class.getName(); + } + + @Override + public String getDescription() { + return globalizationHelper + .getLocalizedTextsUtil(getBundle()) + .getText("collectedvolume.createstep.description"); + } + + @Override + public String showCreateStep() { + return "org/scientificcms/contenttypes/ui/collectedvolue/create-collectedvolume.xhtml"; + } + + @Override + public Class getPublicationItemClass() { + return CollectedVolumeItem.class; + } + + @Override + public CollectedVolume createPublication() { + return new CollectedVolume(); + } + + @Override + protected String getEditStepName() { + return CollectedVolumePropertiesStep.EDIT_STEP_URL_FRAGMENT; + } + +} diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/MonographPropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/MonographPropertiesStep.java index 4fb6cf1..2dd0688 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/MonographPropertiesStep.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/MonographPropertiesStep.java @@ -62,6 +62,11 @@ public class MonographPropertiesStep extends AbstractPublicationWithPublisherPro return "monograph-basicproperties"; } + @Override + protected String getStepTemplatePath() { + return "org/scientificcms/contenttypes/ui/monograph/edit-monograph.xhtml"; + } + @Override public Class getPublicationClass() { return Monograph.class; @@ -110,8 +115,6 @@ public class MonographPropertiesStep extends AbstractPublicationWithPublisherPro return super.updateName(sectionIdentifier, documentPath, name); } - - @POST @Path("/title/@add") @AuthorizationRequired @@ -327,11 +330,6 @@ public class MonographPropertiesStep extends AbstractPublicationWithPublisherPro return super.removePublisher(sectionIdentifier, documentPath); } - @Override - protected String getStepTemplatePath() { - return "org/scientificcms/contenttypes/ui/monograph/edit-monograph.xhtml"; - } - @POST() @Path("/properties") @AuthorizationRequired diff --git a/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle.properties b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle.properties index 6873c11..b536658 100644 --- a/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle.properties +++ b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle.properties @@ -429,3 +429,5 @@ publicationpicker.select=Select publicationpicker.column.name=Name publicationpicker.column.type=Type publicationpicker.column.action=Action +articleincollectedvolumeitem.createstep.description=Create a new article in a collected volume. +collectedvolume.createstep.description=Create a new collected volume. diff --git a/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle_de.properties b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle_de.properties index c8b7f00..dda95c7 100644 --- a/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle_de.properties +++ b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle_de.properties @@ -429,3 +429,5 @@ publicationpicker.select=Ausw\u00e4hlen publicationpicker.column.name=Name publicationpicker.column.type=Typ publicationpicker.column.action=Aktion +articleincollectedvolumeitem.createstep.description=Einen neuen Sammelbandartikel anlegen. +collectedvolume.createstep.description=Einen neuen Sammelband anlegen.