From 7d037aaccf8eb7e1c056fad4df4a0f3ed049fce3 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 25 Apr 2017 18:27:09 +0900 Subject: [PATCH] ing resultsetcol --- .../crawler/result/OFResultSetCol.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java index 7f9100b..a3d5ecf 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java @@ -2,10 +2,7 @@ package com.loafle.overflow.crawler.result; import com.loafle.overflow.crawler.config.Item; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by root on 17. 4. 25. @@ -20,13 +17,8 @@ public class OFResultSetCol extends OFResultSet{ public void setMeta() { List meta = this.item.getQuery().getKeys(); - List arrayColumns = (List)this.item.getQuery().getQueryInfo().get("arrayColumns"); - for( int indexI = 0 ; indexI < arrayColumns.size(); ++indexI) { - meta.add(arrayColumns.get(indexI)); - } - if(this.meta == null) { this.meta = new HashMap<>(); } @@ -35,6 +27,11 @@ public class OFResultSetCol extends OFResultSet{ this.meta.put(meta.get(indexI), indexI); } + for( int indexI = 0 ; indexI < arrayColumns.size(); ++indexI) { + this.meta.put(arrayColumns.get(indexI), indexI+ meta.size()); + } + + } public Map parse() { @@ -73,7 +70,7 @@ public class OFResultSetCol extends OFResultSet{ metric = convertMetric(metric, arrayValue); - resultMap.put(metric, row.get(indexI)); + resultMap.put(metric, row.get(indexK)); } } @@ -86,14 +83,14 @@ public class OFResultSetCol extends OFResultSet{ private String convertMetric(String metric, List arrayValue) { - char convertChar = '$'; - String convertStr = "$"; + String convertChar = "$"; + String convertStr = null; for(int indexI = 0 ; indexI < arrayValue.size(); ++indexI) { - convertStr = convertChar + String.valueOf(indexI +1); + convertStr = convertChar + String.valueOf(indexI); - metric = metric.replaceFirst(convertStr, arrayValue.get(indexI)); + metric = metric.replace(convertStr, arrayValue.get(indexI)); }