Andrew Grant 5 mesiacov pred
rodič
commit
feaa384b16

+ 27 - 0
src/main/java/scot/carricksoftware/grantswriter/constants/MappingConstants.java

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.constants;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class MappingConstants {
+
+    private MappingConstants() {
+        // to stop checkstyle complaining
+    }
+
+
+    public static final String SPECIFY_OUTPUT = "/output";
+
+    public static final String CREATE_TEX = "/tex";
+
+    public static final String BUILD_PDF = "/pdf";
+
+    public static final String PRINT = "/print";
+
+
+}

+ 20 - 0
src/main/java/scot/carricksoftware/grantswriter/constants/ViewConstants.java

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.constants;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class ViewConstants {
+
+    private ViewConstants() {
+        // to stop checkstyle complaining
+    }
+
+    public static final String NOT_AVAILABLE = "not-available";
+
+
+}

+ 31 - 0
src/main/java/scot/carricksoftware/grantswriter/controllers/IndexController.java

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 21/03/2025, 00:08. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grantswriter.controllers;
+
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import scot.carricksoftware.grantswriter.constants.MappingConstants;
+
+@SuppressWarnings("unused")
+
+public interface IndexController {
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.SPECIFY_OUTPUT)
+    String specifyOutput(Model model);
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.CREATE_TEX)
+    String createTex(Model model);
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.BUILD_PDF)
+    String buildPDF(Model model);
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.PRINT)
+    String print(Model model);
+}

+ 55 - 0
src/main/java/scot/carricksoftware/grantswriter/controllers/IndexControllerImpl.java

@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 21/03/2025, 00:08. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grantswriter.controllers;
+
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import scot.carricksoftware.grantswriter.constants.MappingConstants;
+import scot.carricksoftware.grantswriter.constants.ViewConstants;
+
+@Controller
+public class IndexControllerImpl implements IndexController {
+
+    private static final Logger logger = LogManager.getLogger(IndexControllerImpl.class);
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.SPECIFY_OUTPUT)
+    @Override
+    public final String specifyOutput(final Model model) {
+        logger.debug("IndexControllerImpl::specifyOutput");
+        return ViewConstants.NOT_AVAILABLE;
+    }
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.CREATE_TEX)
+    @Override
+    public final String createTex(final Model model) {
+        logger.debug("IndexControllerImpl::createTex");
+        return ViewConstants.NOT_AVAILABLE;
+    }
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.BUILD_PDF)
+    @Override
+    public String buildPDF(final Model model) {
+        logger.debug("IndexControllerImpl::buildPDF");
+        return ViewConstants.NOT_AVAILABLE;
+    }
+
+    @SuppressWarnings("SameReturnValue")
+    @GetMapping(MappingConstants.PRINT)
+    @Override
+    public String print(final Model model) {
+        logger.debug("IndexControllerImpl::print");
+        return ViewConstants.NOT_AVAILABLE;
+    }
+
+
+}

+ 25 - 0
src/main/resources/templates/not-available.html

@@ -0,0 +1,25 @@
+<!doctype html>
+<!--suppress HtmlUnknownTarget -->
+<html lang="en">
+<head>
+    <!-- Required meta tags -->
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+    <!-- Bootstrap CSS -->
+    <!--suppress SpellCheckingInspection -->
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
+          integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
+
+    <title>Grants Application - writer not available</title>
+</head>
+<body>
+
+<div th:insert="~{fragments/layout::banner}"></div>
+
+<div class="mx-auto" style="width:50%;text-align:center;">
+    <h1 id="pageHeader">Writer Starter Not Available </h1>
+</div>
+
+</body>
+</html>