Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update generated project with latest templates.
- Loading branch information
Nicolas Romanetti
committed
Dec 30, 2016
1 parent
e49c29e
commit a88ae52
Showing
55 changed files
with
1,450 additions
and
119 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
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
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
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
132 changes: 132 additions & 0 deletions
132
quickstart-generated/src/main/generated-java/com/mycompany/myapp/domain/UseCase1.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,132 @@ | ||
/* | ||
* Source code generated by Celerio, a Jaxio product. | ||
* Documentation: http://www.jaxio.com/documentation/celerio/ | ||
* Follow us on twitter: @jaxiosoft | ||
* Need commercial support ? Contact us: info@jaxio.com | ||
* Template pack-angular:src/main/java/domain/Entity.java.e.vm | ||
*/ | ||
package com.mycompany.myapp.domain; | ||
|
||
import java.io.Serializable; | ||
import java.util.logging.Logger; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Table; | ||
import javax.persistence.Transient; | ||
import javax.persistence.UniqueConstraint; | ||
import javax.validation.constraints.Size; | ||
|
||
import org.hibernate.validator.constraints.NotEmpty; | ||
|
||
import com.google.common.base.MoreObjects; | ||
import com.google.common.base.Objects; | ||
|
||
/** | ||
* USE_CASE_1 has a composite pk, just for demo | ||
*/ | ||
@Entity | ||
@Table(name = "USE_CASE_1", uniqueConstraints = { @UniqueConstraint(name = "PRIMARY_KEY_4", columnNames = { "ID1", "ID2" }) }) | ||
public class UseCase1 implements Identifiable<UseCase1Pk>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
private static final Logger log = Logger.getLogger(UseCase1.class.getName()); | ||
|
||
// Composite primary key | ||
private UseCase1Pk id = new UseCase1Pk(); | ||
|
||
// Raw attributes | ||
private String dummy; | ||
|
||
@Override | ||
public String entityClassName() { | ||
return UseCase1.class.getSimpleName(); | ||
} | ||
|
||
// ----------------------- | ||
// Composite Primary Key | ||
// ----------------------- | ||
|
||
/** | ||
* Returns the composite primary key. | ||
*/ | ||
@Override | ||
@EmbeddedId | ||
public UseCase1Pk getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Set the composite primary key. | ||
* @param id the composite primary key. | ||
*/ | ||
@Override | ||
public void setId(UseCase1Pk id) { | ||
this.id = id; | ||
} | ||
|
||
public UseCase1 id(UseCase1Pk id) { | ||
setId(id); | ||
return this; | ||
} | ||
|
||
/** | ||
* Tells whether or not this instance has a non empty composite primary key set. | ||
* @return true if a non empty primary key is set, false otherwise | ||
*/ | ||
@Override | ||
@Transient | ||
public boolean isIdSet() { | ||
return getId() != null && getId().areFieldsSet(); | ||
} | ||
// -- [dummy] ------------------------ | ||
|
||
@NotEmpty | ||
@Size(max = 100) | ||
@Column(name = "DUMMY", nullable = false, length = 100) | ||
public String getDummy() { | ||
return dummy; | ||
} | ||
|
||
public void setDummy(String dummy) { | ||
this.dummy = dummy; | ||
} | ||
|
||
public UseCase1 dummy(String dummy) { | ||
setDummy(dummy); | ||
return this; | ||
} | ||
|
||
/** | ||
* Apply the default values. | ||
*/ | ||
public UseCase1 withDefaults() { | ||
return this; | ||
} | ||
|
||
/** | ||
* Equals implementation using a business key. | ||
*/ | ||
@Override | ||
public boolean equals(Object other) { | ||
return this == other || (other instanceof UseCase1 && hashCode() == other.hashCode()); | ||
} | ||
|
||
private IdentifiableHashBuilder identifiableHashBuilder = new IdentifiableHashBuilder(); | ||
|
||
@Override | ||
public int hashCode() { | ||
return identifiableHashBuilder.hash(log, this); | ||
} | ||
|
||
/** | ||
* Construct a readable string representation for this UseCase1 instance. | ||
* @see java.lang.Object#toString() | ||
*/ | ||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this) // | ||
.add("dummy", getDummy()) // | ||
.toString(); | ||
} | ||
} |
157 changes: 157 additions & 0 deletions
157
quickstart-generated/src/main/generated-java/com/mycompany/myapp/domain/UseCase1Pk.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,157 @@ | ||
/* | ||
* Source code generated by Celerio, a Jaxio product. | ||
* Documentation: http://www.jaxio.com/documentation/celerio/ | ||
* Follow us on twitter: @jaxiosoft | ||
* Need commercial support ? Contact us: info@jaxio.com | ||
* Template pack-angular:src/main/java/domain/CompositePk.java.cpk.vm | ||
*/ | ||
package com.mycompany.myapp.domain; | ||
|
||
import static org.apache.commons.lang.StringUtils.isNotEmpty; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import javax.persistence.Transient; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Size; | ||
|
||
import org.hibernate.validator.constraints.NotEmpty; | ||
|
||
import com.google.common.base.Objects; | ||
|
||
@Embeddable | ||
|
||
public class UseCase1Pk implements Comparable<UseCase1Pk>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private LocalDateTime id1; | ||
private String id2; | ||
|
||
public UseCase1Pk() { | ||
} | ||
|
||
public UseCase1Pk(LocalDateTime id1, String id2) { | ||
this.id1 = id1; | ||
this.id2 = id2; | ||
} | ||
|
||
/** | ||
* Helper to determine if this composite primary key is fully set. | ||
*/ | ||
@Transient | ||
public boolean areFieldsSet() { | ||
return isId1Set() && isId2Set(); | ||
} | ||
|
||
/** | ||
* Helper method to determine if this instance is considered empty, that is, | ||
* if all the non primary key columns are null. | ||
*/ | ||
@Transient | ||
public boolean isEmpty() { | ||
return !isId1Set() && !isId2Set(); | ||
} | ||
|
||
//-- [id1] ------------------------------ | ||
|
||
@NotNull | ||
@Column(name = "ID1", nullable = false, length = 23) | ||
public LocalDateTime getId1() { | ||
return id1; | ||
} | ||
|
||
public void setId1(LocalDateTime id1) { | ||
this.id1 = id1; | ||
} | ||
|
||
public UseCase1Pk id1(LocalDateTime id1) { | ||
setId1(id1); | ||
return this; | ||
} | ||
|
||
/** | ||
* Helper that determines if this attribute is set or not. | ||
*/ | ||
@Transient | ||
public boolean isId1Set() { | ||
return getId1() != null; | ||
} | ||
|
||
//-- [id2] ------------------------------ | ||
|
||
@NotEmpty | ||
@Size(max = 100) | ||
@Column(name = "ID2", nullable = false, length = 100) | ||
public String getId2() { | ||
return id2; | ||
} | ||
|
||
public void setId2(String id2) { | ||
this.id2 = id2; | ||
} | ||
|
||
public UseCase1Pk id2(String id2) { | ||
setId2(id2); | ||
return this; | ||
} | ||
|
||
/** | ||
* Helper that determines if this attribute is set or not. | ||
*/ | ||
@Transient | ||
public boolean isId2Set() { | ||
return getId2() != null && !getId2().isEmpty(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return this == other || (other instanceof UseCase1Pk && hashCode() == other.hashCode()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(getId1(), // | ||
getId2()); | ||
} | ||
|
||
@Override | ||
public int compareTo(UseCase1Pk other) { | ||
return other == null ? -1 : hashCode() - other.hashCode(); | ||
} | ||
|
||
/** | ||
* Return the string representation of the composite primary key, it should be reversable by version produced by the {@link #String()} method | ||
*/ | ||
@Override | ||
public String toString() { | ||
StringBuilder result = new StringBuilder(); | ||
if (isId1Set()) { | ||
result.append(getId1()); | ||
} | ||
result.append("_"); | ||
if (isId2Set()) { | ||
result.append(getId2()); | ||
} | ||
|
||
return result.toString(); | ||
} | ||
|
||
/** | ||
* Build an instance from a string version produced by the {@link #toString()} method | ||
*/ | ||
public static UseCase1Pk fromString(String string) { | ||
UseCase1Pk result = new UseCase1Pk(); | ||
String[] values = string.split("_"); | ||
if (isNotEmpty(values[0])) { | ||
result.setId1(java.time.LocalDateTime.parse(values[0])); | ||
} | ||
if (isNotEmpty(values[1])) { | ||
result.setId2(values[1]); | ||
} | ||
|
||
return result; | ||
} | ||
} |
Oops, something went wrong.