Skip to content

Commit 8d26eac

Browse files
author
Nicolas Romanetti
committed
sync with latest templates
1 parent 527f0e8 commit 8d26eac

File tree

184 files changed

+14277
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+14277
-8
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
! Project home: https://github.com/jaxio/celerio-angular-quickstart
4+
!
5+
! Source code generated by Celerio, an Open Source code generator by Jaxio.
6+
! Documentation: http://www.jaxio.com/documentation/celerio/
7+
! Source code: https://github.com/jaxio/celerio/
8+
! Follow us on twitter: @jaxiosoft
9+
! This header can be customized in Celerio conf...
10+
! Template pack-angular:bootstrap/celerio-template-packs.boot.vm.xml
11+
-->
12+
<celerio xmlns="http://www.jaxio.com/schema/celerio" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jaxio.com/schema/celerio ./celerio.xsd">
13+
<configuration>
14+
<packs>
15+
<pack name="pack-angular" enable="true" />
16+
</packs>
17+
</configuration>
18+
</celerio>

quickstart-generated/src/main/config/celerio-maven-plugin/metadata.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<metadata xmlns="http://www.jaxio.com/schema/celerio">
3-
<jdbcConnectivity driver="org.h2.Driver" url="jdbc:h2:/Users/nromanetti/tmp09/celerio-angular-quickstart/quickstart-generated/target/db/angular-lab;MVCC=TRUE;FILE_LOCK=NO" user="root" password="manager" schemaName="" oracleRetrieveRemarks="false" oracleRetrieveSynonyms="true" reverseIndexes="true" reverseOnlyUniqueIndexes="true" catalog="">
3+
<jdbcConnectivity driver="org.h2.Driver" url="jdbc:h2:/Users/nromanetti/jaxio/celerio-angular-quickstart/quickstart-generated/target/db/angular-lab;MVCC=TRUE;FILE_LOCK=NO" user="root" password="manager" schemaName="" oracleRetrieveRemarks="false" oracleRetrieveSynonyms="true" reverseIndexes="true" reverseOnlyUniqueIndexes="true" catalog="">
44
<tableNamePatterns/>
55
<tableTypes>
66
<tableType>TABLE</tableType>
@@ -10,7 +10,7 @@
1010
<tables>
1111
<table name="AUTHOR" type="TABLE" remarks="Author has various dates for demo">
1212
<columns>
13-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_7B2E274B_0146_4C8B_A5BD_C509D9C4F704)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
13+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_5040E36F_4237_4D2B_9322_F6D64B91F2CD)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
1414
<column name="CIVILITY" columnDef="MR" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="2" size="2" type="CHAR"/>
1515
<column name="FIRST_NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="3" size="100" type="VARCHAR"/>
1616
<column name="LAST_NAME" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="100" type="VARCHAR"/>
@@ -31,7 +31,7 @@
3131
</table>
3232
<table name="BOOK" type="TABLE" remarks="BOOK supports file upload/download for demo">
3333
<columns>
34-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_FC7C36FA_F430_43B3_B5E2_3538F46679D9)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
34+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_6768F5B0_4F21_49A7_8416_1DAD99CD1601)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
3535
<column name="TITLE" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
3636
<column name="SUMMARY" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="3" size="255" type="VARCHAR"/>
3737
<column name="EXTRACT_BINARY" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="2147483647" type="VARBINARY"/>
@@ -57,7 +57,7 @@
5757
</table>
5858
<table name="PASSPORT" type="TABLE">
5959
<columns>
60-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_D3E41835_CCC8_4B9F_A2EC_7ECF971DFD13)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
60+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_E2970F9D_A1C5_490B_9B9F_041223D0E10B)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
6161
<column name="PASSPORT_NUMBER" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
6262
<column name="EXPIRATION_DATE" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="3" size="8" type="DATE"/>
6363
<column name="HOLDER_ID" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="4" size="10" type="INTEGER"/>
@@ -75,7 +75,7 @@
7575
</table>
7676
<table name="PROJECT" type="TABLE">
7777
<columns>
78-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_D38B2060_CBB5_46D3_9440_30D366DC1AE7)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
78+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_D234D41B_6223_4F9C_8D08_2CDABD243B71)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
7979
<column name="NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
8080
<column name="URL" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="3" size="100" type="VARCHAR"/>
8181
<column name="AUTHOR_ID" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="4" size="10" type="INTEGER"/>
@@ -93,7 +93,7 @@
9393
</table>
9494
<table name="ROLE" type="TABLE">
9595
<columns>
96-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_4AE32E6E_3FF7_4852_AA18_3D26FA6D791B)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
96+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_628BADD9_DE00_4465_815C_2AACF06224B8)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
9797
<column name="ROLE_NAME" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="100" type="VARCHAR"/>
9898
</columns>
9999
<indexes>
@@ -107,7 +107,7 @@
107107
</table>
108108
<table name="USER" type="TABLE" remarks="The User is a human that can connect to this web application">
109109
<columns>
110-
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_C8A71D66_718E_476D_A849_DFD9D87A169A)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
110+
<column name="ID" columnDef="(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_13AD0A4D_022D_4C23_8B39_4EC99E837ADA)" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
111111
<column name="LOGIN" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" remarks="The login used to login" size="100" type="VARCHAR"/>
112112
<column name="PASSWORD" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="3" size="100" type="VARCHAR"/>
113113
<column name="EMAIL" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="100" type="VARCHAR"/>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/Application.java.p.vm
10+
*/
11+
package com.mycompany.myapp;
12+
13+
import org.springframework.boot.SpringApplication;
14+
import org.springframework.boot.autoconfigure.SpringBootApplication;
15+
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
16+
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
17+
import org.springframework.boot.web.servlet.ErrorPage;
18+
import org.springframework.context.annotation.Bean;
19+
import org.springframework.http.HttpStatus;
20+
21+
@SpringBootApplication
22+
public class Application {
23+
24+
public static void main(String[] args) {
25+
SpringApplication.run(Application.class, args);
26+
}
27+
28+
@Bean
29+
public EmbeddedServletContainerCustomizer containerCustomizer() {
30+
return new Angular2PathLocationStrategyCustomizer();
31+
}
32+
33+
// http://stackoverflow.com/questions/36761019/how-can-i-use-angular2-pathlocationstrategy-in-a-spring-boot-application
34+
private static class Angular2PathLocationStrategyCustomizer implements EmbeddedServletContainerCustomizer {
35+
@Override
36+
public void customize(ConfigurableEmbeddedServletContainer container) {
37+
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
38+
}
39+
}
40+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/audit/AuditContextHolder.p.vm.java
10+
*/
11+
package com.mycompany.myapp.audit;
12+
13+
import static org.apache.commons.lang.StringUtils.trimToNull;
14+
15+
import javax.persistence.PrePersist;
16+
import javax.persistence.PreUpdate;
17+
18+
import com.mycompany.myapp.security.UserContext;
19+
20+
/**
21+
* Enable/disable {@link PreUpdate} and {@link PrePersist} actions and/or force the username to be used.
22+
* Please note that you are in charge of reseting the context properties if you use them directly.
23+
*/
24+
public final class AuditContextHolder {
25+
private static final ThreadLocal<Boolean> audit = new ThreadLocal<Boolean>();
26+
private static final ThreadLocal<String> username = new ThreadLocal<String>();
27+
28+
private AuditContextHolder() {
29+
}
30+
31+
public static void setAudit(boolean auditing) {
32+
audit.set(auditing);
33+
}
34+
35+
public static void setUsername(String user) {
36+
username.set(trimToNull(user));
37+
}
38+
39+
/**
40+
* Whether audit is enable ? Defaults to true.
41+
*/
42+
public static boolean audit() {
43+
return audit.get() == null ? true : audit.get();
44+
}
45+
46+
/**
47+
* The username bound to this thread or if it is null the username returned by the {@link UserContext};
48+
*/
49+
public static String username() {
50+
return username.get() == null ? UserContext.getUsername() : username.get();
51+
}
52+
53+
public static void clear() {
54+
audit.remove();
55+
username.remove();
56+
}
57+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/config/CustomLocalDateDeserializer.java.p.vm
10+
*/
11+
package com.mycompany.myapp.config;
12+
13+
import com.fasterxml.jackson.core.JsonParser;
14+
import com.fasterxml.jackson.core.JsonTokenId;
15+
import com.fasterxml.jackson.databind.DeserializationContext;
16+
import com.fasterxml.jackson.databind.JsonDeserializer;
17+
18+
import java.io.IOException;
19+
import java.time.Instant;
20+
import java.time.LocalDate;
21+
import java.time.LocalDateTime;
22+
import java.time.ZoneOffset;
23+
24+
public class CustomLocalDateDeserializer extends JsonDeserializer<LocalDate> {
25+
26+
public LocalDate deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException {
27+
28+
if (parser.hasTokenId(JsonTokenId.ID_STRING)) {
29+
String date = parser.getText().trim();
30+
31+
if (date.isEmpty()) {
32+
return null;
33+
}
34+
35+
return LocalDateTime.ofInstant(Instant.parse(date), ZoneOffset.UTC).toLocalDate();
36+
}
37+
38+
return null;
39+
}
40+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/config/CustomLocalDateSerializer.java.p.vm
10+
*/
11+
package com.mycompany.myapp.config;
12+
13+
import com.fasterxml.jackson.core.JsonGenerator;
14+
import com.fasterxml.jackson.databind.JsonSerializer;
15+
import com.fasterxml.jackson.databind.SerializerProvider;
16+
17+
import java.io.IOException;
18+
import java.time.LocalDate;
19+
20+
import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE;
21+
22+
public class CustomLocalDateSerializer extends JsonSerializer<LocalDate> {
23+
24+
@Override
25+
public void serialize(LocalDate date, JsonGenerator jgen, SerializerProvider provider) throws IOException {
26+
jgen.writeString(date != null ? ISO_LOCAL_DATE.format(date) + "T22:00:00.000Z" : null); // 22: as primeng sent it...
27+
}
28+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/config/CustomLocalDateTimeDeserializer.java.p.vm
10+
*/
11+
package com.mycompany.myapp.config;
12+
13+
import com.fasterxml.jackson.core.JsonParser;
14+
import com.fasterxml.jackson.core.JsonTokenId;
15+
import com.fasterxml.jackson.databind.DeserializationContext;
16+
import com.fasterxml.jackson.databind.JsonDeserializer;
17+
18+
import java.io.IOException;
19+
import java.time.Instant;
20+
import java.time.LocalDateTime;
21+
import java.time.ZoneOffset;
22+
23+
public class CustomLocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
24+
25+
public LocalDateTime deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException {
26+
27+
if (parser.hasTokenId(JsonTokenId.ID_STRING)) {
28+
String date = parser.getText().trim();
29+
30+
if (date.isEmpty()) {
31+
return null;
32+
}
33+
34+
return LocalDateTime.ofInstant(Instant.parse(date), ZoneOffset.UTC);
35+
36+
}
37+
38+
return null;
39+
}
40+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/config/CustomLocalDateTimeSerializer.java.p.vm
10+
*/
11+
package com.mycompany.myapp.config;
12+
13+
import com.fasterxml.jackson.core.JsonGenerator;
14+
import com.fasterxml.jackson.databind.JsonSerializer;
15+
import com.fasterxml.jackson.databind.SerializerProvider;
16+
17+
import java.io.IOException;
18+
import java.time.LocalDateTime;
19+
20+
import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME;
21+
22+
public class CustomLocalDateTimeSerializer extends JsonSerializer<LocalDateTime> {
23+
24+
@Override
25+
public void serialize(LocalDateTime date, JsonGenerator jgen, SerializerProvider provider) throws IOException {
26+
jgen.writeString(date != null ? ISO_LOCAL_DATE_TIME.format(date) + ".000Z" : null);
27+
}
28+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Project home: https://github.com/jaxio/celerio-angular-quickstart
3+
*
4+
* Source code generated by Celerio, an Open Source code generator by Jaxio.
5+
* Documentation: http://www.jaxio.com/documentation/celerio/
6+
* Source code: https://github.com/jaxio/celerio/
7+
* Follow us on twitter: @jaxiosoft
8+
* This header can be customized in Celerio conf...
9+
* Template pack-angular:src/main/java/config/JacksonConfiguration.java.p.vm
10+
*/
11+
package com.mycompany.myapp.config;
12+
13+
import com.fasterxml.jackson.databind.SerializationFeature;
14+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
15+
import org.springframework.context.annotation.Bean;
16+
import org.springframework.context.annotation.Configuration;
17+
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
18+
19+
import java.time.LocalDate;
20+
import java.time.LocalDateTime;
21+
22+
@Configuration
23+
public class JacksonConfiguration {
24+
25+
@Bean
26+
Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder() {
27+
JavaTimeModule module = new JavaTimeModule();
28+
29+
module.addDeserializer(LocalDate.class, new CustomLocalDateDeserializer());
30+
module.addSerializer(LocalDate.class, new CustomLocalDateSerializer());
31+
32+
module.addDeserializer(LocalDateTime.class, new CustomLocalDateTimeDeserializer());
33+
module.addSerializer(LocalDateTime.class, new CustomLocalDateTimeSerializer());
34+
35+
return new Jackson2ObjectMapperBuilder().featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).findModulesViaServiceLoader(true)
36+
.modulesToInstall(module);
37+
}
38+
}

0 commit comments

Comments
 (0)