Java tutorial
// Description: Java 7 XMsg Client DbIO implementation for SecGroup. /* * CF Customer Relations Management model * * Copyright (c) 2010-2014 Mark Sobkow * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgClient; import java.math.*; import java.sql.*; import java.text.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.*; import net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmObj.*; import net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsg.*; import net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.*; /* * CFCrmXMsgClientSecGroupTable XMsg Client DbIO implementation * for SecGroup. */ public class CFCrmXMsgClientSecGroupTable implements ICFCrmSecGroupTable { private CFCrmXMsgClientSchema schema; public CFCrmXMsgClientSecGroupTable(CFCrmXMsgClientSchema argSchema) { schema = argSchema; } public void createSecGroup(CFCrmAuthorization Authorization, CFCrmSecGroupBuff Buff) { final String S_ProcName = "createSecGroup"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstCreate("\n\t\t\t", Buff) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { Buff.set(realized.getSecGroupBuff()); } } else { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getLastObjectProcessed()"); } } public CFCrmSecGroupBuff readDerived(CFCrmAuthorization Authorization, CFCrmSecGroupPKey PKey) { final String S_ProcName = "readDerived"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstRead("\n\t\t\t", PKey) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFCrmSecGroupBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { buff = realized.getSecGroupBuff(); } } return (buff); } public CFCrmSecGroupBuff lockDerived(CFCrmAuthorization Authorization, CFCrmSecGroupPKey PKey) { final String S_ProcName = "lockDerived"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstLock("\n\t\t\t", PKey) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFCrmSecGroupBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { buff = realized.getSecGroupBuff(); } } return (buff); } public CFCrmSecGroupBuff[] readAllDerived(CFCrmAuthorization Authorization) { final String S_ProcName = "readAllDerived"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstReadAll("\n\t\t\t") + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj> sortedMap = (SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj>) sortedMapObj; int sz = sortedMap.size(); CFCrmSecGroupBuff arr[] = new CFCrmSecGroupBuff[sz]; Iterator<ICFCrmSecGroupObj> iter = sortedMap.values().iterator(); ICFCrmSecGroupObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFCrmSecGroupObj) iter.next(); arr[idx] = cur.getSecGroupBuff(); } return (arr); } public CFCrmSecGroupBuff readDerivedByIdIdx(CFCrmAuthorization Authorization, long argClusterId, int argSecGroupId) { final String S_ProcName = "readDerivedByIdIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstReadByIdIdx("\n\t\t\t", argClusterId, argSecGroupId) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFCrmSecGroupBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { buff = realized.getSecGroupBuff(); } } return (buff); } public CFCrmSecGroupBuff[] readDerivedByClusterIdx(CFCrmAuthorization Authorization, long argClusterId) { final String S_ProcName = "readDerivedByClusterIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstReadByClusterIdx("\n\t\t\t", argClusterId) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj> sortedMap = (SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj>) sortedMapObj; int sz = sortedMap.size(); CFCrmSecGroupBuff arr[] = new CFCrmSecGroupBuff[sz]; Iterator<ICFCrmSecGroupObj> iter = sortedMap.values().iterator(); ICFCrmSecGroupObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFCrmSecGroupObj) iter.next(); arr[idx] = cur.getSecGroupBuff(); } return (arr); } public CFCrmSecGroupBuff readDerivedByUNameIdx(CFCrmAuthorization Authorization, long argClusterId, String argName) { final String S_ProcName = "readDerivedByUNameIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstReadByUNameIdx("\n\t\t\t", argClusterId, argName) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFCrmSecGroupBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { buff = realized.getSecGroupBuff(); } } return (buff); } public CFCrmSecGroupBuff readBuff(CFCrmAuthorization Authorization, CFCrmSecGroupPKey PKey) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "readBuff"); } public CFCrmSecGroupBuff lockBuff(CFCrmAuthorization Authorization, CFCrmSecGroupPKey PKey) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "lockBuff"); } public CFCrmSecGroupBuff[] readAllBuff(CFCrmAuthorization Authorization) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "readAllBuff"); } public CFCrmSecGroupBuff readBuffByIdIdx(CFCrmAuthorization Authorization, long argClusterId, int argSecGroupId) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "readBuffByIdIdx"); } public CFCrmSecGroupBuff[] readBuffByClusterIdx(CFCrmAuthorization Authorization, long argClusterId) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "readBuffByClusterIdx"); } public CFCrmSecGroupBuff readBuffByUNameIdx(CFCrmAuthorization Authorization, long argClusterId, String argName) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "readBuffByUNameIdx"); } public void updateSecGroup(CFCrmAuthorization Authorization, CFCrmSecGroupBuff Buff) { final String S_ProcName = "updateSecGroup"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstUpdate("\n\t\t\t", Buff) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFCrmSecGroupBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFCrmSecGroupObj realized = null; if (lastObjectProcessed instanceof ICFCrmSecGroupObj) { realized = (ICFCrmSecGroupObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFCrmSecGroupObj"); } if (realized != null) { buff = realized.getSecGroupBuff(); } } if (buff != null) { Buff.set(buff); } } public void deleteSecGroup(CFCrmAuthorization Authorization, CFCrmSecGroupBuff Buff) { final String S_ProcName = "deleteSecGroup"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstDelete("\n\t\t\t", Buff) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } boolean deleted = responseHandler.getDeleted(); if (!deleted) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Server did not respond with a Deleted message"); } } public void deleteSecGroupByIdIdx(CFCrmAuthorization Authorization, long argClusterId, int argSecGroupId) { final String S_ProcName = "deleteSecGroupByIdIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstDeleteByIdIdx("\n\t\t\t", argClusterId, argSecGroupId) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } boolean deleted = responseHandler.getDeleted(); if (!deleted) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Server did not respond with a Deleted message"); } } public void deleteSecGroupByIdIdx(CFCrmAuthorization Authorization, CFCrmSecGroupPKey argKey) { deleteSecGroupByIdIdx(Authorization, argKey.getRequiredClusterId(), argKey.getRequiredSecGroupId()); } public void deleteSecGroupByClusterIdx(CFCrmAuthorization Authorization, long argClusterId) { final String S_ProcName = "deleteSecGroupByClusterIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstDeleteByClusterIdx("\n\t\t\t", argClusterId) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } boolean deleted = responseHandler.getDeleted(); if (!deleted) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Server did not respond with a Deleted message"); } } public void deleteSecGroupByClusterIdx(CFCrmAuthorization Authorization, CFCrmSecGroupByClusterIdxKey argKey) { deleteSecGroupByClusterIdx(Authorization, argKey.getRequiredClusterId()); } public void deleteSecGroupByUNameIdx(CFCrmAuthorization Authorization, long argClusterId, String argName) { final String S_ProcName = "deleteSecGroupByUNameIdx"; String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstDeleteByUNameIdx("\n\t\t\t", argClusterId, argName) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } boolean deleted = responseHandler.getDeleted(); if (!deleted) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Server did not respond with a Deleted message"); } } public void deleteSecGroupByUNameIdx(CFCrmAuthorization Authorization, CFCrmSecGroupByUNameIdxKey argKey) { deleteSecGroupByUNameIdx(Authorization, argKey.getRequiredClusterId(), argKey.getRequiredName()); } public CFCrmCursor openSecGroupCursorAll(CFCrmAuthorization Authorization) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "openSecGroupCursorAll"); } public CFCrmCursor openSecGroupCursorByClusterIdx(CFCrmAuthorization Authorization, long argClusterId) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "openSecGroupCursorByClusterIdx"); } public void closeSecGroupCursor(CFCrmCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "closeSecGroupCursor"); } public CFCrmSecGroupBuff nextSecGroupCursor(CFCrmCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "next$Tablename$Cursor"); } public CFCrmSecGroupBuff prevSecGroupCursor(CFCrmCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "prevSecGroupCursor"); } public CFCrmSecGroupBuff firstSecGroupCursor(CFCrmCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "firstSecGroupCursor"); } public CFCrmSecGroupBuff lastSecGroupCursor(CFCrmCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "lastSecGroupCursor"); } public CFCrmSecGroupBuff nthSecGroupCursor(CFCrmCursor Cursor, int Idx) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nthSecGroupCursor"); } /** * Release the prepared statements. * <p> * When the schema changes connections, the prepared statements * have to be released because they contain connection-specific * information for most databases. */ public void releasePreparedStatements() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "releasePreparedStatements"); } }