Skip to content

Commit

Permalink
update generated project with latest templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Romanetti committed Dec 30, 2016
1 parent e49c29e commit a88ae52
Show file tree
Hide file tree
Showing 55 changed files with 1,450 additions and 119 deletions.
2 changes: 1 addition & 1 deletion quickstart-generated/pom.xml
Expand Up @@ -65,7 +65,7 @@
<!-- Version dependencies when used in multiple dependencies -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<celerio-maven-plugin.outputDir>${project.basedir}</celerio-maven-plugin.outputDir>
<celerio-maven-plugin.version>4.0.13</celerio-maven-plugin.version>
<celerio-maven-plugin.version>4.0.14</celerio-maven-plugin.version>

<celerio-maven-plugin.configuration>../quickstart-conf/celerio-maven-plugin.xml</celerio-maven-plugin.configuration>
<celerio-maven-plugin.packs.configuration>../quickstart-conf/celerio-template-packs.xml</celerio-maven-plugin.packs.configuration>
Expand Down
Expand Up @@ -8,9 +8,9 @@
</jdbcConnectivity>
<databaseInfo databaseMajorVersion="1" databaseMinorVersion="4" databaseProductName="H2" databaseProductVersion="1.4.187 (2015-04-10)" driverMajorVersion="1" driverMinorVersion="4" driverName="H2 JDBC Driver" driverVersion="1.4.187 (2015-04-10)" extraInfo=""/>
<tables>
<table name="AUTHOR" type="TABLE">
<table name="AUTHOR" type="TABLE" remarks="Author has various dates for demo">
<columns>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_0BCAC0D0_EBC0_49FD_A1E1_9F9D42E049F9)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_DB4B5B0F_EF3B_4DF0_B046_BCF9043C6929)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="CIVILITY" columnDef="MR" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="2" size="2" type="CHAR"/>
<column name="FIRST_NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="3" size="100" type="VARCHAR"/>
<column name="LAST_NAME" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="100" type="VARCHAR"/>
Expand All @@ -29,9 +29,9 @@
<primaryKey>ID</primaryKey>
</primaryKeys>
</table>
<table name="BOOK" type="TABLE">
<table name="BOOK" type="TABLE" remarks="BOOK supports file upload/download for demo">
<columns>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_80C56D48_ED2D_45FA_9708_701A6FA7E6A2)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_C97720A5_C8FE_43C3_A8E8_30111A2EA64A)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="TITLE" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
<column name="SUMMARY" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="3" size="255" type="VARCHAR"/>
<column name="EXTRACT_BINARY" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="2147483647" type="VARBINARY"/>
Expand All @@ -57,7 +57,7 @@
</table>
<table name="PROJECT" type="TABLE">
<columns>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_54B3A094_5D8E_42DE_BC3A_58CF102532A1)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_8F6B9943_A790_4F73_A7E2_5A8639CF4D14)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
<column name="URL" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="3" size="100" type="VARCHAR"/>
<column name="AUTHOR_ID" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="4" size="10" type="INTEGER"/>
Expand All @@ -75,7 +75,7 @@
</table>
<table name="ROLE" type="TABLE">
<columns>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_1FC564CD_D86B_4923_BF52_8C86C4813280)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_6BB1FA8C_8A72_4F89_AB92_7F8A1E89D9F6)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ROLE_NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
</columns>
<indexes>
Expand All @@ -89,7 +89,7 @@
</table>
<table name="USER" type="TABLE" remarks="The User is a human that can connect to this web application">
<columns>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_45682669_E6F8_4B8C_B318_5DEF5CC67AD8)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_BB62669F_50C7_424D_BD9A_8D1DA33823D6)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="LOGIN" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" remarks="The login used to login" size="100" type="VARCHAR"/>
<column name="PASSWORD" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="3" size="100" type="VARCHAR"/>
<column name="EMAIL" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="100" type="VARCHAR"/>
Expand Down Expand Up @@ -130,5 +130,21 @@
<primaryKey>USER_ID</primaryKey>
</primaryKeys>
</table>
<table name="USE_CASE_1" type="TABLE" remarks="USE_CASE_1 has a composite pk, just for demo">
<columns>
<column name="ID1" decimalDigits="10" autoIncrement="false" nullable="false" ordinalPosition="1" size="23" type="TIMESTAMP"/>
<column name="ID2" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
<column name="DUMMY" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="3" size="100" type="VARCHAR"/>
</columns>
<indexes>
<indexe columnName="ID1" indexName="PRIMARY_KEY_4" nonUnique="false"/>
<indexe columnName="ID2" indexName="PRIMARY_KEY_4" nonUnique="false"/>
</indexes>
<importedKeys/>
<primaryKeys>
<primaryKey>ID1</primaryKey>
<primaryKey>ID2</primaryKey>
</primaryKeys>
</table>
</tables>
</metadata>
Expand Up @@ -34,6 +34,9 @@
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
* Author has various dates for demo
*/
@Entity
@Table(name = "AUTHOR")
public class Author implements Identifiable<Integer>, Serializable {
Expand Down
Expand Up @@ -33,6 +33,9 @@
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
* BOOK supports file upload/download for demo
*/
@Entity
@Table(name = "BOOK")
public class Book implements Identifiable<Integer>, Serializable {
Expand Down
@@ -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();
}
}
@@ -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;
}
}

0 comments on commit a88ae52

Please sign in to comment.