• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDictionary and FetchSpecificationNamed usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDictionary and FetchSpecificationNamed usage


  • Subject: NSDictionary and FetchSpecificationNamed usage
  • From: Dev WO <email@hidden>
  • Date: Wed, 19 Oct 2005 18:34:40 +0200

Hi list,
I'm trying to make a fetch using a parameter in code and a FetchSpecificationNamed in the EOModel.
My issue is that I'm not using a GUI item to bind to the NSDictionary but an object int he code.
And I can't get the NSDictionary to work (even after regarding the documentation, I don't understand very well), I've red quite some post on NSDictionary but I still couldn't find out.


So I have a first method that will call the following one with two object "product" and "provisioning":
-----
public void provisioningOrder(Product product, ProductProvisioning provisioning) {
CustomerOrderItem aCustomerOrderItem;
NSMutableDictionary theProduct = new NSMutableDictionary();
theProduct = ((NSArray)product.valueForKey("productPK"));
EOFetchSpecification fetchSpec = EOFetchSpecification.fetchSpecificationNamed ("FetchSpecItemSortedByOrderDateForAProductAndRefresh", "CustomerOrderItem");
EOFetchSpecification boundFs = fetchSpec.fetchSpecificationWithQualifierBindings(theProduct);
NSArray orderItemNotComplete = ec.objectsWithFetchSpecification(boundFs);
if ( orderItemNotComplete.count() < 1) {
product.setStockStatus(new Integer(product.stockStatus ().intValue() + provisioning.quantity().intValue()));
}
else {
int i=0;
while (i<orderItemNotComplete.count()) {
aCustomerOrderItem = (CustomerOrderItem) orderItemNotComplete.objectAtIndex(i);
if ((aCustomerOrderItem.quantity().intValue() - aCustomerOrderItem.quantityAvailable().intValue()) > provisioning.quantity().intValue()) {
aCustomerOrderItem.setQuantityAvailable(new Integer(aCustomerOrderItem.quantityAvailable().intValue() + provisioning.quantity().intValue()));
}
else {
aCustomerOrderItem.setQuantityAvailable (aCustomerOrderItem.quantity());
product.setStockStatus(new Integer (product.stockStatus().intValue() + (provisioning.quantity().intValue () - (aCustomerOrderItem.quantity().intValue() - aCustomerOrderItem.quantityAvailable().intValue()))));
}
i++;
}
}
}
-----
I just need to fetch the CustomerOrderItem for the specific object product!
My namedFetchSpecification is handling the sorting and some extra qualifier.


Could someone explain me in a human readable language;) what I'm doing wrong? obviously I'm doing something wrong:)

Thanks

Xavier
_______________________________________________
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


  • Follow-Ups:
    • Re: NSDictionary and FetchSpecificationNamed usage
      • From: Arturo Perez <email@hidden>
  • Prev by Date: WOMailDelivery Woes - Data Types incorrectly set?
  • Next by Date: Creating an NSArray Key
  • Previous by thread: Re: WOMailDelivery Woes - Data Types incorrectly set?
  • Next by thread: Re: NSDictionary and FetchSpecificationNamed usage
  • Index(es):
    • Date
    • Thread