You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2017/09/26 08:20:28 UTC
[07/10] cayenne git commit: Cleanup
Cleanup
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/dbd733ab
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/dbd733ab
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/dbd733ab
Branch: refs/heads/STABLE-4.0
Commit: dbd733abd2365cb7c0af4a5e41d621985e2cf04f
Parents: 5e37020
Author: Nikita Timofeev <st...@gmail.com>
Authored: Fri Sep 22 17:28:14 2017 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Fri Sep 22 17:28:14 2017 +0300
----------------------------------------------------------------------
.../src/docbkx/customizing-cayenne-runtime.xml | 6 +-
.../src/docbkx/ext-project-compatibility.xml | 59 ---------------
.../cayenne-guide/src/docbkx/ext-velocity.xml | 79 --------------------
docs/docbook/cayenne-guide/src/docbkx/part5.xml | 6 +-
.../src/docbkx/queries-sqlselect.xml | 2 +-
.../src/docbkx/queries-sqltemplate.xml | 30 +++++++-
6 files changed, 34 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml b/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
index 1ffdb3b..3383e01 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
@@ -265,6 +265,8 @@ binder.bindList(DefaultDbAdapterFactory.DETECTORS_LIST)
<para>
In order to use your custom data type you should implement <code>ValueObjectType</code> describing it in terms of some type already known to Cayenne
(e.g. backed by system or user ExtendedType).
+ </para>
+ <para>
Let's assume we want to support some data type called <code>Money</code>:
<programlisting language="java"><![CDATA[public class Money {
private BigDecimal value;
@@ -317,8 +319,8 @@ binder.bindList(DefaultDbAdapterFactory.DETECTORS_LIST)
.build();]]></programlisting>
</para>
<para>More examples of implementation you can find in
- <!--<link xlink:href="https://github.com/apache/cayenne/tree/master/cayenne-java8">cayenne-java8 module</link> or-->
- <link xlink:href="https://github.com/apache/cayenne/tree/master/cayenne-joda">cayenne-joda module</link>.</para>
+ <link xlink:href="https://github.com/apache/cayenne/tree/STABLE-4.0/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types">cayenne-java8 module</link>
+ </para>
</section>
<section xml:id="extendedtypes">
<title>Extended Types</title>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/ext-project-compatibility.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/ext-project-compatibility.xml b/docs/docbook/cayenne-guide/src/docbkx/ext-project-compatibility.xml
deleted file mode 100644
index d645098..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/ext-project-compatibility.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
- version="5.0" xml:id="ext-project-compatibility">
- <title>Project compatibility extension</title>
- <section>
- <title>Description</title>
- <para>Since version <emphasis>4.1</emphasis> Cayenne doesn't allow to load project XML files
- from previous versions as this can lead to unexpected errors in runtime. This module allows to
- use project files from older versions performing their upgrade on the fly (without modifying files).
- This can be useful when using Cayenne models from third-party libraries in your app.
- <note>
- <para>You should prefer explicit project upgrade via Cayenne Modeler.</para>
- </note>
- </para>
- </section>
- <section>
- <title>Including in a project</title>
- <section>
- <title>Maven</title>
- <para>
- <programlisting language="xml"><dependency>
- <groupId>org.apache.cayenne</groupId>
- <artifactId>cayenne-project-compatibility</artifactId>
- <version><?eval ${project.version}?></version>
-</dependency></programlisting>
- </para>
- </section>
- <section>
- <title>Gradle</title>
- <para>
- <programlisting language="groovy">compile 'org.apache.cayenne:cayenne-project-compatibility:<?eval ${project.version}?>'</programlisting>
- </para>
- </section>
- </section>
- <section>
- <title>Usage</title>
- <para>
- This module doesn't require any additional setup.
- </para>
- </section>
-</chapter>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/ext-velocity.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/ext-velocity.xml b/docs/docbook/cayenne-guide/src/docbkx/ext-velocity.xml
deleted file mode 100644
index 4086bdf..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/ext-velocity.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
- version="5.0" xml:id="ext-velocity">
- <title>Apache Velocity extension</title>
- <section>
- <title>Description</title>
- <para>This module enables usage of full featured Apache Velocity templates in <code>org.apache.cayenne.query.SQLTemplate</code>
- queries.</para>
- </section>
- <section>
- <title>Including in a project</title>
- <section>
- <title>Maven</title>
- <para>
- <programlisting language="xml"><dependency>
- <groupId>org.apache.cayenne</groupId>
- <artifactId>cayenne-velocity</artifactId>
- <version><?eval ${project.version}?></version>
-</dependency></programlisting>
- </para>
- </section>
- <section>
- <title>Gradle</title>
- <para>
- <programlisting language="groovy">compile 'org.apache.cayenne:cayenne-velocity:<?eval ${project.version}?>'</programlisting>
- </para>
- </section>
- </section>
- <section>
- <title>Usage</title>
- <para>
- This module doesn't require any additional setup.
- </para>
- <para>
- In addition of directives mentioned in <link linkend="sqltemplate-bind-directive">this</link> chapter, this module enables <code>#chain</code> and <code>#chunk</code>
- directives.
- </para>
- <para><code>#chain</code> and <code>#chunk</code> directives are used for
- conditional inclusion of SQL code. They are used together with
- <code>#chain</code> wrapping multiple <code>#chunks</code>. A chunk
- evaluates its parameter expression and if it is NULL suppresses rendering of the
- enclosed SQL block. A chain renders its prefix and its chunks joined by the
- operator. If all the chunks are suppressed, the chain itself is suppressed. This
- allows to work with otherwise hard to script SQL semantics. E.g. a WHERE clause
- can contain multiple conditions joined with AND or OR. Application code would
- like to exclude a condition if its right-hand parameter is not present (similar
- to Expression pruning discussed above). If all conditions are excluded, the
- entire WHERE clause should be excluded. chain/chunk allows to do that.</para>
- <para>
- <emphasis role="italic"
- >Semantics</emphasis>:<programlisting language="java">#chain(operator) ... #end
-#chain(operator prefix) ... #end
-#chunk() ... #end
-#chunk(param) ... #end </programlisting></para>
- <para><emphasis role="italic">Full
- example:</emphasis><programlisting language="java">#chain('OR' 'WHERE')
- #chunk($name) NAME LIKE #bind($name) #end
- #chunk($id) ARTIST_ID > #bind($id) #end
-#end" </programlisting></para>
- </section>
-</chapter>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/part5.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part5.xml b/docs/docbook/cayenne-guide/src/docbkx/part5.xml
index ee95291..347f6ce 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/part5.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/part5.xml
@@ -23,10 +23,8 @@
<xi:include href="ext-cache-invalidation.xml"/>
<xi:include href="ext-commit-log.xml"/>
<xi:include href="ext-crypto.xml"/>
- <!--<xi:include href="ext-dbcp2.xml"/>-->
- <!--<xi:include href="ext-java8.xml"/>-->
+ <xi:include href="ext-dbcp2.xml"/>
+ <xi:include href="ext-java8.xml"/>
<xi:include href="ext-jcache.xml"/>
<xi:include href="ext-joda.xml"/>
- <xi:include href="ext-project-compatibility.xml"/>
- <xi:include href="ext-velocity.xml"/>
</part>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/queries-sqlselect.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/queries-sqlselect.xml b/docs/docbook/cayenne-guide/src/docbkx/queries-sqlselect.xml
index 20be436..e488fab 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/queries-sqlselect.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/queries-sqlselect.xml
@@ -23,7 +23,7 @@
<code>SQLSelect</code> and <code>SQLExec</code> are essentially a "fluent" versions of older <code>SQLTemplate</code> query.
<code>SQLSelect</code> can be used (as name suggests) to select custom data in form of entities, separate columns or collection of <code>DataRow</code>.
<code>SQLExec</code> is designed to just execute any raw SQL code (e.g. updates, deletes, DDLs, etc.)
- This queries support all directives described in <link linkend="sqltemplate">SQLTemplate</link> section.
+ These queries support all directives described in <link linkend="sqltemplate">SQLTemplate</link> section.
</para>
<para>
Here is example of how to use <code>SQLSelect</code>:
http://git-wip-us.apache.org/repos/asf/cayenne/blob/dbd733ab/docs/docbook/cayenne-guide/src/docbkx/queries-sqltemplate.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/queries-sqltemplate.xml b/docs/docbook/cayenne-guide/src/docbkx/queries-sqltemplate.xml
index bbfa559..6acc744 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/queries-sqltemplate.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/queries-sqltemplate.xml
@@ -281,9 +281,33 @@ select.setParameters(Collections.singletonMap("a", a)); </programlisting></para>
#result('SALARY' 'float') </programlisting></para>
<para><emphasis role="italic">Full
example:</emphasis><programlisting language="sql">SELECT #result('ID' 'int'), #result('NAME' 'String'), #result('DATE_OF_BIRTH' 'java.util.Date') FROM ARTIST</programlisting></para>
- <note>
- <para>For advanced features you may look at the <link linkend="ext-velocity">Apache Velocity extension</link></para>
- </note>
+ </section>
+ <section>
+ <title>#chain and #chunk</title>
+
+ <para><code>#chain</code> and <code>#chunk</code> directives are used for
+ conditional inclusion of SQL code. They are used together with
+ <code>#chain</code> wrapping multiple <code>#chunks</code>. A chunk
+ evaluates its parameter expression and if it is NULL suppresses rendering of the
+ enclosed SQL block. A chain renders its prefix and its chunks joined by the
+ operator. If all the chunks are suppressed, the chain itself is suppressed. This
+ allows to work with otherwise hard to script SQL semantics. E.g. a WHERE clause
+ can contain multiple conditions joined with AND or OR. Application code would
+ like to exclude a condition if its right-hand parameter is not present (similar
+ to Expression pruning discussed above). If all conditions are excluded, the
+ entire WHERE clause should be excluded. chain/chunk allows to do that.</para>
+ <para>
+ <emphasis role="italic"
+ >Semantics</emphasis>:<programlisting language="java">#chain(operator) ... #end
+ #chain(operator prefix) ... #end
+ #chunk() ... #end
+ #chunk(param) ... #end </programlisting></para>
+ <para><emphasis role="italic">Full
+ example:</emphasis><programlisting language="java">#chain('OR' 'WHERE')
+ #chunk($name) NAME LIKE #bind($name) #end
+ #chunk($id) ARTIST_ID > #bind($id) #end
+ #end" </programlisting></para>
+
</section>
</section>
<section>