public void deleteReqMinMaxValueByUDescrIdx( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueByUDescrIdxKey argKey) { CFDbTestReqMinMaxValueBuff cur; LinkedList<CFDbTestReqMinMaxValueBuff> matchSet = new LinkedList<CFDbTestReqMinMaxValueBuff>(); Iterator<CFDbTestReqMinMaxValueBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestReqMinMaxValueBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteReqMinMaxValue(Authorization, cur); } }
public void updateReqMinMaxValue( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) { CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestReqMinMaxValueBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateReqMinMaxValue", "Existing record not found", "ReqMinMaxValue", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateReqMinMaxValue", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFDbTestReqMinMaxValueByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFDbTestReqMinMaxValueByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); CFDbTestReqMinMaxValueByTenantIdxKey existingKeyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFDbTestReqMinMaxValueByTenantIdxKey newKeyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateReqMinMaxValue", "ReqMinMaxValueUDescrIdx", newKeyUDescrIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateReqMinMaxValue", "Container", "Tenant", "Tenant", null); } } } // Update is valid Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new HashMap<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); }