public static String formatSecGroupRqstDelete(String separator, CFSecuritySecGroupBuff buff) { String retval = "<RqstSecGroupDelete " + formatSecGroupPKeyAttributes(separator, buff) + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision()) + " />"; return (retval); }
public static String formatSecGroupBuffAttributes(String separator, CFSecuritySecGroupBuff buff) { String retval = CFAsteriskXMsgSecGroupMessageFormatter.formatSecGroupPKeyAttributes(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.formatRequiredXmlString(separator, "Name", buff.getRequiredName()) + CFLibXmlUtil.formatRequiredBoolean( separator, "IsVisible", buff.getRequiredIsVisible()); return (retval); }
public void deleteSecGroup(CFSecurityAuthorization Authorization, CFSecuritySecGroupBuff Buff) { final String S_ProcName = "deleteSecGroup"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecGroupId = Buff.getRequiredSecGroupId(); stmtDeleteByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".dl_secgrp( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;"); 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++, SecGroupId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
public void updateSecGroup(CFSecurityAuthorization Authorization, CFSecuritySecGroupBuff Buff) { final String S_ProcName = "updateSecGroup"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFSecuritySecGroupBuff> buffList = new LinkedList<CFSecuritySecGroupBuff>(); try { long ClusterId = Buff.getRequiredClusterId(); int SecGroupId = Buff.getRequiredSecGroupId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".upd_secgrp( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;"); int argIdx = 1; stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, "SGRP"); stmtUpdateByPKey.setLong(argIdx++, ClusterId); stmtUpdateByPKey.setInt(argIdx++, SecGroupId); stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFSecuritySecGroupBuff updatedBuff = unpackSecGroupResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredName(updatedBuff.getRequiredName()); 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() .newRuntimeException( getClass(), S_ProcName, "upd_secgrp() did not return a valid result cursor"); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "upd_secgrp() did not return a result cursor"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } } }