예제 #1
0
 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;
 }
예제 #2
0
 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;
 }