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 createTenant(CFSecurityAuthorization Authorization, CFSecurityTenantBuff Buff) { final String S_ProcName = "createTenant"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); String TenantName = Buff.getRequiredTenantName(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_tenant ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"; 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++, "TENT"); stmtCreateByPKey.setLong(argIdx++, ClusterId); stmtCreateByPKey.setString(argIdx++, TenantName); resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFSecurityTenantBuff createdBuff = 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(createdBuff.getRequiredClusterId()); Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredTenantName(createdBuff.getRequiredTenantName()); 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 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); } }