From 65a54e2c701de0c7dc6674c5aa68ad131efd6146 Mon Sep 17 00:00:00 2001 From: David Avendasora Date: Tue, 1 May 2012 15:46:07 +0800 Subject: [PATCH] Add ability to chain ERXSortOrderings in addition to ERXSortOrdering --- .../er/extensions/eof/ERXSortOrdering.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSortOrdering.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSortOrdering.java index a6a0ed5f65c..d0efbeaa2e3 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSortOrdering.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXSortOrdering.java @@ -70,6 +70,20 @@ public ERXSortOrderings then(EOSortOrdering nextSortOrdering) { return sortOrderings; } + /** + * Returns ERXSortOrderings with this sort ordering followed by the provided + * array of next sort orderings. + * + * @param nextSortOrderings + * the next sort orderings to chain to this + * @return an array of sort orderings + * @author David Avendasora + */ + public ERXSortOrderings then(NSArray nextSortOrderings) { + array().insertObjectAtIndex(this, 0); + return array(); + } + /** * Returns this sort ordering as an array. * @@ -202,6 +216,19 @@ public ERXSortOrderings then(EOSortOrdering nextSortOrdering) { return this; } + /** + * Adds the given sort orderings to the end of this list and returns + * "this" so it can be chained again. + * + * @param nextSortOrderings the sort ordering to add + * @return this (with the sort orderings appended) + * @author David Avendasora + */ + public ERXSortOrderings then(ERXSortOrderings nextSortOrderings) { + addObjectsFromArray(nextSortOrderings); + return this; + } + /** * Returns an array sorted with this sort ordering. *