public ListIterator<ICFLibAnyObj> enumerateDetails(MssCFGenContext genContext) { final String S_ProcName = "CFAsteriskMssCFIterateHostNodeConfFile.enumerateDetails() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext.getGenDef()"); } List<ICFLibAnyObj> list = new LinkedList<ICFLibAnyObj>(); if (genDef instanceof ICFAsteriskHostNodeObj) { Iterator<ICFAsteriskConfigurationFileObj> elements = ((ICFAsteriskHostNodeObj) genDef).getOptionalComponentsConfFile().iterator(); while (elements.hasNext()) { list.add(elements.next()); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.getGenDef()", genDef, "ICFAsteriskHostNodeObj"); } return (list.listIterator()); }
public void setSwingDataCollection(Collection<ICFInternetProjectBaseObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfProjectBase = new ICFInternetProjectBaseObj[0]; } else { int len = value.size(); arrayOfProjectBase = new ICFInternetProjectBaseObj[len]; Iterator<ICFInternetProjectBaseObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfProjectBase[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfProjectBase, compareProjectBaseByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
public CFSecurityTSecGroupBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_read_tsecgrp_all ?, ?, ?, ?, ?"; if (stmtReadAllBuff == null) { stmtReadAllBuff = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); resultSet = stmtReadAllBuff.executeQuery(); List<CFSecurityTSecGroupBuff> buffList = new LinkedList<CFSecurityTSecGroupBuff>(); while (resultSet.next()) { CFSecurityTSecGroupBuff buff = unpackTSecGroupResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFSecurityTSecGroupBuff[] retBuff = new CFSecurityTSecGroupBuff[buffList.size()]; Iterator<CFSecurityTSecGroupBuff> 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 CFSecurityAuditActionBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadAllBuff = null; try { CFSecurityAuditActionBuff buff = null; List<CFSecurityAuditActionBuff> buffList = new LinkedList<CFSecurityAuditActionBuff>(); stmtReadAllBuff = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;"); int argIdx = 1; stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadAllBuff.execute(); resultSet = (ResultSet) stmtReadAllBuff.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { buff = unpackAuditActionResultSetToBuff(resultSet); buffList.add(buff); } } catch (SQLException e) { // Oracle may return an invalid resultSet if the rowset is empty } } int idx = 0; CFSecurityAuditActionBuff[] retBuff = new CFSecurityAuditActionBuff[buffList.size()]; Iterator<CFSecurityAuditActionBuff> 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; } if (stmtReadAllBuff != null) { try { stmtReadAllBuff.close(); } catch (SQLException e) { } stmtReadAllBuff = null; } } }
public void startElement( String uri, String localName, String qName, Attributes attrs ) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrMajorId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals( "RqstMinorVersionReadByMajorIdx" ); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler)getParser(); if( xmsgRqstHandler == null ) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(), S_ProcName, 0, "getParser()" ); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if( schemaObj == null ) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(), S_ProcName, 0, "getParser().getSchemaObj()" ); } // Extract Attributes numAttrs = attrs.getLength(); for( idxAttr = 0; idxAttr < numAttrs; idxAttr++ ) { attrLocalName = attrs.getLocalName( idxAttr ); if( attrLocalName.equals( "Id" ) ) { if( attrId != null ) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName ); } attrId = attrs.getValue( idxAttr ); } else if( attrLocalName.equals( "TenantId" ) ) { if( attrTenantId != null ) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName ); } attrTenantId = attrs.getValue( idxAttr ); } else if( attrLocalName.equals( "MajorId" ) ) { if( attrMajorId != null ) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName ); } attrMajorId = attrs.getValue( idxAttr ); } else if( attrLocalName.equals( "schemaLocation" ) ) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName ); } } // Ensure that required attributes have values if( ( attrTenantId == null ) || ( attrTenantId.length() <= 0 ) ) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(), S_ProcName, 0, "TenantId" ); } if( ( attrMajorId == null ) || ( attrMajorId.length() <= 0 ) ) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(), S_ProcName, 0, "MajorId" ); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong( attrTenantId ); long natMajorId; natMajorId = Long.parseLong( attrMajorId ); // Read the objects List<ICFInternetMinorVersionObj> list = schemaObj.getMinorVersionTableObj().readMinorVersionByMajorIdx( natTenantId, natMajorId ); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnListOpenTag(); xmsgRqstHandler.appendResponse( responseOpening ); Iterator<ICFInternetMinorVersionObj> iter = list.iterator(); ICFInternetMinorVersionObj cur; String subxml; while( iter.hasNext() ) { cur = iter.next(); subxml = CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnDerivedRec( "\n\t\t", cur.getMinorVersionBuff() ); xmsgRqstHandler.appendResponse( subxml ); } String responseClosing = "\n" + "\t" + CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse( responseClosing ); } catch( RuntimeException e ) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler)getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException( "\n\t\t\t", e ) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse( response ); xmsgRqstHandler.setCaughtException( true ); } catch( Error e ) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler)getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException( "\n\t\t\t", e ) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse( response ); xmsgRqstHandler.setCaughtException( true ); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOCountryCurrencyReadAll"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Read the objects and prepare the response XML List<ICFSecurityISOCountryCurrencyObj> list = schemaObj.getISOCountryCurrencyTableObj().readAllISOCountryCurrency(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgISOCountryCurrencyMessageFormatter .formatISOCountryCurrencyRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecurityISOCountryCurrencyObj> iter = list.iterator(); ICFSecurityISOCountryCurrencyObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAsteriskXMsgISOCountryCurrencyMessageFormatter.formatISOCountryCurrencyRspnDerivedRec( "\n\t\t", cur.getISOCountryCurrencyBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAsteriskXMsgISOCountryCurrencyMessageFormatter .formatISOCountryCurrencyRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }