-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9f101c5
Showing
102 changed files
with
9,713 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# Eclipse meta files | ||
.settings | ||
.project | ||
|
||
target | ||
*/target | ||
|
||
*/.classpath | ||
|
||
## UI | ||
# | ||
user-list-ui/node_modules | ||
user-list-ui/jspm_packages | ||
user-list-ui/npm-debug.log | ||
user-list-ui/debug.log | ||
user-list-ui/src/**/*.js | ||
user-list-ui/!src/systemjs.config.extras.js | ||
user-list-ui/!src/systemjs.config.js | ||
user-list-ui/**/*.js.map | ||
user-list-ui/e2e/**/*.js | ||
user-list-ui/e2e/**/*.js.map | ||
user-list-ui/_test-output | ||
user-list-ui/_temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"# crud-ddd-java-angular2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<name>User List</name> | ||
<description>User List</description> | ||
<modules> | ||
<module>user-list-api</module> | ||
<module>user-list-core</module> | ||
<module>user-list-store-service</module> | ||
<module>user-list-store-service-client</module> | ||
</modules> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>user-list-api</artifactId> | ||
<packaging>war</packaging> | ||
<name>user-list-api Maven Webapp</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish.jersey.containers</groupId> | ||
<artifactId>jersey-container-servlet-core</artifactId> | ||
<version>2.25.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish.jersey.media</groupId> | ||
<artifactId>jersey-media-json-jackson</artifactId> | ||
<version>2.25.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list-core</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>2.7.13</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>user-list-api</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.tomcat.maven</groupId> | ||
<artifactId>tomcat7-maven-plugin</artifactId> | ||
<version>2.1</version> | ||
<configuration> | ||
<path>/</path> | ||
<port>8080</port> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<web-app version="2.5" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> | ||
|
||
<display-name>User List API</display-name> | ||
|
||
<servlet> | ||
<servlet-name>Jersey REST Service</servlet-name> | ||
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> | ||
<init-param> | ||
<param-name>jersey.config.server.provider.packages</param-name> | ||
<param-value>com.pedroaugust8.user.api.resource;com.pedroaugust8.user.api.filter</param-value> | ||
</init-param> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
|
||
<servlet-mapping> | ||
<servlet-name>Jersey REST Service</servlet-name> | ||
<url-pattern>/api/*</url-pattern> | ||
</servlet-mapping> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0"?> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>user-list-api</artifactId> | ||
<packaging>war</packaging> | ||
<name>user-list-api Maven Webapp</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish.jersey.containers</groupId> | ||
<artifactId>jersey-container-servlet-core</artifactId> | ||
<version>2.25.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish.jersey.media</groupId> | ||
<artifactId>jersey-media-json-jackson</artifactId> | ||
<version>2.25.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list-core</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.pedroaugust8</groupId> | ||
<artifactId>user-list-store-service-client</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>2.7.13</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.squarespace.jersey2-guice</groupId> | ||
<artifactId>jersey2-guice-impl</artifactId> | ||
<version>1.0.6</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-servlet</artifactId> | ||
<version>4.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.1.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>user-list-api</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.tomcat.maven</groupId> | ||
<artifactId>tomcat7-maven-plugin</artifactId> | ||
<version>2.1</version> | ||
<configuration> | ||
<path>/</path> | ||
<port>8080</port> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
29 changes: 29 additions & 0 deletions
29
user-list-api/src/main/java/com/pedroaugust8/user/api/UserListApiContextListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.pedroaugust8.user.api; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.google.inject.Guice; | ||
import com.google.inject.Injector; | ||
import com.google.inject.Module; | ||
import com.google.inject.servlet.GuiceServletContextListener; | ||
import com.squarespace.jersey2.guice.JerseyGuiceModule; | ||
import com.squarespace.jersey2.guice.JerseyGuiceUtils; | ||
|
||
import com.pedroaugust8.user.store.service.client.UserStoreServiceClientModule; | ||
|
||
public class UserListApiContextListener extends GuiceServletContextListener{ | ||
@Override | ||
protected Injector getInjector() { | ||
List<Module> modules = new ArrayList<Module>(); | ||
modules.add(new JerseyGuiceModule("__HK2_Generated_0")); | ||
modules.add(new UserListApiModule()); | ||
modules.add(new UserStoreServiceClientModule()); | ||
|
||
Injector injector = Guice.createInjector(modules); | ||
|
||
JerseyGuiceUtils.install(injector); | ||
|
||
return injector; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
user-list-api/src/main/java/com/pedroaugust8/user/api/UserListApiModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.pedroaugust8.user.api; | ||
|
||
import com.google.inject.servlet.ServletModule; | ||
|
||
import com.pedroaugust8.user.api.service.UserService; | ||
import com.pedroaugust8.user.api.service.UserServiceImpl; | ||
|
||
public class UserListApiModule extends ServletModule{ | ||
@Override | ||
protected void configureServlets() { | ||
bind(UserService.class).to(UserServiceImpl.class); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
user-list-api/src/main/java/com/pedroaugust8/user/api/filter/CORSFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.pedroaugust8.user.api.filter; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.ws.rs.container.ContainerRequestContext; | ||
import javax.ws.rs.container.ContainerResponseContext; | ||
import javax.ws.rs.container.ContainerResponseFilter; | ||
import javax.ws.rs.ext.Provider; | ||
|
||
@Provider | ||
public class CORSFilter implements ContainerResponseFilter { | ||
@Override | ||
public void filter(ContainerRequestContext request, ContainerResponseContext response) throws IOException { | ||
response.getHeaders().add("Access-Control-Allow-Origin", "*"); | ||
response.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization"); | ||
response.getHeaders().add("Access-Control-Allow-Credentials", "true"); | ||
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
user-list-api/src/main/java/com/pedroaugust8/user/api/resource/UserResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.pedroaugust8.user.api.resource; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
import com.pedroaugust8.user.api.service.UserService; | ||
import com.pedroaugust8.user.core.User; | ||
|
||
@Path("/user") | ||
public class UserResource { | ||
private UserService userService; | ||
|
||
@Inject | ||
public UserResource(UserService userService){ | ||
this.userService = userService; | ||
} | ||
|
||
@POST | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
public Response save(User user){ | ||
System.out.println(user); | ||
//ReflectionToStringBuilder.toString(user) | ||
this.userService.addUser(user); | ||
return Response.ok().build(); | ||
} | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<User> list(){ | ||
System.out.println("OLAAAAR"); | ||
return this.userService.list(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
user-list-api/src/main/java/com/pedroaugust8/user/api/service/UserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.pedroaugust8.user.api.service; | ||
|
||
import java.util.List; | ||
|
||
import com.pedroaugust8.user.core.User; | ||
|
||
public interface UserService { | ||
void addUser(User user); | ||
List<User> list(); | ||
} |
Oops, something went wrong.