feat: ajout d'annotations
style: ajout d'un editorconfig
This commit is contained in:
parent
d0c6be13b6
commit
1b192bc254
12
.editorconfig
Normal file
12
.editorconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
|
@ -1,27 +0,0 @@
|
|||
package com.pixels;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(name = "HelloServlet", urlPatterns = { "hello" }, loadOnStartup = 1)
|
||||
public class HelloServlet extends HttpServlet {
|
||||
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.getWriter().print("Hello, World!");
|
||||
}
|
||||
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
String name = request.getParameter("name");
|
||||
if (name == null)
|
||||
name = "World";
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("Hello " + name);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package com.pixels.beans;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -16,8 +18,10 @@ public class Groupe implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// nom du groupe
|
||||
@NonNull
|
||||
@NotBlank
|
||||
private String name;
|
||||
|
||||
@OneToOne // le wallet commun à tous les membres du groupe
|
||||
private Wallet wallet;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.pixels.beans;
|
|||
import javax.persistence.*;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -16,5 +17,6 @@ public class Permission implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// type de la permission
|
||||
private int type;
|
||||
}
|
||||
@NonNull
|
||||
private Integer type;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ package com.pixels.beans;
|
|||
import javax.persistence.*;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -17,12 +20,15 @@ public class Pixel implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// prix du pixel à l'achat
|
||||
private int price;
|
||||
@NonNull
|
||||
private Integer price;
|
||||
|
||||
// couleur du pixel sur la peinture
|
||||
private int color;
|
||||
@NonNull
|
||||
private Color color;
|
||||
|
||||
// petit mot écrit par le user
|
||||
@NonNull
|
||||
private String description;
|
||||
|
||||
// propriétaire actuel du pixel
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.pixels.beans;
|
|||
import javax.persistence.*;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -16,5 +17,6 @@ public class Role implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// type du role
|
||||
private int type;
|
||||
}
|
||||
@NonNull
|
||||
private Integer type;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@ package com.pixels.beans;
|
|||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -16,13 +19,16 @@ public class Transaction implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
// prix de la transaction
|
||||
private int price;
|
||||
// prix de la transaction*
|
||||
@NonNull
|
||||
private Integer price;
|
||||
|
||||
// couleur du pixel de la transaction
|
||||
private int color;
|
||||
@NonNull
|
||||
private Color color;
|
||||
|
||||
// date de la transaction
|
||||
@NonNull
|
||||
private Date time;
|
||||
|
||||
@ManyToOne // wallet acheteur
|
||||
|
@ -30,4 +36,4 @@ public class Transaction implements Serializable {
|
|||
|
||||
@ManyToOne // pixel acheté
|
||||
private Pixel pixel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.pixels.beans;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import com.pixels.utils.Hash;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -19,12 +21,18 @@ public class User implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// nom d'utilisateur
|
||||
@NonNull
|
||||
@NotBlank
|
||||
private String userName;
|
||||
|
||||
// addresse mail de l'utilisateur
|
||||
@NonNull
|
||||
@NotBlank
|
||||
private String email;
|
||||
|
||||
// mot de passe hashé en sha256
|
||||
@NonNull
|
||||
@NotBlank
|
||||
private String hashPassword;
|
||||
|
||||
@OneToOne // portefeuille
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.pixels.beans;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -17,7 +19,9 @@ public class Wallet implements Serializable {
|
|||
private Long id;
|
||||
|
||||
// solde du wallet
|
||||
private int balance;
|
||||
@NonNull
|
||||
@NotBlank
|
||||
private Integer balance;
|
||||
|
||||
@OneToMany(mappedBy = "wallet") // transactions associées au wallet
|
||||
private List<Transaction> transactions;
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.pixels.services;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.ejb.Singleton;
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonObject;
|
||||
|
@ -41,11 +43,11 @@ public class PixelService {
|
|||
|
||||
JsonObjectBuilder response = Json.createObjectBuilder();
|
||||
|
||||
Pixel pixel = new Pixel();
|
||||
Pixel pixel = new Pixel(10, new Color(255, 0, 0), "un pixel Poog");
|
||||
em.persist(pixel);
|
||||
|
||||
response.add("status", "pixel created !");
|
||||
return response.build();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue