diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ItemAttachmentManager.java b/ccm-cms/src/main/java/org/librecms/contentsection/ItemAttachmentManager.java
index 236c974ac..c15a5c838 100644
--- a/ccm-cms/src/main/java/org/librecms/contentsection/ItemAttachmentManager.java
+++ b/ccm-cms/src/main/java/org/librecms/contentsection/ItemAttachmentManager.java
@@ -65,6 +65,15 @@ public class ItemAttachmentManager {
return Optional.empty();
}
}
+
+ @Transactional(Transactional.TxType.REQUIRED)
+ public void save(final ItemAttachment> attachment) {
+ if (attachment.getAttachmentId() == 0) {
+ entityManager.persist(attachment);
+ } else {
+ entityManager.merge(attachment);
+ }
+ }
/**
* Adds the provided {@link Asset} to the provided {@link AttachmentList}.
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepAttachmentOrder.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepAttachmentOrder.java
new file mode 100644
index 000000000..c4f3a1eed
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepAttachmentOrder.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 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.librecms.ui.contentsections.documents;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class RelatedInfoStepAttachmentOrder {
+
+ private List attachmentListsOrder;
+
+ private Map> attachmentsOrder;
+
+ public List getAttachmentListsOrder() {
+ return Collections.unmodifiableList(attachmentListsOrder);
+ }
+
+ public void setAttachmentListsOrder(final List attachmentListsOrder) {
+ this.attachmentListsOrder = new ArrayList<>(attachmentListsOrder);
+ }
+
+ public Map> getAttachmentsOrder() {
+ return Collections.unmodifiableMap(attachmentsOrder);
+ }
+
+ public void setAttachmentsOrder(
+ final Map> attachmentsOrder
+ ) {
+ this.attachmentsOrder = attachmentsOrder
+ .entrySet()
+ .stream()
+ .collect(
+ Collectors.toMap(
+ entry -> entry.getKey(),
+ entry -> new ArrayList<>(entry.getValue())
+ )
+ );
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "attachmentListsOrder = %s, "
+ + "attachmentsOrder = %s",
+ Objects.toString(attachmentListsOrder),
+ Objects.toString(attachmentsOrder)
+ );
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepService.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepService.java
new file mode 100644
index 000000000..684dd5c85
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepService.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2021 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.librecms.ui.contentsections.documents;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.librecms.contentsection.AttachmentListRepository;
+import org.librecms.contentsection.ContentItemRepository;
+import org.librecms.contentsection.ItemAttachmentManager;
+import org.librecms.ui.contentsections.ContentSectionsUi;
+import org.w3c.dom.events.Event;
+
+import java.util.Objects;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Path(MvcAuthoringSteps.PATH_PREFIX + "relatedinfo")
+public class RelatedInfoStepService {
+
+ private static final Logger LOGGER = LogManager.getLogger(
+ RelatedInfoStepService.class
+ );
+
+ @Inject
+ private AttachmentListRepository attachmentListRepo;
+
+ @Inject
+ private ItemAttachmentManager attachmentManager;
+
+ @Inject
+ private ContentItemRepository itemRepo;
+
+ @Inject
+ private ContentSectionsUi sectionsUi;
+
+ public Response saveOrder(
+ @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
+ final String sectionIdentifier,
+ @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
+ final String documentPath,
+ final RelatedInfoStepAttachmentOrder order
+ ) {
+ LOGGER.info("order = {}", order);
+
+ return Response.ok().build();
+
+// final ContentSection contentSection = sectionsUi
+// .findContentSection(sectionIdentifier)
+// .orElseThrow(
+// () -> new NotFoundException(
+// String.format(
+// "No content identifed by %s found.",
+// sectionIdentifier
+// )
+// )
+// );
+//
+// final ContentItem document = itemRepo
+// .findByPath(contentSection, documentPath)
+// .orElseThrow(
+// () -> new NotFoundException(
+// String.format(
+// "No document for path %s in section %s.",
+// documentPath,
+// contentSection.getLabel()
+// )
+// )
+// );
+//
+// //final Map attachmentListIndexes =
+ }
+
+}
diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documents/relatedinfo.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documents/relatedinfo.xhtml
index 37b274494..ae0970c14 100644
--- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documents/relatedinfo.xhtml
+++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documents/relatedinfo.xhtml
@@ -15,14 +15,6 @@
#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.add.button.label']}
-