List of usage examples for java.util ListIterator hasNext
boolean hasNext();
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlDomainBaseTable.java
public CFInternetDomainBaseBuff[] readDerivedByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w w w . ja v a2 s . c o m ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_bdomdef_cc_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadClassCodeByTenantIdx == null) { stmtReadClassCodeByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); resultSet = stmtReadClassCodeByTenantIdx.executeQuery(); if (resultSet != null) { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } List<CFInternetDomainBaseBuff> resultList = new LinkedList<CFInternetDomainBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BDOM")) { CFInternetDomainBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TDOM")) { CFInternetTopDomainBuff[] subList = schema.getTableTopDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("DOMN")) { CFInternetDomainBuff[] subList = schema.getTableDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("BPRJ")) { CFInternetProjectBaseBuff[] subList = schema.getTableProjectBase() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFInternetRealProjectBuff[] subList = schema.getTableRealProject() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFInternetTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFInternetSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFInternetVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFInternetMajorVersionBuff[] subList = schema.getTableMajorVersion() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFInternetMinorVersionBuff[] subList = schema.getTableMinorVersion() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFInternetDomainBaseBuff[] retBuff = new CFInternetDomainBaseBuff[resultList.size()]; Iterator<CFInternetDomainBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseDomainBaseTable.java
public CFAstDomainBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w.ja v a 2 s .c om*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_read_bdomdef_cc_by_tenantidx ?, ?, ?, ?, ?" + ", " + "?"; if (stmtReadClassCodeByTenantIdx == null) { stmtReadClassCodeByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); resultSet = stmtReadClassCodeByTenantIdx.executeQuery(); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } List<CFAstDomainBaseBuff> resultList = new LinkedList<CFAstDomainBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BDOM")) { CFAstDomainBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TDOM")) { CFAstTopDomainBuff[] subList = schema.getTableTopDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("DOMN")) { CFAstDomainBuff[] subList = schema.getTableDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("BPRJ")) { CFAstProjectBaseBuff[] subList = schema.getTableProjectBase().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFAstDomainBaseBuff[] retBuff = new CFAstDomainBaseBuff[resultList.size()]; Iterator<CFAstDomainBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlDomainBaseTable.java
public CFAccDomainBaseBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w ww . j a v a 2 s . co m ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_bdomdef_cc_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadClassCodeByTenantIdx == null) { stmtReadClassCodeByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); resultSet = stmtReadClassCodeByTenantIdx.executeQuery(); if (resultSet != null) { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } List<CFAccDomainBaseBuff> resultList = new LinkedList<CFAccDomainBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BDOM")) { CFAccDomainBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TDOM")) { CFAccTopDomainBuff[] subList = schema.getTableTopDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("DOMN")) { CFAccDomainBuff[] subList = schema.getTableDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("BPRJ")) { CFAccProjectBaseBuff[] subList = schema.getTableProjectBase().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFAccRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFAccTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFAccSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFAccVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFAccMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFAccMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFAccDomainBaseBuff[] retBuff = new CFAccDomainBaseBuff[resultList.size()]; Iterator<CFAccDomainBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlDomainBaseTable.java
public CFAstDomainBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w .ja v a 2s . c o m*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_bdomdef_cc_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadClassCodeByTenantIdx == null) { stmtReadClassCodeByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); resultSet = stmtReadClassCodeByTenantIdx.executeQuery(); if (resultSet != null) { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } List<CFAstDomainBaseBuff> resultList = new LinkedList<CFAstDomainBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BDOM")) { CFAstDomainBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TDOM")) { CFAstTopDomainBuff[] subList = schema.getTableTopDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("DOMN")) { CFAstDomainBuff[] subList = schema.getTableDomain().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("BPRJ")) { CFAstProjectBaseBuff[] subList = schema.getTableProjectBase().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFAstDomainBaseBuff[] retBuff = new CFAstDomainBaseBuff[resultList.size()]; Iterator<CFAstDomainBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:com.ephesoft.dcma.tablefinder.share.TableRowFinderUtility.java
/** * Get lines of the table area in a page. * /* w w w. j av a 2 s . co m*/ * @param searchTableConfigDataCarrier {@link SearchTableConfigDataCarrier} * @param lineDataCarrierList {@link List}<{@link LineDataCarrier}> * @param hocrPage {@link HocrPage} * @param lineDataCarrier {@link LineDataCarrier} Line data carrier that will have new selected spans. * @param tableBoundaryDataCarrier * @throws DCMAApplicationException */ private static void getTableLines(final SearchTableConfigDataCarrier searchTableConfigDataCarrier, List<LineDataCarrier> lineDataCarrierList, final HocrPage hocrPage, LineDataCarrier lineDataCarrier, TableBoundaryDataCarrier tableBoundaryDataCarrier) throws DCMAApplicationException { final String pageID = hocrPage.getPageID(); LOGGER.debug("HocrPage page ID : ", pageID); final Spans spans = hocrPage.getSpans(); final List<Span> linkedList = getSortedSpanList(spans); if (null == linkedList || linkedList.isEmpty()) { LOGGER.debug("Return linked list is null for the page id = ", pageID); } else { final ListIterator<Span> listItr = linkedList.listIterator(); if (null == listItr) { LOGGER.debug("Return list iterator is null for the page id = ", pageID); } else { final String startPattern = searchTableConfigDataCarrier.getStartPattern(); final float fuzzyMatchThresholdValue = searchTableConfigDataCarrier.getFuzzyMatchThresholdValue(); List<DataCarrier> startDataCarrier = tableBoundaryDataCarrier.getStartDataCarrier(); if (null == startDataCarrier) { while (listItr.hasNext()) { final Span span = listItr.next(); try { List<Span> spanList = lineDataCarrier.getSpanList(); if (spanList.isEmpty()) { spanList.add(span); } else { if (null != span) { if (isSameLineSpan(spanList, span)) { spanList.add(span); } else { lineDataCarrier = new LineDataCarrier(pageID); spanList = lineDataCarrier.getSpanList(); spanList.add(span); } } } final DataCarrier finalDataCarrier = PatternMatcherUtil.findFuzzyPattern( lineDataCarrier.getLineRowData(), startPattern, fuzzyMatchThresholdValue, spanList); if (null == finalDataCarrier) { startDataCarrier = findPattern(lineDataCarrier.getLineRowData(), startPattern, spanList); } else { startDataCarrier = new ArrayList<DataCarrier>(0); } if (null != startDataCarrier) { LOGGER.debug("Start pattern found for table where start pattern : ", startPattern); addLine(lineDataCarrierList, lineDataCarrier); break; } } catch (final Exception exception) { LOGGER.error(exception.getMessage(), exception); } } } if (startDataCarrier != null) { tableBoundaryDataCarrier.setStartDataCarrier(startDataCarrier); LOGGER.info("Finding end pattern."); while (listItr.hasNext()) { final Span span = listItr.next(); List<Span> spanList = lineDataCarrier.getSpanList(); if (spanList.isEmpty()) { spanList.add(span); } else { if (isSameLineSpan(spanList, span)) { spanList.add(span); } else { lineDataCarrier = new LineDataCarrier(pageID); addLine(lineDataCarrierList, lineDataCarrier); spanList = lineDataCarrier.getSpanList(); spanList.add(span); } } List<DataCarrier> endDataCarrier = null; final String endPattern = searchTableConfigDataCarrier.getEndPattern(); final DataCarrier finalDataCarrier = PatternMatcherUtil.findFuzzyPattern( lineDataCarrier.getLineRowData(), endPattern, fuzzyMatchThresholdValue, spanList); if (null == finalDataCarrier) { endDataCarrier = findPattern(lineDataCarrier.getLineRowData(), endPattern, lineDataCarrier.getSpanList()); } else { endDataCarrier = new ArrayList<DataCarrier>(0); } if (null != endDataCarrier) { LOGGER.debug("End pattern found for table where end pattern : ", endPattern); tableBoundaryDataCarrier.setEndDataCarrier(endDataCarrier); break; } } } else { LOGGER.debug("No start pattern found for table where start pattern : ", startPattern); } } } }
From source file:lob.VisualisationGUI.java
public void dumpData() throws FileNotFoundException, UnsupportedEncodingException { PrintWriter midPriceWriter = new PrintWriter("MidPrice.txt", "UTF-8"); ListIterator<Float> MLI = this.midPriceHistory.listIterator(); while (MLI.hasNext()) { midPriceWriter.println(MLI.next()); }/*from w w w .j a va 2s.c om*/ midPriceWriter.close(); PrintWriter volWriter = new PrintWriter("Volume.txt", "UTF-8"); ListIterator<Long> VLI = this.volHistory.listIterator(); while (VLI.hasNext()) { volWriter.println(VLI.next()); } volWriter.close(); }
From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java
/** * load( Transformer t ) now that the components have been initialized... *//* w ww . j a va 2s. co m*/ public boolean load(Connector c, Transformer t, boolean channelHasBeenChanged, boolean isResponse) { if (alertUnsupportedStepTypes(t)) { return false; } switchTab = false; lastSelectedIndex = 0; tabbedPane.setSelectedIndex(0); this.isResponse = isResponse; prevSelRow = -1; connector = c; transformer = t; channel = PlatformUI.MIRTH_FRAME.channelEditPanel.currentChannel; makeTransformerTable(); // add any existing steps to the model List<Step> list = transformer.getSteps(); ListIterator<Step> li = list.listIterator(); while (li.hasNext()) { Step s = li.next(); setRowData(s, s.getSequenceNumber(), false); } parent.setCurrentContentPage((JPanel) this); parent.setFocus(new JXTaskPane[] { viewTasks, transformerTasks }, false, true); tabTemplatePanel.setTransformerView(); // select the first row if there is one int rowCount = transformerTableModel.getRowCount(); if (rowCount > 0) { transformerTable.setRowSelectionInterval(0, 0); prevSelRow = 0; } else { transformerTable.getSelectionModel().clearSelection(); stepPanel.showCard(BLANK_TYPE); for (TransformerStepPlugin plugin : LoadedExtensions.getInstance().getTransformerStepPlugins() .values()) { plugin.getPanel().setData(null); } loadData(-1); } if (connector.getMode() == Connector.Mode.SOURCE) { tabTemplatePanel.setSourceView(); } else if (connector.getMode() == Connector.Mode.DESTINATION) { tabTemplatePanel.setDestinationView(isResponse); } tabTemplatePanel.setDefaultComponent(); tabTemplatePanel.setIncomingDataType( (String) PlatformUI.MIRTH_FRAME.dataTypeToDisplayName.get(transformer.getInboundDataType())); tabTemplatePanel.setOutgoingDataType( ((String) PlatformUI.MIRTH_FRAME.dataTypeToDisplayName.get(transformer.getOutboundDataType()))); tabTemplatePanel.setIncomingDataProperties(transformer.getInboundProperties()); tabTemplatePanel.setOutgoingDataProperties(transformer.getOutboundProperties()); tabTemplatePanel.setIncomingMessage(transformer.getInboundTemplate()); tabTemplatePanel.setOutgoingMessage(transformer.getOutboundTemplate()); transformerTable.setBorder(BorderFactory.createEmptyBorder()); updateStepNumbers(); if (transformerTableModel.getRowCount() > 0) { updateTaskPane((String) transformerTableModel.getValueAt(0, STEP_TYPE_COL)); } if (channelHasBeenChanged) { modified = true; } else { modified = false; } updateCodePanel(null); return true; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleVersionTable.java
public CFInternetVersionBuff[] readDerivedByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* ww w . j a v a 2s. c om*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; CallableStatement stmtReadClassCodeByTenantIdx = null; try { Connection cnx = schema.getCnx(); stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_verndefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); stmtReadClassCodeByTenantIdx.execute(); resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadClassCodeByTenantIdx != null) { try { stmtReadClassCodeByTenantIdx.close(); } catch (SQLException e) { } stmtReadClassCodeByTenantIdx = null; } } List<CFInternetVersionBuff> resultList = new LinkedList<CFInternetVersionBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("VERN")) { CFInternetVersionBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFInternetMajorVersionBuff[] subList = schema.getTableMajorVersion() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFInternetMinorVersionBuff[] subList = schema.getTableMinorVersion() .readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFInternetVersionBuff[] retBuff = new CFInternetVersionBuff[resultList.size()]; Iterator<CFInternetVersionBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:org.shareok.data.dspacemanager.DspaceApiHandlerImpl.java
@Override public String[] getMetadataValuesByKey(String itemId, String key) { List<String> values = new ArrayList<>(); try {//from w w w . j a v a 2s . c o m List<Map<String, Object>> metadata = getItemMetadataById(itemId); ListIterator it = metadata.listIterator(); while (it.hasNext()) { Map itemMap = (HashMap) it.next(); if (key.equals((String) itemMap.get("key"))) { values.add((String) itemMap.get("value")); } } } catch (Exception ex) { logger.error("Cannot get the item metadata values by key!", ex); } return (values.toArray(new String[values.size()])); }
From source file:org.shareok.data.dspacemanager.DspaceApiHandlerImpl.java
@Override public String[] getMetadataValuesByKey(String itemId, String key, String dspaceApiUrl) { List<String> values = new ArrayList<>(); try {/* www. j a v a2 s . co m*/ List<Map<String, Object>> metadata = getItemMetadataById(itemId, dspaceApiUrl); ListIterator it = metadata.listIterator(); while (it.hasNext()) { Map itemMap = (HashMap) it.next(); if (key.equals((String) itemMap.get("key"))) { values.add((String) itemMap.get("value")); } } } catch (Exception ex) { logger.error("Cannot get the item metadata values by key!", ex); } return (values.toArray(new String[values.size()])); }