public CFSecurityHostNodeBuff lockBuff(
     CFSecurityAuthorization Authorization, CFSecurityHostNodePKey PKey) {
   final String S_ProcName = "lockBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     long ClusterId = PKey.getRequiredClusterId();
     long HostNodeId = PKey.getRequiredHostNodeId();
     String sql =
         "SELECT * FROM "
             + schema.getLowerDbSchemaName()
             + ".sp_lock_hostnode( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " )";
     if (stmtLockBuffByPKey == null) {
       stmtLockBuffByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtLockBuffByPKey.setLong(argIdx++, ClusterId);
     stmtLockBuffByPKey.setLong(argIdx++, HostNodeId);
     resultSet = stmtLockBuffByPKey.executeQuery();
     if (resultSet.next()) {
       CFSecurityHostNodeBuff buff = unpackHostNodeResultSetToBuff(resultSet);
       if (resultSet.next()) {
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response");
       }
       return (buff);
     } else {
       return (null);
     }
   } 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 deleteHostNodeByUDescrIdx(
     CFSecurityAuthorization Authorization, long argClusterId, String argDescription) {
   final String S_ProcName = "deleteHostNodeByUDescrIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "SELECT "
             + schema.getLowerDbSchemaName()
             + ".sp_delete_hostnode_by_udescridx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " ) as DeletedFlag";
     if (stmtDeleteByUDescrIdx == null) {
       stmtDeleteByUDescrIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtDeleteByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByUDescrIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtDeleteByUDescrIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtDeleteByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtDeleteByUDescrIdx.setLong(argIdx++, argClusterId);
     stmtDeleteByUDescrIdx.setString(argIdx++, argDescription);
     resultSet = stmtDeleteByUDescrIdx.executeQuery();
     if (resultSet.next()) {
       boolean deleteFlag = resultSet.getBoolean(1);
       if (resultSet.next()) {
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response");
       }
     } 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;
     }
   }
 }
  protected CFSecurityHostNodeBuff unpackHostNodeResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackHostNodeResultSetToBuff";
    int idxcol = 1;
    CFSecurityHostNodeBuff buff = schema.getFactoryHostNode().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFSecurityPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFSecurityPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredClusterId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredHostNodeId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredHostName(resultSet.getString(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
 public CFSecurityHostNodeBuff readBuffByHostNameIdx(
     CFSecurityAuthorization Authorization, long ClusterId, String HostName) {
   final String S_ProcName = "readBuffByHostNameIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "SELECT * FROM "
             + schema.getLowerDbSchemaName()
             + ".sp_read_hostnode_by_hostnameidx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " )";
     if (stmtReadBuffByHostNameIdx == null) {
       stmtReadBuffByHostNameIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByHostNameIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByHostNameIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByHostNameIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByHostNameIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByHostNameIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByHostNameIdx.setLong(argIdx++, ClusterId);
     stmtReadBuffByHostNameIdx.setString(argIdx++, HostName);
     resultSet = stmtReadBuffByHostNameIdx.executeQuery();
     if (resultSet.next()) {
       CFSecurityHostNodeBuff buff = unpackHostNodeResultSetToBuff(resultSet);
       if (resultSet.next()) {
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response");
       }
       return (buff);
     } else {
       return (null);
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFSecurityHostNodeBuff[] readBuffByClusterIdx(
     CFSecurityAuthorization Authorization, long ClusterId) {
   final String S_ProcName = "readBuffByClusterIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "SELECT * FROM "
             + schema.getLowerDbSchemaName()
             + ".sp_read_hostnode_by_clusteridx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + " )";
     if (stmtReadBuffByClusterIdx == null) {
       stmtReadBuffByClusterIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByClusterIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByClusterIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByClusterIdx.setLong(argIdx++, ClusterId);
     resultSet = stmtReadBuffByClusterIdx.executeQuery();
     List<CFSecurityHostNodeBuff> buffList = new LinkedList<CFSecurityHostNodeBuff>();
     while (resultSet.next()) {
       CFSecurityHostNodeBuff buff = unpackHostNodeResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFSecurityHostNodeBuff[] retBuff = new CFSecurityHostNodeBuff[buffList.size()];
     Iterator<CFSecurityHostNodeBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFSecurityHostNodeBuff[] readDerivedByClusterIdx(
     CFSecurityAuthorization Authorization, long ClusterId) {
   final String S_ProcName = "readDerivedByClusterIdx";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   CFSecurityHostNodeBuff[] buffList = readBuffByClusterIdx(Authorization, ClusterId);
   return (buffList);
 }
 public CFSecurityHostNodeBuff[] readAllDerived(CFSecurityAuthorization Authorization) {
   final String S_ProcName = "readAllDerived";
   CFSecurityHostNodeBuff[] buffArray;
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   buffArray = readAllBuff(Authorization);
   return (buffArray);
 }
 public CFSecurityHostNodeBuff readDerivedByHostNameIdx(
     CFSecurityAuthorization Authorization, long ClusterId, String HostName) {
   final String S_ProcName = "CFSecurityPgSqlHostNodeTable.readDerivedByHostNameIdx() ";
   CFSecurityHostNodeBuff buff;
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   buff = readBuffByHostNameIdx(Authorization, ClusterId, HostName);
   return (buff);
 }
 public String getSqlSelectHostNodeDistinctClassCode() {
   if (S_sqlSelectHostNodeDistinctClassCode == null) {
     S_sqlSelectHostNodeDistinctClassCode =
         "SELECT "
             + "DISTINCT hsnd.ClassCode "
             + "FROM "
             + schema.getLowerDbSchemaName()
             + ".HostNode AS hsnd ";
   }
   return (S_sqlSelectHostNodeDistinctClassCode);
 }
  public CFSecurityHostNodeBuff lockDerived(
      CFSecurityAuthorization Authorization, CFSecurityHostNodePKey PKey) {
    final String S_ProcName = "lockDerived";
    if (!schema.isTransactionOpen()) {
      throw CFLib.getDefaultExceptionFactory()
          .newUsageException(getClass(), S_ProcName, "Transaction not open");
    }
    CFSecurityHostNodeBuff buff;

    buff = lockBuff(Authorization, PKey);
    return (buff);
  }
 public CFSecurityCursor openHostNodeCursorAll(CFSecurityAuthorization Authorization) {
   String sql =
       getSqlSelectHostNodeBuff()
           + ((schema.isSystemUser(Authorization))
               ? ""
               : (" WHERE hsnd.ClusterId = " + Authorization.getSecClusterId()))
           + "ORDER BY "
           + "hsnd.ClusterId ASC"
           + ", "
           + "hsnd.HostNodeId ASC";
   CFSecurityCursor cursor = new CFSecurityPgSqlCursor(Authorization, schema, sql);
   return (cursor);
 }
 public String getSqlSelectHostNodeBuff() {
   if (S_sqlSelectHostNodeBuff == null) {
     S_sqlSelectHostNodeBuff =
         "SELECT "
             + "hsnd.ClusterId, "
             + "hsnd.HostNodeId, "
             + "hsnd.Description, "
             + "hsnd.HostName, "
             + "hsnd.Revision "
             + "FROM "
             + schema.getLowerDbSchemaName()
             + ".HostNode AS hsnd ";
   }
   return (S_sqlSelectHostNodeBuff);
 }
 public void updateHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) {
   final String S_ProcName = "updateHostNode";
   ResultSet resultSet = null;
   try {
     long ClusterId = Buff.getRequiredClusterId();
     long HostNodeId = Buff.getRequiredHostNodeId();
     String Description = Buff.getRequiredDescription();
     String HostName = Buff.getRequiredHostName();
     int Revision = Buff.getRequiredRevision();
     Connection cnx = schema.getCnx();
     String sql =
         "select * from "
             + schema.getLowerDbSchemaName()
             + ".sp_update_hostnode( ?, ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " )";
     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++, "HSND");
     stmtUpdateByPKey.setLong(argIdx++, ClusterId);
     stmtUpdateByPKey.setLong(argIdx++, HostNodeId);
     stmtUpdateByPKey.setString(argIdx++, Description);
     stmtUpdateByPKey.setString(argIdx++, HostName);
     stmtUpdateByPKey.setInt(argIdx++, Revision);
     resultSet = stmtUpdateByPKey.executeQuery();
     if (resultSet.next()) {
       CFSecurityHostNodeBuff updatedBuff = unpackHostNodeResultSetToBuff(resultSet);
       if (resultSet.next()) {
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response");
       }
       Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
       Buff.setRequiredHostName(updatedBuff.getRequiredHostName());
       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;
     }
   }
 }