diff --git a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java
index 6ad132aed..f46434f2e 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java
@@ -6,6 +6,7 @@
package org.librecms.ui;
import org.libreccm.security.AuthorizationRequired;
+import org.librecms.contentsection.ContentSectionRepository;
import java.net.URI;
import java.net.URISyntaxException;
@@ -16,6 +17,7 @@ import javax.mvc.Controller;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
@@ -29,9 +31,12 @@ import javax.ws.rs.core.Response;
@Path("/")
public class ContentSectionsController {
+ @Inject
+ private ContentSectionRepository sectionRepo;
+
@Inject
private HttpServletRequest request;
-
+
@Inject
private ServletContext servletContext;
@@ -83,4 +88,20 @@ public class ContentSectionsController {
return "org/librecms/ui/content-sections/search.xhtml";
}
+ @GET
+ @Path("/{sectionIdentifier}/details")
+ public String getContentSectionDetails() {
+ throw new WebApplicationException(
+ Response.status(Response.Status.NOT_FOUND).build()
+ );
+ }
+
+ @POST
+ @Path("/new")
+ public String createContentSection() {
+ throw new WebApplicationException(
+ Response.status(Response.Status.NOT_FOUND).build()
+ );
+ }
+
}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java
new file mode 100644
index 000000000..6f4c44046
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import org.libreccm.security.AuthorizationRequired;
+import org.librecms.contentsection.ContentSection;
+import org.librecms.contentsection.ContentSectionRepository;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.transaction.Transactional;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@Named("ContentSectionsTableModel")
+public class ContentSectionsTableModel {
+
+ @Inject
+ private ContentSectionRepository sectionRepo;
+
+ @AuthorizationRequired
+ @Transactional
+ public List getContentSections() {
+ return sectionRepo
+ .findAll()
+ .stream()
+ .map(this::buildTableRow)
+ .sorted()
+ .collect(Collectors.toList());
+ }
+
+ private ContentSectionsTableRow buildTableRow(
+ final ContentSection section
+ ) {
+ final ContentSectionsTableRow row = new ContentSectionsTableRow();
+
+ row.setSectionId(section.getObjectId());
+ row.setLabel(section.getLabel());
+
+ return row;
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableRow.java b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableRow.java
new file mode 100644
index 000000000..cf51ac49f
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableRow.java
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import java.util.Objects;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class ContentSectionsTableRow implements
+ Comparable {
+
+ private long sectionId;
+
+ private String label;
+
+ public long getSectionId() {
+ return sectionId;
+ }
+
+ public void setSectionId(final long sectionId) {
+ this.sectionId = sectionId;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(final String label) {
+ this.label = label;
+ }
+
+ @Override
+ public int compareTo(final ContentSectionsTableRow other) {
+ int result;
+ result = Objects.compare(
+ label, other.getLabel(), String::compareTo
+ );
+
+ if (result == 0) {
+ result = Objects.compare(
+ sectionId, other.getSectionId(), Long::compareTo
+ );
+ }
+
+ return result;
+ }
+
+}
diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/create.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/create.xhtml
new file mode 100644
index 000000000..e7cff7ca4
--- /dev/null
+++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/create.xhtml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+