diff --git a/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java b/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java
index e76c2bb..afe6073 100644
--- a/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java
+++ b/sci-publications/src/main/java/org/scientificcms/publications/assets/PublisherAsset.java
@@ -8,8 +8,11 @@ package org.scientificcms.publications.assets;
import org.hibernate.envers.Audited;
import org.librecms.assets.AssetType;
import org.librecms.contentsection.Asset;
+import org.librecms.ui.contentsections.assets.MvcAssetEditKit;
import org.scientificcms.publications.Publisher;
import org.scientificcms.publications.SciPublicationsConstants;
+import org.scientificcms.publications.ui.assets.PublisherCreateStep;
+import org.scientificcms.publications.ui.assets.PublisherEditStep;
import java.util.Objects;
@@ -36,6 +39,10 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
descriptionBundle = SciPublicationsConstants.BUNDLE,
descriptionKey = "publisher.description"
)
+@MvcAssetEditKit(
+ createStep = PublisherCreateStep.class,
+ editStep = PublisherEditStep.class
+)
public class PublisherAsset extends Asset {
private static final long serialVersionUID = 1L;
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/SciPublicationsUiConstants.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/SciPublicationsUiConstants.java
new file mode 100644
index 0000000..cb8a464
--- /dev/null
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/SciPublicationsUiConstants.java
@@ -0,0 +1,16 @@
+package org.scientificcms.publications.ui;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public final class SciPublicationsUiConstants {
+
+ public static final String BUNDLE
+ = "org.scientificcms.publications.ui.SciPublicationsBundle";
+
+ private SciPublicationsUiConstants() {
+ // Nothing
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherCreateStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherCreateStep.java
new file mode 100644
index 0000000..51ed13c
--- /dev/null
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherCreateStep.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2022 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.scientificcms.publications.ui.assets;
+
+import org.libreccm.l10n.GlobalizationHelper;
+import org.librecms.ui.contentsections.assets.AbstractMvcAssetCreateStep;
+import org.scientificcms.publications.Publisher;
+import org.scientificcms.publications.PublisherRepository;
+import org.scientificcms.publications.assets.PublisherAsset;
+import org.scientificcms.publications.ui.SciPublicationsUiConstants;
+
+import java.util.Map;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.transaction.Transactional;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Named("SciCmsPublisherCreateStep")
+public class PublisherCreateStep
+ extends AbstractMvcAssetCreateStep {
+
+ @Inject
+ private GlobalizationHelper globalizationHelper;
+
+ @Inject
+ private PublisherRepository publisherRepo;
+
+ @Override
+ public String showCreateStep() {
+ return "org/scientificcms/assets/publisher/ui/create-publisher.xhtml";
+ }
+
+ @Override
+ public String getLabel() {
+ return globalizationHelper
+ .getLocalizedTextsUtil(getBundle())
+ .getText("publisher.label");
+ }
+
+ @Override
+ public String getDescription() {
+ return globalizationHelper
+ .getLocalizedTextsUtil(getBundle())
+ .getText("publisher.description");
+ }
+
+ @Override
+ public String getBundle() {
+ return SciPublicationsUiConstants.BUNDLE;
+ }
+
+ @Override
+ protected Class getAssetClass() {
+ return PublisherAsset.class;
+ }
+
+ @Override
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected String setAssetProperties(
+ final PublisherAsset publisherAsset,
+ final Map formParams
+ ) {
+ final Publisher publisher = new Publisher();
+ publisher.setName(formParams.get("name")[0]);
+
+ if (formParams.get("place") != null
+ && formParams.get("place").length > 0) {
+ publisher.setPlace(formParams.get("place")[0]);
+ }
+ publisherRepo.save(publisher);
+
+ publisherAsset.setPublisher(publisher);
+
+ return String.format(
+ "redirect:/%s/assets/%s/%s/@publisher-edit",
+ getContentSectionLabel(),
+ getFolderPath(),
+ getName()
+ );
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStep.java
new file mode 100644
index 0000000..3d0ee01
--- /dev/null
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStep.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2022 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.scientificcms.publications.ui.assets;
+
+import org.libreccm.api.IdentifierParser;
+import org.libreccm.l10n.GlobalizationHelper;
+import org.libreccm.security.AuthorizationRequired;
+import org.librecms.contentsection.AssetRepository;
+import org.librecms.ui.contentsections.AssetPermissionsChecker;
+import org.librecms.ui.contentsections.ContentSectionNotFoundException;
+import org.librecms.ui.contentsections.assets.AbstractMvcAssetEditStep;
+import org.librecms.ui.contentsections.assets.AssetNotFoundException;
+import org.librecms.ui.contentsections.assets.AssetStepsDefaultMessagesBundle;
+import org.librecms.ui.contentsections.assets.AssetUi;
+import org.librecms.ui.contentsections.assets.MvcAssetEditStep;
+import org.librecms.ui.contentsections.assets.MvcAssetEditStepDef;
+import org.librecms.ui.contentsections.assets.MvcAssetEditSteps;
+import org.scientificcms.publications.Publisher;
+import org.scientificcms.publications.PublisherRepository;
+import org.scientificcms.publications.assets.PublisherAsset;
+import org.scientificcms.publications.ui.SciPublicationsUiConstants;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.mvc.Controller;
+import javax.mvc.Models;
+import javax.servlet.http.HttpServletRequest;
+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;
+import javax.ws.rs.core.Context;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Path(MvcAssetEditSteps.PATH_PREFIX + "publisher-edit")
+@Controller
+@MvcAssetEditStepDef(
+ bundle = SciPublicationsUiConstants.BUNDLE,
+ descriptionKey = "publisher.editstep.description",
+ labelKey = "publisher.editstep.label",
+ supportedAssetType = PublisherAsset.class
+)
+public class PublisherEditStep extends AbstractMvcAssetEditStep {
+
+ @Inject
+ private AssetPermissionsChecker assetPermissionsChecker;
+
+ @Inject
+ private AssetStepsDefaultMessagesBundle messageBundle;
+
+ @Inject
+ private AssetRepository assetRepo;
+
+ @Inject
+ private AssetUi assetUi;
+
+ private GlobalizationHelper globalizationHelper;
+
+ @Context
+ private HttpServletRequest request;
+
+ @Inject
+ private IdentifierParser identifierParser;
+
+ @Inject
+ private Models models;
+
+ @Inject
+ private PublisherRepository publisherRepo;
+
+ @Inject
+ private PublisherEditStepModel editStepModel;
+
+ @Override
+ public Class extends MvcAssetEditStep> getStepClass() {
+ return PublisherEditStep.class;
+ }
+
+ @Override
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void init() throws ContentSectionNotFoundException,
+ AssetNotFoundException {
+ super.init();
+
+ if (getAsset() instanceof PublisherAsset) {
+ final Publisher publisher = getPublisher();
+ editStepModel.setName(publisher.getName());
+ editStepModel.setPlace(publisher.getPlace());
+ } else {
+ throw new AssetNotFoundException(
+ assetUi.showAssetNotFound(
+ getContentSection(), getAssetPath()
+ ),
+ String.format(
+ "No PublisherAsset for path %s found in section %s.",
+ getAssetPath(),
+ getContentSection().getLabel()
+ )
+ );
+ }
+ }
+
+ protected PublisherAsset getPublisherAsset() {
+ return (PublisherAsset) getAsset();
+ }
+
+ protected Publisher getPublisher() {
+ return getPublisherAsset().getPublisher();
+ }
+
+ @GET
+ @Path("/")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ @Override
+ public String showStep(
+ @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME)
+ final String assetPath
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (AssetNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (assetPermissionsChecker.canEditAsset(getAsset())) {
+ return "org/scientificcms/assets/publisher/ui/edit-publisher.xhtml";
+ } else {
+ return assetUi.showAccessDenied(
+ getContentSection(),
+ getAsset(),
+ messageBundle.get("asset.edit.denied"));
+ }
+ }
+
+ @POST
+ @Path("/properties")
+ @AuthorizationRequired
+ @Transactional(Transactional.TxType.REQUIRED)
+ public String updateProperties(
+ @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME)
+ final String assetPath,
+ @FormParam("name")
+ final String name,
+ @FormParam("place")
+ final String place
+ ) {
+ try {
+ init();
+ } catch (ContentSectionNotFoundException ex) {
+ return ex.showErrorMessage();
+ } catch (AssetNotFoundException ex) {
+ return ex.showErrorMessage();
+ }
+
+ if (assetPermissionsChecker.canEditAsset(getAsset())) {
+ final PublisherAsset publisherAsset = getPublisherAsset();
+ final Publisher publisher = getPublisher();
+
+ publisherAsset.setDisplayName(name);
+ publisher.setName(name);
+ publisher.setPlace(place);
+
+ assetRepo.save(publisherAsset);
+ publisherRepo.save(publisher);
+
+ return buildRedirectPathForStep();
+ } else {
+ return assetUi.showAccessDenied(
+ getContentSection(),
+ getAsset(),
+ messageBundle.get("asset.edit.denied"));
+ }
+ }
+
+}
diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStepModel.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStepModel.java
new file mode 100644
index 0000000..0a5cd4e
--- /dev/null
+++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/assets/PublisherEditStepModel.java
@@ -0,0 +1,36 @@
+package org.scientificcms.publications.ui.assets;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Named("SciCmsPublisherEditStepModel")
+public class PublisherEditStepModel {
+
+ private String name;
+
+ private String place;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getPlace() {
+ return place;
+ }
+
+ public void setPlace(final String place) {
+ this.place = place;
+ }
+
+
+
+}
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
new file mode 100644
index 0000000..7f77a23
--- /dev/null
+++ b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle.properties
@@ -0,0 +1,3 @@
+
+publisher.label=Publisher
+publisher.description=A publisher record that holds the information about a publisher.
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
new file mode 100644
index 0000000..670c21b
--- /dev/null
+++ b/sci-publications/src/main/resources/org/scientificcms/publications/ui/SciPublicationsBundle_de.properties
@@ -0,0 +1,3 @@
+
+publisher.label=Verlag
+publisher.description=Ein Verlag.
diff --git a/scicms-bundle-devel-wildfly/pom.xml b/scicms-bundle-devel-wildfly/pom.xml
index 420a16a..ac6d97a 100644
--- a/scicms-bundle-devel-wildfly/pom.xml
+++ b/scicms-bundle-devel-wildfly/pom.xml
@@ -54,11 +54,11 @@
ccm-cms-js
7.0.0-SNAPSHOT
-->
-
+
@@ -222,14 +222,14 @@
templates/
-
+
org.scientificcms
sci-types-project