Skip to content

Commit 9a70874

Browse files
committed
Merge remote-tracking branch 'eugenp/master'
2 parents 3d164d0 + 77aa65b commit 9a70874

92 files changed

Lines changed: 5670 additions & 708 deletions

File tree

Some content is hidden

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

‎animal-sniffer-mvn-plugin/pom.xml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.baeldung</groupId>
5+
<artifactId>animal-sniffer-mvn-plugin</artifactId>
6+
<packaging>jar</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>example-animal-sniffer-mvn-plugin</name>
9+
<url>http://maven.apache.org</url>
10+
11+
<properties>
12+
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
13+
</properties>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>junit</groupId>
18+
<artifactId>junit</artifactId>
19+
<version>3.8.1</version>
20+
<scope>test</scope>
21+
</dependency>
22+
</dependencies>
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<artifactId>maven-compiler-plugin</artifactId>
27+
<version>3.7.0</version>
28+
<configuration>
29+
<source>1.6</source>
30+
<target>1.6</target>
31+
</configuration>
32+
</plugin>
33+
<plugin>
34+
<groupId>org.codehaus.mojo</groupId>
35+
<artifactId>animal-sniffer-maven-plugin</artifactId>
36+
<version>1.16</version>
37+
<configuration>
38+
<signature>
39+
<groupId>org.codehaus.mojo.signature</groupId>
40+
<artifactId>java16</artifactId>
41+
<version>1.0</version>
42+
</signature>
43+
</configuration>
44+
<executions>
45+
<execution>
46+
<id>animal-sniffer</id>
47+
<phase>verify</phase>
48+
<goals>
49+
<goal>check</goal>
50+
</goals>
51+
</execution>
52+
</executions>
53+
</plugin>
54+
</plugins>
55+
56+
</build>
57+
</project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung;
2+
3+
//import java.nio.charset.StandardCharsets;
4+
5+
/**
6+
* Hello world!
7+
*
8+
*/
9+
public class App
10+
{
11+
public static void main( String[] args )
12+
{
13+
System.out.println( "Hello World!" );
14+
//System.out.println(StandardCharsets.UTF_8.name());
15+
}
16+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.baeldung;
2+
3+
import junit.framework.Test;
4+
import junit.framework.TestCase;
5+
import junit.framework.TestSuite;
6+
7+
/**
8+
* Unit test for simple App.
9+
*/
10+
public class AppTest
11+
extends TestCase
12+
{
13+
/**
14+
* Create the test case
15+
*
16+
* @param testName name of the test case
17+
*/
18+
public AppTest( String testName )
19+
{
20+
super( testName );
21+
}
22+
23+
/**
24+
* @return the suite of tests being tested
25+
*/
26+
public static Test suite()
27+
{
28+
return new TestSuite( AppTest.class );
29+
}
30+
31+
/**
32+
* Rigourous Test :-)
33+
*/
34+
public void testApp()
35+
{
36+
37+
assertTrue( true );
38+
39+
}
40+
}

‎apache-cayenne/pom.xml‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<artifactId>apache-cayenne</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>apache-cayenne</name>
11+
<description>Introduction to Apache Cayenne</description>
12+
13+
<parent>
14+
<groupId>com.baeldung</groupId>
15+
<artifactId>parent-modules</artifactId>
16+
<version>1.0.0-SNAPSHOT</version>
17+
</parent>
18+
19+
<properties>
20+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
22+
<java.version>1.8</java.version>
23+
<mysql.connector.version>5.1.44</mysql.connector.version>
24+
<cayenne.version>4.0.M5</cayenne.version>
25+
<junit.version>4.12</junit.version>
26+
</properties>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.apache.cayenne</groupId>
31+
<artifactId>cayenne-server</artifactId>
32+
<version>${cayenne.version}</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>mysql</groupId>
36+
<artifactId>mysql-connector-java</artifactId>
37+
<version>${mysql.connector.version}</version>
38+
<scope>runtime</scope>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>junit</groupId>
43+
<artifactId>junit</artifactId>
44+
<version>${junit.version}</version>
45+
<scope>test</scope>
46+
</dependency>
47+
</dependencies>
48+
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.apache.cayenne.plugins</groupId>
53+
<artifactId>cayenne-modeler-maven-plugin</artifactId>
54+
<version>${cayenne.version}</version>
55+
</plugin>
56+
</plugins>
57+
</build>
58+
59+
</project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.apachecayenne.persistent;
2+
3+
import com.baeldung.apachecayenne.persistent.auto._Article;
4+
5+
public class Article extends _Article {
6+
7+
private static final long serialVersionUID = 1L;
8+
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.apachecayenne.persistent;
2+
3+
import com.baeldung.apachecayenne.persistent.auto._Author;
4+
5+
public class Author extends _Author {
6+
7+
private static final long serialVersionUID = 1L;
8+
9+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.baeldung.apachecayenne.persistent.auto;
2+
3+
import org.apache.cayenne.CayenneDataObject;
4+
import org.apache.cayenne.exp.Property;
5+
6+
import com.baeldung.apachecayenne.persistent.Author;
7+
8+
/**
9+
* Class _Article was generated by Cayenne.
10+
* It is probably a good idea to avoid changing this class manually,
11+
* since it may be overwritten next time code is regenerated.
12+
* If you need to make any customizations, please use subclass.
13+
*/
14+
public abstract class _Article extends CayenneDataObject {
15+
16+
private static final long serialVersionUID = 1L;
17+
18+
public static final String ID_PK_COLUMN = "id";
19+
20+
public static final Property<String> CONTENT = Property.create("content", String.class);
21+
public static final Property<String> TITLE = Property.create("title", String.class);
22+
public static final Property<Author> AUTHOR = Property.create("author", Author.class);
23+
24+
public void setContent(String content) {
25+
writeProperty("content", content);
26+
}
27+
public String getContent() {
28+
return (String)readProperty("content");
29+
}
30+
31+
public void setTitle(String title) {
32+
writeProperty("title", title);
33+
}
34+
public String getTitle() {
35+
return (String)readProperty("title");
36+
}
37+
38+
public void setAuthor(Author author) {
39+
setToOneTarget("author", author, true);
40+
}
41+
42+
public Author getAuthor() {
43+
return (Author)readProperty("author");
44+
}
45+
46+
47+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.baeldung.apachecayenne.persistent.auto;
2+
3+
import java.util.List;
4+
5+
import org.apache.cayenne.CayenneDataObject;
6+
import org.apache.cayenne.exp.Property;
7+
8+
import com.baeldung.apachecayenne.persistent.Article;
9+
10+
/**
11+
* Class _Author was generated by Cayenne.
12+
* It is probably a good idea to avoid changing this class manually,
13+
* since it may be overwritten next time code is regenerated.
14+
* If you need to make any customizations, please use subclass.
15+
*/
16+
public abstract class _Author extends CayenneDataObject {
17+
18+
private static final long serialVersionUID = 1L;
19+
20+
public static final String ID_PK_COLUMN = "id";
21+
22+
public static final Property<String> NAME = Property.create("name", String.class);
23+
public static final Property<List<Article>> ARTICLES = Property.create("articles", List.class);
24+
25+
public void setName(String name) {
26+
writeProperty("name", name);
27+
}
28+
public String getName() {
29+
return (String)readProperty("name");
30+
}
31+
32+
public void addToArticles(Article obj) {
33+
addToManyTarget("articles", obj, true);
34+
}
35+
public void removeFromArticles(Article obj) {
36+
removeToManyTarget("articles", obj, true);
37+
}
38+
@SuppressWarnings("unchecked")
39+
public List<Article> getArticles() {
40+
return (List<Article>)readProperty("articles");
41+
}
42+
43+
44+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<domain project-version="9">
3+
<map name="datamap"/>
4+
5+
<node name="datanode"
6+
factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
7+
schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"
8+
>
9+
<map-ref name="datamap"/>
10+
<data-source>
11+
<driver value="com.mysql.jdbc.Driver"/>
12+
<url value="jdbc:mysql://localhost:3306/intro_cayenne"/>
13+
<connectionPool min="1" max="1"/>
14+
<login userName="root" password="root"/>
15+
</data-source>
16+
</node>
17+
</domain>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<data-map xmlns="http://cayenne.apache.org/schema/9/modelMap"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
5+
project-version="9">
6+
<property name="defaultPackage" value="com.baeldung.apachecayenne.persistent"/>
7+
<db-entity name="article" catalog="intro_cayenne">
8+
<db-attribute name="author_id" type="INTEGER" isMandatory="true" length="10"/>
9+
<db-attribute name="content" type="VARCHAR" isMandatory="true" length="254"/>
10+
<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
11+
<db-attribute name="title" type="VARCHAR" isMandatory="true" length="254"/>
12+
</db-entity>
13+
<db-entity name="author" catalog="intro_cayenne">
14+
<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
15+
<db-attribute name="name" type="VARCHAR" isMandatory="true" length="254"/>
16+
</db-entity>
17+
<obj-entity name="Article" className="com.baeldung.apachecayenne.persistent.Article" dbEntityName="article">
18+
<obj-attribute name="content" type="java.lang.String" db-attribute-path="content"/>
19+
<obj-attribute name="title" type="java.lang.String" db-attribute-path="title"/>
20+
</obj-entity>
21+
<obj-entity name="Author" className="com.baeldung.apachecayenne.persistent.Author" dbEntityName="author">
22+
<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
23+
</obj-entity>
24+
<db-relationship name="author" source="article" target="author" toMany="false">
25+
<db-attribute-pair source="author_id" target="id"/>
26+
</db-relationship>
27+
<db-relationship name="articles" source="author" target="article" toMany="true">
28+
<db-attribute-pair source="id" target="author_id"/>
29+
</db-relationship>
30+
<obj-relationship name="author" source="Article" target="Author" deleteRule="Nullify" db-relationship-path="author"/>
31+
<obj-relationship name="articles" source="Author" target="Article" deleteRule="Deny" db-relationship-path="articles"/>
32+
</data-map>

0 commit comments

Comments
 (0)