Initial commit
This commit is contained in:
commit
e4622a32bd
22
.devcontainer/Dockerfile
Normal file
22
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
ARG VARIANT=17-bullseye
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
|
||||
|
||||
# [Option] Install Maven
|
||||
ARG INSTALL_MAVEN="false"
|
||||
ARG MAVEN_VERSION=""
|
||||
|
||||
# [Option] Install Gradle
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
ARG JDK_VERSION="17.0.3.fx-zulu"
|
||||
RUN su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install java ${JDK_VERSION}"
|
||||
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --install-recommends libgtk-3-0 libgtk-3-dev libglu1-mesa
|
||||
|
||||
RUN sudo chsh -s /bin/zsh vscode
|
46
.devcontainer/devcontainer.json
Normal file
46
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "Java",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"JDK_VERSION":"17.0.3.fx-zulu",
|
||||
"INSTALL_MAVEN": "true",
|
||||
"MAVEN_VERSION": "3.8.5",
|
||||
"INSTALL_GRADLE": "false",
|
||||
}
|
||||
},
|
||||
|
||||
"settings": {
|
||||
"java.jdt.ls.java.home": "/usr/local/sdkman/candidates/java/current",
|
||||
"maven.executable.path": "/usr/local/sdkman/candidates/maven/current/bin/mvn",
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"zsh": {
|
||||
"path": "zsh",
|
||||
}
|
||||
},
|
||||
"terminal.integrated.defaultProfile.linux": "zsh"
|
||||
},
|
||||
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack",
|
||||
"redhat.vscode-xml",
|
||||
"redhat.fabric8-analytics",
|
||||
"SonarSource.sonarlint-vscode"
|
||||
],
|
||||
|
||||
"remoteUser": "vscode",
|
||||
|
||||
"features": {
|
||||
"git": "os-provided",
|
||||
},
|
||||
|
||||
"containerEnv": {
|
||||
"DISPLAY": ":1"
|
||||
},
|
||||
|
||||
"runArgs": [
|
||||
"--network=host",
|
||||
"-e", "DISPLAY=${env:DISPLAY}",
|
||||
"-v", "/tmp/.X11-unix:/tmp/.X11-unix"
|
||||
]
|
||||
}
|
14
.github/classroom/autograding.json
vendored
Normal file
14
.github/classroom/autograding.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"tests": [
|
||||
{
|
||||
"name": "Test",
|
||||
"setup": "",
|
||||
"run": "xvfb-run --auto-servernum mvn test",
|
||||
"input": "",
|
||||
"output": "",
|
||||
"comparison": "included",
|
||||
"timeout": 30,
|
||||
"points": null
|
||||
}
|
||||
]
|
||||
}
|
24
.github/workflows/actions_template_sync.yml
vendored
Normal file
24
.github/workflows/actions_template_sync.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: actions-template-sync
|
||||
|
||||
on:
|
||||
# cronjob trigger At 00:00 on day-of-month 1. https://crontab.guru/every-month
|
||||
schedule:
|
||||
- cron: "0 0 1 * *"
|
||||
# manual trigger
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
repo-sync:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# To use this repository's private action, you must check out the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: actions-template-sync
|
||||
uses: AndreasAugustin/actions-template-sync@v0.3.1-draft
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
source_repo_path: IUTInfoAix-R202/tp4
|
||||
upstream_branch: main # defaults to main
|
||||
pr_labels: bug
|
19
.github/workflows/classroom.yml
vendored
Normal file
19
.github/workflows/classroom.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: GitHub Classroom Workflow
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Autograding
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: sudo apt-get install xvfb
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
java-package: 'jdk+fx'
|
||||
cache: maven
|
||||
- uses: education/autograding@v1
|
21
.github/workflows/maven.yml
vendored
Normal file
21
.github/workflows/maven.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: Java CI with Maven
|
||||
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
java-package: 'jdk+fx'
|
||||
cache: maven
|
||||
- name: Run headless test
|
||||
uses: GabrielBB/xvfb-action@v1
|
||||
with:
|
||||
run: mvn -B package --file pom.xml
|
100
.gitignore
vendored
Normal file
100
.gitignore
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.idea/
|
||||
*.iml
|
||||
*.log
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# CMake
|
||||
cmake-build-debug/
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
40
.gitpod.yml
Normal file
40
.gitpod.yml
Normal file
@ -0,0 +1,40 @@
|
||||
image:
|
||||
file: Dockerfile
|
||||
|
||||
tasks:
|
||||
- init: |
|
||||
mysql -e "CREATE USER 'monUser'@'localhost' IDENTIFIED BY 'monPassword';"
|
||||
mysql -e "CREATE DATABASE GestionPedaBD"
|
||||
mysql -e "GRANT ALL PRIVILEGES ON GestionPedaBD.* TO 'monUser'@'localhost';"
|
||||
mysql -u monUser -pmonPassword GestionPedaBD < gestion_peda_mysql.sql
|
||||
mvn verify -DskipTests=true
|
||||
- command: mvn compile exec:java -Dexec.mainClass=fr.univ_amu.iut.ExempleJDBC -Dexec.cleanupDaemonThreads=false -DskipTests=true
|
||||
|
||||
ports:
|
||||
- port: 3306
|
||||
onOpen: ignore
|
||||
|
||||
vscode:
|
||||
extensions:
|
||||
- vscjava.vscode-maven
|
||||
- vscjava.vscode-java-dependency
|
||||
- vscjava.vscode-java-debug
|
||||
- vscjava.vscode-java-test
|
||||
- vscjava.vscode-java-pack
|
||||
- redhat.vscode-commons
|
||||
- redhat.java
|
||||
- redhat.vscode-xml
|
||||
- redhat.fabric8-analytics
|
||||
|
||||
github:
|
||||
prebuilds:
|
||||
# enable for the master/default branch (defaults to true)
|
||||
master: true
|
||||
# enable for all branches in this repo (defaults to false)
|
||||
branches: false
|
||||
# enable for pull requests coming from this repo (defaults to true)
|
||||
pullRequests: true
|
||||
# add a check to pull requests (defaults to true)
|
||||
addCheck: true
|
||||
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
|
||||
addComment: true
|
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.test.defaultConfig": "first",
|
||||
"java.test.config": {
|
||||
"name": "first",
|
||||
"workingDirectory": "${workspaceFolder}",
|
||||
"args": [],
|
||||
"vmargs": ["--add-exports", "javafx.graphics/com.sun.javafx.application=ALL-UNNAMED"],
|
||||
"env": {},
|
||||
}
|
||||
}
|
2
Dockerfile
Normal file
2
Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM gitpod/workspace-mysql
|
||||
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.3.fx-zulu"
|
121
LICENSE
Normal file
121
LICENSE
Normal file
@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# <img src="https://raw.githubusercontent.com/IUTInfoAix-M2105/Syllabus/master/assets/logo.png" alt="class logo" class="logo"/> Développement d'application SAE 2.01
|
||||
|
||||
## IUT d’Aix-Marseille – Département Informatique Aix-en-Provence
|
||||
|
||||
- **Ressource:** [R2.02](https://cache.media.enseignementsup-recherche.gouv.fr/file/SPE4-MESRI-17-6-2021/35/5/Annexe_17_INFO_BUT_annee_1_1411355.pdf)
|
||||
- **Responsables:**
|
||||
- [Sébastien Nedjar](mailto:sebastien.nedjar@univ-amu.fr)
|
||||
- [Cyril Pain-Barre](mailto:cyril.pain-barre@univ-amu.fr)
|
||||
- **Besoin d'aide ?**
|
||||
- Consulter et/ou créer des [issues](https://github.com/IUTInfoAix-R202/cours/issues).
|
||||
- [Email](mailto:sebastien.nedjar@univ-amu.fr) pour une question d'ordre privée, ou pour convenir d'un rendez-vous physique.
|
||||
|
||||
## Création de votre fork
|
||||
|
||||
La première chose que vous allez faire est de créer un fork d'un dépôt. Pour ce faire, rendez-vous sur le lien suivant :
|
||||
<https://classroom.github.com/a/VC0pQrhm>
|
||||
|
||||
Vous devrez créer un fork par équipe. Une fois le fork créé, vous devrez ajouter manuellement vos collègues comme propriétaire du dépôt.
|
198
pom.xml
Normal file
198
pom.xml
Normal file
@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>fr.univ_amu.iut</groupId>
|
||||
<artifactId>sae201</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>SAE 201</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.release>17</maven.compiler.release>
|
||||
<junit.jupiter.version>5.4.2</junit.jupiter.version>
|
||||
<javafx.version>18.0.1</javafx.version>
|
||||
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
|
||||
<derby.version>10.15.2.0</derby.version>
|
||||
<eclipselink.version>3.0.2</eclipselink.version>
|
||||
<jakarta.persistence.version>3.1.0</jakarta.persistence.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-graphics</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-media</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.kordamp.ikonli</groupId>
|
||||
<artifactId>ikonli-javafx</artifactId>
|
||||
<version>12.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.kordamp.ikonli</groupId>
|
||||
<artifactId>ikonli-materialdesign-pack</artifactId>
|
||||
<version>12.3.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testfx</groupId>
|
||||
<artifactId>testfx-core</artifactId>
|
||||
<version>4.0.16-alpha</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testfx</groupId>
|
||||
<artifactId>testfx-junit5</artifactId>
|
||||
<version>4.0.16-alpha</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>4.5.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.29</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.3.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.persistence</groupId>
|
||||
<artifactId>jakarta.persistence-api</artifactId>
|
||||
<version>${jakarta.persistence.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.persistence</groupId>
|
||||
<artifactId>eclipselink</artifactId>
|
||||
<version>${eclipselink.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.fxml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<release>${maven.compiler.release}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>${javafx.maven.plugin.version}</version>
|
||||
<configuration>
|
||||
<jlinkImageName>app</jlinkImageName>
|
||||
<launcher>launcher</launcher>
|
||||
<mainClass>sae201/fr.univ_amu.iut.FranceMain</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<argLine>
|
||||
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
48
src/main/java/fr/univ_amu/iut/FranceMain.java
Normal file
48
src/main/java/fr/univ_amu/iut/FranceMain.java
Normal file
@ -0,0 +1,48 @@
|
||||
package fr.univ_amu.iut;
|
||||
|
||||
import fr.univ_amu.iut.view.map.AcademiePath;
|
||||
import fr.univ_amu.iut.view.map.France;
|
||||
import fr.univ_amu.iut.view.map.FranceBuilder;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.BackgroundFill;
|
||||
import javafx.scene.layout.CornerRadii;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class FranceMain extends Application {
|
||||
France france;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
france = FranceBuilder.create()
|
||||
//.backgroundColor(Color.web("#4aa9d7"))
|
||||
//.fillColor(Color.web("#dcb36c"))
|
||||
//.strokeColor(Color.web("#987028"))
|
||||
//.hoverColor(Color.web("#fec47e"))
|
||||
//.pressedColor(Color.web("#6cee85"))
|
||||
//.selectedColor(Color.MAGENTA)
|
||||
.mousePressHandler(evt -> {
|
||||
AcademiePath academiePath = (AcademiePath) evt.getSource();
|
||||
System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
|
||||
})
|
||||
.selectionEnabled(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
StackPane pane = new StackPane(france);
|
||||
pane.setBackground(new Background(new BackgroundFill(france.getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
Scene scene = new Scene(pane);
|
||||
stage.setTitle("Carte des académie");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
217
src/main/java/fr/univ_amu/iut/JPAMain.java
Normal file
217
src/main/java/fr/univ_amu/iut/JPAMain.java
Normal file
@ -0,0 +1,217 @@
|
||||
package fr.univ_amu.iut;
|
||||
|
||||
import fr.univ_amu.iut.model.Acteur;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.Persistence;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JPAMain extends Application {
|
||||
private static final EntityManagerFactory emf = Persistence.createEntityManagerFactory("gestionUsagesPU");
|
||||
private static final EntityManager em = emf.createEntityManager();
|
||||
private TableView<Acteur> table;
|
||||
private TableColumn<Acteur, String> nom;
|
||||
private TableColumn<Acteur, Integer> id;
|
||||
private TableColumn<Acteur, String> prenom;
|
||||
private TableColumn<Acteur, String> ville;
|
||||
private TableColumn<Acteur, String> typeActeur;
|
||||
private ObservableList<Acteur> data;
|
||||
private HBox boutons;
|
||||
private Button ajouter;
|
||||
private Button supprimer;
|
||||
private VBox racine;
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
initialiserTable();
|
||||
initialiserBoutons();
|
||||
initialiserRacine();
|
||||
|
||||
Scene scene = new Scene(racine, 600, 400);
|
||||
stage.setScene(scene);
|
||||
stage.setTitle("Liste d'acteurs");
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void initialiserRacine() {
|
||||
racine = new VBox();
|
||||
racine.setPadding(new Insets(10));
|
||||
racine.getChildren().addAll(table, boutons);
|
||||
}
|
||||
|
||||
private void initialiserBoutons() {
|
||||
boutons = new HBox(10);
|
||||
boutons.setPadding(new Insets(10));
|
||||
boutons.setAlignment(Pos.CENTER);
|
||||
initialiserBoutonAjouter();
|
||||
initialiserBoutonSupprimer();
|
||||
boutons.getChildren().addAll(ajouter, supprimer);
|
||||
}
|
||||
|
||||
private void initialiserBoutonSupprimer() {
|
||||
supprimer = new Button("Supprimer");
|
||||
supprimer.setOnAction(this::supprimerActeur);
|
||||
}
|
||||
|
||||
private void initialiserBoutonAjouter() {
|
||||
ajouter = new Button("Ajouter");
|
||||
ajouter.setOnAction(this::ajouterActeur);
|
||||
}
|
||||
|
||||
private void initialiserTable() {
|
||||
table = new TableView<>();
|
||||
table.setEditable(true);
|
||||
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
table.getSelectionModel().select(0);
|
||||
|
||||
initialiserColonnes();
|
||||
insererColonnes();
|
||||
remplirDonnees();
|
||||
|
||||
VBox.setVgrow(table, Priority.ALWAYS);
|
||||
}
|
||||
|
||||
private static TableColumn<Acteur, Integer> initialiserColonneId() {
|
||||
TableColumn<Acteur, Integer> code = new TableColumn<>("Identifiant");
|
||||
code.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
return code;
|
||||
}
|
||||
|
||||
private static TableColumn<Acteur, String> initialiserColonneNom() {
|
||||
TableColumn<Acteur, String> nom = new TableColumn<>("Nom");
|
||||
nom.setCellValueFactory(new PropertyValueFactory<>("nom"));
|
||||
nom.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
nom.setOnEditCommit(event -> {
|
||||
int index = event.getTablePosition().getRow();
|
||||
Acteur acteur = event.getTableView().getItems().get(index);
|
||||
em.getTransaction().begin();
|
||||
acteur.setNom(event.getNewValue());
|
||||
em.getTransaction().commit();
|
||||
});
|
||||
return nom;
|
||||
}
|
||||
|
||||
private static TableColumn<Acteur, String> initialiserColonnePrenom() {
|
||||
TableColumn<Acteur, String> prenom = new TableColumn<>("Prénom");
|
||||
prenom.setCellValueFactory(new PropertyValueFactory<>("prenom"));
|
||||
prenom.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
prenom.setOnEditCommit(event -> {
|
||||
int index = event.getTablePosition().getRow();
|
||||
Acteur acteur = event.getTableView().getItems().get(index);
|
||||
em.getTransaction().begin();
|
||||
acteur.setPrenom(event.getNewValue());
|
||||
em.getTransaction().commit();
|
||||
});
|
||||
|
||||
return prenom;
|
||||
}
|
||||
|
||||
private static TableColumn<Acteur, String> initialiserColonneVille() {
|
||||
TableColumn<Acteur, String> ville = new TableColumn<>("Ville");
|
||||
ville.setCellValueFactory(new PropertyValueFactory<>("ville"));
|
||||
ville.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
ville.setOnEditCommit(event -> {
|
||||
int index = event.getTablePosition().getRow();
|
||||
Acteur acteur = event.getTableView().getItems().get(index);
|
||||
em.getTransaction().begin();
|
||||
acteur.setVille(event.getNewValue());
|
||||
em.getTransaction().commit();
|
||||
});
|
||||
return ville;
|
||||
}
|
||||
|
||||
private TableColumn<Acteur, String> initialiserColonneTypeActeur() {
|
||||
TableColumn<Acteur, String> typeActeur = new TableColumn<>("Type d'acteur");
|
||||
typeActeur.setCellValueFactory(new PropertyValueFactory<>("typeActeur"));
|
||||
typeActeur.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
typeActeur.setOnEditCommit(event -> {
|
||||
int index = event.getTablePosition().getRow();
|
||||
Acteur acteur = event.getTableView().getItems().get(index);
|
||||
em.getTransaction().begin();
|
||||
acteur.setTypeActeur(event.getNewValue());
|
||||
em.getTransaction().commit();
|
||||
});
|
||||
return typeActeur;
|
||||
}
|
||||
|
||||
private void initialiserColonnes() {
|
||||
id = initialiserColonneId();
|
||||
nom = initialiserColonneNom();
|
||||
prenom = initialiserColonnePrenom();
|
||||
ville = initialiserColonneVille();
|
||||
typeActeur = initialiserColonneTypeActeur();
|
||||
}
|
||||
|
||||
private void insererColonnes() {
|
||||
table.getColumns().addAll(List.of(id, nom, prenom, ville, typeActeur));
|
||||
}
|
||||
|
||||
private void remplirDonnees() {
|
||||
data = listerActeurs();
|
||||
table.setItems(data);
|
||||
}
|
||||
|
||||
private ObservableList<Acteur> listerActeurs() {
|
||||
TypedQuery<Acteur> query = em.createNamedQuery("Acteur.findAll", Acteur.class);
|
||||
return FXCollections.observableList(query.getResultList());
|
||||
}
|
||||
|
||||
private void ajouterActeur(ActionEvent event) {
|
||||
Acteur acteur = new Acteur();
|
||||
em.getTransaction().begin();
|
||||
em.persist(acteur);
|
||||
em.getTransaction().commit();
|
||||
data.add(acteur);
|
||||
|
||||
int rowIndex = data.size() - 1;
|
||||
table.requestFocus();
|
||||
table.scrollTo(rowIndex);
|
||||
table.getSelectionModel().select(rowIndex);
|
||||
table.getFocusModel().focus(rowIndex);
|
||||
}
|
||||
|
||||
private void supprimerActeur(ActionEvent event) {
|
||||
if (table.getItems().size() == 0) return;
|
||||
|
||||
em.getTransaction().begin();
|
||||
em.remove(table.getSelectionModel().getSelectedItem());
|
||||
em.getTransaction().commit();
|
||||
|
||||
int selectedRowIndex = table.getSelectionModel().getSelectedIndex();
|
||||
|
||||
data.remove(selectedRowIndex);
|
||||
|
||||
if (selectedRowIndex != 0) {
|
||||
selectedRowIndex = selectedRowIndex - 1;
|
||||
}
|
||||
|
||||
table.requestFocus();
|
||||
table.scrollTo(selectedRowIndex);
|
||||
table.getSelectionModel().select(selectedRowIndex);
|
||||
table.getFocusModel().focus(selectedRowIndex);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
}
|
43
src/main/java/fr/univ_amu/iut/dao/DAO.java
Normal file
43
src/main/java/fr/univ_amu/iut/dao/DAO.java
Normal file
@ -0,0 +1,43 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DAO<T> {
|
||||
|
||||
/**
|
||||
* Permet la suppression d'un tuple de la base
|
||||
*
|
||||
* @param obj Objet à supprimer dans la base
|
||||
*/
|
||||
boolean delete(T obj);
|
||||
|
||||
/**
|
||||
* Permet de récupérer tous les objets d'une table
|
||||
*
|
||||
* @return liste de tous les objets contenus dans la base
|
||||
*/
|
||||
List<T> findAll();
|
||||
|
||||
/**
|
||||
* Permet de récupérer un objet via son ID
|
||||
*
|
||||
* @param id identifiant du tuple recherché
|
||||
* @return le tuple recherché s'il existe
|
||||
*/
|
||||
T getById(int id);
|
||||
|
||||
/**
|
||||
* Permet de créer une entrée dans la base de données par rapport à un objet
|
||||
*
|
||||
* @param obj Objet à insérer dans la base
|
||||
*/
|
||||
T insert(T obj);
|
||||
|
||||
/**
|
||||
* Permet de mettre à jour les données d'un tuple dans la base à partir d'un
|
||||
* objet passé en paramètre
|
||||
*
|
||||
* @param obj Objet à mettre à jour dans la base
|
||||
*/
|
||||
boolean update(T obj);
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOAcademie.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOAcademie.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.Academie;
|
||||
|
||||
public interface DAOAcademie extends DAO<Academie>{
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOActeur.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOActeur.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.Acteur;
|
||||
|
||||
public interface DAOActeur extends DAO<Acteur>{
|
||||
}
|
4
src/main/java/fr/univ_amu/iut/dao/DAODiscipline.java
Normal file
4
src/main/java/fr/univ_amu/iut/dao/DAODiscipline.java
Normal file
@ -0,0 +1,4 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
public interface DAODiscipline extends DAO<DAODiscipline>{
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.RegionAcademique;
|
||||
|
||||
public interface DAORegionAcademique extends DAO<RegionAcademique>{
|
||||
}
|
7
src/main/java/fr/univ_amu/iut/dao/DAORessource.java
Normal file
7
src/main/java/fr/univ_amu/iut/dao/DAORessource.java
Normal file
@ -0,0 +1,7 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.Ressource;
|
||||
|
||||
public interface DAORessource extends DAO<Ressource>{
|
||||
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOThematique.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOThematique.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.Thematique;
|
||||
|
||||
public interface DAOThematique extends DAO<Thematique>{
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOTypeActeur.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOTypeActeur.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.TypeActeur;
|
||||
|
||||
public interface DAOTypeActeur extends DAO<TypeActeur>{
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOTypeRessource.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOTypeRessource.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.TypeRessource;
|
||||
|
||||
public interface DAOTypeRessource extends DAO<TypeRessource> {
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/DAOUsage.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/DAOUsage.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao;
|
||||
|
||||
import fr.univ_amu.iut.model.Usage;
|
||||
|
||||
public interface DAOUsage extends DAO<Usage>{
|
||||
}
|
15
src/main/java/fr/univ_amu/iut/dao/factory/DAOFactory.java
Normal file
15
src/main/java/fr/univ_amu/iut/dao/factory/DAOFactory.java
Normal file
@ -0,0 +1,15 @@
|
||||
package fr.univ_amu.iut.dao.factory;
|
||||
|
||||
import fr.univ_amu.iut.dao.*;
|
||||
|
||||
public interface DAOFactory {
|
||||
DAOAcademie createDAOAcademie();
|
||||
DAOActeur createDAOActeur();
|
||||
DAODiscipline createDAODiscipline();
|
||||
DAORegionAcademique createDAORegionAcademique();
|
||||
DAORessource createDAORessource();
|
||||
DAOThematique createDAOThematique();
|
||||
DAOTypeActeur createDAOTypeActeur();
|
||||
DAOTypeRessource createDAOTypeRessource();
|
||||
DAOUsage createDAOUsage();
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package fr.univ_amu.iut.dao.factory;
|
||||
|
||||
import fr.univ_amu.iut.dao.jdbc.DAOFactoryJDBC;
|
||||
import fr.univ_amu.iut.dao.jpa.DAOFactoryJPA;
|
||||
|
||||
public class DAOFactoryProducer {
|
||||
public static DAOFactory getFactory(DAOType type) {
|
||||
return switch (type){
|
||||
case JPA -> new DAOFactoryJPA();
|
||||
case JDBC -> new DAOFactoryJDBC();
|
||||
default -> throw new IllegalArgumentException();
|
||||
};
|
||||
}
|
||||
}
|
6
src/main/java/fr/univ_amu/iut/dao/factory/DAOType.java
Normal file
6
src/main/java/fr/univ_amu/iut/dao/factory/DAOType.java
Normal file
@ -0,0 +1,6 @@
|
||||
package fr.univ_amu.iut.dao.factory;
|
||||
|
||||
public enum DAOType {
|
||||
JPA,
|
||||
JDBC
|
||||
}
|
51
src/main/java/fr/univ_amu/iut/dao/jdbc/DAOFactoryJDBC.java
Normal file
51
src/main/java/fr/univ_amu/iut/dao/jdbc/DAOFactoryJDBC.java
Normal file
@ -0,0 +1,51 @@
|
||||
package fr.univ_amu.iut.dao.jdbc;
|
||||
|
||||
import fr.univ_amu.iut.dao.*;
|
||||
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
||||
|
||||
public class DAOFactoryJDBC implements DAOFactory {
|
||||
@Override
|
||||
public DAOAcademie createDAOAcademie() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOActeur createDAOActeur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAODiscipline createDAODiscipline() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORegionAcademique createDAORegionAcademique() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORessource createDAORessource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOThematique createDAOThematique() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOTypeActeur createDAOTypeActeur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOTypeRessource createDAOTypeRessource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOUsage createDAOUsage() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package fr.univ_amu.iut.dao.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class DataAccessException extends RuntimeException {
|
||||
|
||||
public int errorCode;
|
||||
public String state;
|
||||
|
||||
public DataAccessException() {
|
||||
}
|
||||
|
||||
public DataAccessException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DataAccessException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
getCodeAndState(cause);
|
||||
}
|
||||
|
||||
public DataAccessException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public DataAccessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
private void getCodeAndState(Throwable cause) {
|
||||
if (cause instanceof SQLException) {
|
||||
errorCode = ((SQLException) cause).getErrorCode();
|
||||
state = ((SQLException) cause).getSQLState();
|
||||
} else {
|
||||
errorCode = -1;
|
||||
state = cause.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + '[' + errorCode + ',' + state + "]: " + getLocalizedMessage();
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package fr.univ_amu.iut.dao.jdbc;
|
||||
|
||||
import fr.univ_amu.iut.dao.jdbc.rowmappers.RowMapper;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ResultSetIterator<T> implements Iterator<T> {
|
||||
|
||||
private ResultSet rs;
|
||||
private PreparedStatement ps;
|
||||
private Connection connection;
|
||||
private RowMapper<T> rowMapper;
|
||||
private String sql;
|
||||
|
||||
public ResultSetIterator(Connection connection, String sql, RowMapper<T> rowMapper) {
|
||||
assert connection != null;
|
||||
assert sql != null;
|
||||
this.connection = connection;
|
||||
this.sql = sql;
|
||||
this.rowMapper = rowMapper;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
try {
|
||||
ps = connection.prepareStatement(sql);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
} catch (SQLException e) {
|
||||
close();
|
||||
throw new DataAccessException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (ps == null) {
|
||||
init();
|
||||
}
|
||||
try {
|
||||
boolean hasMore = rs.next();
|
||||
if (!hasMore) {
|
||||
close();
|
||||
}
|
||||
return hasMore;
|
||||
} catch (SQLException e) {
|
||||
close();
|
||||
throw new DataAccessException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void close() {
|
||||
try {
|
||||
rs.close();
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
//nothing we can do here
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
//nothing we can do here
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
try {
|
||||
return rowMapper.mapRow(rs, 1);
|
||||
} catch (SQLException e) {
|
||||
close();
|
||||
throw new DataAccessException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package fr.univ_amu.iut.dao.jdbc;
|
||||
|
||||
import fr.univ_amu.iut.dao.jdbc.rowmappers.RowMapper;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class ResultSetStreamer {
|
||||
public static <T> Stream<T> stream(final Connection connection,
|
||||
final String sql,
|
||||
final RowMapper<T> rowMapper) {
|
||||
return StreamSupport
|
||||
.stream(Spliterators.spliteratorUnknownSize(
|
||||
new ResultSetIterator<>(connection, sql, rowMapper), 0), false);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package fr.univ_amu.iut.dao.jdbc.rowmappers;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public interface RowMapper<T> {
|
||||
T mapRow(ResultSet rs, int rowNum) throws SQLException;
|
||||
}
|
52
src/main/java/fr/univ_amu/iut/dao/jpa/DAOFactoryJPA.java
Normal file
52
src/main/java/fr/univ_amu/iut/dao/jpa/DAOFactoryJPA.java
Normal file
@ -0,0 +1,52 @@
|
||||
package fr.univ_amu.iut.dao.jpa;
|
||||
|
||||
import fr.univ_amu.iut.dao.*;
|
||||
import fr.univ_amu.iut.dao.factory.DAOFactory;
|
||||
|
||||
public class DAOFactoryJPA implements DAOFactory {
|
||||
|
||||
@Override
|
||||
public DAOAcademie createDAOAcademie() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOActeur createDAOActeur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAODiscipline createDAODiscipline() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORegionAcademique createDAORegionAcademique() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAORessource createDAORessource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOThematique createDAOThematique() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOTypeActeur createDAOTypeActeur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOTypeRessource createDAOTypeRessource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DAOUsage createDAOUsage() {
|
||||
return null;
|
||||
}
|
||||
}
|
107
src/main/java/fr/univ_amu/iut/model/Academie.java
Normal file
107
src/main/java/fr/univ_amu/iut/model/Academie.java
Normal file
@ -0,0 +1,107 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Entity
|
||||
public class Academie {
|
||||
private final static HashMap<String, Academie> INSTANCES = new HashMap<>();
|
||||
@Transient
|
||||
public static Academie Mayotte = new Academie("MY", "Académie de Mayotte", RegionAcademique.Mayotte);
|
||||
@Transient
|
||||
public static Academie Besancon = new Academie("BE", "Académie de Besançon", RegionAcademique.BourgogneFrancheComte);
|
||||
@Transient
|
||||
public static Academie Bordeaux = new Academie("BO", "Académie de Bordeaux", RegionAcademique.NouvelleAquitaine);
|
||||
@Transient
|
||||
public static Academie ClermontFerrand = new Academie("CL", "Académie de Clermont-Ferrand", RegionAcademique.AuvergneRhoneAlpes);
|
||||
@Transient
|
||||
public static Academie Dijon = new Academie("DI", "Académie de Dijon", RegionAcademique.BourgogneFrancheComte);
|
||||
@Transient
|
||||
public static Academie Grenoble = new Academie("GR", "Académie de Grenoble", RegionAcademique.AuvergneRhoneAlpes);
|
||||
@Transient
|
||||
public static Academie Guadeloupe = new Academie("GU", "Académie de la Guadeloupe", RegionAcademique.Guadeloupe);
|
||||
@Transient
|
||||
public static Academie Guyane = new Academie("GA", "Académie de la Guyane", RegionAcademique.Guyane);
|
||||
@Transient
|
||||
public static Academie Martinique = new Academie("MA", "Académie de la Martinique", RegionAcademique.Martinique);
|
||||
@Transient
|
||||
public static Academie Reunion = new Academie("RE", "Académie de La Réunion", RegionAcademique.Reunion);
|
||||
@Transient
|
||||
public static Academie Limoges = new Academie("LI", "Académie de Limoges", RegionAcademique.NouvelleAquitaine);
|
||||
@Transient
|
||||
public static Academie Lyon = new Academie("LY", "Académie de Lyon", RegionAcademique.AuvergneRhoneAlpes);
|
||||
@Transient
|
||||
public static Academie Poitiers = new Academie("PO", "Académie de Poitiers", RegionAcademique.NouvelleAquitaine);
|
||||
@Transient
|
||||
public static Academie AixMarseille = new Academie("AI", "Académie d'Aix-Marseille", RegionAcademique.ProvenceAlpesCoteDAzur);
|
||||
@Transient
|
||||
public static Academie Amiens = new Academie("AM", "Académie d'Amiens", RegionAcademique.HautsDeFrance);
|
||||
@Transient
|
||||
public static Academie OrleansTours = new Academie("OR", "Académie d'Orléans-Tours", RegionAcademique.CentreValDeLoire);
|
||||
@Transient
|
||||
public static Academie Corse = new Academie("CO", "Académie de Corse", RegionAcademique.Corse);
|
||||
@Transient
|
||||
public static Academie Lille = new Academie("LL", "Académie de Lille", RegionAcademique.HautsDeFrance);
|
||||
@Transient
|
||||
public static Academie NancyMetz = new Academie("NM", "Académie de Nancy-Metz", RegionAcademique.GrandEst);
|
||||
@Transient
|
||||
public static Academie Nantes = new Academie("NA", "Académie de Nantes", RegionAcademique.PaysDeLaLoire);
|
||||
@Transient
|
||||
public static Academie Nice = new Academie("NI", "Académie de Nice", RegionAcademique.ProvenceAlpesCoteDAzur);
|
||||
@Transient
|
||||
public static Academie Normandie = new Academie("NO", "Académie de Normandie", RegionAcademique.Normandie);
|
||||
@Transient
|
||||
public static Academie Reims = new Academie("RI", "Académie de Reims", RegionAcademique.GrandEst);
|
||||
@Transient
|
||||
public static Academie Rennes = new Academie("RN", "Académie de Rennes", RegionAcademique.Bretagne);
|
||||
@Transient
|
||||
public static Academie Strasbourg = new Academie("ST", "Académie de Strasbourg", RegionAcademique.GrandEst);
|
||||
@Transient
|
||||
public static Academie Creteil = new Academie("CR", "Académie de Créteil", RegionAcademique.IleDeFrance);
|
||||
@Transient
|
||||
public static Academie Montpellier = new Academie("MO", "Académie de Montpellier", RegionAcademique.Occitanie);
|
||||
@Transient
|
||||
public static Academie Paris = new Academie("PA", "Académie de Paris", RegionAcademique.IleDeFrance);
|
||||
@Transient
|
||||
public static Academie Toulouse = new Academie("TO", "Académie de Toulouse", RegionAcademique.Occitanie);
|
||||
@Transient
|
||||
public static Academie Versailles = new Academie("VE", "Académie de Versailles", RegionAcademique.IleDeFrance);
|
||||
@Id
|
||||
String code;
|
||||
String nom;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
RegionAcademique regionAcademique;
|
||||
|
||||
private Academie(String code, String nom, RegionAcademique regionAcademique) {
|
||||
this.code = code;
|
||||
this.nom = nom;
|
||||
this.regionAcademique = regionAcademique;
|
||||
INSTANCES.put(this.code, this);
|
||||
}
|
||||
|
||||
public Academie() {
|
||||
}
|
||||
|
||||
public static Academie get(String code) {
|
||||
return INSTANCES.get(code);
|
||||
}
|
||||
|
||||
public static Collection<Academie> toutes() {
|
||||
return INSTANCES.values();
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public RegionAcademique getRegionAcademique() {
|
||||
return regionAcademique;
|
||||
}
|
||||
}
|
108
src/main/java/fr/univ_amu/iut/model/Acteur.java
Normal file
108
src/main/java/fr/univ_amu/iut/model/Acteur.java
Normal file
@ -0,0 +1,108 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "Acteur.findAll", query = "SELECT p FROM Acteur p"),
|
||||
@NamedQuery(name = "Acteur.findById", query = "SELECT p FROM Acteur p WHERE p.id = :id"),
|
||||
})
|
||||
@Entity
|
||||
public class Acteur {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
|
||||
String nom;
|
||||
String prenom;
|
||||
|
||||
@Embedded
|
||||
Coordonees coordonees;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
TypeActeur typeActeur;
|
||||
|
||||
public Acteur() {
|
||||
coordonees = new Coordonees();
|
||||
typeActeur = new TypeActeur();
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom;
|
||||
}
|
||||
|
||||
public Coordonees getCoordonees() {
|
||||
return coordonees;
|
||||
}
|
||||
|
||||
public String getTypeActeur() {
|
||||
return typeActeur.nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public void setPrenom(String prenom) {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
public void setTypeActeur(String typeActeur) {
|
||||
this.typeActeur.setNom(typeActeur);
|
||||
}
|
||||
|
||||
public int getNumero() {
|
||||
return coordonees.getNumero();
|
||||
}
|
||||
|
||||
public void setNumero(int numero) {
|
||||
coordonees.setNumero(numero);
|
||||
}
|
||||
|
||||
public String getRue() {
|
||||
return coordonees.getRue();
|
||||
}
|
||||
|
||||
public void setRue(String rue) {
|
||||
coordonees.setRue(rue);
|
||||
}
|
||||
|
||||
public String getCodePostal() {
|
||||
return coordonees.getCodePostal();
|
||||
}
|
||||
|
||||
public void setCodePostal(String codePostal) {
|
||||
coordonees.setCodePostal(codePostal);
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return coordonees.getVille();
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
coordonees.setVille(ville);
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return coordonees.getMail();
|
||||
}
|
||||
|
||||
public void setMail(String mail) {
|
||||
coordonees.setMail(mail);
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return coordonees.getTelephone();
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
coordonees.setTelephone(telephone);
|
||||
}
|
||||
}
|
64
src/main/java/fr/univ_amu/iut/model/Coordonees.java
Normal file
64
src/main/java/fr/univ_amu/iut/model/Coordonees.java
Normal file
@ -0,0 +1,64 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class Coordonees {
|
||||
private int numero;
|
||||
private String rue;
|
||||
private String codePostal;
|
||||
private String ville;
|
||||
private String mail;
|
||||
private String telephone;
|
||||
|
||||
public Coordonees() {
|
||||
}
|
||||
|
||||
public int getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public void setNumero(int numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public String getRue() {
|
||||
return rue;
|
||||
}
|
||||
|
||||
public void setRue(String rue) {
|
||||
this.rue = rue;
|
||||
}
|
||||
|
||||
public String getCodePostal() {
|
||||
return codePostal;
|
||||
}
|
||||
|
||||
public void setCodePostal(String codePostal) {
|
||||
this.codePostal = codePostal;
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return ville;
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
this.ville = ville;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return mail;
|
||||
}
|
||||
|
||||
public void setMail(String mail) {
|
||||
this.mail = mail;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
}
|
43
src/main/java/fr/univ_amu/iut/model/Discipline.java
Normal file
43
src/main/java/fr/univ_amu/iut/model/Discipline.java
Normal file
@ -0,0 +1,43 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
@Entity
|
||||
public class Discipline {
|
||||
@Transient
|
||||
public static Discipline Toutes = new Discipline("Toutes disciplines");
|
||||
@Transient
|
||||
public static Discipline HistoireGeographie = new Discipline("Histoire-géographie");
|
||||
@Transient
|
||||
public static Discipline PhysiqueChimie = new Discipline("Physique-chimie");
|
||||
@Transient
|
||||
public static Discipline ScienceEtVieDeLaTerre = new Discipline("SVT");
|
||||
@Transient
|
||||
public static Discipline Technologie = new Discipline("Technologie");
|
||||
@Transient
|
||||
public static Discipline Francais = new Discipline("Français");
|
||||
@Transient
|
||||
public static Discipline EconomieGestion = new Discipline("Économie Gestion");
|
||||
@Transient
|
||||
public static Discipline LangueVivante = new Discipline("Langue Vivante");
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
String nom;
|
||||
|
||||
public Discipline() {
|
||||
|
||||
}
|
||||
|
||||
Discipline(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
}
|
14
src/main/java/fr/univ_amu/iut/model/Niveau.java
Normal file
14
src/main/java/fr/univ_amu/iut/model/Niveau.java
Normal file
@ -0,0 +1,14 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
public enum Niveau {
|
||||
Tous("Tous"),
|
||||
PremierDegre("Premier degré"),
|
||||
SecondDegre("Second degré");
|
||||
final String nom;
|
||||
Niveau(String nom){
|
||||
this.nom = nom;
|
||||
}
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
}
|
63
src/main/java/fr/univ_amu/iut/model/RegionAcademique.java
Normal file
63
src/main/java/fr/univ_amu/iut/model/RegionAcademique.java
Normal file
@ -0,0 +1,63 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
public class RegionAcademique {
|
||||
@Transient
|
||||
public static RegionAcademique AuvergneRhoneAlpes = new RegionAcademique("Région académique Auvergne-Rhône-Alpes");
|
||||
@Transient
|
||||
public static RegionAcademique BourgogneFrancheComte = new RegionAcademique("Région académique Bourgogne-Franche-Comté");
|
||||
@Transient
|
||||
public static RegionAcademique Bretagne = new RegionAcademique("Région académique Bretagne");
|
||||
@Transient
|
||||
public static RegionAcademique CentreValDeLoire = new RegionAcademique("Région académique Centre-Val de Loire");
|
||||
@Transient
|
||||
public static RegionAcademique Corse = new RegionAcademique("Région académique Corse");
|
||||
@Transient
|
||||
public static RegionAcademique GrandEst = new RegionAcademique("Région académique Grand Est");
|
||||
@Transient
|
||||
public static RegionAcademique Guadeloupe = new RegionAcademique("Région académique Guadeloupe");
|
||||
@Transient
|
||||
public static RegionAcademique Guyane = new RegionAcademique("Région académique Guyane");
|
||||
@Transient
|
||||
public static RegionAcademique HautsDeFrance = new RegionAcademique("Région académique Hauts-de-France");
|
||||
@Transient
|
||||
public static RegionAcademique IleDeFrance = new RegionAcademique("Région académique Île-de-France");
|
||||
@Transient
|
||||
public static RegionAcademique Martinique = new RegionAcademique("Région académique Martinique");
|
||||
@Transient
|
||||
public static RegionAcademique Normandie = new RegionAcademique("Région académique Normandie");
|
||||
@Transient
|
||||
public static RegionAcademique NouvelleAquitaine = new RegionAcademique("Région académique Nouvelle-Aquitaine");
|
||||
@Transient
|
||||
public static RegionAcademique Occitanie = new RegionAcademique("Région académique Occitanie");
|
||||
@Transient
|
||||
public static RegionAcademique PaysDeLaLoire = new RegionAcademique("Région académique Pays de la Loire");
|
||||
@Transient
|
||||
public static RegionAcademique ProvenceAlpesCoteDAzur = new RegionAcademique("Région académique Provence-Alpes-Côte d'Azur");
|
||||
@Transient
|
||||
public static RegionAcademique Reunion = new RegionAcademique("Région académique La Réunion");
|
||||
@Transient
|
||||
public static RegionAcademique Mayotte = new RegionAcademique("Région académique Mayotte");
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
String nom;
|
||||
|
||||
public RegionAcademique(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public RegionAcademique() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
}
|
35
src/main/java/fr/univ_amu/iut/model/Ressource.java
Normal file
35
src/main/java/fr/univ_amu/iut/model/Ressource.java
Normal file
@ -0,0 +1,35 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@Entity
|
||||
public class Ressource {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
@ManyToOne
|
||||
TypeRessource typeRessource;
|
||||
URL lienRessource;
|
||||
|
||||
public Ressource(TypeRessource typeRessource, URL lienRessource) {
|
||||
this.typeRessource = typeRessource;
|
||||
this.lienRessource = lienRessource;
|
||||
}
|
||||
|
||||
public Ressource() {
|
||||
|
||||
}
|
||||
|
||||
public TypeRessource getTypeRessource() {
|
||||
return typeRessource;
|
||||
}
|
||||
|
||||
public URL getLienRessource() {
|
||||
return lienRessource;
|
||||
}
|
||||
}
|
70
src/main/java/fr/univ_amu/iut/model/Thematique.java
Normal file
70
src/main/java/fr/univ_amu/iut/model/Thematique.java
Normal file
@ -0,0 +1,70 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Transient;
|
||||
|
||||
@Entity
|
||||
public class Thematique {
|
||||
@Transient
|
||||
public static Thematique ClasseInversee= new Thematique("Classe inversée");
|
||||
@Transient
|
||||
public static Thematique CreationNumerique = new Thematique("Création numérique");
|
||||
@Transient
|
||||
public static Thematique DifferenciationPedagogique = new Thematique("Différenciation pédagogique");
|
||||
@Transient
|
||||
public static Thematique EcoleInclusive = new Thematique("École inclusive");
|
||||
@Transient
|
||||
public static Thematique CitoyenneteNumerique = new Thematique("EMI citoyenneté numérique (Se protéger)");
|
||||
@Transient
|
||||
public static Thematique EnseignerADistance = new Thematique("Enseigner à distance");
|
||||
@Transient
|
||||
public static Thematique ExpressionOrale = new Thematique("Expression orale/podcast");
|
||||
@Transient
|
||||
public static Thematique Evaluation = new Thematique("Évaluation");
|
||||
@Transient
|
||||
public static Thematique FormationAuxOutilsNumeriques = new Thematique("Formation aux outils numériques");
|
||||
@Transient
|
||||
public static Thematique FormerADistance = new Thematique("Former à distance");
|
||||
@Transient
|
||||
public static Thematique Hybridation = new Thematique("Hybridation");
|
||||
@Transient
|
||||
public static Thematique Ludification = new Thematique("Ludification");
|
||||
@Transient
|
||||
public static Thematique PedagogieDeProjet = new Thematique("Pédagogie de projet");
|
||||
@Transient
|
||||
public static Thematique Programmation = new Thematique("Programmation/Codage/Robotique");
|
||||
@Transient
|
||||
public static Thematique RealiteVirtuelle = new Thematique("Réalité virtuelle et augmentée");
|
||||
@Transient
|
||||
public static Thematique ReseauxSociaux = new Thematique("Réseaux sociaux");
|
||||
@Transient
|
||||
public static Thematique SExercerSentrainer = new Thematique("S’exercer/s’entraîner");
|
||||
@Transient
|
||||
public static Thematique TiersLab = new Thematique("Tiers lab");
|
||||
@Transient
|
||||
public static Thematique TNE = new Thematique("TNE");
|
||||
@Transient
|
||||
public static Thematique TravailCollaboratif = new Thematique("Travail collaboratif/mutualisation");
|
||||
@Transient
|
||||
public static Thematique TravailEntrePairs = new Thematique("Travail entre pairs");
|
||||
@Transient
|
||||
public static Thematique WebRadio = new Thematique("Webradio");
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
String nom;
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public Thematique(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public Thematique() {
|
||||
}
|
||||
}
|
29
src/main/java/fr/univ_amu/iut/model/TypeActeur.java
Normal file
29
src/main/java/fr/univ_amu/iut/model/TypeActeur.java
Normal file
@ -0,0 +1,29 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TypeActeur {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
String nom;
|
||||
|
||||
public TypeActeur(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public TypeActeur() {
|
||||
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
}
|
23
src/main/java/fr/univ_amu/iut/model/TypeRessource.java
Normal file
23
src/main/java/fr/univ_amu/iut/model/TypeRessource.java
Normal file
@ -0,0 +1,23 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TypeRessource {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
String nom;
|
||||
|
||||
public TypeRessource(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public TypeRessource() {}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
}
|
115
src/main/java/fr/univ_amu/iut/model/Usage.java
Normal file
115
src/main/java/fr/univ_amu/iut/model/Usage.java
Normal file
@ -0,0 +1,115 @@
|
||||
package fr.univ_amu.iut.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class Usage {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
int id;
|
||||
|
||||
String nom;
|
||||
String description;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
Discipline discipline;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
Thematique thematique;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
Niveau niveau;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
List<Academie> academies = new ArrayList<>();
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
List<Ressource> ressources = new ArrayList<>();
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
List<Acteur> acteurs = new ArrayList<>();
|
||||
|
||||
String commentaire;
|
||||
|
||||
public Usage() {
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Discipline getDiscipline() {
|
||||
return discipline;
|
||||
}
|
||||
|
||||
public void setDiscipline(Discipline discipline) {
|
||||
this.discipline = discipline;
|
||||
}
|
||||
|
||||
public Thematique getThematique() {
|
||||
return thematique;
|
||||
}
|
||||
|
||||
public void setThematique(Thematique thematique) {
|
||||
this.thematique = thematique;
|
||||
}
|
||||
|
||||
public Niveau getNiveau() {
|
||||
return niveau;
|
||||
}
|
||||
|
||||
public void setNiveau(Niveau niveau) {
|
||||
this.niveau = niveau;
|
||||
}
|
||||
|
||||
public List<Academie> getAcademies() {
|
||||
return academies;
|
||||
}
|
||||
|
||||
public void addAcademies(Academie ... academies) {
|
||||
this.academies.addAll(List.of(academies));
|
||||
}
|
||||
public void addAcademies(Collection<? extends Academie> academies){
|
||||
this.academies.addAll(academies);
|
||||
}
|
||||
|
||||
public List<Ressource> getRessources() {
|
||||
return ressources;
|
||||
}
|
||||
|
||||
public void addRessource(Ressource ressource) {
|
||||
this.ressources.add(ressource);
|
||||
}
|
||||
|
||||
public List<Acteur> getActeurs() {
|
||||
return acteurs;
|
||||
}
|
||||
|
||||
public void addActeur(Acteur acteur) {
|
||||
this.acteurs.add(acteur);
|
||||
}
|
||||
|
||||
public String getCommentaire() {
|
||||
return commentaire;
|
||||
}
|
||||
|
||||
public void setCommentaire(String commentaire) {
|
||||
this.commentaire = commentaire;
|
||||
}
|
||||
}
|
69
src/main/java/fr/univ_amu/iut/view/map/AcademiePath.java
Normal file
69
src/main/java/fr/univ_amu/iut/view/map/AcademiePath.java
Normal file
@ -0,0 +1,69 @@
|
||||
package fr.univ_amu.iut.view.map;
|
||||
|
||||
import fr.univ_amu.iut.model.Academie;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.shape.SVGPath;
|
||||
import javafx.scene.transform.Transform;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
public class AcademiePath extends SVGPath {
|
||||
private final static HashMap<Academie, AcademiePath> INSTANCES = new HashMap<>();
|
||||
|
||||
Academie academie;
|
||||
private final Tooltip tooltip;
|
||||
|
||||
public AcademiePath(Academie academie){
|
||||
this(academie, null);
|
||||
}
|
||||
|
||||
public AcademiePath(Academie academie, String content) {
|
||||
this.academie = academie;
|
||||
this.tooltip = new Tooltip(academie.getNom());
|
||||
Tooltip.install(this, tooltip);
|
||||
if (null == content) return;
|
||||
setContent(content);
|
||||
getTransforms().add(Transform.affine(1.3333333,0,0,-1.3333333,-79.268904,937.80293));
|
||||
INSTANCES.put(academie,this);
|
||||
}
|
||||
|
||||
private static final String LORES_PROPERTIES = "fr/univ_amu/iut/francefx/lores.properties";
|
||||
|
||||
private static Properties readProperties(String fileName) {
|
||||
final ClassLoader LOADER = Thread.currentThread().getContextClassLoader();
|
||||
final Properties PROPERTIES = new Properties();
|
||||
try (InputStream resourceStream = LOADER.getResourceAsStream(fileName)) {
|
||||
PROPERTIES.load(resourceStream);
|
||||
} catch (IOException exception) {
|
||||
System.out.println(Arrays.toString(exception.getStackTrace()));
|
||||
}
|
||||
return PROPERTIES;
|
||||
}
|
||||
|
||||
public static Map<String, List<AcademiePath>> createCountryPaths() {
|
||||
Properties resolutionProperties = readProperties(LORES_PROPERTIES);
|
||||
|
||||
Map<String, List<AcademiePath>> academiePaths = new HashMap<>();
|
||||
|
||||
resolutionProperties.forEach((key, value) -> {
|
||||
String name = key.toString();
|
||||
List<AcademiePath> pathList = new ArrayList<>();
|
||||
for (String path : value.toString().split(";")) {
|
||||
pathList.add(new AcademiePath(Academie.get(name), path));
|
||||
}
|
||||
academiePaths.put(name, pathList);
|
||||
});
|
||||
|
||||
return academiePaths;
|
||||
}
|
||||
|
||||
public static AcademiePath get(Academie academie) {
|
||||
return INSTANCES.get(academie);
|
||||
}
|
||||
|
||||
public Academie getAcademie() {
|
||||
return academie;
|
||||
}
|
||||
}
|
408
src/main/java/fr/univ_amu/iut/view/map/France.java
Normal file
408
src/main/java/fr/univ_amu/iut/view/map/France.java
Normal file
@ -0,0 +1,408 @@
|
||||
package fr.univ_amu.iut.view.map;
|
||||
|
||||
import fr.univ_amu.iut.model.Academie;
|
||||
import javafx.beans.DefaultProperty;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.css.*;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.event.EventType;
|
||||
import javafx.event.WeakEventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.SVGPath;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static javafx.scene.input.MouseEvent.*;
|
||||
import static javafx.scene.input.MouseEvent.MOUSE_EXITED;
|
||||
|
||||
@DefaultProperty("children")
|
||||
public class France extends Region {
|
||||
protected Pane pane = new Pane();
|
||||
protected Group group = new Group();
|
||||
private final Map<String, List<AcademiePath>> academiePaths = AcademiePath.createCountryPaths();
|
||||
private EventHandler<MouseEvent> mouseEnterHandler;
|
||||
private EventHandler<MouseEvent> mousePressHandler;
|
||||
private EventHandler<MouseEvent> mouseReleaseHandler;
|
||||
private EventHandler<MouseEvent> mouseExitHandler;
|
||||
private final EventHandler<MouseEvent> _mouseEnterHandler = evt -> handleMouseEvent(evt, mouseEnterHandler);
|
||||
private final EventHandler<MouseEvent> _mousePressHandler= evt -> handleMouseEvent(evt, mousePressHandler);
|
||||
private final EventHandler<MouseEvent> _mouseReleaseHandler= evt -> handleMouseEvent(evt, mouseReleaseHandler);
|
||||
private final EventHandler<MouseEvent> _mouseExitHandler= evt -> handleMouseEvent(evt, mouseExitHandler);
|
||||
|
||||
private static final StyleablePropertyFactory<France> FACTORY = new StyleablePropertyFactory<>(Region.getClassCssMetaData());
|
||||
private static final CssMetaData<France, Color> BACKGROUND_COLOR = FACTORY.createColorCssMetaData("-background-color", s -> s.backgroundColor, Color.web("#3f3f4f"), false);
|
||||
private static final CssMetaData<France, Color> FILL_COLOR = FACTORY.createColorCssMetaData("-fill-color", s -> s.fillColor, Color.web("#d9d9dc"), false);
|
||||
private static final CssMetaData<France, Color> STROKE_COLOR = FACTORY.createColorCssMetaData("-stroke-color", s -> s.strokeColor, Color.BLACK, false);
|
||||
private static final CssMetaData<France, Color> HOVER_COLOR = FACTORY.createColorCssMetaData("-hover-color", s -> s.hoverColor, Color.web("#456acf"), false);
|
||||
private static final CssMetaData<France, Color> PRESSED_COLOR = FACTORY.createColorCssMetaData("-pressed-color", s -> s.pressedColor, Color.web("#789dff"), false);
|
||||
private static final CssMetaData<France, Color> SELECTED_COLOR = FACTORY.createColorCssMetaData("-selected-color", s -> s.selectedColor, Color.web("#9dff78"), false);
|
||||
private final StyleableProperty<Color> backgroundColor = new StyleableObjectProperty<>(BACKGROUND_COLOR.getInitialValue(France.this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
setBackground(new Background(new BackgroundFill(get(), CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "backgroundColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return BACKGROUND_COLOR;
|
||||
}
|
||||
};
|
||||
|
||||
private final StyleableProperty<Color> fillColor = new StyleableObjectProperty<>(FILL_COLOR.getInitialValue(France.this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
setFillAndStroke();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "fillColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return FILL_COLOR;
|
||||
}
|
||||
};
|
||||
private final StyleableProperty<Color> strokeColor = new StyleableObjectProperty<>(STROKE_COLOR.getInitialValue(France.this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
setFillAndStroke();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "strokeColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return STROKE_COLOR;
|
||||
}
|
||||
};
|
||||
private final StyleableProperty<Color> hoverColor = new StyleableObjectProperty<>(HOVER_COLOR.getInitialValue(France.this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "hoverColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return HOVER_COLOR;
|
||||
}
|
||||
};
|
||||
private final StyleableProperty<Color> pressedColor = new StyleableObjectProperty<>(PRESSED_COLOR.getInitialValue(this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "pressedColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return PRESSED_COLOR;
|
||||
}
|
||||
};
|
||||
private final StyleableProperty<Color> selectedColor = new StyleableObjectProperty<>(SELECTED_COLOR.getInitialValue(this)) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return France.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "selectedColor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CssMetaData<? extends Styleable, Color> getCssMetaData() {
|
||||
return SELECTED_COLOR;
|
||||
}
|
||||
};
|
||||
|
||||
private final BooleanProperty hoverEnabled = new SimpleBooleanProperty(true);
|
||||
private final BooleanProperty selectionEnabled = new SimpleBooleanProperty(true);
|
||||
|
||||
private final ObjectProperty<Academie> selectedAcademie = new SimpleObjectProperty<>();
|
||||
|
||||
private Academie formerSelectedAcademie;
|
||||
|
||||
public France() {
|
||||
initGraphics();
|
||||
}
|
||||
|
||||
private void initGraphics() {
|
||||
Color fill = getFillColor();
|
||||
Color stroke = getStrokeColor();
|
||||
|
||||
academiePaths.forEach((name, pathList) -> {
|
||||
Academie academie = Academie.get(name);
|
||||
pathList.forEach(path -> {
|
||||
path.setFill(fill);
|
||||
path.setStroke(stroke);
|
||||
path.setStrokeWidth(0.2);
|
||||
path.setOnMouseEntered(new WeakEventHandler<>(_mouseEnterHandler));
|
||||
path.setOnMousePressed(new WeakEventHandler<>(_mousePressHandler));
|
||||
path.setOnMouseReleased(new WeakEventHandler<>(_mouseReleaseHandler));
|
||||
path.setOnMouseExited(new WeakEventHandler<>(_mouseExitHandler));
|
||||
});
|
||||
pane.getChildren().addAll(pathList);
|
||||
});
|
||||
group.getChildren().add(pane);
|
||||
|
||||
getChildren().setAll(group);
|
||||
|
||||
setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
}
|
||||
|
||||
public void setMouseEnterHandler(final EventHandler<MouseEvent> handler) {
|
||||
mouseEnterHandler = handler;
|
||||
}
|
||||
|
||||
public void setMousePressHandler(final EventHandler<MouseEvent> handler) {
|
||||
mousePressHandler = handler;
|
||||
}
|
||||
|
||||
public void setMouseReleaseHandler(final EventHandler<MouseEvent> handler) {
|
||||
mouseReleaseHandler = handler;
|
||||
}
|
||||
|
||||
public void setMouseExitHandler(final EventHandler<MouseEvent> handler) {
|
||||
mouseExitHandler = handler;
|
||||
}
|
||||
public Color getBackgroundColor() {
|
||||
return backgroundColor.getValue();
|
||||
}
|
||||
|
||||
public void setBackgroundColor(final Color COLOR) {
|
||||
backgroundColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> backgroundColorProperty() {
|
||||
return (ObjectProperty<Color>) backgroundColor;
|
||||
}
|
||||
|
||||
public Color getFillColor() {
|
||||
return fillColor.getValue();
|
||||
}
|
||||
|
||||
public void setFillColor(final Color COLOR) {
|
||||
fillColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> fillColorProperty() {
|
||||
return (ObjectProperty<Color>) fillColor;
|
||||
}
|
||||
|
||||
public Color getStrokeColor() {
|
||||
return strokeColor.getValue();
|
||||
}
|
||||
|
||||
public void setStrokeColor(final Color COLOR) {
|
||||
strokeColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> strokeColorProperty() {
|
||||
return (ObjectProperty<Color>) strokeColor;
|
||||
}
|
||||
|
||||
public Color getHoverColor() {
|
||||
return hoverColor.getValue();
|
||||
}
|
||||
|
||||
public void setHoverColor(final Color COLOR) {
|
||||
hoverColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> hoverColorProperty() {
|
||||
return (ObjectProperty<Color>) hoverColor;
|
||||
}
|
||||
|
||||
public Color getPressedColor() {
|
||||
return pressedColor.getValue();
|
||||
}
|
||||
|
||||
public void setPressedColor(final Color COLOR) {
|
||||
pressedColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> pressedColorProperty() {
|
||||
return (ObjectProperty<Color>) pressedColor;
|
||||
}
|
||||
|
||||
public Color getSelectedColor() {
|
||||
return selectedColor.getValue();
|
||||
}
|
||||
|
||||
public void setSelectedColor(final Color COLOR) {
|
||||
selectedColor.setValue(COLOR);
|
||||
}
|
||||
|
||||
public ObjectProperty<Color> selectedColorProperty() {
|
||||
return (ObjectProperty<Color>) selectedColor;
|
||||
}
|
||||
|
||||
public boolean isHoverEnabled() {
|
||||
return hoverEnabled.get();
|
||||
}
|
||||
|
||||
public void setHoverEnabled(final boolean ENABLED) {
|
||||
hoverEnabled.set(ENABLED);
|
||||
}
|
||||
|
||||
public BooleanProperty hoverEnabledProperty() {
|
||||
return hoverEnabled;
|
||||
}
|
||||
|
||||
public boolean isSelectionEnabled() {
|
||||
return selectionEnabled.get();
|
||||
}
|
||||
|
||||
public void setSelectionEnabled(final boolean ENABLED) {
|
||||
selectionEnabled.set(ENABLED);
|
||||
}
|
||||
|
||||
public BooleanProperty selectionEnabledProperty() {
|
||||
return selectionEnabled;
|
||||
}
|
||||
|
||||
public Academie getSelectedAcademie() {
|
||||
return selectedAcademie.get();
|
||||
}
|
||||
|
||||
public void setSelectedAcademie(final Academie academie) {
|
||||
selectedAcademie.set(academie);
|
||||
}
|
||||
|
||||
public ObjectProperty<Academie> selectedAcademieProperty() {
|
||||
return selectedAcademie;
|
||||
}
|
||||
|
||||
|
||||
private void handleMouseEvent(final MouseEvent EVENT, final EventHandler<MouseEvent> HANDLER) {
|
||||
final AcademiePath academiePath = (AcademiePath) EVENT.getSource();
|
||||
final Academie academie = academiePath.getAcademie();
|
||||
final List<AcademiePath> PATHS = academiePaths.get(academie.getCode());
|
||||
|
||||
final EventType<? extends MouseEvent> TYPE = EVENT.getEventType();
|
||||
if (MOUSE_ENTERED == TYPE) {
|
||||
if (isHoverEnabled()) {
|
||||
Color color = isSelectionEnabled() && academie.equals(getSelectedAcademie()) ? getSelectedColor() : getHoverColor();
|
||||
for (SVGPath path : PATHS) {
|
||||
path.setFill(color);
|
||||
}
|
||||
}
|
||||
} else if (MOUSE_PRESSED == TYPE) {
|
||||
if (isSelectionEnabled()) {
|
||||
Color color;
|
||||
if (null == getSelectedAcademie()) {
|
||||
setSelectedAcademie(academie);
|
||||
color = getSelectedColor();
|
||||
} else {
|
||||
color = getFillColor();
|
||||
}
|
||||
for (SVGPath path : academiePaths.get(getSelectedAcademie().getCode())) {
|
||||
path.setFill(color);
|
||||
}
|
||||
} else {
|
||||
if (isHoverEnabled()) {
|
||||
for (SVGPath path : PATHS) {
|
||||
path.setFill(getPressedColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (MOUSE_RELEASED == TYPE) {
|
||||
Color color;
|
||||
if (isSelectionEnabled()) {
|
||||
if (formerSelectedAcademie == academie) {
|
||||
setSelectedAcademie(null);
|
||||
color = getFillColor();
|
||||
} else {
|
||||
setSelectedAcademie(academie);
|
||||
color = getSelectedColor();
|
||||
}
|
||||
formerSelectedAcademie = getSelectedAcademie();
|
||||
} else {
|
||||
color = getHoverColor();
|
||||
}
|
||||
if (isHoverEnabled()) {
|
||||
for (SVGPath path : PATHS) {
|
||||
path.setFill(color);
|
||||
}
|
||||
}
|
||||
} else if (MOUSE_EXITED == TYPE) {
|
||||
if (isHoverEnabled()) {
|
||||
Color color = isSelectionEnabled() && academie.equals(getSelectedAcademie()) ? getSelectedColor() : getFillColor();
|
||||
for (SVGPath path : PATHS) {
|
||||
path.setFill(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null != HANDLER) HANDLER.handle(EVENT);
|
||||
}
|
||||
|
||||
private void setFillAndStroke() {
|
||||
academiePaths.keySet().forEach(name -> {
|
||||
Academie academie = Academie.get(name);
|
||||
setAcademieFillAndStroke(academie, getFillColor() , getStrokeColor());
|
||||
});
|
||||
}
|
||||
|
||||
private void setAcademieFillAndStroke(final Academie academie, final Color fill, final Color stroke) {
|
||||
List<AcademiePath> paths = academiePaths.get(academie.getCode());
|
||||
for (AcademiePath path : paths) {
|
||||
path.setFill(fill);
|
||||
path.setStroke(stroke);
|
||||
}
|
||||
}
|
||||
}
|
191
src/main/java/fr/univ_amu/iut/view/map/FranceBuilder.java
Normal file
191
src/main/java/fr/univ_amu/iut/view/map/FranceBuilder.java
Normal file
@ -0,0 +1,191 @@
|
||||
package fr.univ_amu.iut.view.map;
|
||||
|
||||
|
||||
import javafx.beans.property.*;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Dimension2D;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class FranceBuilder<B extends FranceBuilder<B>> {
|
||||
private final HashMap<String, Property> properties = new HashMap<>();
|
||||
|
||||
private FranceBuilder() {
|
||||
|
||||
}
|
||||
|
||||
public static FranceBuilder create() {
|
||||
return new FranceBuilder();
|
||||
}
|
||||
|
||||
public final B backgroundColor(final Color COLOR) {
|
||||
properties.put("backgroundColor", new SimpleObjectProperty<>(COLOR));
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
public final B fillColor(final Color COLOR) {
|
||||
properties.put("fillColor", new SimpleObjectProperty<>(COLOR));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B strokeColor(final Color COLOR) {
|
||||
properties.put("strokeColor", new SimpleObjectProperty<>(COLOR));
|
||||
return (B)this;
|
||||
}
|
||||
public final B hoverColor(final Color COLOR) {
|
||||
properties.put("hoverColor", new SimpleObjectProperty<>(COLOR));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B pressedColor(final Color COLOR) {
|
||||
properties.put("pressedColor", new SimpleObjectProperty<>(COLOR));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B selectedColor(final Color COLOR) {
|
||||
properties.put("selectedColor", new SimpleObjectProperty(COLOR));
|
||||
return (B)this;
|
||||
}
|
||||
public final B hoverEnabled(final boolean ENABLED) {
|
||||
properties.put("hoverEnabled", new SimpleBooleanProperty(ENABLED));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B selectionEnabled(final boolean ENABLED) {
|
||||
properties.put("selectionEnabled", new SimpleBooleanProperty(ENABLED));
|
||||
return (B)this;
|
||||
}
|
||||
public final B mouseEnterHandler(final EventHandler<MouseEvent> HANDLER) {
|
||||
properties.put("mouseEnterHandler", new SimpleObjectProperty(HANDLER));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B mousePressHandler(final EventHandler<MouseEvent> HANDLER) {
|
||||
properties.put("mousePressHandler", new SimpleObjectProperty(HANDLER));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B mouseReleaseHandler(final EventHandler<MouseEvent> HANDLER) {
|
||||
properties.put("mouseReleaseHandler", new SimpleObjectProperty(HANDLER));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B mouseExitHandler(final EventHandler<MouseEvent> HANDLER) {
|
||||
properties.put("mouseExitHandler", new SimpleObjectProperty(HANDLER));
|
||||
return (B)this;
|
||||
}
|
||||
public final B prefSize(final double WIDTH, final double HEIGHT) {
|
||||
properties.put("prefSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
|
||||
return (B)this;
|
||||
}
|
||||
public final B minSize(final double WIDTH, final double HEIGHT) {
|
||||
properties.put("minSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
|
||||
return (B)this;
|
||||
}
|
||||
public final B maxSize(final double WIDTH, final double HEIGHT) {
|
||||
properties.put("maxSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B prefWidth(final double PREF_WIDTH) {
|
||||
properties.put("prefWidth", new SimpleDoubleProperty(PREF_WIDTH));
|
||||
return (B)this;
|
||||
}
|
||||
public final B prefHeight(final double PREF_HEIGHT) {
|
||||
properties.put("prefHeight", new SimpleDoubleProperty(PREF_HEIGHT));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B minWidth(final double MIN_WIDTH) {
|
||||
properties.put("minWidth", new SimpleDoubleProperty(MIN_WIDTH));
|
||||
return (B)this;
|
||||
}
|
||||
public final B minHeight(final double MIN_HEIGHT) {
|
||||
properties.put("minHeight", new SimpleDoubleProperty(MIN_HEIGHT));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final B maxWidth(final double MAX_WIDTH) {
|
||||
properties.put("maxWidth", new SimpleDoubleProperty(MAX_WIDTH));
|
||||
return (B)this;
|
||||
}
|
||||
public final B maxHeight(final double MAX_HEIGHT) {
|
||||
properties.put("maxHeight", new SimpleDoubleProperty(MAX_HEIGHT));
|
||||
return (B)this;
|
||||
}
|
||||
public final B padding(final Insets INSETS) {
|
||||
properties.put("padding", new SimpleObjectProperty<>(INSETS));
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
public final France build() {
|
||||
final France france = new France();
|
||||
|
||||
for (String key : properties.keySet()) {
|
||||
if ("prefSize".equals(key)) {
|
||||
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
|
||||
france.setPrefSize(dim.getWidth(), dim.getHeight());
|
||||
} else if("minSize".equals(key)) {
|
||||
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
|
||||
france.setMinSize(dim.getWidth(), dim.getHeight());
|
||||
} else if("maxSize".equals(key)) {
|
||||
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
|
||||
france.setMaxSize(dim.getWidth(), dim.getHeight());
|
||||
} else if("prefWidth".equals(key)) {
|
||||
france.setPrefWidth(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("prefHeight".equals(key)) {
|
||||
france.setPrefHeight(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("minWidth".equals(key)) {
|
||||
france.setMinWidth(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("minHeight".equals(key)) {
|
||||
france.setMinHeight(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("maxWidth".equals(key)) {
|
||||
france.setMaxWidth(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("maxHeight".equals(key)) {
|
||||
france.setMaxHeight(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("scaleX".equals(key)) {
|
||||
france.setScaleX(((DoubleProperty) properties.get(key)).get());
|
||||
} else if("scaleY".equals(key)) {
|
||||
france.setScaleY(((DoubleProperty) properties.get(key)).get());
|
||||
} else if ("layoutX".equals(key)) {
|
||||
france.setLayoutX(((DoubleProperty) properties.get(key)).get());
|
||||
} else if ("layoutY".equals(key)) {
|
||||
france.setLayoutY(((DoubleProperty) properties.get(key)).get());
|
||||
} else if ("translateX".equals(key)) {
|
||||
france.setTranslateX(((DoubleProperty) properties.get(key)).get());
|
||||
} else if ("translateY".equals(key)) {
|
||||
france.setTranslateY(((DoubleProperty) properties.get(key)).get());
|
||||
} else if ("padding".equals(key)) {
|
||||
france.setPadding(((ObjectProperty<Insets>) properties.get(key)).get());
|
||||
} else if ("backgroundColor".equals(key)) {
|
||||
france.setBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("fillColor".equals(key)) {
|
||||
france.setFillColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("strokeColor".equals(key)) {
|
||||
france.setStrokeColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("hoverColor".equals(key)) {
|
||||
france.setHoverColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("pressedColor".equals(key)) {
|
||||
france.setPressedColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("selectedColor".equals(key)) {
|
||||
france.setSelectedColor(((ObjectProperty<Color>) properties.get(key)).get());
|
||||
} else if ("hoverEnabled".equals(key)) {
|
||||
france.setHoverEnabled(((BooleanProperty) properties.get(key)).get());
|
||||
} else if ("selectionEnabled".equals(key)) {
|
||||
france.setSelectionEnabled(((BooleanProperty) properties.get(key)).get());
|
||||
} else if ("mouseEnterHandler".equals(key)) {
|
||||
france.setMouseEnterHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
|
||||
} else if ("mousePressHandler".equals(key)) {
|
||||
france.setMousePressHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
|
||||
} else if ("mouseReleaseHandler".equals(key)) {
|
||||
france.setMouseReleaseHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
|
||||
} else if ("mouseExitHandler".equals(key)) {
|
||||
france.setMouseExitHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
|
||||
}
|
||||
}
|
||||
return france;
|
||||
}
|
||||
}
|
17
src/main/java/module-info.java
Normal file
17
src/main/java/module-info.java
Normal file
@ -0,0 +1,17 @@
|
||||
open module francefx {
|
||||
requires transitive javafx.base;
|
||||
requires transitive javafx.controls;
|
||||
requires transitive javafx.graphics;
|
||||
requires transitive javafx.fxml;
|
||||
requires transitive org.kordamp.ikonli.javafx;
|
||||
requires transitive org.kordamp.ikonli.materialdesign;
|
||||
requires transitive org.kordamp.ikonli.core;
|
||||
|
||||
requires jakarta.persistence;
|
||||
|
||||
exports fr.univ_amu.iut.view.map;
|
||||
exports fr.univ_amu.iut.model;
|
||||
exports fr.univ_amu.iut;
|
||||
exports fr.univ_amu.iut.dao;
|
||||
exports fr.univ_amu.iut.dao.factory;
|
||||
}
|
23
src/main/resources/META-INF/persistence.xml
Normal file
23
src/main/resources/META-INF/persistence.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
|
||||
<persistence-unit name="gestionUsagesPU" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
|
||||
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||
|
||||
<properties>
|
||||
<!-- database connection properties -->
|
||||
<property name="jakarta.persistence.jdbc.url" value="jdbc:derby:memory:usageBD;create=true"/>
|
||||
<property name="jakarta.persistence.jdbc.user" value=""/>
|
||||
<property name="jakarta.persistence.jdbc.password" value=""/>
|
||||
|
||||
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
|
||||
<property name="eclipselink.ddl-generation" value="create-tables"/>
|
||||
|
||||
<!-- configure logging -->
|
||||
<property name="eclipselink.logging.level" value="INFO"/>
|
||||
<property name="eclipselink.logging.level.sql" value="FINE"/>
|
||||
<property name="eclipselink.logging.parameters" value="true"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
9
src/main/resources/fr/univ_amu/iut/francefx/france.css
Normal file
9
src/main/resources/fr/univ_amu/iut/francefx/france.css
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
.france {
|
||||
-background-color: #3f3f4f;
|
||||
-fill-color : #d9d9dc;
|
||||
-stroke-color : #000000;
|
||||
-hover-color : #456acf;
|
||||
-pressed-color : #789dff;
|
||||
-selected-color : #9dff78;
|
||||
}
|
30
src/main/resources/fr/univ_amu/iut/francefx/lores.properties
Normal file
30
src/main/resources/fr/univ_amu/iut/francefx/lores.properties
Normal file
File diff suppressed because one or more lines are too long
11
src/test/java/fr/univ_amu/iut/AppTest.java
Normal file
11
src/test/java/fr/univ_amu/iut/AppTest.java
Normal file
@ -0,0 +1,11 @@
|
||||
package fr.univ_amu.iut;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class AppTest {
|
||||
@Test
|
||||
public void test_should_never_fail() {
|
||||
assertThat(true).isTrue();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user