public static String formatSecFormBuffAttributes(String separator, CFSecuritySecFormBuff buff) { String retval = CFDbTestXMsgSecFormMessageFormatter.formatSecFormPKeyAttributes(separator, buff) + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision()) + CFLibXmlUtil.formatOptionalUuid(separator, "CreatedBy", buff.getCreatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "CreatedAt", buff.getCreatedAt()) + CFLibXmlUtil.formatOptionalUuid(separator, "UpdatedBy", buff.getUpdatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "UpdatedAt", buff.getUpdatedAt()) + CFLibXmlUtil.formatRequiredInt32(separator, "SecAppId", buff.getRequiredSecAppId()) + CFLibXmlUtil.formatRequiredXmlString( separator, "JEEServletMapName", buff.getRequiredJEEServletMapName()); return (retval); }
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(); final String sql = "CALL 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; } } }