diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..687c4d1d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+#Ignoring Intellij workspace specific folders and files
+/**/.idea/workspace.xml
+/**/tasks.xml
+/**/*.iml
+
+/**/.idea/libraries
+
+#Ignoring target folders
+**/target/
\ No newline at end of file
diff --git a/Documentation/Diagrammes/diagrammes.asta b/Documentation/Diagrammes/diagrammes.asta
index 8a57e052..06c8e081 100644
Binary files a/Documentation/Diagrammes/diagrammes.asta and b/Documentation/Diagrammes/diagrammes.asta differ
diff --git a/Documentation/Interactions_serveur-clients.ods b/Documentation/Interactions_serveur-clients.ods
index a4d41bbf..3757740b 100644
Binary files a/Documentation/Interactions_serveur-clients.ods and b/Documentation/Interactions_serveur-clients.ods differ
diff --git a/Workspace/.idea/workspace.xml b/Workspace/.idea/workspace.xml
deleted file mode 100644
index 27e76320..00000000
--- a/Workspace/.idea/workspace.xml
+++ /dev/null
@@ -1,1264 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- com.pqt.core.entities.sale.Sale
-
-
- long
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- DEFINITION_ORDER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Android
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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-
-
-
-
-
-
\ No newline at end of file
diff --git a/Workspace/client/client.iml b/Workspace/client/client.iml
deleted file mode 100644
index c3da4df5..00000000
--- a/Workspace/client/client.iml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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
index 9d205d64..4c550960 100644
--- 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
@@ -1,6 +1,6 @@
package com.pqt.client.module.sale;
-import com.pqt.core.entities.client.Client;
+import com.pqt.core.entities.members.Client;
import com.pqt.core.entities.product.Product;
import com.pqt.core.entities.sale.Sale;
import com.pqt.core.entities.sale.SaleStatus;
diff --git a/Workspace/core/core.iml b/Workspace/core/core.iml
deleted file mode 100644
index c035f0b0..00000000
--- a/Workspace/core/core.iml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Workspace/core/pom.xml b/Workspace/core/pom.xml
index ab69cb6e..3837197a 100644
--- a/Workspace/core/pom.xml
+++ b/Workspace/core/pom.xml
@@ -12,4 +12,14 @@
core
+
+
+
+
+ com.google.code.gson
+ gson
+ 2.8.1
+
+
+
\ No newline at end of file
diff --git a/Workspace/core/src/main/java/com/pqt/core/communication/GSonMessageToolFactory.java b/Workspace/core/src/main/java/com/pqt/core/communication/GSonMessageToolFactory.java
new file mode 100644
index 00000000..9eac8abd
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/communication/GSonMessageToolFactory.java
@@ -0,0 +1,39 @@
+package com.pqt.core.communication;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
+import com.pqt.core.entities.members.PqtMember;
+import com.pqt.core.entities.members.PqtMemberType;
+import com.pqt.core.entities.messages.Message;
+import com.pqt.core.entities.messages.MessageType;
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.product.ProductUpdate;
+import com.pqt.core.entities.sale.Sale;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+//TODO écrire Javadoc
+public class GSonMessageToolFactory implements IMessageToolFactory {
+ private Gson gson;
+
+ public GSonMessageToolFactory() {
+ gson = new GsonBuilder().create();
+ }
+
+ public IObjectFormatter getObjectFormatter(Class clazz){
+ return (obj)->gson.toJson(obj);
+ }
+ public IObjectParser getObjectParser(Class clazz){
+ return (str)->gson.fromJson(str, clazz);
+ }
+ public IObjectFormatter> getListFormatter(Class clazz){
+ return (obj)->gson.toJson(obj);
+ }
+ public IObjectParser> getListParser(Class clazz){
+ Type listType = new TypeToken>(){}.getType();
+ return (str)->gson.fromJson(str, listType);
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/communication/IMessageToolFactory.java b/Workspace/core/src/main/java/com/pqt/core/communication/IMessageToolFactory.java
new file mode 100644
index 00000000..1235a0b1
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/communication/IMessageToolFactory.java
@@ -0,0 +1,25 @@
+package com.pqt.core.communication;
+
+import com.google.gson.reflect.TypeToken;
+import com.pqt.core.entities.members.PqtMember;
+import com.pqt.core.entities.members.PqtMemberType;
+import com.pqt.core.entities.messages.Message;
+import com.pqt.core.entities.messages.MessageType;
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.product.ProductUpdate;
+import com.pqt.core.entities.sale.Sale;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+public interface IMessageToolFactory {
+
+ IObjectFormatter getObjectFormatter(Class clazz);
+
+ IObjectParser getObjectParser(Class clazz);
+
+ IObjectFormatter> getListFormatter(Class clazz);
+
+ IObjectParser> getListParser(Class clazz);
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/communication/IObjectFormatter.java b/Workspace/core/src/main/java/com/pqt/core/communication/IObjectFormatter.java
new file mode 100644
index 00000000..df4b05bf
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/communication/IObjectFormatter.java
@@ -0,0 +1,7 @@
+package com.pqt.core.communication;
+
+public interface IObjectFormatter {
+
+ String format(T obj);
+
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/communication/IObjectParser.java b/Workspace/core/src/main/java/com/pqt/core/communication/IObjectParser.java
new file mode 100644
index 00000000..6a354eef
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/communication/IObjectParser.java
@@ -0,0 +1,6 @@
+package com.pqt.core.communication;
+
+public interface IObjectParser {
+
+ T parse(String str);
+}
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/members/Client.java
similarity index 67%
rename from Workspace/core/src/main/java/com/pqt/core/entities/client/Client.java
rename to Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java
index b8306b55..0d667489 100644
--- a/Workspace/core/src/main/java/com/pqt/core/entities/client/Client.java
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java
@@ -1,6 +1,4 @@
-package com.pqt.core.entities.client;
-
-import com.pqt.core.entities.log.ILoggable;
+package com.pqt.core.entities.members;
import java.io.Serializable;
import java.util.Date;
@@ -8,29 +6,27 @@ import java.util.Date;
/**
* Created by Notmoo on 18/07/2017.
*/
-public class Client implements ILoggable, Serializable {
+public class Client extends PqtMember{
- private int id;
private String address;
private Date lastUpdate;
public Client() {
+ super(-1, PqtMemberType.CLIENT);
+ }
+
+ public Client(int id, String address) {
+ super(id, PqtMemberType.CLIENT);
+ this.address = address;
+ this.lastUpdate = new Date();
}
public Client(int id, String address, Date lastUpdate) {
- this.id = id;
+ super(id, PqtMemberType.CLIENT);
this.address = address;
this.lastUpdate = lastUpdate;
}
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
public String getAddress() {
return address;
}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java
new file mode 100644
index 00000000..9804f487
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java
@@ -0,0 +1,42 @@
+package com.pqt.core.entities.members;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class DataServer extends PqtMember{
+
+ private String address;
+ private Date lastUpdate;
+
+ public DataServer() {
+ super(-1, PqtMemberType.DATA_SERVER);
+ }
+
+ public DataServer(long id, String address) {
+ super(id, PqtMemberType.DATA_SERVER);
+ this.address = address;
+ this.lastUpdate = new Date();
+ }
+
+ public DataServer(long id, String address, Date lastUpdate) {
+ super(id, PqtMemberType.DATA_SERVER);
+ this.address = address;
+ this.lastUpdate = lastUpdate;
+ }
+
+ 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/members/PqtMember.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java
new file mode 100644
index 00000000..94399c6b
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java
@@ -0,0 +1,35 @@
+package com.pqt.core.entities.members;
+
+import com.pqt.core.entities.log.ILoggable;
+
+import java.io.Serializable;
+
+public class PqtMember implements ILoggable, Serializable {
+
+ private long id;
+ private PqtMemberType type;
+
+ public PqtMember() {
+ }
+
+ public PqtMember(long id, PqtMemberType type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public PqtMemberType getType() {
+ return type;
+ }
+
+ public void setType(PqtMemberType type) {
+ this.type = type;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMemberType.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMemberType.java
new file mode 100644
index 00000000..2c8e22de
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMemberType.java
@@ -0,0 +1,7 @@
+package com.pqt.core.entities.members;
+
+public enum PqtMemberType {
+
+ CLIENT, DATA_SERVER;
+
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/messages/Message.java b/Workspace/core/src/main/java/com/pqt/core/entities/messages/Message.java
new file mode 100644
index 00000000..78080326
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/messages/Message.java
@@ -0,0 +1,54 @@
+package com.pqt.core.entities.messages;
+
+import com.pqt.core.entities.members.PqtMember;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Message {
+
+ private Map fields;
+ private MessageType type;
+ private PqtMember emitter, receiver;
+
+ public Message(MessageType type, PqtMember emitter, PqtMember receiver) {
+ this(type, emitter, receiver, null);
+ }
+
+ public Message(MessageType type, PqtMember emitter, PqtMember receiver, Map fields) {
+ this.emitter = emitter;
+ this.receiver = receiver;
+ this.type = type;
+ this.fields = new HashMap<>();
+ if(fields!=null)
+ for(String key : fields.keySet()){
+ this.fields.put(key, fields.get(key));
+ }
+ }
+
+ public Map getFields() {
+ return new HashMap<>(fields);
+ }
+
+ public boolean hasField(String header){
+ return fields.containsKey(header);
+ }
+
+ public String getField(String header){
+ return fields.get(header);
+ }
+
+ public PqtMember getEmitter() {
+ return emitter;
+ }
+
+ public PqtMember getReceiver() {
+ return receiver;
+ }
+
+ public MessageType getType() {
+ return type;
+ }
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/messages/MessageType.java b/Workspace/core/src/main/java/com/pqt/core/entities/messages/MessageType.java
new file mode 100644
index 00000000..1c2a3170
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/messages/MessageType.java
@@ -0,0 +1,38 @@
+package com.pqt.core.entities.messages;
+
+public enum MessageType {
+ QUERY_CONNECT,
+ ACK_CONNECT,
+ ERR_CONNECT,
+ REF_CONNECT,
+
+ QUERY_SALE,
+ ACK_SALE,
+ ERR_SALE,
+ REF_SALE,
+
+ QUERY_REVERT_SALE,
+ ACK_REVERT_SALE,
+ ERR_REVERT_SALE,
+ REF_REVERT_SALE,
+
+ QUERY_STAT,
+ MSG_STAT,
+ ERR_STAT,
+ REF_STAT,
+
+ QUERY_STOCK,
+ MSG_STOCK,
+ ERR_STOCK,
+ REF_STOCK,
+
+ QUERY_LOGIN,
+ ACK_LOGIN,
+ ERR_LOGIN,
+ REF_LOGIN,
+
+ QUERY_UPDATE,
+ ACK_UPDATE,
+ ERR_UPDATE,
+ REF_UPDATE
+}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/product/LightweightProduct.java b/Workspace/core/src/main/java/com/pqt/core/entities/product/LightweightProduct.java
new file mode 100644
index 00000000..e13118ed
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/product/LightweightProduct.java
@@ -0,0 +1,97 @@
+package com.pqt.core.entities.product;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LightweightProduct {
+ private long id;
+ private String name;
+ private int amountRemaining;
+ private int amountSold;
+ private boolean sellable;
+ private double price;
+ private List componentIds;
+ private Category category;
+
+ public LightweightProduct() {
+ componentIds = new ArrayList<>();
+ }
+
+ public LightweightProduct(Product product) {
+ this.id = product.getId();
+ this.name = product.getName();
+ this.amountRemaining = product.getAmountRemaining();
+ this.amountSold = product.getAmountSold();
+ this.sellable = product.isSellable();
+ this.price = product.getPrice();
+ this.category = product.getCategory();
+ this.componentIds = new ArrayList<>();
+ if(componentIds!=null){
+ product.getComponents().stream().forEach((component -> componentIds.add(component.getId())));
+ }
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long 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 double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ public List getComponentIds() {
+ return componentIds;
+ }
+
+ public void setComponentIds(List componentIds) {
+ this.componentIds = componentIds;
+ }
+
+ 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/Product.java b/Workspace/core/src/main/java/com/pqt/core/entities/product/Product.java
index 58b9558b..2f72df2b 100644
--- 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
@@ -10,12 +10,12 @@ import java.util.List;
* Created by Notmoo on 18/07/2017.
*/
public class Product implements ILoggable, Serializable{
- private int id;
+ private long id;
private String name;
private int amountRemaining;
private int amountSold;
private boolean sellable;
- private boolean price;
+ private double price;
private List components;
private Category category;
@@ -23,22 +23,25 @@ public class Product implements ILoggable, Serializable{
components = new ArrayList<>();
}
- public Product(int id, String name, int amountRemaining, int amountSold, boolean sellable, boolean price, List components, Category category) {
+ public Product(long id, String name, int amountRemaining, int amountSold, boolean sellable, double 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;
+ this.components = new ArrayList<>();
+ if(components!=null){
+ this.components.addAll(components);
+ }
}
- public int getId() {
+ public long getId() {
return id;
}
- public void setId(int id) {
+ public void setId(long id) {
this.id = id;
}
@@ -74,11 +77,11 @@ public class Product implements ILoggable, Serializable{
this.sellable = sellable;
}
- public boolean isPrice() {
+ public double getPrice() {
return price;
}
- public void setPrice(boolean price) {
+ public void setPrice(double price) {
this.price = price;
}
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
index 8fce305d..adeb0936 100644
--- 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
@@ -2,5 +2,5 @@ package com.pqt.core.entities.query;
public enum QueryType {
- CONNECT, SALE, STOCL, STAT, LOG, UPDATE
+ CONNECT, SALE, STOCK, STAT, LOG, UPDATE
}
diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/sale/LightweightSale.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/LightweightSale.java
new file mode 100644
index 00000000..b605721d
--- /dev/null
+++ b/Workspace/core/src/main/java/com/pqt/core/entities/sale/LightweightSale.java
@@ -0,0 +1,102 @@
+package com.pqt.core.entities.sale;
+
+import com.pqt.core.entities.members.Client;
+import com.pqt.core.entities.product.Product;
+import com.pqt.core.entities.user_account.Account;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class LightweightSale {
+
+ 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 LightweightSale() {
+ }
+
+ public LightweightSale(Sale sale) {
+ this.id = sale.getId();
+ this.orderedAt = sale.getOrderedAt();
+ this.orderedWith = sale.getOrderedWith();
+ this.orderedBy = sale.getOrderedBy();
+ this.orderedFor = sale.getOrderedFor();
+ this.type = sale.getType();
+ this.status = sale.getStatus();
+ products = new HashMap<>();
+ for(Product product : sale.getProducts().keySet()){
+ products.put(product.getId(), sale.getProducts().get(product));
+ }
+ }
+
+ 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/Sale.java b/Workspace/core/src/main/java/com/pqt/core/entities/sale/Sale.java
index 3a805f5c..1da9bd55 100644
--- 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
@@ -1,7 +1,7 @@
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.members.Client;
import com.pqt.core.entities.product.Product;
import com.pqt.core.entities.user_account.Account;