Пример #1
0
 private static Category getCategoryByID(DefaultProfile defaultProfile, String categoryId) {
   EList cats = defaultProfile.getCategory();
   for (Iterator it = cats.iterator(); it.hasNext(); ) {
     Category cat = (Category) it.next();
     if (categoryId.equals(cat.getId())) return cat;
   }
   return null;
 }
Пример #2
0
 public static Preference getPreferenceByID(
     DefaultProfile defaultProfile, String categoryId, String prefId) {
   Category cat = getCategoryByID(defaultProfile, categoryId);
   if (cat != null) { // if found category
     EList groups = cat.getGroup();
     for (Iterator grpIt = groups.iterator(); grpIt.hasNext(); ) {
       Group group = (Group) grpIt.next();
       EList prefs = group.getPref();
       for (Iterator it = prefs.iterator(); it.hasNext(); ) {
         Preference pref = (Preference) it.next();
         if (prefId.equals(pref.getId())) return pref;
       }
     }
   }
   return null;
 }