diff --git a/Documentation/Diagrammes/diagrammes.asta b/Documentation/Diagrammes/diagrammes.asta
new file mode 100644
index 00000000..6deea389
Binary files /dev/null and b/Documentation/Diagrammes/diagrammes.asta differ
diff --git a/Documentation/Interactions_serveur-clients.ods b/Documentation/Interactions_serveur-clients.ods
new file mode 100644
index 00000000..a4d41bbf
Binary files /dev/null and b/Documentation/Interactions_serveur-clients.ods differ
diff --git a/Documentation/Interface/recherche_docu/12_labventory3.jpg b/Documentation/Interface/recherche_docu/12_labventory3.jpg
new file mode 100644
index 00000000..802bf931
Binary files /dev/null and b/Documentation/Interface/recherche_docu/12_labventory3.jpg differ
diff --git a/Documentation/Interface/recherche_docu/Lightstock-screen.jpg b/Documentation/Interface/recherche_docu/Lightstock-screen.jpg
new file mode 100644
index 00000000..c24b35ce
Binary files /dev/null and b/Documentation/Interface/recherche_docu/Lightstock-screen.jpg differ
diff --git a/Documentation/Interface/recherche_docu/VenteTactile.png b/Documentation/Interface/recherche_docu/VenteTactile.png
new file mode 100644
index 00000000..ef6e0114
Binary files /dev/null and b/Documentation/Interface/recherche_docu/VenteTactile.png differ
diff --git a/Documentation/Interface/recherche_docu/caisse.jpg b/Documentation/Interface/recherche_docu/caisse.jpg
new file mode 100644
index 00000000..d6709dbb
Binary files /dev/null and b/Documentation/Interface/recherche_docu/caisse.jpg differ
diff --git a/Documentation/Interface/recherche_docu/flx42.jpg b/Documentation/Interface/recherche_docu/flx42.jpg
new file mode 100644
index 00000000..3a29f0f3
Binary files /dev/null and b/Documentation/Interface/recherche_docu/flx42.jpg differ
diff --git a/Workspace/.idea/.name b/Workspace/.idea/.name
new file mode 100644
index 00000000..1c9bf496
--- /dev/null
+++ b/Workspace/.idea/.name
@@ -0,0 +1 @@
+Main
\ No newline at end of file
diff --git a/Workspace/.idea/compiler.xml b/Workspace/.idea/compiler.xml
new file mode 100644
index 00000000..e4c04dd0
--- /dev/null
+++ b/Workspace/.idea/compiler.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/.idea/misc.xml b/Workspace/.idea/misc.xml
new file mode 100644
index 00000000..82ba6c90
--- /dev/null
+++ b/Workspace/.idea/misc.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/.idea/modules.xml b/Workspace/.idea/modules.xml
new file mode 100644
index 00000000..464e4d5d
--- /dev/null
+++ b/Workspace/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/.idea/workspace.xml b/Workspace/.idea/workspace.xml
new file mode 100644
index 00000000..e5c54913
--- /dev/null
+++ b/Workspace/.idea/workspace.xml
@@ -0,0 +1,1330 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1500330692049
+
+
+ 1500330692049
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No facets are configured
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+ core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/Workspace.iml b/Workspace/Workspace.iml
new file mode 100644
index 00000000..c035f0b0
--- /dev/null
+++ b/Workspace/Workspace.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/client/client.iml b/Workspace/client/client.iml
new file mode 100644
index 00000000..c3da4df5
--- /dev/null
+++ b/Workspace/client/client.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/client/pom.xml b/Workspace/client/pom.xml
new file mode 100644
index 00000000..8c3e701a
--- /dev/null
+++ b/Workspace/client/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ Main
+ com.pqt
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ client
+
+
+ com.pqt
+ core
+ 1.0-SNAPSHOT
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/account/AccountService.java b/Workspace/client/src/main/java/com/pqt/client/module/account/AccountService.java
new file mode 100644
index 00000000..c3affffa
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/account/AccountService.java
@@ -0,0 +1,45 @@
+package com.pqt.client.module.account;
+
+import com.pqt.core.entities.user_account.Account;
+import com.pqt.client.module.account.listeners.IAccountListener;
+
+import java.util.List;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+//TODO add log lines
+public class AccountService {
+
+ public Account getCurrentAccount() {
+ return null;
+ }
+
+ public void setCurrentAccount(Account account) {
+
+ }
+
+ public boolean isAccountLoggedIn(Account account) {
+ return false;
+ }
+
+ public void logInCurrentAccount(String password) {
+
+ }
+
+ public void logOutCurrentAccount(String password) {
+
+ }
+
+ public List getRecentAccounts() {
+ return null;
+ }
+
+ public void addListener(IAccountListener listener) {
+
+ }
+
+ public void removeListener(IAccountListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/AccountListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/AccountListenerAdapter.java
new file mode 100644
index 00000000..50243c75
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/AccountListenerAdapter.java
@@ -0,0 +1,15 @@
+package com.pqt.client.module.account.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class AccountListenerAdapter implements IAccountListener {
+
+
+ /**
+ * @see com.pqt.client.module.account.listeners.IAccountListener#onAccountStatusChanged(boolean)
+ */
+ public void onAccountStatusChanged(boolean status) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountFirerer.java
new file mode 100644
index 00000000..cf8f4867
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountFirerer.java
@@ -0,0 +1,11 @@
+package com.pqt.client.module.account.listeners;
+
+public interface IAccountFirerer {
+
+ public void fireAccountStatusChanged(boolean status);
+
+ public abstract void addListener(IAccountListener listener);
+
+ public abstract void removeListener(IAccountListener listener);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountListener.java b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountListener.java
new file mode 100644
index 00000000..7fa6dfef
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/IAccountListener.java
@@ -0,0 +1,9 @@
+package com.pqt.client.module.account.listeners;
+
+import java.util.EventListener;
+
+public interface IAccountListener extends EventListener {
+
+ public void onAccountStatusChanged(boolean status);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/SimpleAccountFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/SimpleAccountFirerer.java
new file mode 100644
index 00000000..48b81f04
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/account/listeners/SimpleAccountFirerer.java
@@ -0,0 +1,31 @@
+package com.pqt.client.module.account.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SimpleAccountFirerer implements IAccountFirerer {
+
+
+ /**
+ * @see com.pqt.client.module.account.listeners.IAccountFirerer#fireAccountStatusChanged(boolean)
+ */
+ public void fireAccountStatusChanged(boolean status) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.account.listeners.IAccountFirerer#addListener(com.pqt.client.module.account.listeners.IAccountListener)
+ */
+ public void addListener(IAccountListener listener) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.account.listeners.IAccountFirerer#removeListener(com.pqt.client.module.account.listeners.IAccountListener)
+ */
+ public void removeListener(IAccountListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java
new file mode 100644
index 00000000..71757842
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java
@@ -0,0 +1,46 @@
+package com.pqt.client.module.connection;
+
+import com.pqt.client.module.connection.listeners.IConnectionListener;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+//TODO add log lines?
+public class ConnectionService {
+
+ public boolean isConnectedToServer() {
+ return false;
+ }
+
+ public void connectToServer(String ip_address) {
+
+ }
+
+ public void disconnectFromServer() {
+
+ }
+
+ public String getCurrentServerIpAddress() {
+ return null;
+ }
+
+ public void start() {
+
+ }
+
+ public void stop() {
+
+ }
+
+ public void sendText(String text) {
+
+ }
+
+ public void addListener(IConnectionListener listener) {
+
+ }
+
+ public void removeListener(IConnectionListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java
new file mode 100644
index 00000000..1b99f8fa
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java
@@ -0,0 +1,37 @@
+package com.pqt.client.module.connection.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class ConnectionListenerAdapter implements IConnectionListener {
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionListener#onMessageReceivedEvent(String)
+ *
+ *
+ */
+ public void onMessageReceivedEvent(String msg) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionListener#onConnectedEvent()
+ *
+ *
+ */
+ public void onConnectedEvent() {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionListener#onDisconnectedEvent()
+ *
+ *
+ */
+ public void onDisconnectedEvent() {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionFirerer.java
new file mode 100644
index 00000000..4afdde4d
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionFirerer.java
@@ -0,0 +1,15 @@
+package com.pqt.client.module.connection.listeners;
+
+public interface IConnectionFirerer {
+
+ public abstract void fireMessageReceivedEvent(String msg);
+
+ public abstract void fireConnectedEvent();
+
+ public abstract void fireDisconnectedEvent();
+
+ public abstract void addListener(IConnectionListener listener);
+
+ public abstract void removeListener(IConnectionListener listener);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java
new file mode 100644
index 00000000..c04b3b52
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java
@@ -0,0 +1,13 @@
+package com.pqt.client.module.connection.listeners;
+
+import java.util.EventListener;
+
+public interface IConnectionListener extends EventListener {
+
+ public abstract void onMessageReceivedEvent(String msg);
+
+ public abstract void onConnectedEvent();
+
+ public abstract void onDisconnectedEvent();
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/SimpleConnectionFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/SimpleConnectionFirerer.java
new file mode 100644
index 00000000..d8bbf425
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/SimpleConnectionFirerer.java
@@ -0,0 +1,49 @@
+package com.pqt.client.module.connection.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SimpleConnectionFirerer implements IConnectionFirerer {
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionFirerer#fireMessageReceivedEvent(String)
+ *
+ *
+ */
+ public void fireMessageReceivedEvent(String msg) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionFirerer#fireConnectedEvent()
+ */
+ public void fireConnectedEvent() {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionFirerer#fireDisconnectedEvent()
+ */
+ public void fireDisconnectedEvent() {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionFirerer#addListener(com.pqt.client.module.connection.listeners.IConnectionListener)
+ */
+ public void addListener(IConnectionListener listener) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.connection.listeners.IConnectionFirerer#removeListener(com.pqt.client.module.connection.listeners.IConnectionListener)
+ */
+ public void removeListener(IConnectionListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/ILogLineMaker.java b/Workspace/client/src/main/java/com/pqt/client/module/log/ILogLineMaker.java
new file mode 100644
index 00000000..5b95a3bd
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/ILogLineMaker.java
@@ -0,0 +1,8 @@
+package com.pqt.client.module.log;
+
+import com.pqt.core.entities.log.LogLine;
+import com.pqt.core.entities.log.ILoggable;
+
+public interface ILogLineMaker {
+ LogLine make(ILoggable loggable);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/LogLineMakerManager.java b/Workspace/client/src/main/java/com/pqt/client/module/log/LogLineMakerManager.java
new file mode 100644
index 00000000..d1ca30ae
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/LogLineMakerManager.java
@@ -0,0 +1,23 @@
+package com.pqt.client.module.log;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class LogLineMakerManager {
+
+ public ILogLineMaker getMaker(Class clazz) {
+ return null;
+ }
+
+ public boolean setMaker(Class clazz, ILogLineMaker maker) {
+ return false;
+ }
+
+ public ILogLineMaker getDefaultMaker() {
+ return null;
+ }
+
+ public boolean setDefaultMaker(ILogLineMaker maker) {
+ return false;
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/LogService.java b/Workspace/client/src/main/java/com/pqt/client/module/log/LogService.java
new file mode 100644
index 00000000..a78024fd
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/LogService.java
@@ -0,0 +1,28 @@
+package com.pqt.client.module.log;
+
+import com.pqt.core.entities.log.ILoggable;
+import com.pqt.core.entities.log.LogLine;
+
+import java.util.List;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class LogService {
+
+ public void log(ILoggable loggable) {
+
+ }
+
+ public List getAllLogs() {
+ return null;
+ }
+
+ public List getLastLogs(int number) {
+ return null;
+ }
+
+ public List getLastLogs(int number, int offset) {
+ return null;
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogFirerer.java
new file mode 100644
index 00000000..360328a8
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogFirerer.java
@@ -0,0 +1,11 @@
+package com.pqt.client.module.log.listeners;
+
+public interface ILogFirerer {
+
+ public abstract void addListener(ILogListener listener);
+
+ public abstract void removeListener(ILogListener listener);
+
+ public abstract void fireLogEvent();
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogListener.java b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogListener.java
new file mode 100644
index 00000000..b9c74a56
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/ILogListener.java
@@ -0,0 +1,9 @@
+package com.pqt.client.module.log.listeners;
+
+import java.util.EventListener;
+
+public interface ILogListener extends EventListener {
+
+ public abstract void onLogEvent();
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/LogListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/LogListenerAdapter.java
new file mode 100644
index 00000000..ade0d0b7
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/LogListenerAdapter.java
@@ -0,0 +1,17 @@
+package com.pqt.client.module.log.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class LogListenerAdapter implements ILogListener {
+
+
+ /**
+ * @see com.pqt.client.module.log.listeners.ILogListener#onLogEvent()
+ *
+ *
+ */
+ public void onLogEvent() {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/SimpleLogFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/SimpleLogFirerer.java
new file mode 100644
index 00000000..317c766c
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/log/listeners/SimpleLogFirerer.java
@@ -0,0 +1,33 @@
+package com.pqt.client.module.log.listeners;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SimpleLogFirerer implements ILogFirerer {
+
+
+ /**
+ * @see com.pqt.client.module.log.listeners.ILogFirerer#addListener(com.pqt.client.module.log.listeners.ILogListener)
+ */
+ public void addListener(ILogListener listener) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.log.listeners.ILogFirerer#removeListener(com.pqt.client.module.log.listeners.ILogListener)
+ */
+ public void removeListener(ILogListener listener) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.log.listeners.ILogFirerer#fireLogEvent()
+ *
+ *
+ */
+ public void fireLogEvent() {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java
new file mode 100644
index 00000000..c6b39729
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java
@@ -0,0 +1,35 @@
+package com.pqt.client.module.query;
+
+import com.pqt.client.module.query.query_callback.IUpdateQueryCallback;
+import com.pqt.core.entities.query.IQuery;
+import com.pqt.client.module.query.query_callback.ISimpleQueryCallback;
+import com.pqt.client.module.query.query_callback.IStatQueryCallback;
+import com.pqt.client.module.query.query_callback.IStockQueryCallback;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class QueryExecutor {
+
+ public static final QueryExecutor INSTANCE = new QueryExecutor();
+
+ private QueryExecutor(){
+
+ }
+
+ public long execute(IQuery query, ISimpleQueryCallback callback) {
+ return 0;
+ }
+
+ public long execute(IQuery query, IStatQueryCallback callback) {
+ return 0;
+ }
+
+ public long execute(IQuery query, IStockQueryCallback callback) {
+ return 0;
+ }
+
+ public long execute(IQuery query, IUpdateQueryCallback callback) {
+ return 0;
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryFactory.java b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryFactory.java
new file mode 100644
index 00000000..6335c44d
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryFactory.java
@@ -0,0 +1,38 @@
+package com.pqt.client.module.query;
+
+import com.pqt.core.entities.product.ProductUpdate;
+import com.pqt.core.entities.query.IQuery;
+import com.pqt.core.entities.sale.Sale;
+import com.pqt.core.entities.user_account.Account;
+
+import java.util.List;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class QueryFactory {
+
+ public static IQuery newConnectQuery(String serverAddress) {
+ return null;
+ }
+
+ public static IQuery newSaleQuery(Sale sale) {
+ return null;
+ }
+
+ public static IQuery newStockQuery() {
+ return null;
+ }
+
+ public static IQuery newStatQuery() {
+ return null;
+ }
+
+ public static IQuery newLogQuery(Account account, boolean state) {
+ return null;
+ }
+
+ public static IQuery newUpdateQuery(List updates) {
+ return null;
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/ISimpleQueryCallback.java b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/ISimpleQueryCallback.java
new file mode 100644
index 00000000..83428624
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/ISimpleQueryCallback.java
@@ -0,0 +1,7 @@
+package com.pqt.client.module.query.query_callback;
+
+public interface ISimpleQueryCallback {
+ public void ack();
+ public void err(Throwable cause);
+ public void ref(Throwable cause);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStatQueryCallback.java b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStatQueryCallback.java
new file mode 100644
index 00000000..4de628dc
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStatQueryCallback.java
@@ -0,0 +1,10 @@
+package com.pqt.client.module.query.query_callback;
+
+
+import java.util.Map;
+
+public interface IStatQueryCallback {
+ public void ack(Map stats);
+ public void err(Throwable cause);
+ public void ref(Throwable cause);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStockQueryCallback.java b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStockQueryCallback.java
new file mode 100644
index 00000000..f85a7fe5
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IStockQueryCallback.java
@@ -0,0 +1,11 @@
+package com.pqt.client.module.query.query_callback;
+
+import com.pqt.core.entities.product.Product;
+
+import java.util.List;
+
+public interface IStockQueryCallback {
+ public void ack(List products);
+ public void err(Throwable cause);
+ public void ref(Throwable cause);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IUpdateQueryCallback.java b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IUpdateQueryCallback.java
new file mode 100644
index 00000000..f7e5b728
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/query/query_callback/IUpdateQueryCallback.java
@@ -0,0 +1,7 @@
+package com.pqt.client.module.query.query_callback;
+
+public interface IUpdateQueryCallback {
+ public void ack(long id);
+ public void err(long id, Throwable cause);
+ public void ref(long id, Throwable cause);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java
new file mode 100644
index 00000000..10faee56
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java
@@ -0,0 +1,28 @@
+package com.pqt.client.module.sale;
+
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.sale.Sale;
+
+import java.util.Map;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SaleBuilder {
+
+ public boolean addProduct(Product product) {
+ return false;
+ }
+
+ public boolean removeProduct(Product product) {
+ return false;
+ }
+
+ public Map getCurrentProductList() {
+ return null;
+ }
+
+ public Sale build() {
+ return null;
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java
new file mode 100644
index 00000000..334edddb
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java
@@ -0,0 +1,30 @@
+package com.pqt.client.module.sale;
+
+import com.pqt.client.module.sale.listeners.ISaleListener;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+//TODO add log lines
+public class SaleService {
+
+ public void getNewSaleBuilder() {
+
+ }
+
+ public void commitSale(SaleBuilder saleBuilder) {
+
+ }
+
+ public void revertSale(int saleId) {
+
+ }
+
+ public void addListener(ISaleListener listener) {
+
+ }
+
+ public void removeListener(ISaleListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleFirerer.java
new file mode 100644
index 00000000..f2c3cb10
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleFirerer.java
@@ -0,0 +1,17 @@
+package com.pqt.client.module.sale.listeners;
+
+import com.pqt.core.entities.sale.Sale;
+
+public interface ISaleFirerer {
+
+ public abstract void fireSaleValidationSuccess(Sale sale);
+
+ public abstract void fireSaleValidationError(Sale sale, Throwable cause);
+
+ public abstract void fireSaleValidationRefused(Sale sale, Throwable cause);
+
+ public abstract void addListener(ISaleListener listener);
+
+ public abstract void removeListener(ISaleListener listener);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleListener.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleListener.java
new file mode 100644
index 00000000..8852d3c3
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/ISaleListener.java
@@ -0,0 +1,15 @@
+package com.pqt.client.module.sale.listeners;
+
+import com.pqt.core.entities.sale.Sale;
+
+import java.util.EventListener;
+
+public interface ISaleListener extends EventListener {
+
+ public abstract void onSaleValidationSuccess(Sale sale);
+
+ public abstract void onSaleValidationError(Sale sale, Throwable cause);
+
+ public abstract void onSaleValidationRefused(Sale sale, Throwable cause);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SaleListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SaleListenerAdapter.java
new file mode 100644
index 00000000..7bc34190
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SaleListenerAdapter.java
@@ -0,0 +1,35 @@
+package com.pqt.client.module.sale.listeners;
+
+import com.pqt.core.entities.sale.Sale;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SaleListenerAdapter implements ISaleListener {
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleListener#onSaleValidationSuccess(com.pqt.core.entities.sale.Sale)
+ *
+ *
+ */
+ public void onSaleValidationSuccess(Sale sale) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleListener#onSaleValidationError(com.pqt.core.entities.sale.Sale, Throwable)
+ */
+ public void onSaleValidationError(Sale sale, Throwable cause) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleListener#onSaleValidationRefused(com.pqt.core.entities.sale.Sale, Throwable)
+ */
+ public void onSaleValidationRefused(Sale sale, Throwable cause) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SimpleSaleFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SimpleSaleFirerer.java
new file mode 100644
index 00000000..c105c76a
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/listeners/SimpleSaleFirerer.java
@@ -0,0 +1,49 @@
+package com.pqt.client.module.sale.listeners;
+
+import com.pqt.core.entities.sale.Sale;
+
+//TODO écrire contenu méthodes
+//TODO écrire javadoc
+public class SimpleSaleFirerer implements ISaleFirerer {
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleFirerer#fireSaleValidationSuccess(com.pqt.core.entities.sale.Sale)
+ */
+ public void fireSaleValidationSuccess(Sale sale) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleFirerer#fireSaleValidationError(com.pqt.core.entities.sale.Sale, Throwable)
+ */
+ public void fireSaleValidationError(Sale sale, Throwable cause) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleFirerer#fireSaleValidationRefused(com.pqt.core.entities.sale.Sale, Throwable)
+ */
+ public void fireSaleValidationRefused(Sale sale, Throwable cause) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleFirerer#addListener(com.pqt.client.module.sale.listeners.ISaleListener)
+ */
+ public void addListener(ISaleListener listener) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.sale.listeners.ISaleFirerer#removeListener(com.pqt.client.module.sale.listeners.ISaleListener)
+ */
+ public void removeListener(ISaleListener listener) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java
new file mode 100644
index 00000000..83c59ad9
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatDao.java
@@ -0,0 +1,68 @@
+package com.pqt.client.module.stat;
+
+import com.pqt.client.module.query.QueryExecutor;
+import com.pqt.client.module.query.QueryFactory;
+import com.pqt.client.module.query.query_callback.IStatQueryCallback;
+import com.pqt.client.module.stat.listeners.IStatFirerer;
+import com.pqt.client.module.stat.listeners.IStatListener;
+import com.pqt.client.module.stat.listeners.SimpleStatFirerer;
+
+import java.util.*;
+
+//TODO écrire javadoc
+public class StatDao {
+
+ private Date lastRefreshTimestamp;
+ private Map stats;
+ private IStatFirerer eventFirerer;
+
+ public StatDao() {
+ eventFirerer = new SimpleStatFirerer();
+ stats = new HashMap<>();
+ lastRefreshTimestamp = null;
+ }
+
+ public synchronized Map getStats() {
+ return new HashMap<>(stats);
+ }
+
+ public void refreshStats() {
+ QueryExecutor.INSTANCE.execute(QueryFactory.newStockQuery(), new IStatQueryCallback() {
+ @Override
+ public void ack(Map stats) {
+ replaceStats(stats);
+ eventFirerer.fireGetStatSuccess();
+ //TODO add log line
+ }
+
+ @Override
+ public void err(Throwable cause) {
+ eventFirerer.fireGetStatError(cause);
+ //TODO add log line
+ }
+
+ @Override
+ public void ref(Throwable cause) {
+ eventFirerer.fireGetStatRefused(cause);
+ //TODO add log line
+ }
+ });
+ }
+
+ public Date getLastRefreshTimestamp(){
+ return lastRefreshTimestamp;
+ }
+
+ private synchronized void replaceStats(Map stats) {
+ this.stats = new HashMap<>(stats);
+ this.lastRefreshTimestamp = new Date();
+ }
+
+ public void removeListener(IStatListener listener) {
+ eventFirerer.removeListener(listener);
+ }
+
+ public void addListener(IStatListener listener) {
+ eventFirerer.addListener(listener);
+ }
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/StatService.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatService.java
new file mode 100644
index 00000000..8a642b0a
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/StatService.java
@@ -0,0 +1,33 @@
+package com.pqt.client.module.stat;
+
+import com.pqt.client.module.stat.listeners.IStatListener;
+
+import java.util.Map;
+
+//TODO écrire javadoc
+//TODO add log lines
+public class StatService {
+
+ private StatDao dao;
+
+ public StatService() {
+ dao = new StatDao();
+ }
+
+ public Map getStats() {
+ return dao.getStats();
+ }
+
+ public void refreshStats() {
+ dao.refreshStats();
+ }
+
+ public void addListener(IStatListener listener) {
+ dao.addListener(listener);
+ }
+
+ public void removeListener(IStatListener listener) {
+ dao.removeListener(listener);
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java
new file mode 100644
index 00000000..105af3f2
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatFirerer.java
@@ -0,0 +1,16 @@
+package com.pqt.client.module.stat.listeners;
+
+import java.util.Map;
+
+public interface IStatFirerer {
+
+ public abstract void fireGetStatSuccess();
+
+ public abstract void fireGetStatError(Throwable cause);
+
+ public abstract void fireGetStatRefused(Throwable cause);
+
+ void removeListener(IStatListener listener);
+
+ void addListener(IStatListener listener);
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java
new file mode 100644
index 00000000..21c324b9
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/IStatListener.java
@@ -0,0 +1,14 @@
+package com.pqt.client.module.stat.listeners;
+
+import java.util.EventListener;
+import java.util.Map;
+
+public interface IStatListener extends EventListener {
+
+ public abstract void onGetStatSuccess();
+
+ public abstract void onGetStatError(Throwable cause);
+
+ public abstract void onGetStatRefused(Throwable cause);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java
new file mode 100644
index 00000000..d84966e6
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/SimpleStatFirerer.java
@@ -0,0 +1,53 @@
+package com.pqt.client.module.stat.listeners;
+
+import javax.swing.event.EventListenerList;
+
+//TODO écrire javadoc
+public class SimpleStatFirerer implements IStatFirerer {
+
+ private EventListenerList listeners;
+
+ public SimpleStatFirerer() {
+ listeners = new EventListenerList();
+ }
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatSuccess()
+ */
+ public void fireGetStatSuccess() {
+ for(IStatListener l : listeners.getListeners(IStatListener.class)){
+ l.onGetStatSuccess();
+ }
+ }
+
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatError(Throwable)
+ */
+ public void fireGetStatError(Throwable cause) {
+ for(IStatListener l : listeners.getListeners(IStatListener.class)){
+ l.onGetStatError(cause);
+ }
+ }
+
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatFirerer#fireGetStatRefused(Throwable)
+ */
+ public void fireGetStatRefused(Throwable cause) {
+ for(IStatListener l : listeners.getListeners(IStatListener.class)){
+ l.onGetStatRefused(cause);
+ }
+ }
+
+ @Override
+ public void removeListener(IStatListener listener) {
+ listeners.remove(IStatListener.class, listener);
+ }
+
+ @Override
+ public void addListener(IStatListener listener) {
+ listeners.add(IStatListener.class, listener);
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java
new file mode 100644
index 00000000..c182895e
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stat/listeners/StatListenerAdapter.java
@@ -0,0 +1,29 @@
+package com.pqt.client.module.stat.listeners;
+
+public class StatListenerAdapter implements IStatListener {
+
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatSuccess()
+ */
+ public void onGetStatSuccess() {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatError(Throwable)
+ */
+ public void onGetStatError(Throwable cause) {
+
+ }
+
+
+ /**
+ * @see com.pqt.client.module.stat.listeners.IStatListener#onGetStatRefused(Throwable)
+ */
+ public void onGetStatRefused(Throwable cause) {
+
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockFirerer.java
new file mode 100644
index 00000000..7e1d7082
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockFirerer.java
@@ -0,0 +1,16 @@
+package com.pqt.client.module.stock.Listeners;
+
+public interface IStockFirerer {
+ void fireGetProductListSuccessEvent();
+ void fireGetProductListErrorEvent(Throwable cause);
+ void fireGetProductListRefusedEvent(Throwable cause);
+ void fireProductListChangedEvent();
+
+ void fireProductListUpdateSuccessEvent(long id);
+ void fireProductListUpdateErrorEvent(long id, Throwable cause);
+ void fireProductListUpdateRefusedEvent(long id, Throwable cause);
+
+ void addListener(IStockListener listener);
+ void removeListener(IStockListener listener);
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockListener.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockListener.java
new file mode 100644
index 00000000..075cf588
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/IStockListener.java
@@ -0,0 +1,16 @@
+package com.pqt.client.module.stock.Listeners;
+
+import java.util.EventListener;
+
+public interface IStockListener extends EventListener {
+
+ void onGetProductListSuccessEvent();
+ void onGetProductListErrorEvent(Throwable cause);
+ void onGetProductListRefusedEvent(Throwable cause);
+
+ void onProductListUpdateSuccessEvent(long id);
+ void onProductListUpdateErrorEvent(long id, Throwable cause);
+ void onProductListUpdateRefusedEvent(long id, Throwable cause);
+
+ void onProductListChangedEvent();
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/SimpleStockFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/SimpleStockFirerer.java
new file mode 100644
index 00000000..a4f513e2
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/SimpleStockFirerer.java
@@ -0,0 +1,73 @@
+package com.pqt.client.module.stock.Listeners;
+
+
+import javax.swing.event.EventListenerList;
+
+//TODO écrire javadoc
+public class SimpleStockFirerer implements IStockFirerer {
+
+ private EventListenerList listeners;
+
+ public SimpleStockFirerer() {
+ listeners = new EventListenerList();
+ }
+
+ @Override
+ public void fireGetProductListSuccessEvent() {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onGetProductListSuccessEvent();
+ }
+ }
+
+ @Override
+ public void fireGetProductListErrorEvent(Throwable cause) {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onGetProductListErrorEvent(cause);
+ }
+ }
+
+ @Override
+ public void fireGetProductListRefusedEvent(Throwable cause) {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onGetProductListRefusedEvent(cause);
+ }
+ }
+
+ @Override
+ public void fireProductListChangedEvent() {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onProductListChangedEvent();
+ }
+ }
+
+ @Override
+ public void fireProductListUpdateSuccessEvent(long id) {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onProductListUpdateSuccessEvent(id);
+ }
+ }
+
+ @Override
+ public void fireProductListUpdateErrorEvent(long id, Throwable cause) {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onProductListUpdateErrorEvent(id, cause);
+ }
+ }
+
+ @Override
+ public void fireProductListUpdateRefusedEvent(long id, Throwable cause) {
+ for(IStockListener l : listeners.getListeners(IStockListener.class)){
+ l.onProductListUpdateRefusedEvent(id, cause);
+ }
+ }
+
+ @Override
+ public void addListener(IStockListener listener) {
+ listeners.add(IStockListener.class, listener);
+ }
+
+ @Override
+ public void removeListener(IStockListener listener) {
+ listeners.remove(IStockListener.class, listener);
+ }
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/StockListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/StockListenerAdapter.java
new file mode 100644
index 00000000..9ec57b06
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/Listeners/StockListenerAdapter.java
@@ -0,0 +1,39 @@
+package com.pqt.client.module.stock.Listeners;
+
+public class StockListenerAdapter implements IStockListener {
+
+ @Override
+ public void onGetProductListSuccessEvent() {
+
+ }
+
+ @Override
+ public void onGetProductListErrorEvent(Throwable cause) {
+
+ }
+
+ @Override
+ public void onGetProductListRefusedEvent(Throwable cause) {
+
+ }
+
+ @Override
+ public void onProductListUpdateSuccessEvent(long id) {
+
+ }
+
+ @Override
+ public void onProductListUpdateErrorEvent(long id, Throwable cause) {
+
+ }
+
+ @Override
+ public void onProductListUpdateRefusedEvent(long id, Throwable cause) {
+
+ }
+
+ @Override
+ public void onProductListChangedEvent() {
+
+ }
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/StockDao.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/StockDao.java
new file mode 100644
index 00000000..6ab6b940
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/StockDao.java
@@ -0,0 +1,118 @@
+package com.pqt.client.module.stock;
+
+import com.pqt.client.module.query.QueryExecutor;
+import com.pqt.client.module.query.QueryFactory;
+import com.pqt.client.module.query.query_callback.IStockQueryCallback;
+import com.pqt.client.module.query.query_callback.IUpdateQueryCallback;
+import com.pqt.client.module.stock.Listeners.IStockFirerer;
+import com.pqt.client.module.stock.Listeners.IStockListener;
+import com.pqt.client.module.stock.Listeners.SimpleStockFirerer;
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.product.ProductUpdate;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+//TODO écrire javadoc
+public class StockDao {
+
+ private IStockFirerer eventFirerer;
+ private Date lastRefreshTimestamp;
+ private List products;
+
+ public StockDao() {
+ eventFirerer = new SimpleStockFirerer();
+ products = new ArrayList<>();
+ lastRefreshTimestamp = null;
+ }
+
+ public synchronized List getProducts() {
+ return new ArrayList<>(products);
+ }
+
+ public synchronized Product getProduct(final int id) {
+ Optional match = products.stream().filter((product->product.getId()==id)).findFirst();
+ if(match.isPresent())
+ return match.get();
+
+ return null;
+ }
+
+ public void refreshProductList() {
+ QueryExecutor.INSTANCE.execute(QueryFactory.newStockQuery(), new IStockQueryCallback() {
+ @Override
+ public void ack(List products) {
+ replaceProductList(products);
+ eventFirerer.fireGetProductListSuccessEvent();
+ //TODO add log line
+ }
+
+ @Override
+ public void err(Throwable cause) {
+ //TODO add log line
+ eventFirerer.fireGetProductListErrorEvent(cause);
+ }
+
+ @Override
+ public void ref(Throwable cause) {
+ //TODO add log line
+ eventFirerer.fireGetProductListRefusedEvent(cause);
+ }
+ });
+ }
+
+ public Date getLastRefreshTimestamp(){
+ return lastRefreshTimestamp;
+ }
+
+ private synchronized void replaceProductList(List products){
+ this.products.clear();
+ this.products.addAll(products);
+ this.lastRefreshTimestamp = new Date();
+ eventFirerer.fireProductListChangedEvent();
+ }
+
+ public long commitUpdate(List updates){
+ return QueryExecutor.INSTANCE.execute(QueryFactory.newUpdateQuery(updates),new IUpdateQueryCallback(){
+
+ @Override
+ public void ack(long id) {
+ //TODO add log line
+ refreshProductList();
+ eventFirerer.fireProductListUpdateSuccessEvent(id);
+ }
+
+ @Override
+ public void err(long id, Throwable cause) {
+ //TODO add log line
+ eventFirerer.fireProductListUpdateErrorEvent(id, cause);
+ }
+
+ @Override
+ public void ref(long id, Throwable cause) {
+ //TODO add log line
+ eventFirerer.fireProductListUpdateRefusedEvent(id, cause);
+ }
+ });
+ }
+
+ /**
+ * Ajoute un listener à la liste de diffusion des événements pouvant être levé par le service.
+ * @param listener
+ * @see {@link IStockListener}
+ */
+ public void addListener(IStockListener listener) {
+ eventFirerer.addListener(listener);
+ }
+
+ /**
+ * Retire un listener d'événement donné de la liste de diffusion des événements.
+ * @param listener
+ * @see {@link IStockListener}
+ */
+ public void removeListener(IStockListener listener) {
+ eventFirerer.removeListener(listener);
+ }
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/StockService.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/StockService.java
new file mode 100644
index 00000000..b978fd8d
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/StockService.java
@@ -0,0 +1,109 @@
+package com.pqt.client.module.stock;
+
+import com.pqt.client.module.query.QueryExecutor;
+import com.pqt.client.module.query.QueryFactory;
+import com.pqt.client.module.query.query_callback.IUpdateQueryCallback;
+import com.pqt.client.module.stock.Listeners.IStockFirerer;
+import com.pqt.client.module.stock.Listeners.SimpleStockFirerer;
+import com.pqt.core.entities.product.Product;
+import com.pqt.client.module.stock.Listeners.IStockListener;
+
+import java.util.Date;
+import java.util.List;
+
+//TODO Add log lines
+public class StockService {
+
+ public static final StockService INSTANCE = new StockService();
+
+ private StockDao dao;
+
+ private StockService() {
+ dao = new StockDao();
+ }
+
+ /**
+ * Accesseur renvoyant un objet {@link Date} correspondant à la dernière heure où les stocks ont été mis à jour
+ *
+ * @return {@link Date} représentant l'instant de la dernière mise à jour des stocks.
+ */
+ public Date getLastRefreshTimestamp(){
+ return dao.getLastRefreshTimestamp();
+ }
+
+ /**
+ * Démarre la procédure de mise à jour des stocks.
+ *
+ * L'exécution de cette méthode ne constitue pas la mise à jour, elle ne fait que démarrer la procédure.
+ * Les événements liées à la mise à jour du stock peuvent être écoutés via la classe de listener {@link IStockListener}.
+ */
+ public void refreshProductList() {
+ dao.refreshProductList();
+ }
+
+ /**
+ * Accesseur de la liste des produits actuellement en vente.
+ *
+ * La liste peut être obsolète, voir {@link #getLastRefreshTimestamp()} pour la date du dernier refresh et {@link #refreshProductList()} pour la mettre à jour.
+ *
+ * @return Liste des produits en vente.
+ */
+ public List getProducts() {
+ return dao.getProducts();
+ }
+
+ /**
+ * Accesseur récupérant un unique produit présent dans les stocks en se basant sur son id.
+ *
+ * @param id identifiant du produit voulu
+ * @return produit voulu s'il est présent dans le stock, ou null si l'identifiant {@code id} ne correspond à aucun produit présent dans le stock.
+ */
+ public Product getProduct(int id) {
+ return dao.getProduct(id);
+ }
+
+ /**
+ * Renvoie un nouveau builder d'update de stock.
+ *
+ * Un update de stock correspond à un ticket de demande de modification du stock, composé d'ajouts, de suppressions et de modifications de produits.
+ * Un objet {@link UpdateBuilder} permet de générer facilement une update. Pour valider l'update, voir {@link #commitUpdate(UpdateBuilder)}.
+ *
+ * @return nouvelle instance de la classe {@link UpdateBuilder}.
+ */
+ public UpdateBuilder getNewUpdateBuilder() {
+ return new UpdateBuilder();
+ }
+
+ /**
+ * Propose une modification de stock et lance la procédure de validation. Retourne l'identifiant de la modification, qui sera utilisé dans les notifications pour discriminer les événements.
+ *
+ * L'exécution de cette méthode ne constitue pas la modification, elle ne fait que démarrer la procédure.
+ * Les événements liées à la valiation des updates du stock peuvent être écoutés via la classe de listener {@link IStockListener}.
+ *
+ * Une procédure de mise à jour du stock sera automatiquement lancée si la modification est validée (comme si la méthode {@link #refreshProductList()} avait été appelée).
+ * @param updateBuilder
+ * @return l'identifiant de l'update soumise.
+ */
+ public long commitUpdate(UpdateBuilder updateBuilder) {
+ return dao.commitUpdate(updateBuilder.build());
+ }
+
+ /**
+ * Ajoute un listener à la liste de diffusion des événements pouvant être levé par le service.
+ * @param listener
+ * @see {@link IStockListener}
+ */
+ public void addListener(IStockListener listener) {
+ dao.addListener(listener);
+ }
+
+ /**
+ * Retire un listener d'événement donné de la liste de diffusion des événements.
+ * @param listener
+ * @see {@link IStockListener}
+ */
+ public void removeListener(IStockListener listener) {
+ dao.removeListener(listener);
+ }
+
+}
diff --git a/Workspace/client/src/main/java/com/pqt/client/module/stock/UpdateBuilder.java b/Workspace/client/src/main/java/com/pqt/client/module/stock/UpdateBuilder.java
new file mode 100644
index 00000000..36826f26
--- /dev/null
+++ b/Workspace/client/src/main/java/com/pqt/client/module/stock/UpdateBuilder.java
@@ -0,0 +1,50 @@
+package com.pqt.client.module.stock;
+
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.product.ProductUpdate;
+
+import java.util.*;
+
+public class UpdateBuilder {
+
+ private Set toAdd, toRemove;
+ private Map toModify;
+
+ public UpdateBuilder() {
+ toAdd = new HashSet<>();
+ toRemove = new HashSet<>();
+ toModify = new HashMap<>();
+ }
+
+ public void addProduct(Product product) {
+ if(!toAdd.contains(product)){
+ toAdd.add(product);
+ }
+ }
+
+ public void removeProduct(Product product) {
+ if(toRemove.contains(product)){
+ toRemove.remove(product);
+ }
+ }
+
+ public void modifyProduct(Product oldVersion, Product newVersion) {
+ toModify.put(oldVersion, newVersion);
+ }
+
+ public List build() {
+ List reply = new ArrayList<>();
+ for(Product product : toAdd){
+ reply.add(new ProductUpdate(null, product));
+ }
+ for(Product product : toRemove){
+ reply.add(new ProductUpdate(product, null));
+ }
+ for(Product product : toModify.keySet()){
+ reply.add(new ProductUpdate(product, toModify.get(product)));
+ }
+
+ return reply;
+ }
+
+}
diff --git a/Workspace/core/core.iml b/Workspace/core/core.iml
new file mode 100644
index 00000000..c035f0b0
--- /dev/null
+++ b/Workspace/core/core.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace/core/pom.xml b/Workspace/core/pom.xml
new file mode 100644
index 00000000..ab69cb6e
--- /dev/null
+++ b/Workspace/core/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ Main
+ com.pqt
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ core
+
+
+
\ No newline at end of file
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/client/Client.java b/Workspace/core/src/main/java/com/pqt/core/entities/client/Client.java
new file mode 100644
index 00000000..b8306b55
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/client/Client.java
@@ -0,0 +1,49 @@
+package com.pqt.core.entities.client;
+
+import com.pqt.core.entities.log.ILoggable;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class Client implements ILoggable, Serializable {
+
+ private int id;
+ private String address;
+ private Date lastUpdate;
+
+ public Client() {
+ }
+
+ public Client(int id, String address, Date lastUpdate) {
+ this.id = id;
+ this.address = address;
+ this.lastUpdate = lastUpdate;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public Date getLastUpdate() {
+ return lastUpdate;
+ }
+
+ public void setLastUpdate(Date lastUpdate) {
+ this.lastUpdate = lastUpdate;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/log/ILoggable.java b/Workspace/core/src/main/java/com/pqt/core/entities/log/ILoggable.java
new file mode 100644
index 00000000..f4ed38f6
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/log/ILoggable.java
@@ -0,0 +1,7 @@
+package com.pqt.core.entities.log;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public interface ILoggable {
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLine.java b/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLine.java
new file mode 100644
index 00000000..261a4e83
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLine.java
@@ -0,0 +1,66 @@
+package com.pqt.core.entities.log;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class LogLine implements Serializable{
+ private int id;
+ private String description;
+ private Date timestamp;
+ private ILoggable relatedItem;
+ private LogLineActionType type;
+
+ public LogLine() {
+ }
+
+ public LogLine(int id, String description, Date timestamp, ILoggable relatedItem, LogLineActionType type) {
+ this.id = id;
+ this.description = description;
+ this.timestamp = timestamp;
+ this.relatedItem = relatedItem;
+ this.type = type;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public ILoggable getRelatedItem() {
+ return relatedItem;
+ }
+
+ public void setRelatedItem(ILoggable relatedItem) {
+ this.relatedItem = relatedItem;
+ }
+
+ public LogLineActionType getType() {
+ return type;
+ }
+
+ public void setType(LogLineActionType type) {
+ this.type = type;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLineActionType.java b/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLineActionType.java
new file mode 100644
index 00000000..2d02dd78
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/log/LogLineActionType.java
@@ -0,0 +1,11 @@
+package com.pqt.core.entities.log;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public enum LogLineActionType {
+ ADD_PRODUCT_ACTION, REMOVE_PRODUCT_ACTION, MODIFY_PRODUCT_ACTION,
+ COMMIT_SALE_ACTION, REVERT_SALE_ACTION,
+ LOG_IN_ACCOUNT_ACTION, LOG_OUT_ACCOUNT_ACTION,
+ CONNECT_CLIENT_ACTION, DISCONNECT_CLIENT_ACTION
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/product/Category.java b/Workspace/core/src/main/java/com/pqt/core/entities/product/Category.java
new file mode 100644
index 00000000..82b7073c
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/product/Category.java
@@ -0,0 +1,35 @@
+package com.pqt.core.entities.product;
+
+import java.io.Serializable;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class Category implements Serializable{
+ private int id;
+ private String name;
+
+ public Category() {
+ }
+
+ public Category(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/product/Product.java b/Workspace/core/src/main/java/com/pqt/core/entities/product/Product.java
new file mode 100644
index 00000000..58b9558b
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/product/Product.java
@@ -0,0 +1,100 @@
+package com.pqt.core.entities.product;
+
+import com.pqt.core.entities.log.ILoggable;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class Product implements ILoggable, Serializable{
+ private int id;
+ private String name;
+ private int amountRemaining;
+ private int amountSold;
+ private boolean sellable;
+ private boolean price;
+ private List components;
+ private Category category;
+
+ public Product() {
+ components = new ArrayList<>();
+ }
+
+ public Product(int id, String name, int amountRemaining, int amountSold, boolean sellable, boolean price, List components, Category category) {
+ this.id = id;
+ this.name = name;
+ this.amountRemaining = amountRemaining;
+ this.amountSold = amountSold;
+ this.sellable = sellable;
+ this.price = price;
+ this.components = components;
+ this.category = category;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAmountRemaining() {
+ return amountRemaining;
+ }
+
+ public void setAmountRemaining(int amountRemaining) {
+ this.amountRemaining = amountRemaining;
+ }
+
+ public int getAmountSold() {
+ return amountSold;
+ }
+
+ public void setAmountSold(int amountSold) {
+ this.amountSold = amountSold;
+ }
+
+ public boolean isSellable() {
+ return sellable;
+ }
+
+ public void setSellable(boolean sellable) {
+ this.sellable = sellable;
+ }
+
+ public boolean isPrice() {
+ return price;
+ }
+
+ public void setPrice(boolean price) {
+ this.price = price;
+ }
+
+ public List getComponents() {
+ return components;
+ }
+
+ public void setComponents(List components) {
+ this.components = components;
+ }
+
+ public Category getCategory() {
+ return category;
+ }
+
+ public void setCategory(Category category) {
+ this.category = category;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/product/ProductUpdate.java b/Workspace/core/src/main/java/com/pqt/core/entities/product/ProductUpdate.java
new file mode 100644
index 00000000..402f7071
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/product/ProductUpdate.java
@@ -0,0 +1,53 @@
+package com.pqt.core.entities.product;
+
+import com.pqt.core.entities.log.ILoggable;
+import sun.misc.Version;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ProductUpdate implements ILoggable, Serializable {
+
+ private Date createdAt;
+ private Product oldVersion;
+ private Product newVersion;
+
+ public ProductUpdate() {
+ }
+
+ public ProductUpdate(Product oldVersion, Product newVersion) {
+ this.createdAt = new Date();
+ this.oldVersion = oldVersion;
+ this.newVersion = newVersion;
+ }
+
+ public ProductUpdate(Date createdAt, Product oldVersion, Product newVersion) {
+ this.createdAt = createdAt;
+ this.oldVersion = oldVersion;
+ this.newVersion = newVersion;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public Product getOldVersion() {
+ return oldVersion;
+ }
+
+ public void setOldVersion(Product oldVersion) {
+ this.oldVersion = oldVersion;
+ }
+
+ public Product getNewVersion() {
+ return newVersion;
+ }
+
+ public void setNewVersion(Product newVersion) {
+ this.newVersion = newVersion;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/ConnectQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/ConnectQuery.java
new file mode 100644
index 00000000..f5caa308
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/ConnectQuery.java
@@ -0,0 +1,19 @@
+package com.pqt.core.entities.query;
+
+public class ConnectQuery extends SimpleQuery {
+
+ private String serverAddress;
+
+ public ConnectQuery(String serverAddress) {
+ super(QueryType.CONNECT);
+ this.serverAddress = serverAddress;
+ }
+
+ public String getServerAddress() {
+ return serverAddress;
+ }
+
+ public void setServerAddress(String serverAddress) {
+ this.serverAddress = serverAddress;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/IQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/IQuery.java
new file mode 100644
index 00000000..c14de50a
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/IQuery.java
@@ -0,0 +1,5 @@
+package com.pqt.core.entities.query;
+
+public interface IQuery {
+
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/LogQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/LogQuery.java
new file mode 100644
index 00000000..106d5fd7
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/LogQuery.java
@@ -0,0 +1,32 @@
+package com.pqt.core.entities.query;
+
+import com.pqt.core.entities.user_account.Account;
+
+public class LogQuery extends SimpleQuery {
+
+ private Account account;
+
+ private boolean newDesiredState;
+
+ public LogQuery(Account account, boolean newDesiredState) {
+ super(QueryType.LOG);
+ this.account = account;
+ this.newDesiredState = newDesiredState;
+ }
+
+ public Account getAccount() {
+ return account;
+ }
+
+ public void setAccount(Account account) {
+ this.account = account;
+ }
+
+ public boolean isNewDesiredState() {
+ return newDesiredState;
+ }
+
+ public void setNewDesiredState(boolean newDesiredState) {
+ this.newDesiredState = newDesiredState;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/QueryType.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/QueryType.java
new file mode 100644
index 00000000..8fce305d
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/QueryType.java
@@ -0,0 +1,6 @@
+package com.pqt.core.entities.query;
+
+public enum QueryType {
+
+ CONNECT, SALE, STOCL, STAT, LOG, UPDATE
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/SaleQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/SaleQuery.java
new file mode 100644
index 00000000..c205abf2
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/SaleQuery.java
@@ -0,0 +1,21 @@
+package com.pqt.core.entities.query;
+
+import com.pqt.core.entities.sale.Sale;
+
+public class SaleQuery extends SimpleQuery {
+
+ private Sale sale;
+
+ public SaleQuery(Sale sale) {
+ super(QueryType.SALE);
+ this.sale = sale;
+ }
+
+ public Sale getSale() {
+ return sale;
+ }
+
+ public void setSale(Sale sale) {
+ this.sale = sale;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/SimpleQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/SimpleQuery.java
new file mode 100644
index 00000000..463653cd
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/SimpleQuery.java
@@ -0,0 +1,21 @@
+package com.pqt.core.entities.query;
+
+public class SimpleQuery implements IQuery {
+
+ private QueryType type;
+
+ /**
+ *
+ * @param type
+ * @throws NullPointerException if type is null
+ */
+ public SimpleQuery(QueryType type) {
+ if(type==null) throw new NullPointerException("null value not allowed as query type");
+
+ this.type = type;
+ }
+
+ public QueryType getType() {
+ return type;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/query/UpdateQuery.java b/Workspace/core/src/main/java/com/pqt/core/entities/query/UpdateQuery.java
new file mode 100644
index 00000000..3a996bd4
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/query/UpdateQuery.java
@@ -0,0 +1,23 @@
+package com.pqt.core.entities.query;
+
+import com.pqt.core.entities.product.ProductUpdate;
+
+import java.util.List;
+
+public class UpdateQuery extends SimpleQuery {
+
+ private List updates;
+
+ public UpdateQuery(List updates) {
+ super(QueryType.UPDATE);
+ this.updates = updates;
+ }
+
+ public List getUpdates() {
+ return updates;
+ }
+
+ public void setUpdates(List updates) {
+ this.updates = updates;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java
new file mode 100644
index 00000000..3a805f5c
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java
@@ -0,0 +1,103 @@
+package com.pqt.core.entities.sale;
+
+import com.pqt.core.entities.log.ILoggable;
+import com.pqt.core.entities.client.Client;
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.user_account.Account;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class Sale implements ILoggable, Serializable{
+
+ private int id;
+ private Map products;
+ private Date orderedAt;
+ private Client orderedWith;
+ private Account orderedBy;
+ private Account orderedFor;
+ private SaleType type;
+ private SaleStatus status;
+
+ public Sale() {
+ }
+
+ public Sale(int id, Map products, Date orderedAt, Client orderedWith, Account orderedBy, Account orderedFor, SaleType type, SaleStatus status) {
+ this.id = id;
+ this.products = products;
+ this.orderedAt = orderedAt;
+ this.orderedWith = orderedWith;
+ this.orderedBy = orderedBy;
+ this.orderedFor = orderedFor;
+ this.type = type;
+ this.status = status;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Map getProducts() {
+ return products;
+ }
+
+ public void setProducts(Map products) {
+ this.products = products;
+ }
+
+ public Date getOrderedAt() {
+ return orderedAt;
+ }
+
+ public void setOrderedAt(Date orderedAt) {
+ this.orderedAt = orderedAt;
+ }
+
+ public Client getOrderedWith() {
+ return orderedWith;
+ }
+
+ public void setOrderedWith(Client orderedWith) {
+ this.orderedWith = orderedWith;
+ }
+
+ public Account getOrderedBy() {
+ return orderedBy;
+ }
+
+ public void setOrderedBy(Account orderedBy) {
+ this.orderedBy = orderedBy;
+ }
+
+ public Account getOrderedFor() {
+ return orderedFor;
+ }
+
+ public void setOrderedFor(Account orderedFor) {
+ this.orderedFor = orderedFor;
+ }
+
+ public SaleType getType() {
+ return type;
+ }
+
+ public void setType(SaleType type) {
+ this.type = type;
+ }
+
+ public SaleStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(SaleStatus status) {
+ this.status = status;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleStatus.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleStatus.java
new file mode 100644
index 00000000..a9857a79
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleStatus.java
@@ -0,0 +1,19 @@
+package com.pqt.core.entities.sale;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public enum SaleStatus {
+
+ PENDING(0), REFUSED(1), ACCEPTED(2), ABORTED(3);
+
+ private int id;
+
+ private SaleStatus(int id){
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleType.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleType.java
new file mode 100644
index 00000000..7dbf33c8
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/sale/SaleType.java
@@ -0,0 +1,8 @@
+package com.pqt.core.entities.sale;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public enum SaleType {
+ CASH, BANK_CHECK, STUDENT_ASSOCIATION_ACCOUNT, OFFERED_GUEST, OFFERED_STAFF_MEMBER
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/user_account/Account.java b/Workspace/core/src/main/java/com/pqt/core/entities/user_account/Account.java
new file mode 100644
index 00000000..687fab3f
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/user_account/Account.java
@@ -0,0 +1,68 @@
+package com.pqt.core.entities.user_account;
+
+import com.pqt.core.entities.log.ILoggable;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public class Account implements ILoggable, Serializable {
+ private int id;
+ private String username;
+ private String passwordHash;
+ private Date creationDate;
+ private AccountLevel permissionLevel;
+
+ public Account() {
+ }
+
+ public Account(int id, String username, String passwordHash, Date creationDate, AccountLevel permissionLevel) {
+ this.id = id;
+ this.username = username;
+ this.passwordHash = passwordHash;
+ this.creationDate = creationDate;
+ this.permissionLevel = permissionLevel;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPasswordHash() {
+ return passwordHash;
+ }
+
+ public void setPasswordHash(String passwordHash) {
+ this.passwordHash = passwordHash;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public AccountLevel getPermissionLevel() {
+ return permissionLevel;
+ }
+
+ public void setPermissionLevel(AccountLevel permissionLevel) {
+ this.permissionLevel = permissionLevel;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/user_account/AccountLevel.java b/Workspace/core/src/main/java/com/pqt/core/entities/user_account/AccountLevel.java
new file mode 100644
index 00000000..dd068a72
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/user_account/AccountLevel.java
@@ -0,0 +1,8 @@
+package com.pqt.core.entities.user_account;
+
+/**
+ * Created by Notmoo on 18/07/2017.
+ */
+public enum AccountLevel {
+ GUEST, STAFF, WAITER, MASTER
+}
diff --git a/Workspace/pom.xml b/Workspace/pom.xml
new file mode 100644
index 00000000..b882372d
--- /dev/null
+++ b/Workspace/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ com.pqt
+ Main
+ 1.0-SNAPSHOT
+
+ core
+ client
+
+ pom
+
+
+
+
+ maven-compiler-plugin
+
+
+ 1.8
+
+
+
+
+
\ No newline at end of file