bloat removal 3/3 - LightPITModule annotation and ModuleManager

Sat, 23 May 2020 14:13:09 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 23 May 2020 14:13:09 +0200
changeset 79
f64255a88d66
parent 78
bb4c52bf3439
child 80
27a25f32048e

bloat removal 3/3 - LightPITModule annotation and ModuleManager

src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/LightPITModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/MenuEntry.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/ModuleManager.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ErrorModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/LanguageModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/UsersModule.java file | annotate | diff | comparison | revisions
src/main/resources/localization/language.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/language_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/lightpit.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/lightpit_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/projects.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/projects_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/users.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/users_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/index.jsp file | annotate | diff | comparison | revisions
     1.1 --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat May 23 13:52:04 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat May 23 14:13:09 2020 +0200
     1.3 @@ -50,7 +50,7 @@
     1.4  
     1.5  /**
     1.6   * A special implementation of a HTTPServlet which is focused on implementing
     1.7 - * the necessary functionality for {@link LightPITModule}s.
     1.8 + * the necessary functionality for LightPIT pages.
     1.9   */
    1.10  public abstract class AbstractLightPITServlet extends HttpServlet {
    1.11  
    1.12 @@ -90,15 +90,6 @@
    1.13      private final Map<HttpMethod, Map<String, Method>> mappings = new HashMap<>();
    1.14  
    1.15      /**
    1.16 -     * Gives implementing modules access to the {@link ModuleManager}.
    1.17 -     *
    1.18 -     * @return the module manager
    1.19 -     */
    1.20 -    protected final ModuleManager getModuleManager() {
    1.21 -        return (ModuleManager) getServletContext().getAttribute(ModuleManager.SC_ATTR_NAME);
    1.22 -    }
    1.23 -
    1.24 -    /**
    1.25       * Returns the name of the resource bundle associated with this servlet.
    1.26       * @return the resource bundle base name
    1.27       */
    1.28 @@ -332,7 +323,12 @@
    1.29      private void forwardToFullView(HttpServletRequest req, HttpServletResponse resp)
    1.30              throws IOException, ServletException {
    1.31  
    1.32 -        final var mainMenu = new ArrayList<MenuEntry>(getModuleManager().getMainMenu());
    1.33 +        final String lightpitBundle = "localization.lightpit";
    1.34 +        final var mainMenu = List.of(
    1.35 +                new MenuEntry(new ResourceKey(lightpitBundle, "menu.projects"), "projects/"),
    1.36 +                new MenuEntry(new ResourceKey(lightpitBundle, "menu.users"), "teams/"),
    1.37 +                new MenuEntry(new ResourceKey(lightpitBundle, "menu.languages"), "language/")
    1.38 +        );
    1.39          for (var entry : mainMenu) {
    1.40              if (Functions.fullPath(req).startsWith("/" + entry.getPathName())) {
    1.41                  entry.setActive(true);
     2.1 --- a/src/main/java/de/uapcore/lightpit/LightPITModule.java	Sat May 23 13:52:04 2020 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,101 +0,0 @@
     2.4 -/*
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2018 Mike Becker. All rights reserved.
     2.8 - *
     2.9 - * Redistribution and use in source and binary forms, with or without
    2.10 - * modification, are permitted provided that the following conditions are met:
    2.11 - *
    2.12 - *   1. Redistributions of source code must retain the above copyright
    2.13 - *      notice, this list of conditions and the following disclaimer.
    2.14 - *
    2.15 - *   2. Redistributions in binary form must reproduce the above copyright
    2.16 - *      notice, this list of conditions and the following disclaimer in the
    2.17 - *      documentation and/or other materials provided with the distribution.
    2.18 - *
    2.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    2.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    2.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    2.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    2.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    2.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    2.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    2.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    2.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2.29 - * POSSIBILITY OF SUCH DAMAGE.
    2.30 - *
    2.31 - */
    2.32 -package de.uapcore.lightpit;
    2.33 -
    2.34 -import javax.servlet.annotation.WebServlet;
    2.35 -import java.lang.annotation.*;
    2.36 -
    2.37 -
    2.38 -/**
    2.39 - * Contains information about a LightPIT module.
    2.40 - * <p>
    2.41 - * This annotation is typically used to annotate the {@link WebServlet} which
    2.42 - * implements the module's functionality.
    2.43 - */
    2.44 -@Documented
    2.45 -@Retention(RetentionPolicy.RUNTIME)
    2.46 -@Target(ElementType.TYPE)
    2.47 -public @interface LightPITModule {
    2.48 -    /**
    2.49 -     * Base name of the module specific resource bundle.
    2.50 -     *
    2.51 -     * @return a base name suitable for the JSTL tag 'setBundle'.
    2.52 -     */
    2.53 -    String bundleBaseName();
    2.54 -
    2.55 -    /**
    2.56 -     * The path for this module, which will also be used for the menu entry.
    2.57 -     * <p>
    2.58 -     * This path must adhere to the URL pattern of the Servlet but must not
    2.59 -     * contain any starting or trailing slashes.
    2.60 -     *
    2.61 -     * @return the relative module path
    2.62 -     */
    2.63 -    String modulePath();
    2.64 -
    2.65 -    /**
    2.66 -     * If set to <code>true</code>, this module is always loaded, but never
    2.67 -     * visible in the menu or the Web UI module manager.
    2.68 -     *
    2.69 -     * @return true, if this is a system module
    2.70 -     */
    2.71 -    boolean systemModule() default false;
    2.72 -
    2.73 -    /**
    2.74 -     * Optionally specifies a default priority for this module.
    2.75 -     * The priority is used to order the menu entries.
    2.76 -     *
    2.77 -     * @return an integer priority
    2.78 -     */
    2.79 -    int defaultPriority() default 1000;
    2.80 -
    2.81 -    /**
    2.82 -     * Class representing the annotation.
    2.83 -     * This is necessary, because the EL resolver cannot deal with
    2.84 -     * annotation objects.
    2.85 -     * <p>
    2.86 -     * Note, that only the properties which are interesting for the JSP pages
    2.87 -     * are proxied by this object.
    2.88 -     */
    2.89 -    class ELProxy {
    2.90 -        private final String bundleBaseName, modulePath;
    2.91 -
    2.92 -        public ELProxy(LightPITModule annotation) {
    2.93 -            bundleBaseName = annotation.bundleBaseName();
    2.94 -            modulePath = annotation.modulePath();
    2.95 -        }
    2.96 -
    2.97 -        public String getBundleBaseName() {
    2.98 -            return bundleBaseName;
    2.99 -        }
   2.100 -        public String getModulePath() {
   2.101 -            return modulePath;
   2.102 -        }
   2.103 -    }
   2.104 -}
     3.1 --- a/src/main/java/de/uapcore/lightpit/MenuEntry.java	Sat May 23 13:52:04 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/MenuEntry.java	Sat May 23 14:13:09 2020 +0200
     3.3 @@ -28,16 +28,7 @@
     3.4   */
     3.5  package de.uapcore.lightpit;
     3.6  
     3.7 -import java.util.Objects;
     3.8 -
     3.9 -/**
    3.10 - * Maps a resource key for the menu label to the path name for the underlying
    3.11 - * site.
    3.12 - * <p>
    3.13 - * Objects of this class are internally instantiated by the
    3.14 - * {@link ModuleManager}.
    3.15 - */
    3.16 -public class MenuEntry implements Comparable<MenuEntry> {
    3.17 +public class MenuEntry {
    3.18  
    3.19      /**
    3.20       * Resource key for the menu label.
    3.21 @@ -55,27 +46,20 @@
    3.22      private final String pathName;
    3.23  
    3.24      /**
    3.25 -     * Sequence number to determine the ordering of the menu.
    3.26 -     */
    3.27 -    private final int sequence;
    3.28 -
    3.29 -    /**
    3.30       * True if this menu entry is active.
    3.31       */
    3.32      private boolean active = false;
    3.33  
    3.34 -    public MenuEntry(ResourceKey resourceKey, String pathName, int sequence) {
    3.35 +    public MenuEntry(ResourceKey resourceKey, String pathName) {
    3.36          this.text = null;
    3.37          this.resourceKey = resourceKey;
    3.38          this.pathName = pathName;
    3.39 -        this.sequence = sequence;
    3.40      }
    3.41  
    3.42 -    public MenuEntry(String text, String pathName, int sequence) {
    3.43 +    public MenuEntry(String text, String pathName) {
    3.44          this.text = text;
    3.45          this.resourceKey = null;
    3.46          this.pathName = pathName;
    3.47 -        this.sequence = sequence;
    3.48      }
    3.49  
    3.50      public ResourceKey getResourceKey() {
    3.51 @@ -90,10 +74,6 @@
    3.52          return pathName;
    3.53      }
    3.54  
    3.55 -    public int getSequence() {
    3.56 -        return sequence;
    3.57 -    }
    3.58 -
    3.59      public boolean isActive() {
    3.60          return this.active;
    3.61      }
    3.62 @@ -102,22 +82,4 @@
    3.63          this.active = true;
    3.64      }
    3.65  
    3.66 -    @Override
    3.67 -    public boolean equals(Object o) {
    3.68 -        if (this == o) return true;
    3.69 -        if (o == null || getClass() != o.getClass()) return false;
    3.70 -        MenuEntry menuEntry = (MenuEntry) o;
    3.71 -        return resourceKey.equals(menuEntry.resourceKey) &&
    3.72 -                pathName.equals(menuEntry.pathName);
    3.73 -    }
    3.74 -
    3.75 -    @Override
    3.76 -    public int hashCode() {
    3.77 -        return Objects.hash(resourceKey, pathName);
    3.78 -    }
    3.79 -
    3.80 -    @Override
    3.81 -    public int compareTo(MenuEntry menuEntry) {
    3.82 -        return Integer.compare(this.sequence, menuEntry.sequence);
    3.83 -    }
    3.84  }
     4.1 --- a/src/main/java/de/uapcore/lightpit/ModuleManager.java	Sat May 23 13:52:04 2020 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,172 +0,0 @@
     4.4 -/*
     4.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 - *
     4.7 - * Copyright 2018 Mike Becker. All rights reserved.
     4.8 - *
     4.9 - * Redistribution and use in source and binary forms, with or without
    4.10 - * modification, are permitted provided that the following conditions are met:
    4.11 - *
    4.12 - *   1. Redistributions of source code must retain the above copyright
    4.13 - *      notice, this list of conditions and the following disclaimer.
    4.14 - *
    4.15 - *   2. Redistributions in binary form must reproduce the above copyright
    4.16 - *      notice, this list of conditions and the following disclaimer in the
    4.17 - *      documentation and/or other materials provided with the distribution.
    4.18 - *
    4.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    4.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    4.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    4.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    4.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    4.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    4.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    4.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    4.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    4.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    4.29 - * POSSIBILITY OF SUCH DAMAGE.
    4.30 - *
    4.31 - */
    4.32 -package de.uapcore.lightpit;
    4.33 -
    4.34 -import org.slf4j.Logger;
    4.35 -import org.slf4j.LoggerFactory;
    4.36 -
    4.37 -import javax.servlet.Registration;
    4.38 -import javax.servlet.ServletContext;
    4.39 -import javax.servlet.ServletContextEvent;
    4.40 -import javax.servlet.ServletContextListener;
    4.41 -import javax.servlet.annotation.WebListener;
    4.42 -import java.util.ArrayList;
    4.43 -import java.util.Collections;
    4.44 -import java.util.List;
    4.45 -import java.util.Optional;
    4.46 -
    4.47 -/**
    4.48 - * Scans registered servlets for LightPIT modules.
    4.49 - */
    4.50 -@WebListener
    4.51 -public final class ModuleManager implements ServletContextListener {
    4.52 -
    4.53 -    private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class);
    4.54 -
    4.55 -    /**
    4.56 -     * The attribute name in the servlet context under which an instance of this class can be found.
    4.57 -     */
    4.58 -    public static final String SC_ATTR_NAME = ModuleManager.class.getName();
    4.59 -    private ServletContext sc;
    4.60 -
    4.61 -    /**
    4.62 -     * Maps class names to module information.
    4.63 -     */
    4.64 -    private final List<LightPITModule> registeredModules = new ArrayList<>();
    4.65 -
    4.66 -    /**
    4.67 -     * Contains the menu entries for the loaded modules.
    4.68 -     */
    4.69 -    private final List<MenuEntry> mainMenu = new ArrayList<>();
    4.70 -
    4.71 -    @Override
    4.72 -    public void contextInitialized(ServletContextEvent sce) {
    4.73 -        sc = sce.getServletContext();
    4.74 -        reloadAll();
    4.75 -        sc.setAttribute(SC_ATTR_NAME, this);
    4.76 -        LOG.info("Module manager injected into ServletContext.");
    4.77 -    }
    4.78 -
    4.79 -    @Override
    4.80 -    public void contextDestroyed(ServletContextEvent sce) {
    4.81 -        unloadAll();
    4.82 -    }
    4.83 -
    4.84 -    private Optional<LightPITModule> getModuleInfo(Registration reg) {
    4.85 -        try {
    4.86 -            final Class<?> scclass = Class.forName(reg.getClassName());
    4.87 -
    4.88 -            final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass);
    4.89 -            final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
    4.90 -
    4.91 -            if (lpservlet && !lpmodule) {
    4.92 -                LOG.warn(
    4.93 -                        "{} is a LightPIT Servlet but is missing the module annotation.",
    4.94 -                        reg.getClassName()
    4.95 -                );
    4.96 -            } else if (!lpservlet && lpmodule) {
    4.97 -                LOG.warn(
    4.98 -                        "{} is annotated as a LightPIT Module but does not extend {}.",
    4.99 -                        reg.getClassName(),
   4.100 -                        AbstractLightPITServlet.class.getSimpleName()
   4.101 -                );
   4.102 -            }
   4.103 -
   4.104 -            if (lpservlet && lpmodule) {
   4.105 -                final LightPITModule moduleInfo = scclass.getAnnotation(LightPITModule.class);
   4.106 -                return Optional.of(moduleInfo);
   4.107 -            } else {
   4.108 -                return Optional.empty();
   4.109 -            }
   4.110 -        } catch (ClassNotFoundException ex) {
   4.111 -            LOG.error(
   4.112 -                    "Servlet registration refers to class {} which cannot be found by the class loader (Reason: {})",
   4.113 -                    reg.getClassName(),
   4.114 -                    ex.getMessage()
   4.115 -            );
   4.116 -            return Optional.empty();
   4.117 -        }
   4.118 -    }
   4.119 -
   4.120 -    private void handleServletRegistration(String name, Registration reg) {
   4.121 -        final Optional<LightPITModule> moduleInfo = getModuleInfo(reg);
   4.122 -        if (moduleInfo.isPresent()) {
   4.123 -            registeredModules.add(moduleInfo.get());
   4.124 -            LOG.info("Module detected: {}", name);
   4.125 -        } else {
   4.126 -            LOG.debug("Servlet {} is no module, skipping.", name);
   4.127 -        }
   4.128 -    }
   4.129 -
   4.130 -    /**
   4.131 -     * Scans for modules and reloads them all.
   4.132 -     */
   4.133 -    public void reloadAll() {
   4.134 -        registeredModules.clear();
   4.135 -        sc.getServletRegistrations().forEach(this::handleServletRegistration);
   4.136 -        createMainMenu();
   4.137 -
   4.138 -        LOG.info("Modules loaded.");
   4.139 -    }
   4.140 -
   4.141 -    /**
   4.142 -     * Unloads all found modules.
   4.143 -     */
   4.144 -    public void unloadAll() {
   4.145 -        registeredModules.clear();
   4.146 -        LOG.info("All modules unloaded.");
   4.147 -    }
   4.148 -
   4.149 -    /**
   4.150 -     * Populates the main menu based on the registered modules.
   4.151 -     */
   4.152 -    private void createMainMenu() {
   4.153 -        mainMenu.clear();
   4.154 -        registeredModules
   4.155 -                .stream()
   4.156 -                .filter(mod -> !mod.systemModule())
   4.157 -                .map(mod -> new MenuEntry(
   4.158 -                        new ResourceKey(
   4.159 -                                mod.bundleBaseName(),
   4.160 -                                "menuLabel"),
   4.161 -                        mod.modulePath() + "/",
   4.162 -                        mod.defaultPriority()))
   4.163 -                .sorted()
   4.164 -                .forEachOrdered(mainMenu::add);
   4.165 -    }
   4.166 -
   4.167 -    /**
   4.168 -     * Returns the main menu.
   4.169 -     *
   4.170 -     * @return a list of menu items
   4.171 -     */
   4.172 -    public List<MenuEntry> getMainMenu() {
   4.173 -        return Collections.unmodifiableList(mainMenu);
   4.174 -    }
   4.175 -}
     5.1 --- a/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Sat May 23 13:52:04 2020 +0200
     5.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Sat May 23 14:13:09 2020 +0200
     5.3 @@ -28,21 +28,16 @@
     5.4   */
     5.5  package de.uapcore.lightpit.modules;
     5.6  
     5.7 -import de.uapcore.lightpit.*;
     5.8 +import de.uapcore.lightpit.AbstractLightPITServlet;
     5.9 +import de.uapcore.lightpit.HttpMethod;
    5.10 +import de.uapcore.lightpit.RequestMapping;
    5.11 +import de.uapcore.lightpit.ResponseType;
    5.12  
    5.13  import javax.servlet.annotation.WebServlet;
    5.14  import javax.servlet.http.HttpServletRequest;
    5.15  import javax.servlet.http.HttpServletResponse;
    5.16  import java.util.Optional;
    5.17  
    5.18 -/**
    5.19 - * Entry point for the application.
    5.20 - */
    5.21 -@LightPITModule(
    5.22 -        bundleBaseName = "localization.error",
    5.23 -        modulePath = "error",
    5.24 -        systemModule = true
    5.25 -)
    5.26  @WebServlet(
    5.27          name = "ErrorModule",
    5.28          urlPatterns = "/error/*"
     6.1 --- a/src/main/java/de/uapcore/lightpit/modules/LanguageModule.java	Sat May 23 13:52:04 2020 +0200
     6.2 +++ b/src/main/java/de/uapcore/lightpit/modules/LanguageModule.java	Sat May 23 14:13:09 2020 +0200
     6.3 @@ -38,12 +38,6 @@
     6.4  import javax.servlet.http.HttpServletResponse;
     6.5  import java.util.*;
     6.6  
     6.7 -
     6.8 -@LightPITModule(
     6.9 -        bundleBaseName = "localization.language",
    6.10 -        modulePath = "language",
    6.11 -        defaultPriority = 20000
    6.12 -)
    6.13  @WebServlet(
    6.14          name = "LanguageModule",
    6.15          urlPatterns = "/language/*"
     7.1 --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat May 23 13:52:04 2020 +0200
     7.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat May 23 14:13:09 2020 +0200
     7.3 @@ -49,11 +49,6 @@
     7.4  
     7.5  import static de.uapcore.lightpit.Functions.fqn;
     7.6  
     7.7 -@LightPITModule(
     7.8 -        bundleBaseName = "localization.projects",
     7.9 -        modulePath = "projects",
    7.10 -        defaultPriority = 20
    7.11 -)
    7.12  @WebServlet(
    7.13          name = "ProjectsModule",
    7.14          urlPatterns = "/projects/*"
    7.15 @@ -149,18 +144,18 @@
    7.16          MenuEntry entry;
    7.17  
    7.18          final var breadcrumbs = new ArrayList<MenuEntry>();
    7.19 -        entry = new MenuEntry(new ResourceKey("localization.projects", "menuLabel"),
    7.20 -                "projects/", 0);
    7.21 +        entry = new MenuEntry(new ResourceKey("localization.lightpit", "menu.projects"),
    7.22 +                "projects/");
    7.23          breadcrumbs.add(entry);
    7.24          if (level == 0) entry.setActive(true);
    7.25  
    7.26          if (sessionSelection.project != null) {
    7.27              if (sessionSelection.project.getId() < 0) {
    7.28                  entry = new MenuEntry(new ResourceKey("localization.projects", "button.create"),
    7.29 -                        "projects/edit", 1);
    7.30 +                        "projects/edit");
    7.31              } else {
    7.32                  entry = new MenuEntry(sessionSelection.project.getName(),
    7.33 -                        "projects/view?pid=" + sessionSelection.project.getId(), 1);
    7.34 +                        "projects/view?pid=" + sessionSelection.project.getId());
    7.35              }
    7.36              if (level == 1) entry.setActive(true);
    7.37              breadcrumbs.add(entry);
    7.38 @@ -169,11 +164,11 @@
    7.39          if (sessionSelection.version != null) {
    7.40              if (sessionSelection.version.getId() < 0) {
    7.41                  entry = new MenuEntry(new ResourceKey("localization.projects", "button.version.create"),
    7.42 -                        "projects/versions/edit", 2);
    7.43 +                        "projects/versions/edit");
    7.44              } else {
    7.45                  entry = new MenuEntry(sessionSelection.version.getName(),
    7.46                          // TODO: change link to issue overview for that version
    7.47 -                        "projects/versions/edit?id=" + sessionSelection.version.getId(), 2);
    7.48 +                        "projects/versions/edit?id=" + sessionSelection.version.getId());
    7.49              }
    7.50              if (level == 2) entry.setActive(true);
    7.51              breadcrumbs.add(entry);
    7.52 @@ -182,15 +177,15 @@
    7.53          if (sessionSelection.issue != null) {
    7.54              entry = new MenuEntry(new ResourceKey("localization.projects", "menu.issues"),
    7.55                      // TODO: change link to a separate issue view (maybe depending on the selected version)
    7.56 -                    "projects/view?pid=" + sessionSelection.issue.getProject().getId(), 3);
    7.57 +                    "projects/view?pid=" + sessionSelection.issue.getProject().getId());
    7.58              breadcrumbs.add(entry);
    7.59              if (sessionSelection.issue.getId() < 0) {
    7.60                  entry = new MenuEntry(new ResourceKey("localization.projects", "button.issue.create"),
    7.61 -                        "projects/issues/edit", 2);
    7.62 +                        "projects/issues/edit");
    7.63              } else {
    7.64                  entry = new MenuEntry("#" + sessionSelection.issue.getId(),
    7.65                          // TODO: maybe change link to a view rather than directly opening the editor
    7.66 -                        "projects/issues/edit?id=" + sessionSelection.issue.getId(), 4);
    7.67 +                        "projects/issues/edit?id=" + sessionSelection.issue.getId());
    7.68              }
    7.69              if (level == 3) entry.setActive(true);
    7.70              breadcrumbs.add(entry);
     8.1 --- a/src/main/java/de/uapcore/lightpit/modules/UsersModule.java	Sat May 23 13:52:04 2020 +0200
     8.2 +++ b/src/main/java/de/uapcore/lightpit/modules/UsersModule.java	Sat May 23 14:13:09 2020 +0200
     8.3 @@ -40,11 +40,6 @@
     8.4  import java.sql.SQLException;
     8.5  import java.util.NoSuchElementException;
     8.6  
     8.7 -@LightPITModule(
     8.8 -        bundleBaseName = "localization.users",
     8.9 -        modulePath = "teams",
    8.10 -        defaultPriority = 100
    8.11 -)
    8.12  @WebServlet(
    8.13          name = "UsersModule",
    8.14          urlPatterns = "/teams/*"
     9.1 --- a/src/main/resources/localization/language.properties	Sat May 23 13:52:04 2020 +0200
     9.2 +++ b/src/main/resources/localization/language.properties	Sat May 23 14:13:09 2020 +0200
     9.3 @@ -22,7 +22,6 @@
     9.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     9.5  
     9.6  pageTitle=Language Selection
     9.7 -menuLabel=Language
     9.8  
     9.9  submit = Switch language
    9.10  browserLanguage = Browser language
    10.1 --- a/src/main/resources/localization/language_de.properties	Sat May 23 13:52:04 2020 +0200
    10.2 +++ b/src/main/resources/localization/language_de.properties	Sat May 23 14:13:09 2020 +0200
    10.3 @@ -22,7 +22,6 @@
    10.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    10.5  
    10.6  pageTitle=Sprachauswahl
    10.7 -menuLabel = Sprache
    10.8  
    10.9  submit = Sprache ausw\u00e4hlen
   10.10  browserLanguage = Browsersprache
    11.1 --- a/src/main/resources/localization/lightpit.properties	Sat May 23 13:52:04 2020 +0200
    11.2 +++ b/src/main/resources/localization/lightpit.properties	Sat May 23 14:13:09 2020 +0200
    11.3 @@ -21,10 +21,14 @@
    11.4  # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    11.5  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    11.6  
    11.7 -version=LightPIT - Version 0.1 (Snapshot) 
    11.8 +version=LightPIT - Version 0.1 (Snapshot)
    11.9  
   11.10  button.okay=OK
   11.11  button.cancel=Cancel
   11.12  
   11.13  commit.success=Operation successful - you will be redirected in a second.
   11.14 -commit.redirect-link=If redirection does not work, click the following link:
   11.15 \ No newline at end of file
   11.16 +commit.redirect-link=If redirection does not work, click the following link:
   11.17 +
   11.18 +menu.projects=Projects
   11.19 +menu.users=Developer
   11.20 +menu.languages=Language
    12.1 --- a/src/main/resources/localization/lightpit_de.properties	Sat May 23 13:52:04 2020 +0200
    12.2 +++ b/src/main/resources/localization/lightpit_de.properties	Sat May 23 14:13:09 2020 +0200
    12.3 @@ -28,3 +28,7 @@
    12.4  
    12.5  commit.success=Operation erfolgreich - Sie werden jeden Moment weitergeleitet.
    12.6  commit.redirect-link=Falls die Weiterleitung nicht klappt, klicken Sie bitte hier:
    12.7 +
    12.8 +menu.projects=Projekte
    12.9 +menu.users=Entwickler
   12.10 +menu.languages=Sprache
    13.1 --- a/src/main/resources/localization/projects.properties	Sat May 23 13:52:04 2020 +0200
    13.2 +++ b/src/main/resources/localization/projects.properties	Sat May 23 14:13:09 2020 +0200
    13.3 @@ -22,7 +22,6 @@
    13.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    13.5  
    13.6  pageTitle=Project Tracking
    13.7 -menuLabel=Projects
    13.8  
    13.9  button.create=New Project
   13.10  button.version.create=New Version
    14.1 --- a/src/main/resources/localization/projects_de.properties	Sat May 23 13:52:04 2020 +0200
    14.2 +++ b/src/main/resources/localization/projects_de.properties	Sat May 23 14:13:09 2020 +0200
    14.3 @@ -22,7 +22,6 @@
    14.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    14.5  
    14.6  pageTitle=Projektverwaltung
    14.7 -menuLabel=Projekte
    14.8  
    14.9  button.create=Neues Projekt
   14.10  button.version.create=Neue Version
    15.1 --- a/src/main/resources/localization/users.properties	Sat May 23 13:52:04 2020 +0200
    15.2 +++ b/src/main/resources/localization/users.properties	Sat May 23 14:13:09 2020 +0200
    15.3 @@ -22,7 +22,6 @@
    15.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    15.5  
    15.6  pageTitle=User Management
    15.7 -menuLabel=Developer
    15.8  
    15.9  button.create=Add Developer
   15.10  
    16.1 --- a/src/main/resources/localization/users_de.properties	Sat May 23 13:52:04 2020 +0200
    16.2 +++ b/src/main/resources/localization/users_de.properties	Sat May 23 14:13:09 2020 +0200
    16.3 @@ -22,7 +22,6 @@
    16.4  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    16.5  
    16.6  pageTitle=Benutzerverwaltung
    16.7 -menuLabel=Entwickler
    16.8  
    16.9  button.create=Neuer Entwickler
   16.10  
    17.1 --- a/src/main/webapp/index.jsp	Sat May 23 13:52:04 2020 +0200
    17.2 +++ b/src/main/webapp/index.jsp	Sat May 23 14:13:09 2020 +0200
    17.3 @@ -26,5 +26,5 @@
    17.4  --%>
    17.5  <%
    17.6      response.setStatus(response.SC_MOVED_TEMPORARILY);
    17.7 -    response.setHeader("Location", "/projects/");
    17.8 +    response.setHeader("Location", "projects/");
    17.9  %>

mercurial