Revision 4871
Added by ben leinfelder over 15 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
65 | 65 |
|
66 | 66 |
import org.apache.log4j.Logger; |
67 | 67 |
import org.apache.log4j.PropertyConfigurator; |
68 |
import org.ecoinformatics.datamanager.transpose.DataTranspose; |
|
69 | 68 |
import org.ecoinformatics.eml.EMLParser; |
70 | 69 |
|
71 | 70 |
import au.com.bytecode.opencsv.CSVWriter; |
... | ... | |
924 | 923 |
} |
925 | 924 |
String fileName = "query-results." + qformat; |
926 | 925 |
|
927 |
boolean transpose = false; |
|
928 |
temp = params.get("transpose"); |
|
929 |
if (temp != null && temp.length > 0) { |
|
930 |
transpose = Boolean.parseBoolean(temp[0]); |
|
931 |
} |
|
932 |
int observation = 0; |
|
933 |
temp = params.get("observation"); |
|
934 |
if (temp != null && temp.length > 0) { |
|
935 |
observation = Integer.parseInt(temp[0]); |
|
936 |
} |
|
937 |
int pivot = 0; |
|
938 |
temp = params.get("pivot"); |
|
939 |
if (temp != null && temp.length > 0) { |
|
940 |
pivot = Integer.parseInt(temp[0]); |
|
941 |
} |
|
942 |
|
|
943 | 926 |
//get the results as csv file |
944 | 927 |
if (qformat != null && qformat.equalsIgnoreCase("csv")) { |
945 | 928 |
response.setContentType("text/csv"); |
... | ... | |
949 | 932 |
Writer writer = new OutputStreamWriter(response.getOutputStream()); |
950 | 933 |
CSVWriter csv = new CSVWriter(writer, CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER); |
951 | 934 |
try { |
952 |
if (transpose) { |
|
953 |
List transposedTable = DataTranspose.transpose(rs, observation, pivot); |
|
954 |
csv.writeAll(transposedTable); |
|
955 |
} else { |
|
956 |
csv.writeAll(rs, true); |
|
957 |
} |
|
958 | 935 |
|
936 |
csv.writeAll(rs, true); |
|
937 |
|
|
959 | 938 |
csv.flush(); |
960 | 939 |
response.flushBuffer(); |
961 | 940 |
|
Also available in: Unified diff
remove DataTranspose from core metacat - only used in FIRST skin for this 1.9.1 release