Member Names external by application.properties

This commit is contained in:
Mirco 2024-06-13 10:08:32 +02:00
parent abaff760ab
commit d1e633c4d3
6 changed files with 66 additions and 23 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
build/ build/
.gradle/ .gradle/
.idea/

View file

@ -4,7 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cd657914-f421-422e-8fe7-ce4378fd5404" name="Changes" comment="" /> <list default="true" id="cd657914-f421-422e-8fe7-ce4378fd5404" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gradlew" beforeDir="false" afterPath="$PROJECT_DIR$/gradlew" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MEApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MEApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MainView.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MainView.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -40,6 +47,9 @@
<component name="PackageJsonUpdateNotifier"> <component name="PackageJsonUpdateNotifier">
<dismissed value="$PROJECT_DIR$/package.json" /> <dismissed value="$PROJECT_DIR$/package.json" />
</component> </component>
<component name="ProblemsViewState">
<option name="selectedTabId" value="QODANA_PROBLEMS_VIEW_TAB" />
</component>
<component name="ProjectColorInfo">{ <component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 1 &quot;associatedIndex&quot;: 1
}</component> }</component>
@ -48,17 +58,32 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_ADD_EXTERNAL_FILES": "true", &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
"Gradle.ModeratorElection [:MEApplication.main()].executor": "Run", &quot;Application.App_build.executor&quot;: &quot;Run&quot;,
"Gradle.base-starter-spring-gradle [:DemoApplication.main()].executor": "Run", &quot;Gradle.Build ModeratorElection.executor&quot;: &quot;Run&quot;,
"Gradle.base-starter-spring-gradle [:MEApplication.main()].executor": "Run", &quot;Gradle.Load Gradle Dependencies.executor&quot;: &quot;Run&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;Gradle.ModeratorElection [:MEApplication.main()].executor&quot;: &quot;Run&quot;,
"kotlin-language-version-configured": "true", &quot;Gradle.base-starter-spring-gradle [:DemoApplication.main()].executor&quot;: &quot;Run&quot;,
"last_opened_file_path": "/home/zam/repo/JavaLearning/base-starter-spring-gradle" &quot;Gradle.base-starter-spring-gradle [:MEApplication.main()].executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/zam/repo/JavaLearning/base-starter-spring-gradle&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;build.tools&quot;
} }
}]]></component> }</component>
<component name="RunManager">
<configuration name="App_build" type="Application" factoryName="Application">
<option name="ALTERNATIVE_JRE_PATH" value="21" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.ModeratorElection.MEApplication" />
<module name="ModeratorElection" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task"> <task active="true" id="Default" summary="Default task">
@ -70,4 +95,15 @@
</task> </task>
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project> </project>

14
gradlew vendored
View file

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class MEApplication { public class MEApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(MEApplication.class, args); SpringApplication.run(MEApplication.class, args);
} }

View file

@ -14,19 +14,25 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route; import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.PageTitle;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Route("") @Route("")
@PageTitle("Moderatorenwahl") @PageTitle("Moderatorenwahl")
@Configuration
public class MainView extends VerticalLayout { public class MainView extends VerticalLayout {
public MainView() { public MainView(@Value("${membernames}") String membernames) {
String[] memberNamesArray = membernames.split(",");
List<String> selectMemberItemsNameslist = Arrays.asList(memberNamesArray);
CheckboxGroup<String> checkboxGroup = new CheckboxGroup<>(); CheckboxGroup<String> checkboxGroup = new CheckboxGroup<>();
checkboxGroup.setLabel("Team members to elect"); checkboxGroup.setLabel("Team members to elect");
checkboxGroup.setItems("Micha", "Ansgar", "Clemens", "Mattis", "Erik", "Mirco"); checkboxGroup.setItems(selectMemberItemsNameslist);
checkboxGroup.select("Micha", "Ansgar", "Clemens", "Mattis", "Erik", "Mirco"); checkboxGroup.select(selectMemberItemsNameslist);
checkboxGroup.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL); checkboxGroup.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL);
add(checkboxGroup); add(checkboxGroup);

View file

@ -8,3 +8,4 @@ vaadin.launch-browser=true
# For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters # For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application
spring.jpa.defer-datasource-initialization = true spring.jpa.defer-datasource-initialization = true
membernames=Micha,Ansgar,Clemens,Mattis,Erik,Mirco