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 2020/10/06 10:27:21 UTC

[cayenne] branch master updated (a35e579 -> 117f2f8)

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


    from a35e579  CAY-2682 Vertical Inheritance: DB-generated PK doesn't propagate from the root to children
     new ef042ac  CAY-2676 Degredation: Custom class generation templates are not working anymore
     new 117f2f8  Add missing license headers

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 RELEASE-NOTES.txt                                   |  1 +
 .../apache/cayenne/gen/ClassGenerationAction.java   |  3 +++
 .../cayenne/gen/BaseTemplatesGenerationTest.java    | 21 ++++++++++++++++++++-
 .../org/apache/cayenne/gen/DataMapUtilsTest.java    | 19 +++++++++++++++++++
 .../{ObjEntity.java => _ObjEntity.java}             |  0
 .../{SQLTemplate.java => _SQLTemplate.java}         |  0
 .../{SelectQuery.java => _SelectQuery.java}         |  0
 .../templateTest/{auto => _auto}/_ObjEntity.java    |  0
 .../templateTest/{auto => _auto}/_SQLTemplate.java  |  0
 .../templateTest/{auto => _auto}/_SelectQuery.java  |  0
 .../translator/select/QualifierTranslatorIT.java    | 19 +++++++++++++++++++
 .../exp/AggregateExpInMemoryEvaluationIT.java       | 19 +++++++++++++++++++
 .../apache/cayenne/testdo/cay_2641/ArtistLazy.java  | 19 +++++++++++++++++++
 .../apache/cayenne/testdo/cay_2641/DatamapLazy.java | 19 +++++++++++++++++++
 .../cayenne/testdo/cay_2641/PaintingLazy.java       | 19 +++++++++++++++++++
 .../cayenne/testdo/cay_2641/client/ArtistLazy.java  | 19 +++++++++++++++++++
 .../testdo/cay_2641/client/PaintingLazy.java        | 19 +++++++++++++++++++
 .../testdo/inheritance_vertical/IvGenKeyRoot.java   | 19 +++++++++++++++++++
 .../testdo/inheritance_vertical/IvGenKeySub.java    | 19 +++++++++++++++++++
 .../meaningful_pk/ClientMeaningfulPkDep2.java       | 19 +++++++++++++++++++
 .../testdo/meaningful_pk/MeaningfulPkDep2.java      | 19 +++++++++++++++++++
 .../org/apache/cayenne/unit/di/CommitStats.java     | 19 +++++++++++++++++++
 .../apache/cayenne/modeler/CodeTemplateManager.java | 14 +++++++++-----
 23 files changed, 280 insertions(+), 6 deletions(-)
 rename cayenne-cgen/src/test/resources/templateTest/{ObjEntity.java => _ObjEntity.java} (100%)
 rename cayenne-cgen/src/test/resources/templateTest/{SQLTemplate.java => _SQLTemplate.java} (100%)
 rename cayenne-cgen/src/test/resources/templateTest/{SelectQuery.java => _SelectQuery.java} (100%)
 rename cayenne-cgen/src/test/resources/templateTest/{auto => _auto}/_ObjEntity.java (100%)
 rename cayenne-cgen/src/test/resources/templateTest/{auto => _auto}/_SQLTemplate.java (100%)
 rename cayenne-cgen/src/test/resources/templateTest/{auto => _auto}/_SelectQuery.java (100%)


[cayenne] 02/02: Add missing license headers

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 117f2f828db1d045db0d29257c19bb8a9bd9a3f1
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Oct 6 13:23:44 2020 +0300

    Add missing license headers
---
 .../cayenne/gen/BaseTemplatesGenerationTest.java    | 21 ++++++++++++++++++++-
 .../org/apache/cayenne/gen/DataMapUtilsTest.java    | 19 +++++++++++++++++++
 .../{ObjEntity.java => _ObjEntity.java}             |  0
 .../{SQLTemplate.java => _SQLTemplate.java}         |  0
 .../{SelectQuery.java => _SelectQuery.java}         |  0
 .../templateTest/{auto => _auto}/_ObjEntity.java    |  0
 .../templateTest/{auto => _auto}/_SQLTemplate.java  |  0
 .../templateTest/{auto => _auto}/_SelectQuery.java  |  0
 .../translator/select/QualifierTranslatorIT.java    | 19 +++++++++++++++++++
 .../exp/AggregateExpInMemoryEvaluationIT.java       | 19 +++++++++++++++++++
 .../apache/cayenne/testdo/cay_2641/ArtistLazy.java  | 19 +++++++++++++++++++
 .../apache/cayenne/testdo/cay_2641/DatamapLazy.java | 19 +++++++++++++++++++
 .../cayenne/testdo/cay_2641/PaintingLazy.java       | 19 +++++++++++++++++++
 .../cayenne/testdo/cay_2641/client/ArtistLazy.java  | 19 +++++++++++++++++++
 .../testdo/cay_2641/client/PaintingLazy.java        | 19 +++++++++++++++++++
 .../testdo/inheritance_vertical/IvGenKeyRoot.java   | 19 +++++++++++++++++++
 .../testdo/inheritance_vertical/IvGenKeySub.java    | 19 +++++++++++++++++++
 .../meaningful_pk/ClientMeaningfulPkDep2.java       | 19 +++++++++++++++++++
 .../testdo/meaningful_pk/MeaningfulPkDep2.java      | 19 +++++++++++++++++++
 .../org/apache/cayenne/unit/di/CommitStats.java     | 19 +++++++++++++++++++
 20 files changed, 267 insertions(+), 1 deletion(-)

diff --git a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/BaseTemplatesGenerationTest.java b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/BaseTemplatesGenerationTest.java
index 14e9b20..e3f7242 100644
--- a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/BaseTemplatesGenerationTest.java
+++ b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/BaseTemplatesGenerationTest.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.gen;
 
 import org.apache.cayenne.exp.Expression;
@@ -140,7 +159,7 @@ public class BaseTemplatesGenerationTest {
     }
 
     private String readResource(String name) throws IOException {
-        String resourceName = "templateTest/" + name + ".java";
+        String resourceName = "templateTest/_" + name + ".java";
         InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName);
         if(stream == null) {
             throw new FileNotFoundException("Resource not found: " + resourceName);
diff --git a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/DataMapUtilsTest.java b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/DataMapUtilsTest.java
index 32361fc..89a7a5e 100644
--- a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/DataMapUtilsTest.java
+++ b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/DataMapUtilsTest.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.gen;
 
 import org.apache.cayenne.exp.Expression;
diff --git a/cayenne-cgen/src/test/resources/templateTest/ObjEntity.java b/cayenne-cgen/src/test/resources/templateTest/_ObjEntity.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/ObjEntity.java
rename to cayenne-cgen/src/test/resources/templateTest/_ObjEntity.java
diff --git a/cayenne-cgen/src/test/resources/templateTest/SQLTemplate.java b/cayenne-cgen/src/test/resources/templateTest/_SQLTemplate.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/SQLTemplate.java
rename to cayenne-cgen/src/test/resources/templateTest/_SQLTemplate.java
diff --git a/cayenne-cgen/src/test/resources/templateTest/SelectQuery.java b/cayenne-cgen/src/test/resources/templateTest/_SelectQuery.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/SelectQuery.java
rename to cayenne-cgen/src/test/resources/templateTest/_SelectQuery.java
diff --git a/cayenne-cgen/src/test/resources/templateTest/auto/_ObjEntity.java b/cayenne-cgen/src/test/resources/templateTest/_auto/_ObjEntity.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/auto/_ObjEntity.java
rename to cayenne-cgen/src/test/resources/templateTest/_auto/_ObjEntity.java
diff --git a/cayenne-cgen/src/test/resources/templateTest/auto/_SQLTemplate.java b/cayenne-cgen/src/test/resources/templateTest/_auto/_SQLTemplate.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/auto/_SQLTemplate.java
rename to cayenne-cgen/src/test/resources/templateTest/_auto/_SQLTemplate.java
diff --git a/cayenne-cgen/src/test/resources/templateTest/auto/_SelectQuery.java b/cayenne-cgen/src/test/resources/templateTest/_auto/_SelectQuery.java
similarity index 100%
rename from cayenne-cgen/src/test/resources/templateTest/auto/_SelectQuery.java
rename to cayenne-cgen/src/test/resources/templateTest/_auto/_SelectQuery.java
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorIT.java
index 9073e85..7cdd4b2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorIT.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.access.translator.select;
 
 import org.apache.cayenne.ObjectContext;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/AggregateExpInMemoryEvaluationIT.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/AggregateExpInMemoryEvaluationIT.java
index 2fe5d0a..8a2c3b8 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/AggregateExpInMemoryEvaluationIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/AggregateExpInMemoryEvaluationIT.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.exp;
 
 import java.math.BigDecimal;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/ArtistLazy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/ArtistLazy.java
index dcd9224..bb417b2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/ArtistLazy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/ArtistLazy.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.cay_2641;
 
 import org.apache.cayenne.testdo.cay_2641.auto._ArtistLazy;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/DatamapLazy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/DatamapLazy.java
index f026e12..fbc1adb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/DatamapLazy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/DatamapLazy.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.cay_2641;
 
 import org.apache.cayenne.testdo.cay_2641.auto._DatamapLazy;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/PaintingLazy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/PaintingLazy.java
index dd6f77a..e6dc099 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/PaintingLazy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/PaintingLazy.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.cay_2641;
 
 import org.apache.cayenne.testdo.cay_2641.auto._PaintingLazy;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java
index 593a6aa..806af39 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.cay_2641.client;
 
 import org.apache.cayenne.testdo.cay_2641.client.auto._ArtistLazy;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java
index a290ca4..1bd04be 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.cay_2641.client;
 
 import org.apache.cayenne.testdo.cay_2641.client.auto._PaintingLazy;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeyRoot.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeyRoot.java
index c407be3..4ef21e3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeyRoot.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeyRoot.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.inheritance_vertical;
 
 import org.apache.cayenne.testdo.inheritance_vertical.auto._IvGenKeyRoot;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeySub.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeySub.java
index c58b953..3578a8d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeySub.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/IvGenKeySub.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.inheritance_vertical;
 
 import org.apache.cayenne.testdo.inheritance_vertical.auto._IvGenKeySub;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java
index 304e538..7a950b2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.meaningful_pk;
 
 import org.apache.cayenne.testdo.meaningful_pk.auto._ClientMeaningfulPkDep2;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/MeaningfulPkDep2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/MeaningfulPkDep2.java
index 0d25cd5..a295f85 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/MeaningfulPkDep2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/MeaningfulPkDep2.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.testdo.meaningful_pk;
 
 import org.apache.cayenne.testdo.meaningful_pk.auto._MeaningfulPkDep2;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/CommitStats.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/CommitStats.java
index 4679463..40ba0e9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/CommitStats.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/CommitStats.java
@@ -1,3 +1,22 @@
+/*****************************************************************
+ *   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
+ *
+ *    https://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.
+ ****************************************************************/
+
 package org.apache.cayenne.unit.di;
 
 import org.apache.cayenne.DataChannel;


[cayenne] 01/02: CAY-2676 Degredation: Custom class generation templates are not working anymore

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit ef042ac76c2f146e549e0d36d16e94554b96d42d
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Oct 6 12:25:08 2020 +0300

    CAY-2676 Degredation: Custom class generation templates are not working anymore
---
 RELEASE-NOTES.txt                                          |  1 +
 .../java/org/apache/cayenne/gen/ClassGenerationAction.java |  3 +++
 .../org/apache/cayenne/modeler/CodeTemplateManager.java    | 14 +++++++++-----
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index e6e5a35..18783af 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -33,6 +33,7 @@ CAY-2671 QualifierTranslator fails to translate expressions with compound PKs/FK
 CAY-2675 A one-to-one relationship with meaningful PK can be nullified in the nested context
 CAY-2679 Unstable ordering of relationships in the .map.xml file
 CAY-2681 Modeler: All selected checkboxes cause project to become dirty at initialization
+CAY-2676 Degredation: Custom class generation templates are not working anymore
 CAY-2682 Vertical Inheritance: DB-generated PK doesn't propagate from the root to children
 
 ----------------------------------
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
index d876fc1..caeaaee 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
@@ -315,6 +315,9 @@ public class ClassGenerationAction {
 			props.put("resource.loaders", "cayenne");
 			props.put("resource.loader.cayenne.class", ClassGeneratorResourceLoader.class.getName());
 			props.put("resource.loader.cayenne.cache", "false");
+			if (cgenConfiguration.getRootPath() != null) {
+				props.put("resource.loader.cayenne.path", cgenConfiguration.getRootPath().toString());
+			}
 
 			VelocityEngine velocityEngine = new VelocityEngine();
 			velocityEngine.init(props);
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
index 9b4b4f1..f9f6108 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CodeTemplateManager.java
@@ -19,6 +19,7 @@
 
 package org.apache.cayenne.modeler;
 
+import java.net.URISyntaxException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
@@ -166,13 +167,16 @@ public class CodeTemplateManager {
 	public String getTemplatePath(String name, Resource rootPath) {
 		Object value = customTemplates.get(name);
 		if (value != null) {
-			if(rootPath != null) {
-				Path path = Paths.get(rootPath.getURL().getPath()).getParent();
-				value = path.relativize(Paths.get((String) value));
+			try {
+				if(rootPath != null) {
+						Path path = Paths.get(rootPath.getURL().toURI()).getParent();
+						value = path.relativize(Paths.get((String) value));
+				}
+				return value.toString();
+			} catch (URISyntaxException e) {
+				logger.warn("Path for template named '{}' could not be resolved", name);
 			}
-			return value.toString();
 		}
-
 		value = standardTemplates.get(name);
 		return value != null ? value.toString() : null;
 	}