public void deleteNumberDefByNextIdx( CFSecurityAuthorization Authorization, CFDbTestValueByNextIdxKey argKey) { final String S_ProcName = "deleteNumberDefByNextIdx"; CFDbTestNumberDefBuff cur; LinkedList<CFDbTestNumberDefBuff> matchSet = new LinkedList<CFDbTestNumberDefBuff>(); Iterator<CFDbTestNumberDefBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestNumberDefBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); String subClassCode = cur.getClassCode(); if ("NUMD".equals(subClassCode)) { schema.getTableNumberDef().deleteNumberDef(Authorization, cur); } else if ("NUMC".equals(subClassCode)) { schema.getTableNumberCol().deleteNumberCol(Authorization, (CFDbTestNumberColBuff) cur); } else if ("NUMT".equals(subClassCode)) { schema.getTableNumberType().deleteNumberType(Authorization, (CFDbTestNumberTypeBuff) cur); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "subClassCode", cur, "Instance of or subclass of NumberDef must not be \"" + subClassCode + "\""); } } }
public void deleteNumberDefByNextIdx( CFSecurityAuthorization Authorization, Long argNextTenantId, Long argNextId) { CFDbTestValueByNextIdxKey key = schema.getFactoryValue().newNextIdxKey(); key.setOptionalNextTenantId(argNextTenantId); key.setOptionalNextId(argNextId); deleteNumberDefByNextIdx(Authorization, key); }
public void deleteNumberDefByScopeIdx( CFSecurityAuthorization Authorization, long argTenantId, long argScopeId) { CFDbTestValueByScopeIdxKey key = schema.getFactoryValue().newScopeIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredScopeId(argScopeId); deleteNumberDefByScopeIdx(Authorization, key); }
public void deleteReqMinMaxValueByIdIdx( CFSecurityAuthorization Authorization, long argTenantId, long argId) { CFDbTestReqMinMaxValuePKey key = schema.getFactoryReqMinMaxValue().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteReqMinMaxValueByIdIdx(Authorization, key); }
public void deleteReqMinMaxValueByUDescrIdx( CFSecurityAuthorization Authorization, long argTenantId, String argDescription) { CFDbTestReqMinMaxValueByUDescrIdxKey key = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredDescription(argDescription); deleteReqMinMaxValueByUDescrIdx(Authorization, key); }
public void deleteNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { final String S_ProcName = "CFDbTestRamNumberDefTable.deleteNumberDef() "; CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestNumberDefBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteNumberDef", pkey); } // Validate reverse foreign keys if (schema .getTableNumberCol() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberCol", pkey); } if (schema .getTableNumberType() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberType", pkey); } // Delete is valid Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict; dictByPKey.remove(pkey); schema.getTableAtom().deleteAtom(Authorization, Buff); }
public CFDbTestNumberDefBuff readDerivedByUNameIdx( CFSecurityAuthorization Authorization, long TenantId, long ScopeId, String Name) { final String S_ProcName = "CFDbTestRamValue.readDerivedByUNameIdx"; CFDbTestValueBuff buff = schema.getTableValue().readDerivedByUNameIdx(Authorization, TenantId, ScopeId, Name); if (buff == null) { return (null); } else if (buff instanceof CFDbTestNumberDefBuff) { return ((CFDbTestNumberDefBuff) buff); } else { return (null); } }
public void updateNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { schema.getTableAtom().updateAtom(Authorization, Buff); CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestNumberDefBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateNumberDef", "Existing record not found", "NumberDef", pkey); } // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateNumberDef", "Superclass", "SuperClass", "Atom", null); } } } // Update is valid Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); }
public CFDbTestReqMinMaxValueBuff lockDerived( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValuePKey PKey) { final String S_ProcName = "CFDbTestRamReqMinMaxValue.readDerived"; CFDbTestReqMinMaxValuePKey key = schema.getFactoryReqMinMaxValue().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFDbTestReqMinMaxValueBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); }
public void createNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { final String S_ProcName = "createNumberDef"; schema.getTableAtom().createAtom(Authorization, Buff); CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Superclass", "SuperClass", "Atom", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); }
public CFDbTestNumberDefBuff readDerivedByIdIdx( CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFDbTestRamValue.readDerivedByIdIdx() "; CFDbTestValuePKey key = schema.getFactoryValue().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFDbTestNumberDefBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); }
public void deleteReqMinMaxValue( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) { final String S_ProcName = "CFDbTestRamReqMinMaxValueTable.deleteReqMinMaxValue() "; CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestReqMinMaxValueBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteReqMinMaxValue", pkey); } CFDbTestReqMinMaxValueByUDescrIdxKey keyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFDbTestReqMinMaxValueByTenantIdxKey keyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); // Validate reverse foreign keys // Delete is valid Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdict; dictByPKey.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); }
public CFDbTestReqMinMaxValueBuff readDerivedByUDescrIdx( CFSecurityAuthorization Authorization, long TenantId, String Description) { final String S_ProcName = "CFDbTestRamReqMinMaxValue.readDerivedByUDescrIdx"; CFDbTestReqMinMaxValueByUDescrIdxKey key = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredDescription(Description); CFDbTestReqMinMaxValueBuff buff; if (dictByUDescrIdx.containsKey(key)) { buff = dictByUDescrIdx.get(key); } else { buff = null; } return (buff); }
public CFSecurityCursor openReqMinMaxValueCursorByTenantIdx( CFSecurityAuthorization Authorization, long TenantId) { CFSecurityCursor cursor; CFDbTestReqMinMaxValueByTenantIdxKey key = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (dictByTenantIdx.containsKey(key)) { Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdictTenantIdx = dictByTenantIdx.get(key); cursor = new CFDbTestRamReqMinMaxValueCursor(Authorization, schema, subdictTenantIdx.values()); } else { cursor = new CFDbTestRamReqMinMaxValueCursor( Authorization, schema, new ArrayList<CFDbTestReqMinMaxValueBuff>()); } return (cursor); }
public CFDbTestNumberDefBuff[] readDerivedByNextIdx( CFSecurityAuthorization Authorization, Long NextTenantId, Long NextId) { final String S_ProcName = "CFDbTestRamValue.readDerivedByNextIdx"; CFDbTestValueBuff buffList[] = schema.getTableValue().readDerivedByNextIdx(Authorization, NextTenantId, NextId); if (buffList == null) { return (null); } else { CFDbTestValueBuff buff; ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFDbTestNumberDefBuff)) { filteredList.add((CFDbTestNumberDefBuff) buff); } } return (filteredList.toArray(new CFDbTestNumberDefBuff[0])); } }
public CFDbTestReqMinMaxValueBuff[] readDerivedByTenantIdx( CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFDbTestRamReqMinMaxValue.readDerivedByTenantIdx"; CFDbTestReqMinMaxValueByTenantIdxKey key = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); key.setRequiredTenantId(TenantId); CFDbTestReqMinMaxValueBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdictTenantIdx = dictByTenantIdx.get(key); recArray = new CFDbTestReqMinMaxValueBuff[subdictTenantIdx.size()]; Iterator<CFDbTestReqMinMaxValueBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdictTenantIdx = new HashMap<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff>(); dictByTenantIdx.put(key, subdictTenantIdx); recArray = new CFDbTestReqMinMaxValueBuff[0]; } return (recArray); }
public void createReqMinMaxValue( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) { final String S_ProcName = "createReqMinMaxValue"; CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId( ((CFDbTestRamTenantTable) schema.getTableTenant()) .nextReqMinMaxValueIdGen(Authorization, Buff.getRequiredTenantId())); Buff.setRequiredTenantId(pkey.getRequiredTenantId()); Buff.setRequiredId(pkey.getRequiredId()); CFDbTestReqMinMaxValueByUDescrIdxKey keyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); CFDbTestReqMinMaxValueByTenantIdxKey keyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUDescrIdx.containsKey(keyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ReqMinMaxValueUDescrIdx", keyUDescrIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "Tenant", "Tenant", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUDescrIdx.put(keyUDescrIdx, Buff); Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdictTenantIdx; if (dictByTenantIdx.containsKey(keyTenantIdx)) { subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx); } else { subdictTenantIdx = new HashMap<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff>(); dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx); } subdictTenantIdx.put(pkey, Buff); }
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); }