refactor(module-web,module-ejb): refactor code
This commit is contained in:
parent
4cc53430d3
commit
fa9942c031
52
.gitignore
vendored
52
.gitignore
vendored
@ -1,50 +1,2 @@
|
|||||||
# Compiled source #
|
/module-ejb/target/
|
||||||
###################
|
/module-web/target/
|
||||||
*.com
|
|
||||||
*.class
|
|
||||||
*.dll
|
|
||||||
*.exe
|
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
~*
|
|
||||||
*.idea
|
|
||||||
*.iml
|
|
||||||
MANIFEST.MF
|
|
||||||
|
|
||||||
# Packages #
|
|
||||||
############
|
|
||||||
# it's better to unpack these files and commit the raw source
|
|
||||||
# git has its own built in compression methods
|
|
||||||
*.7z
|
|
||||||
*.dmg
|
|
||||||
*.gz
|
|
||||||
*.iso
|
|
||||||
*.jar
|
|
||||||
*.rar
|
|
||||||
*.tar
|
|
||||||
*.zip
|
|
||||||
|
|
||||||
# Logs and databases #
|
|
||||||
######################
|
|
||||||
*.log
|
|
||||||
*.sqlite
|
|
||||||
|
|
||||||
# OS generated files #
|
|
||||||
######################
|
|
||||||
.DS_Store
|
|
||||||
.DS_Store?
|
|
||||||
._*
|
|
||||||
.Spotlight-V100
|
|
||||||
.Trashes
|
|
||||||
ehthumbs.db
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Directory #
|
|
||||||
#############
|
|
||||||
bin/
|
|
||||||
out/
|
|
||||||
target/
|
|
||||||
.vscode/launch.json
|
|
50
_gitignore
Normal file
50
_gitignore
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Compiled source #
|
||||||
|
###################
|
||||||
|
*.com
|
||||||
|
*.class
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
~*
|
||||||
|
*.idea
|
||||||
|
*.iml
|
||||||
|
MANIFEST.MF
|
||||||
|
|
||||||
|
# Packages #
|
||||||
|
############
|
||||||
|
# it's better to unpack these files and commit the raw source
|
||||||
|
# git has its own built in compression methods
|
||||||
|
*.7z
|
||||||
|
*.dmg
|
||||||
|
*.gz
|
||||||
|
*.iso
|
||||||
|
*.jar
|
||||||
|
*.rar
|
||||||
|
*.tar
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
# Logs and databases #
|
||||||
|
######################
|
||||||
|
*.log
|
||||||
|
*.sqlite
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
######################
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Directory #
|
||||||
|
#############
|
||||||
|
bin/
|
||||||
|
out/
|
||||||
|
target/
|
||||||
|
.vscode/launch.json
|
@ -1,4 +1,4 @@
|
|||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.db;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -8,6 +8,8 @@ import javax.persistence.EntityNotFoundException;
|
|||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class BoardGameDao {
|
public class BoardGameDao {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.model;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -13,7 +13,7 @@ import javax.persistence.JoinTable;
|
|||||||
import javax.persistence.ManyToMany;
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import pl.myboardgames.user.UserEntity;
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "boardgames")
|
@Table(name = "boardgames")
|
@ -1,7 +1,6 @@
|
|||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.db;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
@ -9,7 +8,8 @@ import javax.persistence.EntityNotFoundException;
|
|||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import pl.myboardgames.boardgame.BoardGameEntity;
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class UserDao {
|
public class UserDao {
|
@ -3,7 +3,7 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.model;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -15,7 +15,7 @@ import javax.persistence.Id;
|
|||||||
import javax.persistence.ManyToMany;
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import pl.myboardgames.boardgame.BoardGameEntity;
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -3,12 +3,14 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.dto;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import pl.myboardgames.user.UserShortDto;
|
|
||||||
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
import pl.myboardgames.user.dto.UserShortDto;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
@ -3,13 +3,15 @@
|
|||||||
* To change ret template file, choose Tools | Templates
|
* To change ret template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.dto;
|
||||||
|
|
||||||
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Nao
|
* @author Nao
|
||||||
*/
|
*/
|
||||||
class BoardGameMapper {
|
public class BoardGameMapper {
|
||||||
|
|
||||||
public BoardGameMapper() {
|
public BoardGameMapper() {
|
||||||
}
|
}
|
@ -3,7 +3,9 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.dto;
|
||||||
|
|
||||||
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package pl.myboardgames.boardgame;
|
package pl.myboardgames.boardgame.resources;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
@ -13,9 +13,15 @@ import javax.ws.rs.PathParam;
|
|||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import pl.myboardgames.boardgame.db.BoardGameDao;
|
||||||
|
import pl.myboardgames.boardgame.dto.BoardGameDto;
|
||||||
|
import pl.myboardgames.boardgame.dto.BoardGameMapper;
|
||||||
|
import pl.myboardgames.boardgame.dto.BoardGameShortDto;
|
||||||
|
import pl.myboardgames.boardgame.model.BoardGameEntity;
|
||||||
|
|
||||||
@Path("/boardgame")
|
@Path("/boardgame")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class BoardGameController {
|
public class BoardGameResource {
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
BoardGameDao boardGameDatabase;
|
BoardGameDao boardGameDatabase;
|
@ -3,13 +3,14 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.dto;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import pl.myboardgames.boardgame.BoardGameShortDto;
|
import pl.myboardgames.boardgame.dto.BoardGameShortDto;
|
||||||
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -3,13 +3,15 @@
|
|||||||
* To change ret template file, choose Tools | Templates
|
* To change ret template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.dto;
|
||||||
|
|
||||||
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Nao
|
* @author Nao
|
||||||
*/
|
*/
|
||||||
class UserMapper {
|
public class UserMapper {
|
||||||
|
|
||||||
public UserMapper() {
|
public UserMapper() {
|
||||||
}
|
}
|
@ -3,7 +3,9 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.dto;
|
||||||
|
|
||||||
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,4 +1,4 @@
|
|||||||
package pl.myboardgames.user;
|
package pl.myboardgames.user.resources;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
@ -12,11 +12,17 @@ import javax.ws.rs.Path;
|
|||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import pl.myboardgames.boardgame.BoardGameShortDto;
|
|
||||||
|
import pl.myboardgames.boardgame.dto.BoardGameShortDto;
|
||||||
|
import pl.myboardgames.user.db.UserDao;
|
||||||
|
import pl.myboardgames.user.dto.UserDto;
|
||||||
|
import pl.myboardgames.user.dto.UserMapper;
|
||||||
|
import pl.myboardgames.user.dto.UserShortDto;
|
||||||
|
import pl.myboardgames.user.model.UserEntity;
|
||||||
|
|
||||||
@Path("/user")
|
@Path("/user")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class UserController {
|
public class UserResource {
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
UserDao userDatabase;
|
UserDao userDatabase;
|
Loading…
Reference in New Issue
Block a user