Merge origin/master
Conflicts: nbproject/project.properties src/java/bean/Pompier.java src/java/servlet/PompierServlet.java src/java/util/TrmtDate.java web/WEB-INF/jspf/formulairePompier.jspf web/WEB-INF/jspf/header.jspf web/WEB-INF/web.xml
This commit is contained in:
commit
8c53a38e4b
142
build.xml
142
build.xml
@ -1,71 +1,71 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- You may freely edit this file. See commented blocks below for -->
|
<!-- You may freely edit this file. See commented blocks below for -->
|
||||||
<!-- some examples of how to customize the build. -->
|
<!-- some examples of how to customize the build. -->
|
||||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||||
<!-- the Compile on Save feature is turned off for the project. -->
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
<!-- in the project's Project Properties dialog box.-->
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
<project name="sdis29M1" default="default" basedir=".">
|
<project name="sdis29M1" default="default" basedir=".">
|
||||||
<description>Builds, tests, and runs the project sdis29M1.</description>
|
<description>Builds, tests, and runs the project sdis29M1.</description>
|
||||||
<import file="nbproject/build-impl.xml"/>
|
<import file="nbproject/build-impl.xml"/>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
There exist several targets which are by default empty and which can be
|
There exist several targets which are by default empty and which can be
|
||||||
used for execution of your tasks. These targets are usually executed
|
used for execution of your tasks. These targets are usually executed
|
||||||
before and after some main targets. They are:
|
before and after some main targets. They are:
|
||||||
|
|
||||||
-pre-init: called before initialization of project properties
|
-pre-init: called before initialization of project properties
|
||||||
-post-init: called after initialization of project properties
|
-post-init: called after initialization of project properties
|
||||||
-pre-compile: called before javac compilation
|
-pre-compile: called before javac compilation
|
||||||
-post-compile: called after javac compilation
|
-post-compile: called after javac compilation
|
||||||
-pre-compile-single: called before javac compilation of single file
|
-pre-compile-single: called before javac compilation of single file
|
||||||
-post-compile-single: called after javac compilation of single file
|
-post-compile-single: called after javac compilation of single file
|
||||||
-pre-compile-test: called before javac compilation of JUnit tests
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
-post-compile-test: called after javac compilation of JUnit tests
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||||
-pre-dist: called before archive building
|
-pre-dist: called before archive building
|
||||||
-post-dist: called after archive building
|
-post-dist: called after archive building
|
||||||
-post-clean: called after cleaning build products
|
-post-clean: called after cleaning build products
|
||||||
-pre-run-deploy: called before deploying
|
-pre-run-deploy: called before deploying
|
||||||
-post-run-deploy: called after deploying
|
-post-run-deploy: called after deploying
|
||||||
|
|
||||||
Example of pluging an obfuscator after the compilation could look like
|
Example of pluging an obfuscator after the compilation could look like
|
||||||
|
|
||||||
<target name="-post-compile">
|
<target name="-post-compile">
|
||||||
<obfuscate>
|
<obfuscate>
|
||||||
<fileset dir="${build.classes.dir}"/>
|
<fileset dir="${build.classes.dir}"/>
|
||||||
</obfuscate>
|
</obfuscate>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
For list of available properties check the imported
|
For list of available properties check the imported
|
||||||
nbproject/build-impl.xml file.
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
|
||||||
Other way how to customize the build is by overriding existing main targets.
|
Other way how to customize the build is by overriding existing main targets.
|
||||||
The target of interest are:
|
The target of interest are:
|
||||||
|
|
||||||
init-macrodef-javac: defines macro for javac compilation
|
init-macrodef-javac: defines macro for javac compilation
|
||||||
init-macrodef-junit: defines macro for junit execution
|
init-macrodef-junit: defines macro for junit execution
|
||||||
init-macrodef-debug: defines macro for class debugging
|
init-macrodef-debug: defines macro for class debugging
|
||||||
do-dist: archive building
|
do-dist: archive building
|
||||||
run: execution of project
|
run: execution of project
|
||||||
javadoc-build: javadoc generation
|
javadoc-build: javadoc generation
|
||||||
|
|
||||||
Example of overriding the target for project execution could look like
|
Example of overriding the target for project execution could look like
|
||||||
|
|
||||||
<target name="run" depends="<PROJNAME>-impl.jar">
|
<target name="run" depends="<PROJNAME>-impl.jar">
|
||||||
<exec dir="bin" executable="launcher.exe">
|
<exec dir="bin" executable="launcher.exe">
|
||||||
<arg file="${dist.jar}"/>
|
<arg file="${dist.jar}"/>
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
Notice that overridden target depends on jar target and not only on
|
Notice that overridden target depends on jar target and not only on
|
||||||
compile target as regular run target does. Again, for list of available
|
compile target as regular run target does. Again, for list of available
|
||||||
properties which you can use check the target you are overriding in
|
properties which you can use check the target you are overriding in
|
||||||
nbproject/build-impl.xml file.
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
</project>
|
</project>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
build.xml.data.CRC32=b54f128f
|
build.xml.data.CRC32=b54f128f
|
||||||
build.xml.script.CRC32=111e10f7
|
build.xml.script.CRC32=111e10f7
|
||||||
build.xml.stylesheet.CRC32=1707db4f@1.87.0.1
|
build.xml.stylesheet.CRC32=1707db4f@1.86.0.1
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=b54f128f
|
nbproject/build-impl.xml.data.CRC32=b54f128f
|
||||||
nbproject/build-impl.xml.script.CRC32=bc2b5756
|
nbproject/build-impl.xml.script.CRC32=bc2b5756
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.87.0.1
|
nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.86.0.1
|
||||||
|
@ -1,89 +1,89 @@
|
|||||||
annotation.processing.enabled=true
|
annotation.processing.enabled=true
|
||||||
annotation.processing.enabled.in.editor=true
|
annotation.processing.enabled.in.editor=true
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
annotation.processing.run.all.processors=true
|
annotation.processing.run.all.processors=true
|
||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
build.classes.dir=${build.web.dir}/WEB-INF/classes
|
build.classes.dir=${build.web.dir}/WEB-INF/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
build.dir=build
|
build.dir=build
|
||||||
build.generated.dir=${build.dir}/generated
|
build.generated.dir=${build.dir}/generated
|
||||||
build.generated.sources.dir=${build.dir}/generated-sources
|
build.generated.sources.dir=${build.dir}/generated-sources
|
||||||
build.test.classes.dir=${build.dir}/test/classes
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
build.test.results.dir=${build.dir}/test/results
|
build.test.results.dir=${build.dir}/test/results
|
||||||
build.web.dir=${build.dir}/web
|
build.web.dir=${build.dir}/web
|
||||||
build.web.excludes=${build.classes.excludes}
|
build.web.excludes=${build.classes.excludes}
|
||||||
client.urlPart=authentification
|
client.urlPart=authentification
|
||||||
compile.jsps=false
|
compile.jsps=false
|
||||||
conf.dir=${source.root}/conf
|
conf.dir=${source.root}/conf
|
||||||
debug.classpath=${build.classes.dir}:${javac.classpath}
|
debug.classpath=${build.classes.dir}:${javac.classpath}
|
||||||
debug.test.classpath=\
|
debug.test.classpath=\
|
||||||
${run.test.classpath}
|
${run.test.classpath}
|
||||||
display.browser=true
|
display.browser=true
|
||||||
# Files to be excluded from distribution war
|
# Files to be excluded from distribution war
|
||||||
dist.archive.excludes=
|
dist.archive.excludes=
|
||||||
dist.dir=dist
|
dist.dir=dist
|
||||||
dist.ear.war=${dist.dir}/${war.ear.name}
|
dist.ear.war=${dist.dir}/${war.ear.name}
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
dist.war=${dist.dir}/${war.name}
|
dist.war=${dist.dir}/${war.name}
|
||||||
endorsed.classpath=\
|
endorsed.classpath=\
|
||||||
${libs.javaee-endorsed-api-7.0.classpath}
|
${libs.javaee-endorsed-api-7.0.classpath}
|
||||||
excludes=
|
excludes=
|
||||||
file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar=C:\\Users\\domin\\Downloads\\lib\\jakarta.servlet.jsp.jstl-2.0.0.jar
|
file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar=C:\\Users\\domin\\Downloads\\lib\\jakarta.servlet.jsp.jstl-2.0.0.jar
|
||||||
file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar=C:\\Users\\domin\\Downloads\\lib\\jakarta.servlet.jsp.jstl-api-2.0.0.jar
|
file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar=C:\\Users\\domin\\Downloads\\lib\\jakarta.servlet.jsp.jstl-api-2.0.0.jar
|
||||||
file.reference.mysql-connector-java-8.0.26.jar=C:\\Users\\domin\\Downloads\\lib\\mysql-connector-java-8.0.26.jar
|
file.reference.mysql-connector-java-8.0.26.jar=C:\\Users\\domin\\Downloads\\lib\\mysql-connector-java-8.0.26.jar
|
||||||
includes=**
|
includes=**
|
||||||
j2ee.compile.on.save=true
|
j2ee.compile.on.save=true
|
||||||
j2ee.copy.static.files.on.save=true
|
j2ee.copy.static.files.on.save=true
|
||||||
j2ee.deploy.on.save=true
|
j2ee.deploy.on.save=true
|
||||||
j2ee.platform=1.7-web
|
j2ee.platform=1.7-web
|
||||||
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-ssi.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.20.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jakartaee-migration-1.0.0-shaded.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-cs.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
|
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-ssi.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.20.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jakartaee-migration-1.0.0-shaded.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-cs.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
|
||||||
j2ee.server.type=Tomcat
|
j2ee.server.type=Tomcat
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
javac.classpath=\
|
javac.classpath=\
|
||||||
${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar}:\
|
${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar}:\
|
||||||
${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar}:\
|
${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar}:\
|
||||||
${file.reference.mysql-connector-java-8.0.26.jar}
|
${file.reference.mysql-connector-java-8.0.26.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.debug=true
|
javac.debug=true
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
javac.processorpath=\
|
javac.processorpath=\
|
||||||
${javac.classpath}
|
${javac.classpath}
|
||||||
javac.source=1.7
|
javac.source=1.7
|
||||||
javac.target=1.7
|
javac.target=1.7
|
||||||
javac.test.classpath=\
|
javac.test.classpath=\
|
||||||
${javac.classpath}:\
|
${javac.classpath}:\
|
||||||
${build.classes.dir}
|
${build.classes.dir}
|
||||||
javac.test.processorpath=\
|
javac.test.processorpath=\
|
||||||
${javac.test.classpath}
|
${javac.test.classpath}
|
||||||
javadoc.additionalparam=
|
javadoc.additionalparam=
|
||||||
javadoc.author=false
|
javadoc.author=false
|
||||||
javadoc.encoding=${source.encoding}
|
javadoc.encoding=${source.encoding}
|
||||||
javadoc.noindex=false
|
javadoc.noindex=false
|
||||||
javadoc.nonavbar=false
|
javadoc.nonavbar=false
|
||||||
javadoc.notree=false
|
javadoc.notree=false
|
||||||
javadoc.preview=true
|
javadoc.preview=true
|
||||||
javadoc.private=false
|
javadoc.private=false
|
||||||
javadoc.splitindex=true
|
javadoc.splitindex=true
|
||||||
javadoc.use=true
|
javadoc.use=true
|
||||||
javadoc.version=false
|
javadoc.version=false
|
||||||
javadoc.windowtitle=
|
javadoc.windowtitle=
|
||||||
lib.dir=${web.docbase.dir}/WEB-INF/lib
|
lib.dir=${web.docbase.dir}/WEB-INF/lib
|
||||||
persistence.xml.dir=${conf.dir}
|
persistence.xml.dir=${conf.dir}
|
||||||
platform.active=default_platform
|
platform.active=default_platform
|
||||||
resource.dir=setup
|
resource.dir=setup
|
||||||
run.test.classpath=\
|
run.test.classpath=\
|
||||||
${javac.test.classpath}:\
|
${javac.test.classpath}:\
|
||||||
${build.test.classes.dir}
|
${build.test.classes.dir}
|
||||||
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
|
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
|
||||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
|
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
|
||||||
runmain.jvmargs=
|
runmain.jvmargs=
|
||||||
source.encoding=UTF-8
|
source.encoding=UTF-8
|
||||||
source.root=src
|
source.root=src
|
||||||
src.dir=${source.root}/java
|
src.dir=${source.root}/java
|
||||||
test.src.dir=test
|
test.src.dir=test
|
||||||
war.content.additional=
|
war.content.additional=
|
||||||
war.ear.name=${war.name}
|
war.ear.name=${war.name}
|
||||||
war.name=sdis29M1.war
|
war.name=sdis29M1.war
|
||||||
web.docbase.dir=web
|
web.docbase.dir=web
|
||||||
webinf.dir=web/WEB-INF
|
webinf.dir=web/WEB-INF
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
<type>org.netbeans.modules.web.project</type>
|
<type>org.netbeans.modules.web.project</type>
|
||||||
<configuration>
|
<configuration>
|
||||||
<data xmlns="http://www.netbeans.org/ns/web-project/3">
|
<data xmlns="http://www.netbeans.org/ns/web-project/3">
|
||||||
<name>sdis29M1</name>
|
<name>sdis29M1</name>
|
||||||
<minimum-ant-version>1.6.5</minimum-ant-version>
|
<minimum-ant-version>1.6.5</minimum-ant-version>
|
||||||
<web-module-libraries>
|
<web-module-libraries>
|
||||||
<library dirs="200">
|
<library dirs="200">
|
||||||
<file>${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar}</file>
|
<file>${file.reference.jakarta.servlet.jsp.jstl-2.0.0.jar}</file>
|
||||||
<path-in-war>WEB-INF/lib</path-in-war>
|
<path-in-war>WEB-INF/lib</path-in-war>
|
||||||
</library>
|
</library>
|
||||||
<library dirs="200">
|
<library dirs="200">
|
||||||
<file>${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar}</file>
|
<file>${file.reference.jakarta.servlet.jsp.jstl-api-2.0.0.jar}</file>
|
||||||
<path-in-war>WEB-INF/lib</path-in-war>
|
<path-in-war>WEB-INF/lib</path-in-war>
|
||||||
</library>
|
</library>
|
||||||
<library dirs="200">
|
<library dirs="200">
|
||||||
<file>${file.reference.mysql-connector-java-8.0.26.jar}</file>
|
<file>${file.reference.mysql-connector-java-8.0.26.jar}</file>
|
||||||
<path-in-war>WEB-INF/lib</path-in-war>
|
<path-in-war>WEB-INF/lib</path-in-war>
|
||||||
</library>
|
</library>
|
||||||
</web-module-libraries>
|
</web-module-libraries>
|
||||||
<web-module-additional-libraries/>
|
<web-module-additional-libraries/>
|
||||||
<source-roots>
|
<source-roots>
|
||||||
<root id="src.dir"/>
|
<root id="src.dir"/>
|
||||||
</source-roots>
|
</source-roots>
|
||||||
<test-roots>
|
<test-roots>
|
||||||
<root id="test.src.dir"/>
|
<root id="test.src.dir"/>
|
||||||
</test-roots>
|
</test-roots>
|
||||||
</data>
|
</data>
|
||||||
</configuration>
|
</configuration>
|
||||||
</project>
|
</project>
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
package bdd;
|
package bdd;
|
||||||
|
|
||||||
import bean.Dispo;
|
import bean.Gardes;
|
||||||
import bean.Pompier;
|
import bean.Pompier;
|
||||||
|
import util.TrmtDate;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -15,49 +16,46 @@ import java.util.ArrayList;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import util.TrmtDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author clementine.desrucques
|
* @author funcha.ahamadi
|
||||||
*/
|
*/
|
||||||
public class DispoMySql {
|
public class gardeMySQL {
|
||||||
private final Connection theConnection = Connexion.getConnect("localhost",
|
private final Connection theConnection = Connexion.getConnect("localhost",
|
||||||
"sdis29",
|
"sdis29",
|
||||||
"adminBDsdis",
|
"adminBDsdis",
|
||||||
"mdpBDsdis");
|
"mdpBDsdis");
|
||||||
|
public ArrayList<Gardes> getLesDisponibilite(Calendar[] lesDates, int[] lesPeriodes) {
|
||||||
public ArrayList<Dispo> getLesDispo(Calendar[] lesDates, String[] lesPeriodes) {
|
ArrayList<Gardes> lesDispo = new ArrayList<>();
|
||||||
ArrayList<Dispo> lesP = new ArrayList<>();
|
Gardes uneDispo;
|
||||||
Dispo uneDispo;
|
|
||||||
|
|
||||||
/* a. Initialisation de la collection lesVentil pour la période,
|
/* a. Initialisation de la collection lesVentil pour la période,
|
||||||
création d'une ventil par salarié, par date et période
|
création d'une ventil par salarié, par date et période
|
||||||
*/
|
*/
|
||||||
int indiceDateFin = lesDates.length - 1;
|
int indiceDateFin = lesDates.length - 1;
|
||||||
Pompier leP;
|
Pompier lePompier;
|
||||||
PompierMySQL sm = new PompierMySQL();
|
PompierMySQL pm = new PompierMySQL();
|
||||||
ArrayList<Pompier> lesPom = sm.readAll();
|
ArrayList<Pompier> lesPompiers = pm.readLesPompiersCaserne(idCaserne);
|
||||||
for (Pompier unP : lesPom) {
|
for (Pompier unPompier : lesPompiers) {
|
||||||
for (Calendar uneDate : lesDates) {
|
for (Calendar uneDate : lesDates) {
|
||||||
for (String unePeriode : lesPeriodes) {
|
for (int unePeriode : lesPeriodes) {
|
||||||
uneDispo = new Dispo(uneDate, unePeriode, unP);
|
uneDispo = new Gardes(uneDate, unePeriode, unPompier);
|
||||||
lesP.add(uneDispo);
|
lesDispo.add(uneDispo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* b) Maj de la collection lesVentil
|
/* b) Maj de la collection lesVentil
|
||||||
*/
|
*/
|
||||||
readAll(lesPomp, lesDates[0], lesDates[indiceDateFin]);
|
readAll(lesDispo, lesDates[0], lesDates[indiceDateFin]);
|
||||||
//System.out.println("lesVentil : " + lesVentil);
|
//System.out.println("lesDispo : " + lesDispo);
|
||||||
return lesPomp;
|
return lesDispo;
|
||||||
}
|
}
|
||||||
|
public void readAll(ArrayList<Gardes> lesDispo, Calendar d1, Calendar d2) {
|
||||||
public void readAll(ArrayList<Pompier> lesPomp, Calendar d1, Calendar d2) {
|
Pompier lePompier;
|
||||||
Pompier leP;
|
Gardes uneDispo;
|
||||||
Dispo uneDispo;
|
Gardes laDispoTrouvee;
|
||||||
Dispo laDispoTrouvee;
|
|
||||||
String sql = "SELECT * FROM gardes "
|
String sql = "SELECT * FROM gardes "
|
||||||
+ "INNER JOIN pompier on idPompier = id "
|
+ "INNER JOIN pompier on idPompier = id "
|
||||||
+ "WHERE jourGarde BETWEEN ? and ?;";
|
+ "WHERE jourGarde BETWEEN ? and ?;";
|
||||||
@ -66,35 +64,25 @@ public class DispoMySql {
|
|||||||
prepStmt.setDate(1, TrmtDate.getSQLDate(d1));
|
prepStmt.setDate(1, TrmtDate.getSQLDate(d1));
|
||||||
prepStmt.setDate(2, TrmtDate.getSQLDate(d2));
|
prepStmt.setDate(2, TrmtDate.getSQLDate(d2));
|
||||||
ResultSet resultat = prepStmt.executeQuery();
|
ResultSet resultat = prepStmt.executeQuery();
|
||||||
while (resultat.next()) {
|
while (resultat.next())
|
||||||
leP = new Pompier(
|
// public Pompier(Caserne laCaserne, int id, String nom, String prenom) {
|
||||||
|
lePompier = new Pompier(
|
||||||
resultat.getCaserne("laCaserne"),
|
resultat.getCaserne("laCaserne"),
|
||||||
resultat.getInt("id"),
|
resultat.getInt("id"),
|
||||||
resultat.getString("nom"),
|
resultat.getString("nom"),
|
||||||
resultat.getString("prenom"),
|
resultat.getString("prenom")
|
||||||
resultat.getParametre("leStatut"),
|
|
||||||
resultat.getParametre("leType"),
|
|
||||||
resultat.getString("mail"),
|
|
||||||
resultat.getString("login"),
|
|
||||||
resultat.getString("mdp"),
|
|
||||||
resultat.getString("adresse"),
|
|
||||||
resultat.getString("cp"),
|
|
||||||
resultat.getString("ville"),
|
|
||||||
resultat.getString("bip"),
|
|
||||||
resultat.getParametre("leGrade"),
|
|
||||||
resultat.getString("commentaire")
|
|
||||||
);
|
);
|
||||||
uneDispo = new Dispo(TrmtDate.getCalDate(resultat.getDate("jourVentil")),
|
uneDispo = new Gardes(TrmtDate.getCalDate(resultat.getDate("jourGarde")),
|
||||||
resultat.getString("periode"),
|
resultat.getInt("periode"),
|
||||||
leP);
|
lePompier);
|
||||||
// Recherche si unpompier existe dans les Pompier
|
// Recherche si uneDispo existe dans les Dispos
|
||||||
int indice = lesDispo.indexOf(uneDispo);
|
int indice = lesDispo.indexOf(uneDispo);
|
||||||
if (indice > -1) {
|
if (indice > -1) {
|
||||||
laDispoTrouvee = lesDispo.get(indice);
|
laDispoTrouvee = lesDispo.get(indice);
|
||||||
laDispoTrouvee.setActivite(resultat.getInt("dispo"));
|
laDispoTrouvee.setDisponibilite(resultat.getInt("disponibilite"));
|
||||||
laDispoTrouvee.setIsInBD(true);
|
laDispoTrouvee.setIsInBDD(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
prepStmt.close();
|
prepStmt.close();
|
||||||
resultat.close();
|
resultat.close();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
@ -103,12 +91,12 @@ public class DispoMySql {
|
|||||||
System.out.println("Code erreur : " + ex.getErrorCode());
|
System.out.println("Code erreur : " + ex.getErrorCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Suppression de la ventilation passé en param
|
* Suppression de la ventilation passé en param
|
||||||
* @param v : ventilation
|
* @param v : ventilation
|
||||||
* @return : nb lignes supprimées
|
* @return : nb lignes supprimées
|
||||||
*/
|
*/
|
||||||
public int delete(Dispo p) {
|
public int delete(Gardes v) {
|
||||||
int nbMaj = -1;
|
int nbMaj = -1;
|
||||||
String sql = "DELETE FROM gardes "
|
String sql = "DELETE FROM gardes "
|
||||||
+ "WHERE idPompier = ? AND"
|
+ "WHERE idPompier = ? AND"
|
||||||
@ -116,9 +104,9 @@ public class DispoMySql {
|
|||||||
+ "jourGarde = ?;";
|
+ "jourGarde = ?;";
|
||||||
try {
|
try {
|
||||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||||
prepStmt.setInt(1, p.getPompier().getId());
|
prepStmt.setInt(1, v.getPompier().getId());
|
||||||
prepStmt.setString(2, p.getPeriode());
|
prepStmt.setInt(2, v.getPeriode());
|
||||||
prepStmt.setDate(3, TrmtDate.getSQLDate(p.getJourVentil()));
|
prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourGarde()));
|
||||||
nbMaj= prepStmt.executeUpdate();
|
nbMaj= prepStmt.executeUpdate();
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
@ -131,24 +119,24 @@ public class DispoMySql {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int update(Dispo v) {
|
public int update(Gardes v) {
|
||||||
|
|
||||||
int nbMAJ = -1;
|
int nbMAJ = -1;
|
||||||
String sql = "UPDATE gardes "
|
String sql = "UPDATE gardes "
|
||||||
+ "SET ventil = ? "
|
+ "SET ventil = ? "
|
||||||
+ "WHERE idPompier = ? "
|
+ "WHERE idPompier= ? "
|
||||||
+ "AND jourGarde = ? "
|
+ "AND jourGarde = ? "
|
||||||
+ "AND periode = ?";
|
+ "AND periode = ?";
|
||||||
try {
|
try {
|
||||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||||
prepStmt.setInt(1, v.getActivite());
|
prepStmt.setInt(1, v.getDisponibilite());
|
||||||
prepStmt.setInt(2, v.getPompier().getId());
|
prepStmt.setInt(2, v.getPompier().getId());
|
||||||
prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourVentil()));
|
prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourGarde()));
|
||||||
prepStmt.setString(4, v.getPeriode());
|
prepStmt.setInt(4, v.getPeriode());
|
||||||
System.out.println("update : " + prepStmt);
|
System.out.println("update : " + prepStmt);
|
||||||
nbMAJ = prepStmt.executeUpdate();
|
nbMAJ = prepStmt.executeUpdate();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
Logger.getLogger(DispoMySql.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(gardeMySQL.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
return nbMAJ;
|
return nbMAJ;
|
||||||
}
|
}
|
||||||
@ -157,17 +145,17 @@ public class DispoMySql {
|
|||||||
* @param v : ventil à créer
|
* @param v : ventil à créer
|
||||||
* @return : id du ventil
|
* @return : id du ventil
|
||||||
*/
|
*/
|
||||||
public int create(Dispo v) {
|
public int create(Gardes v) {
|
||||||
int nbCre = -1;
|
int nbCre = -1;
|
||||||
String sql = "INSERT INTO gardes "
|
String sql = "INSERT INTO gardes "
|
||||||
+ "(jourGarde, idPompier, periode, ventil)"
|
+ "(jourGarde, periode, idPompier, ventil)"
|
||||||
+ "VALUES (?, ?, ?, ?);";
|
+ "VALUES (?, ?, ?, ?);";
|
||||||
try {
|
try {
|
||||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||||
prepStmt.setDate(1, TrmtDate.getSQLDate(v.getJourVentil()));
|
prepStmt.setDate(1, TrmtDate.getSQLDate(v.getJourGarde()));
|
||||||
prepStmt.setString(2, v.getPeriode());
|
prepStmt.setInt(2, v.getPeriode());
|
||||||
prepStmt.setInt(3, v.getPompier().getId());
|
prepStmt.setInt(3, v.getPompier().getId());
|
||||||
prepStmt.setInt(4, v.getActivite());
|
prepStmt.setInt(4, v.getDisponibilite());
|
||||||
int nbLigne= prepStmt.executeUpdate();
|
int nbLigne= prepStmt.executeUpdate();
|
||||||
if (nbLigne > 0) {
|
if (nbLigne > 0) {
|
||||||
ResultSet result = prepStmt.getGeneratedKeys();
|
ResultSet result = prepStmt.getGeneratedKeys();
|
||||||
@ -183,5 +171,13 @@ public class DispoMySql {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nbCre;
|
return nbCre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package bean;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author clementine.desrucques
|
|
||||||
*/
|
|
||||||
public class Dispo {
|
|
||||||
Calendar JourVentil;
|
|
||||||
String periode;
|
|
||||||
Pompier pompier;
|
|
||||||
int activite;
|
|
||||||
boolean isInBD;
|
|
||||||
|
|
||||||
public Dispo(Calendar JourVentil, String periode, Pompier pompier, int activite, boolean isInBD) {
|
|
||||||
this.JourVentil = JourVentil;
|
|
||||||
this.periode = periode;
|
|
||||||
this.pompier = pompier;
|
|
||||||
this.activite = activite;
|
|
||||||
this.isInBD = isInBD;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dispo(Calendar JourVentil, String periode, Pompier pompier) {
|
|
||||||
this.JourVentil = JourVentil;
|
|
||||||
this.periode = periode;
|
|
||||||
this.pompier = pompier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calendar getJourVentil() {
|
|
||||||
return JourVentil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJourVentil(Calendar JourVentil) {
|
|
||||||
this.JourVentil = JourVentil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPeriode() {
|
|
||||||
return periode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPeriode(String periode) {
|
|
||||||
this.periode = periode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pompier getPompier() {
|
|
||||||
return pompier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPompier(Pompier pompier) {
|
|
||||||
this.pompier = pompier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getActivite() {
|
|
||||||
return activite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivite(int activite) {
|
|
||||||
this.activite = activite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIsInBD() {
|
|
||||||
return isInBD;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsInBD(boolean isInBD) {
|
|
||||||
this.isInBD = isInBD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 79 * hash + Objects.hashCode(this.JourVentil);
|
|
||||||
hash = 79 * hash + Objects.hashCode(this.periode);
|
|
||||||
hash = 79 * hash + Objects.hashCode(this.pompier);
|
|
||||||
hash = 79 * hash + this.activite;
|
|
||||||
hash = 79 * hash + (this.isInBD ? 1 : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Dispo other = (Dispo) obj;
|
|
||||||
if (this.activite != other.activite) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.isInBD != other.isInBD) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(this.periode, other.periode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(this.JourVentil, other.JourVentil)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(this.pompier, other.pompier)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Dispo{" + "JourVentil=" + JourVentil + ", periode=" + periode + ", pompier=" + pompier + ", activite=" + activite + ", isInBD=" + isInBD + '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
123
src/java/bean/Gardes.java
Normal file
123
src/java/bean/Gardes.java
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package bean;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author funcha.ahamadi
|
||||||
|
*/
|
||||||
|
public class Gardes {
|
||||||
|
Calendar jourGarde;
|
||||||
|
int periode;
|
||||||
|
Pompier pompier;
|
||||||
|
int disponibilite;
|
||||||
|
boolean isInBDD;
|
||||||
|
|
||||||
|
public Gardes(Calendar jourGarde, int periode, Pompier pompier, int disponibilite, boolean isInBDD) {
|
||||||
|
this.jourGarde = jourGarde;
|
||||||
|
this.periode = periode;
|
||||||
|
this.pompier = pompier;
|
||||||
|
this.disponibilite = disponibilite;
|
||||||
|
this.isInBDD = isInBDD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Gardes(Calendar jourGarde, int periode, Pompier pompier) {
|
||||||
|
this.jourGarde = jourGarde;
|
||||||
|
this.periode = periode;
|
||||||
|
this.pompier = pompier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Calendar getJourGarde() {
|
||||||
|
return jourGarde;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJourGarde(Calendar jourGarde) {
|
||||||
|
this.jourGarde = jourGarde;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPeriode() {
|
||||||
|
return periode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriode(int periode) {
|
||||||
|
this.periode = periode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pompier getPompier() {
|
||||||
|
return pompier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPompier(Pompier pompier) {
|
||||||
|
this.pompier = pompier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDisponibilite() {
|
||||||
|
return disponibilite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisponibilite(int disponibilite) {
|
||||||
|
this.disponibilite = disponibilite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIsInBDD() {
|
||||||
|
return isInBDD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsInBDD(boolean isInBDD) {
|
||||||
|
this.isInBDD = isInBDD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 43 * hash + Objects.hashCode(this.jourGarde);
|
||||||
|
hash = 43 * hash + this.periode;
|
||||||
|
hash = 43 * hash + Objects.hashCode(this.pompier);
|
||||||
|
hash = 43 * hash + this.disponibilite;
|
||||||
|
hash = 43 * hash + (this.isInBDD ? 1 : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Gardes other = (Gardes) obj;
|
||||||
|
if (this.periode != other.periode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.disponibilite != other.disponibilite) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.isInBDD != other.isInBDD) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.jourGarde, other.jourGarde)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.pompier, other.pompier)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Gardes{" + "jourGarde=" + jourGarde + ", periode=" + periode + ", pompier=" + pompier + ", disponibilite=" + disponibilite + ", isInBDD=" + isInBDD + '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
package form;
|
package form;
|
||||||
|
|
||||||
import bdd.DispoMySql;
|
import bdd.gardeMySQL;
|
||||||
import bean.Dispo;
|
import bean.Gardes;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -21,28 +21,28 @@ public class DispoForm {
|
|||||||
|
|
||||||
public void verifDispo(HttpServletRequest request){
|
public void verifDispo(HttpServletRequest request){
|
||||||
HttpSession maS = request.getSession();
|
HttpSession maS = request.getSession();
|
||||||
ArrayList <Dispo> lesDispo = (ArrayList<Dispo>) maS.getAttribute("lesVentilInit");
|
ArrayList <Gardes> lesG = (ArrayList<Gardes>) maS.getAttribute("lesVentilInit");
|
||||||
|
|
||||||
DispoMySql vm = new DispoMySql();
|
gardeMySQL vm = new gardeMySQL();
|
||||||
Map<String, String[]> map = request.getParameterMap();
|
Map<String, String[]> map = request.getParameterMap();
|
||||||
String[] lesNvVentil = map.get("lesAct");
|
String[] lesNvVentil = map.get("lesAct");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Dispo uneDispo : lesDispo){
|
for(Gardes uneGarde : lesG){
|
||||||
int oldAct = uneDispo.getActivite();
|
int oldAct = uneGarde.getDisponibilite();
|
||||||
int newAct = Integer.parseInt(lesNvVentil[i]);
|
int newAct = Integer.parseInt(lesNvVentil[i]);
|
||||||
if(oldAct != newAct){
|
if(oldAct != newAct){
|
||||||
if(uneDispo.isIsInBD()){
|
if(uneGarde.isIsInBDD()){
|
||||||
if(newAct == 0){
|
if(newAct == 0){
|
||||||
vm.delete(uneDispo);
|
vm.delete(uneGarde);
|
||||||
uneDispo.setIsInBD(false);
|
uneGarde.setIsInBDD(false);
|
||||||
} else {
|
} else {
|
||||||
uneDispo.setActivite(newAct);
|
uneGarde.setDisponibilite(newAct);
|
||||||
vm.update(uneDispo);
|
vm.update(uneGarde);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uneDispo.setActivite(newAct);
|
uneGarde.setDisponibilite(newAct);
|
||||||
vm.create(uneDispo);
|
vm.create(uneGarde);
|
||||||
uneDispo.setIsInBD(true);
|
uneGarde.setIsInBDD(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -5,25 +5,26 @@
|
|||||||
*/
|
*/
|
||||||
package servlet;
|
package servlet;
|
||||||
|
|
||||||
import bdd.DispoMySql;
|
import bdd.gardeMySQL;
|
||||||
import bean.Dispo;
|
import bean.Gardes;
|
||||||
|
import bean.Pompier;
|
||||||
import form.DispoForm;
|
import form.DispoForm;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
import util.TrmtDate;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServlet;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import util.TrmtDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author clementine.desrucques
|
* @author funcha.ahamadi
|
||||||
*/
|
*/
|
||||||
public class DispoServlet extends HttpServlet {
|
public class GardesServlet extends HttpServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||||
@ -42,10 +43,10 @@ public class DispoServlet extends HttpServlet {
|
|||||||
out.println("<!DOCTYPE html>");
|
out.println("<!DOCTYPE html>");
|
||||||
out.println("<html>");
|
out.println("<html>");
|
||||||
out.println("<head>");
|
out.println("<head>");
|
||||||
out.println("<title>Servlet DispoServlet</title>");
|
out.println("<title>Servlet feuilleGardes</title>");
|
||||||
out.println("</head>");
|
out.println("</head>");
|
||||||
out.println("<body>");
|
out.println("<body>");
|
||||||
out.println("<h1>Servlet DispoServlet at " + request.getContextPath() + "</h1>");
|
out.println("<h1>Servlet feuilleGardes at " + request.getContextPath() + "</h1>");
|
||||||
out.println("</body>");
|
out.println("</body>");
|
||||||
out.println("</html>");
|
out.println("</html>");
|
||||||
}
|
}
|
||||||
@ -63,40 +64,34 @@ public class DispoServlet extends HttpServlet {
|
|||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
// processRequest(request, response);
|
//processRequest(request, response);
|
||||||
HttpSession maSession = request.getSession();
|
HttpSession maSession = request.getSession();
|
||||||
if (maSession.getAttribute("lesVentilInit") == null) {
|
ArrayList<Pompier> lesPompiers = (ArrayList<Pompier>) maSession.getAttribute("lesPompiers");
|
||||||
|
Calendar[] lesDates = new Calendar[7];
|
||||||
/* Initialisations des dates de la semaine */
|
String[] lesDatesEnString = new String[7];
|
||||||
Calendar[] lesDates = new Calendar[5];
|
lesDates[0] = TrmtDate.getDateDebutSemaine();
|
||||||
String[] lesDatesEnString = new String[5];
|
lesDatesEnString[0] = TrmtDate.getDateAAfficher(lesDates[0]);
|
||||||
lesDates[0] = TrmtDate.getDateDebutSemaine();
|
|
||||||
lesDatesEnString[0] = TrmtDate.getDateAAfficher(lesDates[0]);
|
for (int i = 1; i < lesDates.length; i++) {
|
||||||
for (int i = 1; i < lesDates.length; i++) {
|
lesDates[i] = TrmtDate.addDays(lesDates[0], i);
|
||||||
lesDates[i] = TrmtDate.addDays(lesDates[0], i);
|
lesDatesEnString[i] = TrmtDate.getDateAAfficher(lesDates[i]);
|
||||||
lesDatesEnString[i] = TrmtDate.getDateAAfficher(lesDates[i]);
|
}
|
||||||
}
|
maSession.setAttribute("lesDates", lesDates);
|
||||||
|
maSession.setAttribute("lesDatesEnString", lesDatesEnString);
|
||||||
maSession.setAttribute("lesDates", lesDates);
|
/*Initialisation des periodes */
|
||||||
maSession.setAttribute("lesDatesEnString", lesDatesEnString);
|
int[] lesPeriodes = {1,2,3,4};
|
||||||
//System.out.println("lesDates "+ lesDates[4].getTime());
|
maSession.setAttribute("lesPeriodes", lesPeriodes);
|
||||||
|
/* Recherche des ventilations */
|
||||||
/* Initialisation des périodes */
|
gardeMySQL vm = new gardeMySQL();
|
||||||
String[] lesPeriodes = {"AM", "PM"};
|
ArrayList<Gardes> lesVentilInit = vm.getLesDisponibilite(lesDates, lesPeriodes);
|
||||||
maSession.setAttribute("lesPeriodes", lesPeriodes);
|
|
||||||
|
|
||||||
/* Recherche des ventilations */
|
|
||||||
DispoMySql vm = new DispoMySql();
|
|
||||||
ArrayList<Dispo> lesVentilInit = vm.getLesDispo(lesDates, lesPeriodes);
|
|
||||||
//System.out.println("lesVentilInit : " + lesVentilInit);
|
//System.out.println("lesVentilInit : " + lesVentilInit);
|
||||||
maSession.setAttribute("lesVentilInit", lesVentilInit);
|
maSession.setAttribute("lesVentilInit", lesVentilInit);
|
||||||
|
|
||||||
/* Initialisation des couleurs */
|
/* Initialisation des couleurs */
|
||||||
String[] lesCouleurs = {"blanc", "gris", "jaune"};
|
String[] lesCouleurs = {"blanc", "gris", "jaune"};
|
||||||
maSession.setAttribute("lesCouleurs", lesCouleurs);
|
maSession.setAttribute("lesCouleurs", lesCouleurs);
|
||||||
}
|
|
||||||
/* Affichage de la page de ventilation */
|
/* Affichage de la page de ventilation */
|
||||||
getServletContext().getRequestDispatcher("/WEB-INF/gardeJSP.jsp").forward(request, response);
|
getServletContext().getRequestDispatcher("/WEB-INF/feuilleGardesJSP.jsp").forward(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,129 +1,129 @@
|
|||||||
package util;
|
package util;
|
||||||
/*
|
/*
|
||||||
* Classe abstraite facilitant le traitement des dates
|
* Classe abstraite facilitant le traitement des dates
|
||||||
* Toutes les méthodes sont statiques, appel : TrmtDate.nomMéthode
|
* Toutes les méthodes sont statiques, appel : TrmtDate.nomMéthode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Dominique_2
|
* @author Dominique_2
|
||||||
*/
|
*/
|
||||||
public abstract class TrmtDate {
|
public abstract class TrmtDate {
|
||||||
static Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
|
static Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recherche de la date du début de la semaine courante
|
* Recherche de la date du début de la semaine courante
|
||||||
* @return date du lundi de la semaine, format Calendar
|
* @return date du lundi de la semaine, format Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar getDateDebutSemaine() {
|
public static Calendar getDateDebutSemaine() {
|
||||||
return getDateDebutSemaine(getDateDuJour());
|
return getDateDebutSemaine(getDateDuJour());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recherche de la date du début de semaine à partir de la date passée en paramètre
|
* Recherche de la date du début de semaine à partir de la date passée en paramètre
|
||||||
* @param c Calendar, date de recherche
|
* @param c Calendar, date de recherche
|
||||||
* @return Calendar, début semaine à partir de c
|
* @return Calendar, début semaine à partir de c
|
||||||
*/
|
*/
|
||||||
public static Calendar getDateDebutSemaine(Calendar c) {
|
public static Calendar getDateDebutSemaine(Calendar c) {
|
||||||
Calendar leCal = getClone(c);
|
Calendar leCal = getClone(c);
|
||||||
leCal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
|
leCal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
|
||||||
//System.out.println("Date du lundi correspondant : " + nvCal.getTime());
|
//System.out.println("Date du lundi correspondant : " + nvCal.getTime());
|
||||||
return leCal;
|
return leCal;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retourne la date passée en paramètre sous la forme : lun.05/10 par exemple
|
* Retourne la date passée en paramètre sous la forme : lun.05/10 par exemple
|
||||||
* @param d date à transformer
|
* @param d date à transformer
|
||||||
* @return chaine de car., forme lun.05/10 par exemple
|
* @return chaine de car., forme lun.05/10 par exemple
|
||||||
*/
|
*/
|
||||||
public static String getDateAAfficher(Calendar d) {
|
public static String getDateAAfficher(Calendar d) {
|
||||||
Locale locale = Locale.getDefault();
|
Locale locale = Locale.getDefault();
|
||||||
String dateAAfficher = d.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale);
|
String dateAAfficher = d.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM");
|
||||||
String jrMois = sdf.format(d.getTime());
|
String jrMois = sdf.format(d.getTime());
|
||||||
dateAAfficher += jrMois;
|
dateAAfficher += jrMois;
|
||||||
return dateAAfficher;
|
return dateAAfficher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne une date égale à la date passée en paramètre plus le nb jours indiqués
|
* Retourne une date égale à la date passée en paramètre plus le nb jours indiqués
|
||||||
* @param dateInit date initiale, format Calendar
|
* @param dateInit date initiale, format Calendar
|
||||||
* @param days nb jours à ajouter
|
* @param days nb jours à ajouter
|
||||||
* @return dateInit + days, format Calendar
|
* @return dateInit + days, format Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar addDays(Calendar dateInit, int days) {
|
public static Calendar addDays(Calendar dateInit, int days) {
|
||||||
Calendar leCal = getClone(dateInit);
|
Calendar leCal = getClone(dateInit);
|
||||||
leCal.setTime(dateInit.getTime());
|
leCal.setTime(dateInit.getTime());
|
||||||
leCal.add(Calendar.DAY_OF_MONTH, days);
|
leCal.add(Calendar.DAY_OF_MONTH, days);
|
||||||
return leCal;
|
return leCal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne une instance de Calendar correspondant à la date au format SQl
|
* Retourne une instance de Calendar correspondant à la date au format SQl
|
||||||
* passée en paramètre
|
* passée en paramètre
|
||||||
* @param sqlDate : date au format java.sql.Date
|
* @param sqlDate : date au format java.sql.Date
|
||||||
* @return instance de Calendar
|
* @return instance de Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar getCalDate(java.sql.Date sqlDate) {
|
public static Calendar getCalDate(java.sql.Date sqlDate) {
|
||||||
cal.setTime(new java.util.Date(sqlDate.getTime()));
|
cal.setTime(new java.util.Date(sqlDate.getTime()));
|
||||||
return cal;
|
return cal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne une date sql à partir d'une instance de Calendar
|
* Retourne une date sql à partir d'une instance de Calendar
|
||||||
* @param unCal
|
* @param unCal
|
||||||
* @return date sql
|
* @return date sql
|
||||||
*/
|
*/
|
||||||
public static java.sql.Date getSQLDate(Calendar unCal) {
|
public static java.sql.Date getSQLDate(Calendar unCal) {
|
||||||
return new java.sql.Date(unCal.getTimeInMillis());
|
return new java.sql.Date(unCal.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne une instance de Calendar correspondant à la date
|
* Retourne une instance de Calendar correspondant à la date
|
||||||
* passée en paramètre
|
* passée en paramètre
|
||||||
* @param utilDate : date au format java.util.Date
|
* @param utilDate : date au format java.util.Date
|
||||||
* @return instance de Calendar
|
* @return instance de Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar getCalDate(java.util.Date utilDate) {
|
public static Calendar getCalDate(java.util.Date utilDate) {
|
||||||
cal.setTime(utilDate);
|
cal.setTime(utilDate);
|
||||||
return cal;
|
return cal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne la date du jour au format SQL
|
* Retourne la date du jour au format SQL
|
||||||
* @return Date au format sql
|
* @return Date au format sql
|
||||||
*/
|
*/
|
||||||
public static java.sql.Date getSQLDateDuJour() {
|
public static java.sql.Date getSQLDateDuJour() {
|
||||||
return java.sql.Date.valueOf(java.time.LocalDate.now());
|
return java.sql.Date.valueOf(java.time.LocalDate.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne la date du jour au format Calendar
|
* Retourne la date du jour au format Calendar
|
||||||
* @return Calendar
|
* @return Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar getDateDuJour() {
|
public static Calendar getDateDuJour() {
|
||||||
Calendar nvCal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
|
Calendar nvCal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
|
||||||
nvCal.set(Calendar.HOUR_OF_DAY, 0);
|
nvCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
nvCal.set(Calendar.MINUTE, 0);
|
nvCal.set(Calendar.MINUTE, 0);
|
||||||
nvCal.set(Calendar.SECOND, 0);
|
nvCal.set(Calendar.SECOND, 0);
|
||||||
nvCal.set(Calendar.MILLISECOND, 0);
|
nvCal.set(Calendar.MILLISECOND, 0);
|
||||||
//System.out.println("Date du jour : " + nvCal.getTime());
|
//System.out.println("Date du jour : " + nvCal.getTime());
|
||||||
return nvCal;
|
return nvCal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permet d'obtenir une autre instance de Calendar identique à celle passée en paramètre
|
* Permet d'obtenir une autre instance de Calendar identique à celle passée en paramètre
|
||||||
* @param c Calendar à cloner
|
* @param c Calendar à cloner
|
||||||
* @return nouvelle instance de Calendar
|
* @return nouvelle instance de Calendar
|
||||||
*/
|
*/
|
||||||
public static Calendar getClone(Calendar c) {
|
public static Calendar getClone(Calendar c) {
|
||||||
Calendar leCal = Calendar.getInstance();
|
Calendar leCal = Calendar.getInstance();
|
||||||
leCal.setTime(c.getTime());
|
leCal.setTime(c.getTime());
|
||||||
return leCal;
|
return leCal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
54
web/WEB-INF/feuilleGardes.jsp
Normal file
54
web/WEB-INF/feuilleGardes.jsp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<%--
|
||||||
|
Document : feuilleGardes
|
||||||
|
Created on : 6 déc. 2021, 15:07:45
|
||||||
|
Author : funcha.ahamadi
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<legend>
|
||||||
|
Feuille de gardes
|
||||||
|
</legend>
|
||||||
|
<form action="gardes" method="POST">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th rowspan="2">N° de BIP</th>
|
||||||
|
<th rowspan="2">Nom Prenom</th>
|
||||||
|
<c:forEach items='${sessionScope.lesDatesEnString}' var="uneDate" varStatus="status">
|
||||||
|
<th colspan="2" class="text-center"> ${uneDate}</th>
|
||||||
|
</c:forEach>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<c:forEach var="i" begin="0" end="4" step="1">
|
||||||
|
<c:forEach items='${sessionScope.lesPeriodes}' var="unePeriode" varStatus="status">
|
||||||
|
<td class="text-center">${unePeriode}</td>
|
||||||
|
</c:forEach>
|
||||||
|
</c:forEach>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:set var="oldId" value="-1" scope="page"/>
|
||||||
|
<tr>
|
||||||
|
<c:forEach items='${sessionScope.lesVentilInit}' var="uneVentil" varStatus="status">
|
||||||
|
<c:set var="newId" value='${uneVentil.getPompier().getId()}' scope="page"/>
|
||||||
|
<c:if test='${oldId != newId}' var="test" scope="page">
|
||||||
|
</tr><tr>
|
||||||
|
<td>${uneVentil.getPompier().getId()}</td>
|
||||||
|
<td>${uneVentil.getPompier().getNom()} ${uneVentil.getPompier().getPrenom()}</td>
|
||||||
|
|
||||||
|
<c:set var="oldId" value='${newId}' scope="page"/>
|
||||||
|
</c:if>
|
||||||
|
<c:set var="activite" value='${uneVentil.getActivite()}' scope="page"/>
|
||||||
|
<td>
|
||||||
|
<input readonly type="text" value='${activite}' name="lesActivites"class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||||
|
</td>
|
||||||
|
</c:forEach>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</form><!-- comment -->
|
@ -109,4 +109,4 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div> <!-- fin id=identie -->
|
</div> <!-- fin id=identie -->
|
||||||
</div> <!-- fin class=container -->
|
</div> <!-- fin class=container -->
|
||||||
</header>
|
</header>
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<servlet-class>servlet.PompierServlet</servlet-class>
|
<servlet-class>servlet.PompierServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>DispoServlet</servlet-name>
|
<servlet-name>feuilleGardes</servlet-name>
|
||||||
<servlet-class>servlet.DispoServlet</servlet-class>
|
<servlet-class>servlet.GardesServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>AuthentifServlet</servlet-name>
|
<servlet-name>AuthentifServlet</servlet-name>
|
||||||
@ -29,8 +29,8 @@
|
|||||||
<url-pattern>/pompier</url-pattern>
|
<url-pattern>/pompier</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>DispoServlet</servlet-name>
|
<servlet-name>feuilleGardes</servlet-name>
|
||||||
<url-pattern>/DispoServlet</url-pattern>
|
<url-pattern>/gardes</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
<session-config>
|
<session-config>
|
||||||
<session-timeout>
|
<session-timeout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user