protected static String resolveEntity(String entityName, EOEditingContext ec) { if (entityName == null) return null; try { EOEntity entity = EOUtilities.entityNamed(ec, entityName); if (entity != null) { return entityName; } } catch (EOObjectNotAvailableException naex) { } entityName = SettingsReader.stringForKeyPath("interfaces." + entityName, null); int dot = entityName.lastIndexOf('.'); if (dot > 0) { entityName = entityName.substring(dot + 1); } // return resolveEntity(entityName); if (entityName == null) return null; try { EOEntity entity = EOUtilities.entityNamed(ec, entityName); if (entity != null) { return entityName; } } catch (EOObjectNotAvailableException naex2) { } return null; }
public void appendToResponse(WOResponse aResponse, WOContext aContext) { try { Number b = (Number) valueForBinding("firstNameDisplay"); if (b != null) firstNameDisplay = b.intValue(); else firstNameDisplay = 2; b = (Number) valueForBinding("secondNameDisplay"); if (b != null) secondNameDisplay = b.intValue(); else secondNameDisplay = 2; } catch (ClassCastException cex) { throw new IllegalArgumentException("NameDisplay bindings should be integer"); } String request = (String) valueForBinding("searchRequest"); if (request != null) { performSearchRequest(request); } else { selection = (PersonLink) EOUtilities.localInstanceOfObject( ec, (EOEnterpriseObject) valueForBinding("selection")); // syncSelection(); } if (selection == null && Various.boolForObject(valueForBinding("showPopup"))) { selection = defaultSelectionValue(); setValueForBinding(selection, "selection"); } super.appendToResponse(aResponse, aContext); found = null; // searchMessage = null; }
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) { super.takeValuesFromRequest(aRequest, aContext); if (!Various.boolForObject(valueForBinding("showPopup"))) { selection = (PersonLink) EOUtilities.localInstanceOfObject( ec, (EOEnterpriseObject) valueForBinding("selection")); // syncSelection(); } }
public WOActionResults delete() { NSMutableArray personList = (NSMutableArray) session().valueForKey("personList"); if (personList != null && personList.count() > 0) { for (int i = 0; i < personList.count(); i++) { PersonLink pers = (PersonLink) personList.objectAtIndex(i); if (item == EOUtilities.localInstanceOfObject(ec, pers.person())) { personList.removeObjectAtIndex(i); break; } } } return context().page(); // onEdit = null; }
protected PersonLink defaultSelectionValue() { NSArray list = (NSArray) valueForBinding("forcedList"); if (list != null && list.count() > 0) { return (PersonLink) EOUtilities.localInstanceOfObject(ec, (EOEnterpriseObject) list.objectAtIndex(0)); } list = (NSArray) session().valueForKey("personList"); if (list != null && list.count() > 0) { Enumeration enu = list.objectEnumerator(); while (enu.hasMoreElements()) { EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement(); if (entity().equals(pers.entityName())) { return (PersonLink) pers; } } } return null; }
public NSArray personList() { NSArray forcedList = (NSArray) valueForBinding("forcedList"); NSMutableArray result = (forcedList == null) ? new NSMutableArray() : EOUtilities.localInstancesOfObjects(ec, forcedList).mutableClone(); NSArray personList = (NSArray) session().valueForKey("personList"); if (personList != null && personList.count() > 0) { Enumeration enu = personList.objectEnumerator(); while (enu.hasMoreElements()) { EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement(); if (!result.contains(pers) && (entity().equals(pers.entityName()) || pers.entityName().equals(alterEntity()))) result.addObject(pers); } } return result; }