diff --git a/.gitignore b/.gitignore index a1c2a23..7cb6b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,43 @@ -# Compiled class file -*.class +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ -# Log file -*.log +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ -# BlueJ files -*.ctxt +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ -# Mobile Tools for Java (J2ME) -.mtj.tmp/ +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar +### VS Code ### +.vscode/ -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/Gartenverwaltung/src/App/App.java b/Gartenverwaltung/src/App/App.java deleted file mode 100644 index bb42ef3..0000000 --- a/Gartenverwaltung/src/App/App.java +++ /dev/null @@ -1,4 +0,0 @@ -package src.App; - -public class App { -} diff --git a/Gartenverwaltung/src/UI/Model.java b/Gartenverwaltung/src/UI/Model.java deleted file mode 100644 index 238f716..0000000 --- a/Gartenverwaltung/src/UI/Model.java +++ /dev/null @@ -1,4 +0,0 @@ -package src.UI; - -public class Model { -} diff --git a/Gartenverwaltung/src/Weather/Weather_Dummy.java b/Gartenverwaltung/src/Weather/Weather_Dummy.java deleted file mode 100644 index c9a549c..0000000 --- a/Gartenverwaltung/src/Weather/Weather_Dummy.java +++ /dev/null @@ -1,4 +0,0 @@ -package src.Weather; - -public class Weather_Dummy { -} diff --git a/README.md b/README.md index afc890d..5b7f091 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,26 @@ PM3 FivePlants Gartenverwaltung ## Class Diagram Umletino: https://www.umletino.com/umletino.html -## Branch model -- active branch: *main* - - -This branch has a running version of the code. -- feature: *feature_xy_"Milestone"* - - -This branches contain code for feature. When the code is ready it will be merged into the main branch. -- bugfix: *bugfix_xy_"Milestone"* - - -This branch are for bugfixes. -- documentation: *doc_xy_"Milestone"* - - -This branch is for documentation of the code and the readme. - - Draft File: doc/ClassDiagramDraft.uxf + +## Branch model +- production branch: `main` + +This branch has a working version of the code. + +- development branch: `dev` + +This branch should contain a running (although not necessarily working) version of the code. Working states are to be merged into the `main` branch regularly. + +- feature: `feature_xy_` + +These branches contain features in active development. When the code is ready it will be merged into the `dev` branch. + +- bugfix: `bugfix_xy_` + +These branches are for bugfixes. + +- documentation: `doc_xy_` + +These branches are for javadoc and project documentation (such as the readme, class diagrams etc.). + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..5268664 --- /dev/null +++ b/build.gradle @@ -0,0 +1,56 @@ +plugins { + id 'java' + id 'application' + id 'org.openjfx.javafxplugin' version '0.0.13' + id 'org.beryx.jlink' version '2.25.0' +} + +group 'ch.zhaw.pm3' +version '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +ext { + junitVersion = '5.8.2' +} + +sourceCompatibility = '17' +targetCompatibility = '17' + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +application { + mainModule = 'ch.zhaw.gartenverwaltung' + mainClass = 'ch.zhaw.gartenverwaltung.HelloApplication' +} + +javafx { + version = '17.0.2' + modules = ['javafx.controls', 'javafx.fxml'] +} + +dependencies { + + testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}") +} + +test { + useJUnitPlatform() +} + +jlink { + imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip") + options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + launcher { + name = 'app' + } +} + +jlinkZip { + group = 'distribution' +} \ No newline at end of file diff --git a/doc/ClassDiagramDraft.uxf b/doc/Classdiagramm/ClassDiagramDraft.uxf similarity index 100% rename from doc/ClassDiagramDraft.uxf rename to doc/Classdiagramm/ClassDiagramDraft.uxf diff --git a/doc/plant_db-erm.uxf b/doc/Datenbankmodell/plant_db-erm.uxf similarity index 100% rename from doc/plant_db-erm.uxf rename to doc/Datenbankmodell/plant_db-erm.uxf diff --git a/doc/Dömanenmodell/Diagram 2022-10-17 09-22-54.uxf b/doc/Dömanenmodell/Diagram 2022-10-17 09-22-54.uxf new file mode 100644 index 0000000..b662132 --- /dev/null +++ b/doc/Dömanenmodell/Diagram 2022-10-17 09-22-54.uxf @@ -0,0 +1,70 @@ +12UMLClass85237212072Gardener +-- +Name +TypeUMLClass144372120120Plant +-- +name +descriptionUMLClass60037212084Garden +-- +Location +hardiness zoneUMLClass38437212072Bed +-- +AreaUMLClass115262412036WeatherUMLClass85281612036CalendarUMLClass8529614472Community +-- +Plant Information +UMLClass28863612072Growth phase +-- +durationUMLClass85262412084Gardening task +-- +start date +end date +intervalRelation852156120240lt=- +m1=0..* +m2=1..* +< is part of 10;180;10;10Relation70837216860lt=- +m1=1 +m2=1..* +< has 120;20;10;20Relation25237215660lt=- +m1=1 +m2=0..* +< contains 110;20;10;20Relation252444156216lt=- +m1=1 +m2=1..* +has >10;10;80;10;80;160Relation49237213260lt=- +m1=1 +m2=1..* +< contains 90;20;10;20Relation900432120216lt=- +m1=1 +m2=1..* +< manages 10;10;10;160Relation96062421660lt=- +m1=1 +m2=1..* +< manipulates160;20;10;20Relation900696108144lt=- +m1=1 +m2=0..* +< contains10;10;10;100Relation960408468468lt=- +m1=1 +m2=1 +< informs 10;360;310;360;310;10;10;10UMLClass1263612084Need +-- +start date +end dateRelation60432108228lt=- +m1=1..* +m2=1..* +has >10;170;10;10;70;10Relation60672816120lt=- +m1=1 +m2=1 +requires >660;10;520;10;520;80;10;80;10;40UMLClass45658812036Team +Relation564432312180lt=- +m1=1 +m2=1..* +contains of >10;130;240;10Relation56460031260lt=- +m1=1 +m2=0..* +manages >10;20;240;20Relation960156216240lt=- +m1=0..n +m2=1..n +exchanges Informatione >10;10;10;180Relation12064819260lt=- +m1=0..n +m2=1 +< contains 10;20;140;20 \ No newline at end of file diff --git a/doc/Dömanenmodell/Diagram 2022-10-17 09-22-57.png b/doc/Dömanenmodell/Diagram 2022-10-17 09-22-57.png new file mode 100644 index 0000000..ee0237e Binary files /dev/null and b/doc/Dömanenmodell/Diagram 2022-10-17 09-22-57.png differ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# 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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..ac1b06f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..5bdb5ba --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "PM3-HS22-IT21b_WIN-Team1" \ No newline at end of file diff --git a/src/main/java/ch/zhaw/gartenverwaltung/HelloApplication.java b/src/main/java/ch/zhaw/gartenverwaltung/HelloApplication.java new file mode 100644 index 0000000..0d70b44 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/HelloApplication.java @@ -0,0 +1,23 @@ +package ch.zhaw.gartenverwaltung; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +public class HelloApplication extends Application { + @Override + public void start(Stage stage) throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 320, 240); + stage.setTitle("Hello!"); + stage.setScene(scene); + stage.show(); + } + + public static void main(String[] args) { + launch(); + } +} \ No newline at end of file diff --git a/src/main/java/ch/zhaw/gartenverwaltung/HelloController.java b/src/main/java/ch/zhaw/gartenverwaltung/HelloController.java new file mode 100644 index 0000000..7e952ac --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/HelloController.java @@ -0,0 +1,14 @@ +package ch.zhaw.gartenverwaltung; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; + +public class HelloController { + @FXML + private Label welcomeText; + + @FXML + protected void onHelloButtonClick() { + welcomeText.setText("Welcome to JavaFX Application!"); + } +} \ No newline at end of file diff --git a/src/main/java/ch/zhaw/gartenverwaltung/io/GardenPlan.java b/src/main/java/ch/zhaw/gartenverwaltung/io/GardenPlan.java new file mode 100644 index 0000000..94e1346 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/io/GardenPlan.java @@ -0,0 +1,12 @@ +package ch.zhaw.gartenverwaltung.io; + +import ch.zhaw.gartenverwaltung.types.UserPlanting; + +import java.io.IOException; +import java.util.List; + +public interface GardenPlan { + List getPlantings(); + void savePlanting(UserPlanting planting) throws IOException; + void removePlanting(UserPlanting planting) throws IOException; +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/io/PlantDatabase.java b/src/main/java/ch/zhaw/gartenverwaltung/io/PlantDatabase.java new file mode 100644 index 0000000..f0d9bf9 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/io/PlantDatabase.java @@ -0,0 +1,12 @@ +package ch.zhaw.gartenverwaltung.io; + +import ch.zhaw.gartenverwaltung.types.Plant; +import ch.zhaw.gartenverwaltung.types.HardinessZone; + +import java.util.List; +import java.util.Optional; + +public interface PlantDatabase { + List getPlantList(HardinessZone zone); + Optional getPlantById(long id); +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/io/TaskDatabase.java b/src/main/java/ch/zhaw/gartenverwaltung/io/TaskDatabase.java new file mode 100644 index 0000000..73cf8e0 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/io/TaskDatabase.java @@ -0,0 +1,13 @@ +package ch.zhaw.gartenverwaltung.io; + +import ch.zhaw.gartenverwaltung.types.Task; + +import java.io.IOException; +import java.util.Date; +import java.util.List; + +public interface TaskDatabase { + List getTaskList(Date start, Date end); + void saveTask(Task task) throws IOException; + void removeTask(Task task) throws IOException; +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhase.java b/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhase.java new file mode 100644 index 0000000..665b895 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhase.java @@ -0,0 +1,9 @@ +package ch.zhaw.gartenverwaltung.types; + +import java.util.Date; + +public record GrowthPhase(Date startDate, + Date endDate, + GrowthPhaseType type, + HardinessZone zone) { +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhaseType.java b/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhaseType.java new file mode 100644 index 0000000..99e5d2b --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/GrowthPhaseType.java @@ -0,0 +1,5 @@ +package ch.zhaw.gartenverwaltung.types; + +public enum GrowthPhaseType { + SOW, PLANT, HARVEST +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/HardinessZone.java b/src/main/java/ch/zhaw/gartenverwaltung/types/HardinessZone.java new file mode 100644 index 0000000..5d0bc91 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/HardinessZone.java @@ -0,0 +1,9 @@ +package ch.zhaw.gartenverwaltung.types; + +/** + * Represents the available hardiness zones + * (Subject to later expansion) + */ +public enum HardinessZone { + ZONE_8A +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/Plant.java b/src/main/java/ch/zhaw/gartenverwaltung/types/Plant.java new file mode 100644 index 0000000..99336e7 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/Plant.java @@ -0,0 +1,11 @@ +package ch.zhaw.gartenverwaltung.types; + +import java.util.List; + +public record Plant( + long id, + String name, + String description, + int spacing, + List lifecycle) { +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/Task.java b/src/main/java/ch/zhaw/gartenverwaltung/types/Task.java new file mode 100644 index 0000000..d85435b --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/Task.java @@ -0,0 +1,50 @@ +package ch.zhaw.gartenverwaltung.types; + +import java.util.Date; +import java.util.Optional; + +/** + * Models a Task + * May be created using the builder pattern. + */ +public class Task { + private long id; + private final String name; + private final String description; + private final Date startDate; + private Integer interval; + private Date endDate; + + public Task(String name, String description, Date startDate) { + this.name = name; + this.description = description; + this.startDate = endDate; + } + + // Builder-pattern-style setters + public Task withId(long id) { + this.id = id; + return this; + } + public Task withInterval(int interval) { + this.interval = interval; + return this; + } + public Task withEndDate(Date endDate) { + this.endDate = endDate; + return this; + } + + // Getters + public long getId() { return id; } + public String getName() { return name; } + public String getDescription() { return description; } + public Date getStartDate() { return startDate; } + + public Optional getInterval() { + return Optional.ofNullable(interval); + } + public Optional getEndDate() { + return Optional.ofNullable(endDate); + } +} diff --git a/src/main/java/ch/zhaw/gartenverwaltung/types/UserPlanting.java b/src/main/java/ch/zhaw/gartenverwaltung/types/UserPlanting.java new file mode 100644 index 0000000..804d388 --- /dev/null +++ b/src/main/java/ch/zhaw/gartenverwaltung/types/UserPlanting.java @@ -0,0 +1,10 @@ +package ch.zhaw.gartenverwaltung.types; + +import java.util.Date; + +public record UserPlanting( + long plantId, + Date startDate, + int area +) { +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..4bffe36 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module ch.zhaw.gartenverwaltung { + requires javafx.controls; + requires javafx.fxml; + + + opens ch.zhaw.gartenverwaltung to javafx.fxml; + exports ch.zhaw.gartenverwaltung; +} \ No newline at end of file diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/hello-view.fxml b/src/main/resources/ch/zhaw/gartenverwaltung/hello-view.fxml new file mode 100644 index 0000000..63df7af --- /dev/null +++ b/src/main/resources/ch/zhaw/gartenverwaltung/hello-view.fxml @@ -0,0 +1,16 @@ + + + + + + + + + + + + +