public void deleteServiceTypeByIdIdx(int ServiceTypeId) {
   CFSecurityServiceTypePKey pkey =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey();
   pkey.setRequiredServiceTypeId(ServiceTypeId);
   ICFSecurityServiceTypeObj obj = readServiceType(pkey);
   if (obj != null) {
     ICFSecurityServiceTypeEditObj editObj = (ICFSecurityServiceTypeEditObj) obj.getEdit();
     boolean editStarted;
     if (editObj == null) {
       editObj = (ICFSecurityServiceTypeEditObj) obj.beginEdit();
       if (editObj != null) {
         editStarted = true;
       } else {
         editStarted = false;
       }
     } else {
       editStarted = false;
     }
     if (editObj != null) {
       editObj.delete();
       if (editStarted) {
         editObj.endEdit();
       }
     }
     obj.forget(true);
   }
 }
 public ICFSecurityServiceTypeObj readServiceTypeByUDescrIdx(
     String Description, boolean forceRead) {
   if (indexByUDescrIdx == null) {
     indexByUDescrIdx =
         new HashMap<CFSecurityServiceTypeByUDescrIdxKey, ICFSecurityServiceTypeObj>();
   }
   CFSecurityServiceTypeByUDescrIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
   key.setRequiredDescription(Description);
   ICFSecurityServiceTypeObj obj = null;
   if ((!forceRead) && indexByUDescrIdx.containsKey(key)) {
     obj = indexByUDescrIdx.get(key);
   } else {
     CFSecurityServiceTypeBuff buff =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableServiceType()
             .readDerivedByUDescrIdx(schema.getAuthorization(), Description);
     if (buff != null) {
       obj = schema.getServiceTypeTableObj().newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityServiceTypeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUDescrIdx.put(key, null);
     }
   }
   return (obj);
 }
 public void deleteServiceType(ICFSecurityServiceTypeObj Obj) {
   ICFSecurityServiceTypeObj obj = Obj;
   ((ICFAccSchema) schema.getBackingStore())
       .getTableServiceType()
       .deleteServiceType(schema.getAuthorization(), obj.getServiceTypeBuff());
   obj.forget(true);
 }
 public ICFSecurityServiceTypeObj updateServiceType(ICFSecurityServiceTypeObj Obj) {
   ICFSecurityServiceTypeObj obj = Obj;
   ((ICFAccSchema) schema.getBackingStore())
       .getTableServiceType()
       .updateServiceType(schema.getAuthorization(), Obj.getServiceTypeBuff());
   obj = (ICFSecurityServiceTypeObj) Obj.realize();
   return (obj);
 }
 public ICFSecurityServiceTypeObj createServiceType(ICFSecurityServiceTypeObj Obj) {
   ICFSecurityServiceTypeObj obj = Obj;
   CFSecurityServiceTypeBuff buff = obj.getServiceTypeBuff();
   ((ICFAccSchema) schema.getBackingStore())
       .getTableServiceType()
       .createServiceType(schema.getAuthorization(), buff);
   obj.copyBuffToPKey();
   obj = obj.realize();
   return (obj);
 }
 public void forgetServiceTypeByIdIdx(int ServiceTypeId) {
   if (members == null) {
     return;
   }
   CFSecurityServiceTypePKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey();
   key.setRequiredServiceTypeId(ServiceTypeId);
   if (members.containsKey(key)) {
     ICFSecurityServiceTypeObj probed = members.get(key);
     if (probed != null) {
       probed.forget(true);
     }
   }
 }
 public void minimizeMemory() {
   allServiceType = null;
   indexByUDescrIdx = null;
   List<ICFSecurityServiceTypeObj> toForget = new LinkedList<ICFSecurityServiceTypeObj>();
   ICFSecurityServiceTypeObj cur = null;
   Iterator<ICFSecurityServiceTypeObj> iter = members.values().iterator();
   while (iter.hasNext()) {
     cur = iter.next();
     toForget.add(cur);
   }
   iter = toForget.iterator();
   while (iter.hasNext()) {
     cur = iter.next();
     cur.forget();
   }
 }
  public void forgetServiceTypeByUDescrIdx(String Description) {
    if (indexByUDescrIdx == null) {
      return;
    }
    CFSecurityServiceTypeByUDescrIdxKey key =
        ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
    key.setRequiredDescription(Description);
    if (indexByUDescrIdx.containsKey(key)) {
      ICFSecurityServiceTypeObj probed = indexByUDescrIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUDescrIdx.remove(key);
    }
  }
 public ICFSecurityServiceTypeObj lockServiceType(CFSecurityServiceTypePKey pkey) {
   ICFSecurityServiceTypeObj locked = null;
   CFSecurityServiceTypeBuff lockBuff =
       ((ICFAccSchema) schema.getBackingStore())
           .getTableServiceType()
           .lockDerived(schema.getAuthorization(), pkey);
   if (lockBuff != null) {
     locked = schema.getServiceTypeTableObj().newInstance();
     locked.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey());
     locked.setBuff(lockBuff);
     locked = (ICFSecurityServiceTypeObj) locked.realize();
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newCollisionDetectedException(getClass(), "lockServiceType", pkey);
   }
   return (locked);
 }
 public void deleteServiceTypeByUDescrIdx(String Description) {
   if (indexByUDescrIdx == null) {
     indexByUDescrIdx =
         new HashMap<CFSecurityServiceTypeByUDescrIdxKey, ICFSecurityServiceTypeObj>();
   }
   CFSecurityServiceTypeByUDescrIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
   key.setRequiredDescription(Description);
   ICFSecurityServiceTypeObj obj = null;
   if (indexByUDescrIdx.containsKey(key)) {
     obj = indexByUDescrIdx.get(key);
     ((ICFAccSchema) schema.getBackingStore())
         .getTableServiceType()
         .deleteServiceTypeByUDescrIdx(schema.getAuthorization(), Description);
     obj.forget(true);
   } else {
     ((ICFAccSchema) schema.getBackingStore())
         .getTableServiceType()
         .deleteServiceTypeByUDescrIdx(schema.getAuthorization(), Description);
   }
 }
 public ICFSecurityServiceTypeObj readServiceType(
     CFSecurityServiceTypePKey pkey, boolean forceRead) {
   ICFSecurityServiceTypeObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecurityServiceTypeBuff readBuff =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableServiceType()
             .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredServiceTypeId());
     if (readBuff != null) {
       obj = schema.getServiceTypeTableObj().newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecurityServiceTypeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
  public void forgetServiceType(ICFSecurityServiceTypeObj Obj, boolean forgetSubObjects) {
    ICFSecurityServiceTypeObj obj = Obj;
    CFSecurityServiceTypePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityServiceTypeObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByUDescrIdx != null) {
        CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
        keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription());
        indexByUDescrIdx.remove(keyUDescrIdx);
      }

      if (allServiceType != null) {
        allServiceType.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        ((ICFSecuritySchemaObj) schema)
            .getServiceTableObj()
            .forgetServiceByTypeIdx(keepObj.getRequiredServiceTypeId());
      }
    }
  }
 public List<ICFSecurityServiceTypeObj> readAllServiceType(boolean forceRead) {
   final String S_ProcName = "readAllServiceType";
   if ((allServiceType == null) || forceRead) {
     Map<CFSecurityServiceTypePKey, ICFSecurityServiceTypeObj> map =
         new HashMap<CFSecurityServiceTypePKey, ICFSecurityServiceTypeObj>();
     allServiceType = map;
     CFSecurityServiceTypeBuff[] buffList =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableServiceType()
             .readAllDerived(schema.getAuthorization());
     CFSecurityServiceTypeBuff buff;
     ICFSecurityServiceTypeObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey());
       obj.setBuff(buff);
       ICFSecurityServiceTypeObj realized = (ICFSecurityServiceTypeObj) obj.realize();
     }
   }
   Comparator<ICFSecurityServiceTypeObj> cmp =
       new Comparator<ICFSecurityServiceTypeObj>() {
         public int compare(ICFSecurityServiceTypeObj lhs, ICFSecurityServiceTypeObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecurityServiceTypePKey lhsPKey = lhs.getPKey();
             CFSecurityServiceTypePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allServiceType.size();
   ICFSecurityServiceTypeObj arr[] = new ICFSecurityServiceTypeObj[len];
   Iterator<ICFSecurityServiceTypeObj> valIter = allServiceType.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFSecurityServiceTypeObj> arrayList = new ArrayList<ICFSecurityServiceTypeObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecurityServiceTypeObj> sortedList = arrayList;
   return (sortedList);
 }
  public ICFSecurityServiceTypeObj realizeServiceType(ICFSecurityServiceTypeObj Obj) {
    ICFSecurityServiceTypeObj obj = Obj;
    CFSecurityServiceTypePKey pkey = obj.getPKey();
    ICFSecurityServiceTypeObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecurityServiceTypeObj existingObj = members.get(pkey);
      keepObj = existingObj;

      /*
       *	We always rebind the data because if we're being called, some index has
       *	been updated and is refreshing it's data, which may or may not have changed
       */

      // Detach object from alternate and duplicate indexes, leave PKey alone

      if (indexByUDescrIdx != null) {
        CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
        keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription());
        indexByUDescrIdx.remove(keyUDescrIdx);
      }

      keepObj.setBuff(Obj.getBuff());
      // Attach new object to alternate and duplicate indexes -- PKey stay stable

      if (indexByUDescrIdx != null) {
        CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
        keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription());
        indexByUDescrIdx.put(keyUDescrIdx, keepObj);
      }
      if (allServiceType != null) {
        allServiceType.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj.setIsNew(false);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allServiceType != null) {
        allServiceType.put(keepObj.getPKey(), keepObj);
      }

      if (indexByUDescrIdx != null) {
        CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
        keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription());
        indexByUDescrIdx.put(keyUDescrIdx, keepObj);
      }
    }
    return (keepObj);
  }