public void deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "deleteSecForm"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long ClusterId = Buff.getRequiredClusterId(); int SecFormId = Buff.getRequiredSecFormId(); final String sql = "CALL sp_delete_secform( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setLong(argIdx++, ClusterId); stmtDeleteByPKey.setInt(argIdx++, SecFormId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; resultSet = stmtDeleteByPKey.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "CFInternetRamSecFormTable.deleteSecForm() "; CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFSecuritySecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); }
public void deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "deleteSecForm"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long ClusterId = Buff.getRequiredClusterId(); int SecFormId = Buff.getRequiredSecFormId(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_secform( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setLong(argIdx++, ClusterId); stmtDeleteByPKey.setInt(argIdx++, SecFormId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "deleteSecForm"; try { Connection cnx = schema.getCnx(); long ClusterId = Buff.getRequiredClusterId(); int SecFormId = Buff.getRequiredSecFormId(); String sql = "exec sp_delete_secform ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setLong(argIdx++, ClusterId); stmtDeleteByPKey.setInt(argIdx++, SecFormId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; Object stuff = null; boolean moreResults = stmtDeleteByPKey.execute(); while (stuff == null) { try { moreResults = stmtDeleteByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { stuff = stmtDeleteByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtDeleteByPKey.getUpdateCount()) { break; } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
public void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "updateSecForm"; if ("SFRM".equals(Buff.getClassCode()) && (!schema.isClusterUser(Authorization, Buff.getRequiredClusterId(), "UpdateSecForm"))) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Permission denied -- User not part of SecGroup UpdateSecForm"); } ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecFormId = Buff.getRequiredSecFormId(); int SecAppId = Buff.getRequiredSecAppId(); String JEEServletMapName = Buff.getRequiredJEEServletMapName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_secform( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "SFRM"); stmtUpdateByPKey.setLong(argIdx++, ClusterId); stmtUpdateByPKey.setInt(argIdx++, SecFormId); stmtUpdateByPKey.setInt(argIdx++, SecAppId); stmtUpdateByPKey.setString(argIdx++, JEEServletMapName); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFSecuritySecFormBuff updatedBuff = unpackSecFormResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredSecAppId(updatedBuff.getRequiredSecAppId()); Buff.setRequiredJEEServletMapName(updatedBuff.getRequiredJEEServletMapName()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void createSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "createSecForm"; CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId( ((CFInternetRamClusterTable) schema.getTableCluster()) .nextSecFormIdGen(Authorization, Buff.getRequiredClusterId())); Buff.setRequiredClusterId(pkey.getRequiredClusterId()); Buff.setRequiredSecFormId(pkey.getRequiredSecFormId()); CFSecuritySecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUJEEServletIdx.containsKey(keyUJEEServletIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "SecFormUJEEServletIdx", keyUJEEServletIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Owner", "SecFormCluster", "Cluster", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableSecApp() .readDerivedByIdIdx( Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "SecFormApplication", "SecApp", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdictClusterIdx; if (dictByClusterIdx.containsKey(keyClusterIdx)) { subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx); } else { subdictClusterIdx = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx); } subdictClusterIdx.put(pkey, Buff); Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdictSecAppIdx; if (dictBySecAppIdx.containsKey(keySecAppIdx)) { subdictSecAppIdx = dictBySecAppIdx.get(keySecAppIdx); } else { subdictSecAppIdx = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictBySecAppIdx.put(keySecAppIdx, subdictSecAppIdx); } subdictSecAppIdx.put(pkey, Buff); dictByUJEEServletIdx.put(keyUJEEServletIdx, Buff); }
public void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateSecForm", "Existing record not found", "SecForm", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateSecForm", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecuritySecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); CFSecuritySecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName()); // Check unique indexes if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) { if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateSecForm", "Owner", "SecFormCluster", "Cluster", null); } } } { boolean allNull = true; if (allNull) { if (null == schema .getTableSecApp() .readDerivedByIdIdx( Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateSecForm", "Container", "SecFormApplication", "SecApp", null); } } } // Update is valid Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByClusterIdx.get(existingKeyClusterIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByClusterIdx.containsKey(newKeyClusterIdx)) { subdict = dictByClusterIdx.get(newKeyClusterIdx); } else { subdict = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySecAppIdx.get(existingKeySecAppIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) { subdict = dictBySecAppIdx.get(newKeySecAppIdx); } else { subdict = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictBySecAppIdx.put(newKeySecAppIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx); dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff); }
public void createSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "createSecForm"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecAppId = Buff.getRequiredSecAppId(); String JEEServletMapName = Buff.getRequiredJEEServletMapName(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_secform ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "SFRM"); stmtCreateByPKey.setLong(argIdx++, ClusterId); stmtCreateByPKey.setInt(argIdx++, SecAppId); stmtCreateByPKey.setString(argIdx++, JEEServletMapName); resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFSecuritySecFormBuff createdBuff = unpackSecFormResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredClusterId(createdBuff.getRequiredClusterId()); Buff.setRequiredSecFormId(createdBuff.getRequiredSecFormId()); Buff.setRequiredSecAppId(createdBuff.getRequiredSecAppId()); Buff.setRequiredJEEServletMapName(createdBuff.getRequiredJEEServletMapName()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void copyBuffToPKey() { getPKey().setRequiredClusterId(buff.getRequiredClusterId()); getPKey().setRequiredSecFormId(buff.getRequiredSecFormId()); }
public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFSecuritySecFormHPKey) { CFSecuritySecFormHPKey rhs = (CFSecuritySecFormHPKey) obj; { long lhsClusterId = getAuditClusterId(); long rhsClusterId = rhs.getAuditClusterId(); if (lhsClusterId != rhsClusterId) { return (false); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp != null) { if (rhsAuditStamp != null) { if (!lhsAuditStamp.equals(rhsAuditStamp)) { return (false); } } else { return (false); } } else { return (false); } } { short lhsActionId = getAuditActionId(); short rhsActionId = rhs.getAuditActionId(); if (lhsActionId != rhsActionId) { return (false); } } { int lhsRevision = getRequiredRevision(); int rhsRevision = rhs.getRequiredRevision(); if (lhsRevision != rhsRevision) { return (false); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId != null) { if (rhsAuditSessionId != null) { if (!lhsAuditSessionId.equals(rhsAuditSessionId)) { return (false); } } else { return (false); } } else { return (false); } } if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredSecFormId() != rhs.getRequiredSecFormId()) { return (false); } return (true); } else if (obj instanceof CFSecurityHPKey) { CFSecurityHPKey rhs = (CFSecurityHPKey) obj; { long lhsClusterId = getAuditClusterId(); long rhsClusterId = rhs.getAuditClusterId(); if (lhsClusterId != rhsClusterId) { return (false); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp != null) { if (rhsAuditStamp != null) { if (!lhsAuditStamp.equals(rhsAuditStamp)) { return (false); } } else { return (false); } } else { return (false); } } { short lhsActionId = getAuditActionId(); short rhsActionId = rhs.getAuditActionId(); if (lhsActionId != rhsActionId) { return (false); } } { int lhsRevision = getRequiredRevision(); int rhsRevision = rhs.getRequiredRevision(); if (lhsRevision != rhsRevision) { return (false); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId != null) { if (rhsAuditSessionId != null) { if (!lhsAuditSessionId.equals(rhsAuditSessionId)) { return (false); } } else { return (false); } } else { return (false); } } return (true); } else if (obj instanceof CFSecuritySecFormPKey) { CFSecuritySecFormPKey rhs = (CFSecuritySecFormPKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredSecFormId() != rhs.getRequiredSecFormId()) { return (false); } return (true); } else if (obj instanceof CFSecuritySecFormHBuff) { CFSecuritySecFormHBuff rhs = (CFSecuritySecFormHBuff) obj; { long lhsClusterId = getAuditClusterId(); long rhsClusterId = rhs.getAuditClusterId(); if (lhsClusterId != rhsClusterId) { return (false); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp != null) { if (rhsAuditStamp != null) { if (!lhsAuditStamp.equals(rhsAuditStamp)) { return (false); } } else { return (false); } } else { return (false); } } { short lhsActionId = getAuditActionId(); short rhsActionId = rhs.getAuditActionId(); if (lhsActionId != rhsActionId) { return (false); } } { int lhsRevision = getRequiredRevision(); int rhsRevision = rhs.getRequiredRevision(); if (lhsRevision != rhsRevision) { return (false); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId != null) { if (rhsAuditSessionId != null) { if (!lhsAuditSessionId.equals(rhsAuditSessionId)) { return (false); } } else { return (false); } } else { return (false); } } if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredSecFormId() != rhs.getRequiredSecFormId()) { return (false); } if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredSecFormId() != rhs.getRequiredSecFormId()) { return (false); } return (true); } else if (obj instanceof CFSecuritySecFormBuff) { CFSecuritySecFormBuff rhs = (CFSecuritySecFormBuff) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredSecFormId() != rhs.getRequiredSecFormId()) { return (false); } return (true); } else { return (false); } }
public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFSecuritySecFormHBuff) { CFSecuritySecFormHBuff rhs = (CFSecuritySecFormHBuff) obj; int retval = 0; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredSecFormId() < rhs.getRequiredSecFormId()) { return (-1); } else if (getRequiredSecFormId() > rhs.getRequiredSecFormId()) { return (1); } return (0); } else if (obj instanceof CFSecuritySecFormHPKey) { CFSecuritySecFormHPKey rhs = (CFSecuritySecFormHPKey) obj; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredSecFormId() < rhs.getRequiredSecFormId()) { return (-1); } else if (getRequiredSecFormId() > rhs.getRequiredSecFormId()) { return (1); } return (0); } else if (obj instanceof CFSecurityHPKey) { CFSecurityHPKey rhs = (CFSecurityHPKey) obj; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } return (0); } else if (obj instanceof CFSecuritySecFormPKey) { CFSecuritySecFormPKey rhs = (CFSecuritySecFormPKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredSecFormId() < rhs.getRequiredSecFormId()) { return (-1); } else if (getRequiredSecFormId() > rhs.getRequiredSecFormId()) { return (1); } return (0); } else if (obj instanceof CFSecuritySecFormBuff) { CFSecuritySecFormBuff rhs = (CFSecuritySecFormBuff) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredSecFormId() < rhs.getRequiredSecFormId()) { return (-1); } else if (getRequiredSecFormId() > rhs.getRequiredSecFormId()) { return (1); } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), "compareTo", "obj", obj, "CFSecuritySecFormHPKey, CFSecuritySecFormPKey, CFSecuritySecFormBuff"); } }
public static String formatSecFormPKeyAttributes(String separator, CFSecuritySecFormBuff buff) { String retval = CFLibXmlUtil.formatRequiredInt64(separator, "ClusterId", buff.getRequiredClusterId()) + CFLibXmlUtil.formatRequiredInt32(separator, "SecFormId", buff.getRequiredSecFormId()); return (retval); }
public void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "updateSecForm"; ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecFormId = Buff.getRequiredSecFormId(); int SecAppId = Buff.getRequiredSecAppId(); String JEEServletMapName = Buff.getRequiredJEEServletMapName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "exec sp_update_secform ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "SFRM"); stmtUpdateByPKey.setLong(argIdx++, ClusterId); stmtUpdateByPKey.setInt(argIdx++, SecFormId); stmtUpdateByPKey.setInt(argIdx++, SecAppId); stmtUpdateByPKey.setString(argIdx++, JEEServletMapName); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtUpdateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtUpdateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtUpdateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } if (resultSet.next()) { CFSecuritySecFormBuff updatedBuff = unpackSecFormResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredSecAppId(updatedBuff.getRequiredSecAppId()); Buff.setRequiredJEEServletMapName(updatedBuff.getRequiredJEEServletMapName()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }