Re: Fetch and sort based on a given list

2012-03-11 Thread Ted Archibald
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 NSArrayT
sortedArraySortedWithKeys(NSArray? extends EOEnterpriseObject array,
ERXKeyString key, NSArrayString 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 ted.archib...@gmail.comwrote:

 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.

 NSArrayString keys =
 ATLArrayUtilities.toNSArray((String)context().request().formValueForKey(
 keys), ,);

 NSArrayEO 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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Fetch and sort based on a given list

2012-03-11 Thread Michael Sharp
ERXS maybe..  

Eo.fetchEos(ec, Eo.KEY.in(keys), ERXS.ascs(keys));

Sharpy..

On 12/03/2012, at 9:50 AM, Ted Archibald wrote:

 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 NSArrayT 
 sortedArraySortedWithKeys(NSArray? extends EOEnterpriseObject array, 
 ERXKeyString key, NSArrayString 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 ted.archib...@gmail.com 
 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.
 
 NSArrayString keys = 
 ATLArrayUtilities.toNSArray((String)context().request().formValueForKey(keys),
  ,);
 NSArrayEO 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  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com
 
 This email sent to getsh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com