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
Showing
134 changed files
with
19,688 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,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>org.agoncal.sample.javaee.howsmallissmall.micro</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<artifactId>cdbookstore</artifactId> | ||
<version>1.0</version> | ||
<packaging>war</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.webjars</groupId> | ||
<artifactId>bootstrap</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.primefaces</groupId> | ||
<artifactId>primefaces</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.primefaces.themes</groupId> | ||
<artifactId>all-themes</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.thedeanda</groupId> | ||
<artifactId>lorem</artifactId> | ||
</dependency> | ||
<!-- Wildfly Swarm --> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>undertow</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>jaxrs-weld</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>jpa</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>ejb</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>jsf</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>cdbookstore</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-plugin</artifactId> | ||
<configuration> | ||
<properties> | ||
<swarm.http.port>8080</swarm.http.port> | ||
<swarm.context.path>/cdbookstore</swarm.context.path> | ||
</properties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>swarm-maven</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-plugin</artifactId> | ||
<configuration> | ||
<bundleDependencies>false</bundleDependencies> | ||
<properties> | ||
<swarm.http.port>8080</swarm.http.port> | ||
<swarm.context.path>/cdbookstore</swarm.context.path> | ||
</properties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
32 changes: 32 additions & 0 deletions
32
...rc/main/java/org/agoncal/sample/javaee/howsmallissmall/cdbookstore/constraints/Email.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,32 @@ | ||
package org.agoncal.sample.javaee.howsmallissmall.cdbookstore.constraints; | ||
|
||
import java.lang.annotation.*; | ||
|
||
import javax.validation.Constraint; | ||
import javax.validation.Payload; | ||
import javax.validation.ReportAsSingleViolation; | ||
|
||
@Constraint(validatedBy = {}) | ||
@ReportAsSingleViolation | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, | ||
ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR }) | ||
@Documented | ||
public @interface Email | ||
{ | ||
|
||
String message() default "Invalid value"; | ||
|
||
Class<?>[]groups() default {}; | ||
|
||
Class<? extends Payload>[]payload() default {}; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, | ||
ElementType.TYPE, ElementType.ANNOTATION_TYPE, | ||
ElementType.CONSTRUCTOR }) | ||
public @interface List | ||
{ | ||
Email[]value(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...main/java/org/agoncal/sample/javaee/howsmallissmall/cdbookstore/constraints/NotEmpty.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,32 @@ | ||
package org.agoncal.sample.javaee.howsmallissmall.cdbookstore.constraints; | ||
|
||
import java.lang.annotation.*; | ||
|
||
import javax.validation.Constraint; | ||
import javax.validation.Payload; | ||
import javax.validation.ReportAsSingleViolation; | ||
|
||
@Constraint(validatedBy = {}) | ||
@ReportAsSingleViolation | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, | ||
ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR }) | ||
@Documented | ||
public @interface NotEmpty | ||
{ | ||
|
||
String message() default "Invalid value"; | ||
|
||
Class<?>[]groups() default {}; | ||
|
||
Class<? extends Payload>[]payload() default {}; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, | ||
ElementType.TYPE, ElementType.ANNOTATION_TYPE, | ||
ElementType.CONSTRUCTOR }) | ||
public @interface List | ||
{ | ||
NotEmpty[]value(); | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
...re/src/main/java/org/agoncal/sample/javaee/howsmallissmall/cdbookstore/model/Address.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,116 @@ | ||
package org.agoncal.sample.javaee.howsmallissmall.cdbookstore.model; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import javax.persistence.ManyToOne; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Size; | ||
|
||
@Embeddable | ||
public class Address implements Serializable | ||
{ | ||
|
||
@Column(length = 50, nullable = false) | ||
@Size(min = 5, max = 50) | ||
@NotNull | ||
private String street1; | ||
|
||
@Column | ||
private String street2; | ||
|
||
@Column(length = 50, nullable = false) | ||
@Size(min = 2, max = 50) | ||
@NotNull | ||
private String city; | ||
|
||
@Column | ||
private String state; | ||
|
||
@Column(length = 10, name = "zip_code", nullable = false) | ||
@Size(min = 1, max = 10) | ||
@NotNull | ||
private String zipcode; | ||
|
||
@ManyToOne | ||
@NotNull | ||
private Country country; | ||
|
||
public String getStreet1() | ||
{ | ||
return street1; | ||
} | ||
|
||
public void setStreet1(String street1) | ||
{ | ||
this.street1 = street1; | ||
} | ||
|
||
public String getStreet2() | ||
{ | ||
return street2; | ||
} | ||
|
||
public void setStreet2(String street2) | ||
{ | ||
this.street2 = street2; | ||
} | ||
|
||
public String getCity() | ||
{ | ||
return city; | ||
} | ||
|
||
public void setCity(String city) | ||
{ | ||
this.city = city; | ||
} | ||
|
||
public String getState() | ||
{ | ||
return state; | ||
} | ||
|
||
public void setState(String state) | ||
{ | ||
this.state = state; | ||
} | ||
|
||
public String getZipcode() | ||
{ | ||
return zipcode; | ||
} | ||
|
||
public void setZipcode(String zipcode) | ||
{ | ||
this.zipcode = zipcode; | ||
} | ||
|
||
public Country getCountry() | ||
{ | ||
return this.country; | ||
} | ||
|
||
public void setCountry(final Country country) | ||
{ | ||
this.country = country; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
String result = getClass().getSimpleName() + " "; | ||
if (street1 != null && !street1.trim().isEmpty()) | ||
result += "street1: " + street1; | ||
if (street2 != null && !street2.trim().isEmpty()) | ||
result += ", street2: " + street2; | ||
if (city != null && !city.trim().isEmpty()) | ||
result += ", city: " + city; | ||
if (state != null && !state.trim().isEmpty()) | ||
result += ", state: " + state; | ||
if (zipcode != null && !zipcode.trim().isEmpty()) | ||
result += ", zipcode: " + zipcode; | ||
return result; | ||
} | ||
} |
Oops, something went wrong.