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 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); }
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 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 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); }