public void configureWOOgnl(NSNotification n) { WOOgnl.factory().configureWOForOgnl(); NSNotificationCenter.defaultCenter().removeObserver(this); _retainerArray.remove(this); } }
public double computeFromRawRecords(NSArray rawRecords) { String totalKey = keyPath(); double doubleValue = 0.0; if(totalKey.indexOf("~") == 0) { Object result = WOOgnl.factory().getValue(totalKey.substring(1), rawRecords); doubleValue = DRValueConverter.converter().doubleForValue(result); } else if(totalKey.indexOf("@") == 0) { Object result = rawRecords.valueForKeyPath(totalKey); doubleValue = DRValueConverter.converter().doubleForValue(result); if(doubleValue == 0.0 && totalKey.indexOf("@count") == 0) { // FIXME: ak, we should return "-" on not found... probably possible via a formatter return 0.0; } } return doubleValue; } }
protected void processDeclaration(WODeclaration declaration) { NSMutableDictionary associations = (NSMutableDictionary) declaration.associations(); Enumeration bindingNameEnum = associations.keyEnumerator(); while (bindingNameEnum.hasMoreElements()) { String bindingName = (String) bindingNameEnum.nextElement(); WOAssociation association = (WOAssociation) associations.valueForKey(bindingName); WOAssociation helperAssociation = parserHelperAssociation(association); if (helperAssociation != association) { associations.setObjectForKey(helperAssociation, bindingName); } } // This will replace constant associations with ognl associations // when needed. WOOgnl.factory().convertOgnlConstantAssociations(associations); }
@Override public Object valueInComponent(WOComponent component) { WOAssociation.Event event = _markStartOfEventIfNeeded("valueForKeyPath", keyPath(), component); Object value = null; try { value = WOOgnl.factory().getValue(keyPath(), component); } catch (Exception e) { if (shouldThrowException()) { throw new NSForwardException(e); } log.error("Exception invoking valueInComponent on WOOgnlAssociation with keyPath '{}'", keyPath(), e); } if (event != null) { EOEventCenter.markEndOfEvent(event); } if (_debugEnabled) { _logPullValue(value, component); } return value; }
@Override public void setValue(Object object, WOComponent component) { WOAssociation.Event event = _markStartOfEventIfNeeded("takeValueForKeyPath", keyPath(), component); try { // not sure how to manage validation or whether the current // implementation is enough... WOOgnl.factory().setValue(keyPath(), component, object); } catch (Exception e) { if (shouldThrowException()) { throw new NSForwardException(e); } log.error("Exception invoking setValue on WOOgnlAssociation: '{}'.", keyPath(), e); } if (event != null) { EOEventCenter.markEndOfEvent(event); } if (_debugEnabled) { _logPushValue(object, component); } }