public void setTenantBuff(CFSecurityTenantBuff src) { setRequiredId(src.getRequiredId()); setCreatedByUserId(src.getCreatedByUserId()); setCreatedAt(src.getCreatedAt()); setUpdatedByUserId(src.getUpdatedByUserId()); setUpdatedAt(src.getUpdatedAt()); setRequiredClusterId(src.getRequiredClusterId()); setRequiredTenantName(src.getRequiredTenantName()); setRequiredRevision(src.getRequiredRevision()); }
public void deleteTenant(CFSecurityAuthorization Authorization, CFSecurityTenantBuff Buff) { final String S_ProcName = "deleteTenant"; try { Connection cnx = schema.getCnx(); long Id = Buff.getRequiredId(); String sql = "exec sp_delete_tenant ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"; 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++, Id); 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 updateTenant(CFSecurityAuthorization Authorization, CFSecurityTenantBuff Buff) { final String S_ProcName = "updateTenant"; ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); long Id = Buff.getRequiredId(); String TenantName = Buff.getRequiredTenantName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "exec sp_update_tenant ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, "TENT"); stmtUpdateByPKey.setLong(argIdx++, ClusterId); stmtUpdateByPKey.setLong(argIdx++, Id); stmtUpdateByPKey.setString(argIdx++, TenantName); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFSecurityTenantBuff updatedBuff = unpackTenantResultSetToBuff(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(updatedBuff.getRequiredClusterId()); Buff.setRequiredTenantName(updatedBuff.getRequiredTenantName()); 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 int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFSecurityTenantBuff) { CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj; int retval = 0; { int cmp = getCreatedByUserId().compareTo(rhs.getCreatedByUserId()); if (cmp != 0) { return (cmp); } cmp = getCreatedAt().compareTo(rhs.getCreatedAt()); if (cmp != 0) { return (cmp); } cmp = getUpdatedByUserId().compareTo(rhs.getUpdatedByUserId()); if (cmp != 0) { return (cmp); } cmp = getUpdatedAt().compareTo(rhs.getUpdatedAt()); if (cmp != 0) { return (cmp); } } if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } { int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFSecurityTenantPKey) { CFSecurityTenantPKey rhs = (CFSecurityTenantPKey) obj; if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFSecurityTenantHPKey) { CFSecurityTenantHPKey rhs = (CFSecurityTenantHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFSecurityTenantHBuff) { CFSecurityTenantHBuff rhs = (CFSecurityTenantHBuff) obj; int retval = 0; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } { int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFSecurityTenantByClusterIdxKey) { CFSecurityTenantByClusterIdxKey rhs = (CFSecurityTenantByClusterIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } return (0); } else if (obj instanceof CFSecurityTenantByUNameIdxKey) { CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } { int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName()); if (cmp != 0) { return (cmp); } } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null); } }
public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFSecurityTenantBuff) { CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj; if (!getCreatedByUserId().equals(rhs.getCreatedByUserId())) { return (false); } if (!getCreatedAt().equals(rhs.getCreatedAt())) { return (false); } if (!getUpdatedByUserId().equals(rhs.getUpdatedByUserId())) { return (false); } if (!getUpdatedAt().equals(rhs.getUpdatedAt())) { return (false); } if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) { return (false); } return (true); } else if (obj instanceof CFSecurityTenantPKey) { CFSecurityTenantPKey rhs = (CFSecurityTenantPKey) obj; if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else if (obj instanceof CFSecurityTenantHBuff) { CFSecurityTenantHBuff rhs = (CFSecurityTenantHBuff) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) { return (false); } return (true); } else if (obj instanceof CFSecurityTenantHPKey) { CFSecurityTenantHPKey rhs = (CFSecurityTenantHPKey) obj; if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else if (obj instanceof CFSecurityTenantByClusterIdxKey) { CFSecurityTenantByClusterIdxKey rhs = (CFSecurityTenantByClusterIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } return (true); } else if (obj instanceof CFSecurityTenantByUNameIdxKey) { CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) { return (false); } return (true); } else { boolean retval = super.equals(obj); return (retval); } }