Merge pull request #623 from hugithordarson/orderings-sort-any-collection-2024-09-07

Change Orderings.orderedList() to accept a Collection rather than a List
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index dd8cb60..12a7ee9 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -8,6 +8,14 @@
 https://issues.apache.org/jira/browse/CAY
 
 ----------------------------------
+Release: 5.0-M2
+Date:
+----------------------------------
+Changes/New Features:
+
+Bug Fixes:
+
+----------------------------------
 Release: 5.0-M1
 Date: Aug 28, 2024
 ----------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
index 1e067a0..7fc9fbe 100644
--- a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
@@ -16,10 +16,15 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-title: "Cayenne Guide 5.0"
-description: "Cayenne Guide 5.0"
+title: "Cayenne Guide"
+description: "Cayenne Guide"
 cayenneVersion: "5.0"
 weight: 30
+menu:
+    footer:
+        weight: 30
+        parent: docs
+        name: "Cayenne Guide (5.0)"
 ---
 
 
diff --git a/docs/asciidoc/getting-started-db-first/src/docs/asciidoc/_getting-started-db-first/header.html b/docs/asciidoc/getting-started-db-first/src/docs/asciidoc/_getting-started-db-first/header.html
index 2a4accf..7cbd066 100644
--- a/docs/asciidoc/getting-started-db-first/src/docs/asciidoc/_getting-started-db-first/header.html
+++ b/docs/asciidoc/getting-started-db-first/src/docs/asciidoc/_getting-started-db-first/header.html
@@ -17,13 +17,7 @@
 #  under the License.
 
 title: "Cayenne Database First tutorial"
-description: "Tutorial how to quick start new Cayenne project from existing database"
-cayenneVersion: "4.2"
+description: "Tutorial how to quick start new Cayenne 5.0 project from existing database"
+cayenneVersion: "5.0"
 docsMenuTitle: "Database First Tutorial"
-weight: 30
-menu:
-    footer:
-        weight: 30
-        parent: docs
-        name: "Database First tutorial (4.2)"
 ---
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
index f02666d..892e520 100644
--- a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
@@ -17,13 +17,8 @@
 #  under the License.
 
 title: "Cayenne Getting Started Guide"
-description: "Tutorial how to quick start new Cayenne project"
+description: "Tutorial how to quick start new Cayenne 5.0 project"
 weight: 10
 docsMenuTitle: "Getting Started"
-cayenneVersion: "4.2"
-menu:
-    footer:
-        weight: 10
-        parent: docs
-        name: "Getting Started (4.2)"
+cayenneVersion: "5.0"
 ---
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc
new file mode 100644
index 0000000..2ffa5de
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc
@@ -0,0 +1,74 @@
+// 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.
+
+== Java Version
+
+Minimum required JDK version is 11 or newer. If your project requires Java 8, you should keep using Cayenne 4.2.
+Cayenne 5.0 is fully tested with Java 11, 17 and 21.
+
+== Incompatible Changes
+
+Apache Cayenne 5.0-M1 removes support for a multi-layered stack, so no more Cayenne ROP and all the related client parts.
+Moreover, this release renames every part that contains `server` in its name, including the main library.
+For all the details please consult `UPGRADE.txt`, as this document only highlights the most impactful changes.
+
+=== Main Library Renaming
+
+Main Cayenne artifact is renamed from `cayenne-server` to `cayenne`, so you need to change your dependencies accordingly
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.cayenne</groupId>
+    <artifactId>cayenne</artifactId>
+    <version>{version}</version>
+</dependency>
+----
+
+=== Server Runtime and Module Deprecation
+
+`ServerRuntime` is deprecated and replaced by `CayenneRuntime`. As well as `ServerModule` renamed to `CoreModule`.
+
+[source,java]
+----
+CayenneRuntime runtime = CayenneRuntime.builder()
+                .addConfig("cayenne-project.xml")
+                .module(b -> CoreModule.extend(b).setProperty("some_property", "some_value"))
+                .build();
+----
+
+=== New Modules Extenders
+
+Each Cayenne module now provides a module-specific extender created with an "extend(Binder)" method.
+It is usually invoked within a lambda that produces a Module, or within an app Module.
+
+[source,java]
+----
+CayenneRuntime.builder(..)
+    .addModule(b -> CacheInvalidationModule.extend(b).addHandler(MyHandler.class))
+    .build();
+----
+
+=== Removal of Deprecated Modules
+
+- All modules related to the ROP functionality is completely gone.
+That includes `cayenne-rop-server`, `cayenne-client` and other related parts.
+- `cayenne-xmpp`, `cayenne-jms` and `cayenne-jgroups` event bridges are removed.
+- Finally `cayenne-joda` and `cayenne-web` modules are gone.
+
+=== Removal of Deprecated Code
+
+As always, code deprecated in earlier versions is gone. One notable class removed is `SelectQuery`, so you should use `ObjectSelect` from now on.
+
+
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
index ec97297..44a7bf6 100644
--- a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
@@ -16,9 +16,9 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-title: "Guide to 4.2 Features"
-description: "This guide highlights the new features and changes introduced in Apache Cayenne 4.2"
-cayenneVersion: "4.2"
+title: "Guide to 5.0 Features"
+description: "This guide highlights the new features and changes introduced in Apache Cayenne 5.0"
+cayenneVersion: "5.0"
 docsMenuTitle: "Upgrade Guide"
 weight: 50
 ---
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc
index 5bccf34..88a4569 100644
--- a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc
@@ -12,10 +12,56 @@
 // the specific language governing permissions and limitations under the
 // License.
 
-== Java Version
-
-Minimum required JDK version is 11 or newer.
-Cayenne 5.0 is fully tested with Java 11, 17 and 21.
-
 == New Features
 
+=== New Dev Versioning Scheme
+
+From now on a snapshot version of Cayenne is a constant value, so the dev version of 5.0 will always be 5.0-SNAPSHOT.
+So you can always stay at the bleeding edge of development if needed.
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.cayenne</groupId>
+    <artifactId>cayenne</artifactId>
+    <version>5.0-SNAPSHOT</version>
+</dependency>
+----
+
+=== New Class Generation UI
+
+The new Class Generation UI in the Cayenne Modeler simplifies configuration, allows multiple `cgen` setups per project,
+and includes a template editor.
+
+Custom templates are now part of the project XML configuration and don't require separate setup in either Modeler, or Maven/Gradle plugins.
+
+=== Improved `(not)exists` Queries
+
+In most cases, you don’t need to deal with a subquery for `(not)exists` queries, as it is now directly supported by the Expression API.
+That includes `Expression`, expression parser, and Property API.
+
+This feature can handle any expression and spawn several sub-queries per expression if needed.
+
+[source,java]
+----
+long count = ObjectSelect.query(Artist.class)
+        .where(Artist.PAINTING_ARRAY.dot(Painting.PAINTING_TITLE).like("painting%").exists())
+        .selectCount(context);
+----
+
+=== Improved SQL Support
+
+`ANY` and `ALL` subqueries are now supported, as well as `case-when` expressions.
+
+[source,java]
+----
+import static org.apache.cayenne.exp.ExpressionFactory.*;
+// ...
+Expression caseWhenExp = caseWhen(
+                List.of((betweenExp("estimatedPrice", 0, 9)),
+                        (betweenExp("estimatedPrice", 10, 20))),
+                List.of((wrapScalarValue("low")),
+                        (wrapScalarValue("high"))),
+                wrapScalarValue("error"));
+----
+
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
index fe8c4a1..d4092d0 100644
--- a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
@@ -34,8 +34,8 @@
 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._#
 
-
 This guide highlights the new features and changes introduced in Apache Cayenne 5.0. For a full list of changes consult
 RELEASE-NOTES.txt included in Cayenne download. For release-specific upgrade instructions check UPGRADE.txt.
 
+include::_upgrade-guide/changes.adoc[]
 include::_upgrade-guide/new-features.adoc[]
\ No newline at end of file