resultsetcol
This commit is contained in:
snoop 2017-04-25 18:27:09 +09:00
parent fbf9a96974
commit 7d037aaccf

View File

@ -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<String> meta = this.item.getQuery().getKeys();
List<String> arrayColumns = (List<String>)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<String, String> 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<String> 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));
}