Re: Fetch and sort based on a given list
Re: Fetch and sort based on a given list
- Subject: Re: Fetch and sort based on a given list
- From: Ted Archibald <email@hidden>
- Date: Sun, 11 Mar 2012 17:50:18 -0600
The best I have so far is to loop through the array, but it's not the most elegant solution in the world...
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T extends EOEnterpriseObject> NSArray<T> sortedArraySortedWithKeys(NSArray<? extends EOEnterpriseObject> array, ERXKey<String> key, NSArray<String> keys) {
NSArray sortedArray = new NSArray();
for (int i = 0; i < keys.count(); i++) {
sortedArray = sortedArray.arrayByAddingObjectsFromArray(ATLArrayUtilities.filteredArrayWithQualifierEvaluation(array, key.eq(keys.objectAtIndex(i))));
}
return sortedArray;
}
On Sun, Mar 11, 2012 at 5:26 PM, Ted Archibald
<email@hidden> wrote:
Is there an easy way to fetch and sort an EO given an array of keys.
The qualifier is obvious, but I don't see anything obvious on how to order the fetch based on the given list.
NSArray<String> keys = ATLArrayUtilities.toNSArray((String)context().request().formValueForKey("keys"), ",");
NSArray<EO> eos = Eo.fetchEos(ec, Eo.KEY.in(keys), null);
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden