List of usage examples for org.apache.ibatis.session ResultContext getResultObject
T getResultObject();
From source file:com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.java
License:Apache License
public void queryWithRowHandler(final String id, final Object parameterObject, final RowHandler rowHandler) throws SQLException { transactionManager.doInTransaction(new TransactionScope() { public Object execute(Transaction transaction) throws SQLException { MappedStatement ms = configuration.getMappedStatement(id); Executor executor = transaction.getExecutor(); return executor.query(ms, wrapCollection(parameterObject), RowBounds.DEFAULT, new ResultHandler() { public void handleResult(ResultContext context) { rowHandler.handleRow(context.getResultObject()); }//from ww w.jav a 2 s . co m }); } }); }
From source file:com.skt.adcas.lte.action.CSVDownloadAction.java
private void writeEMSLine(ResultContext context) { HashMap map = (HashMap) context.getResultObject(); String txt = ""; String txt2 = "\n"; try {//from w ww .jav a 2 s. c om txt = (String) map.get("YMD") // + "," + nvl(map.get("MB_TIME"), "") // + "," + nvl(map.get("INGR_ERP_CD"), "") //ERP + "," + nvl(map.get("C_UID"), "") //C_UID + "," + nvl(map.get("MFC_CD"), "") // + "," + nvl(map.get("BTS_NM"), "") //DU + "," + nvl(map.get("CELL_ID"), "") //CELL_ID + "," + nvl(map.get("CELL_NM"), "") //CELL + "," + (nvl(map.get("MCID"), "").equals("T") ? "" : nvl(map.get("MCID"), "")) // MCID + "," + nvl(map.get("UNI"), "") // // + "," + nvl(map.get("FREQ_KIND"), "") // + "," + nvl(map.get("MIMO_TYPE"), "") // MIMO + "," + nvl(map.get("THROUGHPUT"), "") // (Mbps) + "," + nvl(map.get("CQI_AVERAGE"), "") // CQI ?"); + "," + nvl(map.get("CQI0_RATE"), "") // CQI0 (%) + "," + nvl(map.get("RI_RATE"), "") // RI2 (%) + "," + nvl(map.get("DL_PRB_RATE"), "") // DL PRB(%) + "," + nvl(map.get("MCS_AVERAGE"), "") // MCS?"); //SS + "," + nvl(map.get("RSSI"), "") // RSSI "); //SS + "," + nvl(map.get("R2_RSSI"), "") // RSSI "); //SS + "," + nvl(map.get("MIMO_RATE"), "") // MIMO "); // ELG + "," + nvl(map.get("DL_THROUGHPUT"), "") // DL Throughput(kbps)"); // ELG + "," + nvl(map.get("LICENSE_FAIL"), "") // License "); // ELG + "," + nvl(map.get("MIMO_RATE"), "") // OL MIMO (%)"); //ELG + NSN + "," + nvl(map.get("MCS_AVERAGE"), "") // MCS0 (%)"); //ELG + NSN + "," + nvl(map.get("PUCCH_AVG"), "") // RSSI PUCCH "); //ELG + NSN + "," + nvl(map.get("R2_PUCCH_AVG"), "") // RSSI PUCCH "); //NSN + "," + nvl(map.get("PUSCH_AVG"), "") // RSSI PUSCH "); //NSN + "," + nvl(map.get("R2_PUSCH_AVG"), "") // RSSI PUSCH "); //NSN + "," + nvl(map.get("PDCP_DL_MB"), "") // ?? (MB)"); + "," + nvl(map.get("PRB_USG_RATE"), "") // ?? PRB(%)"); + "," + nvl(map.get("DRB_USG_RATE"), "") // ?? DPR(%)"); + "," + nvl(map.get("CON_TIME"), "") // ?? ??(Erl)"); + "," + nvl(map.get("TRY_CCNT"), "") // ?? ?"); + "," + nvl(map.get("CON_RATE"), "") // ?? ?(%)"); + "," + nvl(map.get("CDC_RATE"), "") // ?? CD(%)"); + "," + nvl(map.get("DL_FA_USG_RATE"), "") // FA (%)"); + "," + nvl(map.get("VOICE_DL_MB"), "") // HD Voice + "," + nvl(map.get("VOICE_DL_PRB"), "") // HD Voice PRB (%)"); + "," + nvl(map.get("VOICE_TRY_CCNT"), "") // HD Voice ?"); + "," + nvl(map.get("VOICE_TIME"), "") // HD Voice ?"); + "," + nvl(map.get("IMAGE_DL_MB"), "") // ?? (MB)"); + "," + nvl(map.get("IMAGE_DL_PRB"), "") // ?? PRB(%)"); + "," + nvl(map.get("IMAGE_TRY_CCNT"), "") // ?? ?"); + "," + nvl(map.get("IMAGE_TIME"), "") // ?? ?"); + "," + nvl(map.get("CHNL_TYPE"), "") // "); + "," + nvl(map.get("CHNL_COUNT"), "") // "); ; fileOut.write(txt); fileOut.newLine(); if (isLocalHost()) { System.out.println(txt); } } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
From source file:com.skt.adcas.lte.action.DownLinkByNMSAction.java
public void handleResult(ResultContext context) { //todo ??? Write /*// www .j a va 2 s. c o m rs.write(m.get("BTS_NM")+","+m.get("BTS_CD")+"\n\r") */ System.out.println(context.getResultObject().toString()); }
From source file:jp.co.ctc_g.jse.csv.showcase.integration.mybatis.UserProfileCSVResultHandler.java
License:Apache License
/** * {@inheritDoc}/*from w ww . j ava2 s . com*/ */ @Override public void write(ResultContext context) { UserProfile result = (UserProfile) context.getResultObject(); String[] data = new String[] { result.getName(), result.getKana(), result.getEmail(), result.getZip() }; csv.write(data); }
From source file:jp.terasoluna.fw.collector.db.QueueingResultHandlerImpl.java
License:Apache License
public void handleResult(ResultContext context) { delayCollect();//from w ww.j ava 2 s . c o m if (Thread.currentThread().isInterrupted()) { // ????? if (verboseLog.get()) { LOGGER.trace(LogId.TAL041003); } context.stop(); return; } this.prevRow = context.getResultObject(); }
From source file:org.alfresco.ibatis.RollupResultHandler.java
License:Open Source License
public void handleResult(ResultContext context) { // Shortcut if we have processed enough results if (maxResults > 0 && resultCount >= maxResults) { return;/*from w ww . j a v a2 s. co m*/ } Object valueObject = context.getResultObject(); MetaObject probe = configuration.newMetaObject(valueObject); // Check if the key has changed if (lastKeyValues == null) { lastKeyValues = getKeyValues(probe); resultCount = 0; } // Check if it has changed Object[] currentKeyValues = getKeyValues(probe); if (!Arrays.deepEquals(lastKeyValues, currentKeyValues)) { // Key has changed, so handle the results Object resultObject = coalesceResults(configuration, rawResults, collectionProperty); if (resultObject != null) { DefaultResultContext resultContext = new DefaultResultContext(); resultContext.nextResultObject(resultObject); resultHandler.handleResult(resultContext); resultCount++; } rawResults.clear(); lastKeyValues = currentKeyValues; } // Add the new value to the results for next time rawResults.add(valueObject); // Done }
From source file:org.alfresco.repo.domain.node.ibatis.NodeDAOImpl.java
License:Open Source License
@Override public Pair<Long, Long> getNodeIdsIntervalForType(QName type, Long startTxnTime, Long endTxnTime) { final Pair<Long, Long> intervalPair = new Pair<Long, Long>(LONG_ZERO, LONG_ZERO); Pair<Long, QName> typePair = qnameDAO.getQName(type); if (typePair == null) { // Return default return intervalPair; }//from w w w .j ava2 s. com TransactionQueryEntity txnQuery = new TransactionQueryEntity(); txnQuery.setTypeQNameId(typePair.getFirst()); txnQuery.setMinCommitTime(startTxnTime); txnQuery.setMaxCommitTime(endTxnTime); ResultHandler resultHandler = new ResultHandler() { @SuppressWarnings("unchecked") public void handleResult(ResultContext context) { Map<Long, Long> result = (Map<Long, Long>) context.getResultObject(); if (result != null) { intervalPair.setFirst(result.get("minId")); intervalPair.setSecond(result.get("maxId")); } } }; template.select(SELECT_NODE_INTERVAL_BY_TYPE, txnQuery, resultHandler); return intervalPair; }
From source file:org.alfresco.repo.domain.node.ibatis.NodeDAOImpl.java
License:Open Source License
@Override public List<NodePropertyEntity> selectNodePropertiesByTypes(Set<QName> qnames) { final List<NodePropertyEntity> properties = new ArrayList<NodePropertyEntity>(); // qnames of properties that are encrypted Set<Long> qnameIds = qnameDAO.convertQNamesToIds(qnames, false); if (qnameIds.size() > 0) { IdsEntity param = new IdsEntity(); param.setIds(new ArrayList<Long>(qnameIds)); // TODO - use a callback approach template.select(SELECT_PROPERTIES_BY_TYPES, param, new ResultHandler() { @Override//from w w w . ja va 2 s . c o m public void handleResult(ResultContext context) { properties.add((NodePropertyEntity) context.getResultObject()); } }); } return properties; }
From source file:org.alfresco.repo.domain.node.ibatis.NodeDAOImpl.java
License:Open Source License
@Override public List<NodePropertyEntity> selectNodePropertiesByDataType(QName dataType, long minNodeId, long maxNodeId) { int typeOrdinal = NodePropertyValue.convertToTypeOrdinal(dataType); IdsEntity ids = new IdsEntity(); ids.setIdOne((long) typeOrdinal); ids.setIdTwo(minNodeId);//from www .j av a2s .c o m ids.setIdThree(maxNodeId); final List<NodePropertyEntity> properties = new ArrayList<NodePropertyEntity>(); template.select(SELECT_PROPERTIES_BY_ACTUAL_TYPE, ids, new ResultHandler() { @Override public void handleResult(ResultContext context) { properties.add((NodePropertyEntity) context.getResultObject()); } }); return properties; }
From source file:org.alfresco.repo.domain.node.ibatis.NodeDAOImpl.java
License:Open Source License
@Override protected void selectNodesWithAspects(List<Long> qnameIds, Long minNodeId, Long maxNodeId, final NodeRefQueryCallback resultsCallback) { ResultHandler resultHandler = new ResultHandler() { public void handleResult(ResultContext context) { NodeEntity entity = (NodeEntity) context.getResultObject(); Pair<Long, NodeRef> nodePair = new Pair<Long, NodeRef>(entity.getId(), entity.getNodeRef()); resultsCallback.handle(nodePair); }// w ww .j ava2 s. c o m }; IdsEntity parameters = new IdsEntity(); parameters.setIdOne(minNodeId); parameters.setIdTwo(maxNodeId); parameters.setIds(qnameIds); template.select(SELECT_NODES_WITH_ASPECT_IDS, parameters, resultHandler); }