| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.datamart.common.sql; |
| |
| import java.io.InputStream; |
| import java.io.Reader; |
| import java.math.BigDecimal; |
| import java.net.URL; |
| import java.sql.Array; |
| import java.sql.Blob; |
| import java.sql.Clob; |
| import java.sql.Date; |
| import java.sql.NClob; |
| import java.sql.Ref; |
| import java.sql.ResultSet; |
| import java.sql.ResultSetMetaData; |
| import java.sql.RowId; |
| import java.sql.SQLException; |
| import java.sql.SQLWarning; |
| import java.sql.SQLXML; |
| import java.sql.Time; |
| import java.sql.Timestamp; |
| import java.util.ArrayList; |
| import java.util.Base64; |
| import java.util.Calendar; |
| import java.util.HashMap; |
| import java.util.List; |
| import java.util.Map; |
| |
| import org.apache.commons.lang3.ArrayUtils; |
| import org.apache.commons.lang3.StringUtils; |
| import org.eclipse.osbp.bpm.api.BPMTaskSummary; |
| import org.eclipse.osbp.dsl.common.datatypes.IDto; |
| import org.eclipse.osbp.ui.api.datamart.DatamartPrimary; |
| import org.eclipse.osbp.ui.api.datamart.IDataMart; |
| import org.eclipse.osbp.ui.api.datamart.IDataMart.AttributeVisibility; |
| import org.eclipse.osbp.ui.api.datamart.IDataMart.EType; |
| import org.eclipse.osbp.ui.api.date.SimpleDateFormatter; |
| import org.eclipse.osbp.ui.api.user.IUser; |
| import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action; |
| import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group; |
| import org.eclipse.osbp.ui.api.useraccess.IUserAccessService; |
| import org.eclipse.osbp.xtext.datamart.common.DatamartDtoMapper; |
| import org.olap4j.Cell; |
| import org.olap4j.CellSet; |
| import org.olap4j.CellSetAxis; |
| import org.olap4j.CellSetMetaData; |
| import org.olap4j.OlapException; |
| import org.olap4j.OlapStatement; |
| import org.olap4j.Position; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| import mondrian.olap.Member; |
| import mondrian.olap.Member.MemberType; |
| |
| class TaskMetaInfo { |
| MemberType type; |
| Integer ordinal; |
| |
| TaskMetaInfo(MemberType type, Integer ordinal) { |
| this.type = type; |
| this.ordinal = ordinal; |
| } |
| |
| public MemberType getType() { |
| return type; |
| } |
| |
| public void setType(MemberType type) { |
| this.type = type; |
| } |
| |
| public Integer getOrdinal() { |
| return ordinal; |
| } |
| |
| public void setOrdinal(Integer ordinal) { |
| this.ordinal = ordinal; |
| } |
| } |
| |
| public class SqlCellSet implements CellSet { |
| |
| private static final Logger LOGGER = LoggerFactory.getLogger(SqlCellSet.class); |
| private final List<Cell[]> fCells; |
| private final List<CellSetAxis> fAxes; |
| private final List<SqlCellSetAxis> sqlAxes; |
| private final Map<String, TaskMetaInfo> taskMetaData = new HashMap<String, TaskMetaInfo>() {{ |
| put("Name", new TaskMetaInfo(MemberType.REGULAR, 0)); |
| put("Priority", new TaskMetaInfo(MemberType.REGULAR, 1)); |
| put("Status", new TaskMetaInfo(MemberType.REGULAR, 2)); |
| put("Subject", new TaskMetaInfo(MemberType.REGULAR, 3)); |
| put("Description", new TaskMetaInfo(MemberType.REGULAR, 4)); |
| put("ExpirationTime", new TaskMetaInfo(MemberType.REGULAR, 5)); |
| put("CreatedOn", new TaskMetaInfo(MemberType.REGULAR, 6)); |
| put("CreatedBy", new TaskMetaInfo(MemberType.REGULAR, 7)); |
| put("ActivationTime", new TaskMetaInfo(MemberType.REGULAR, 8)); |
| put("ActualOwner", new TaskMetaInfo(MemberType.REGULAR, 9)); |
| put("TaskId", new TaskMetaInfo(MemberType.REGULAR, 10)); |
| put("ProcessId", new TaskMetaInfo(MemberType.REGULAR, 11)); |
| put("ProcessInstanceId",new TaskMetaInfo(MemberType.REGULAR, 12)); |
| put("ProcessSessionId", new TaskMetaInfo(MemberType.REGULAR, 13)); |
| }}; |
| |
| private OperativeDtoContainer operativeDtoContainer = null; |
| private IUserAccessService userAccessService; |
| private long numRowsFetched = 0L; |
| private Map<String, Boolean> columnIsVisible = new HashMap<>(); |
| |
| public SqlCellSet(List<BPMTaskSummary> tasks, Map<Integer,ArrayList<String>> axisMap) { |
| fCells = new ArrayList<>(); |
| fAxes = new ArrayList<>(); |
| sqlAxes = new ArrayList<>(); |
| int numColumns = taskMetaData.keySet().size(); |
| if (!axisMap.keySet().isEmpty()) { |
| for (int axisNumber : axisMap.keySet()) { |
| SqlCellSetAxis sqlCellSetAxis = new SqlCellSetAxis(this, axisNumber); |
| if (axisNumber == 0) { // the columns axis |
| int ordinal = 0; |
| for (String columnLabel : axisMap.get(0)) { |
| sqlCellSetAxis.addPosition(axisNumber, ordinal, taskMetaData.get(columnLabel).getType(), columnLabel, columnLabel); |
| ordinal ++; |
| } |
| } |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| } |
| else { |
| SqlCellSetAxis sqlCellSetAxis = new SqlCellSetAxis(this, 0); |
| int idx = 0; |
| for (String columnLabel : taskMetaData.keySet()) { |
| sqlCellSetAxis.addPosition(0, idx++, taskMetaData.get(columnLabel).getType(), columnLabel, columnLabel); |
| } |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| // add a default row axis if none given |
| if (axisMap.keySet().size() < 2) { |
| SqlCellSetAxis sqlCellSetAxis = new SqlCellSetAxis(this, 1); |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| numRowsFetched = 0; |
| if (numColumns > 0) { |
| int rowNo = 0; |
| for(BPMTaskSummary task : tasks) { |
| Cell[] row = null; |
| if (!axisMap.keySet().isEmpty()) { |
| int numCols = axisMap.get(0).size(); |
| row = new Cell[numCols]; |
| } |
| else { |
| row = new Cell[numColumns]; |
| } |
| String formattedValue; |
| Object value; |
| if (!axisMap.keySet().isEmpty()) { |
| for (int axisNumber : axisMap.keySet()) { |
| int ordinal = 0; |
| for (String columnLabel : axisMap.get(axisNumber)) { |
| formattedValue = getFormattedValue(task, columnLabel); |
| value = getValue(task, columnLabel); |
| if (axisMap.keySet().size() > 1 && axisMap.get(1).contains(columnLabel)) { |
| sqlAxes.get(1).addPosition(1, rowNo, taskMetaData.get(columnLabel).getType(), formattedValue, formattedValue); |
| } |
| else { |
| row[ordinal] = new SqlCell(this, rowNo, ordinal, value, formattedValue, false, null); |
| ordinal ++; |
| } |
| } |
| } |
| } |
| else { |
| int colNo = 0; |
| for (String columnLabel : taskMetaData.keySet()) { |
| formattedValue = getFormattedValue(task, columnLabel); |
| value = getValue(task, columnLabel); |
| row[colNo] = new SqlCell(this, rowNo, colNo, value, formattedValue, false, null); |
| colNo ++; |
| } |
| } |
| if (axisMap.keySet().size() < 2) { |
| sqlAxes.get(1).addPosition(0, rowNo, MemberType.NULL, "", ""); |
| } |
| fCells.add(row); |
| rowNo++; |
| numRowsFetched ++; |
| } |
| for(SqlCellSetAxis axis : sqlAxes) { |
| fAxes.add(axis); |
| } |
| } |
| } |
| |
| private Object getValue(BPMTaskSummary task, String column){ |
| switch(column) { |
| case "Name": return task.getName()!=null ?task.getName():""; |
| case "Priority": return task.getPriority(); |
| case "Status": return task.getStatus()!=null ? task.getStatus().ordinal() : 0; |
| case "Subject": return task.getSubject()!=null?task.getSubject():""; |
| case "Description": return task.getDescription()!=null?task.getDescription():""; |
| case "ExpirationTime": return task.getExpirationTime(); |
| case "CreatedOn": return task.getCreatedOn(); |
| case "CreatedBy": return task.getCreatedBy()!=null ? task.getCreatedBy() : ""; |
| case "ActivationTime": return task.getActivationTime(); |
| case "ActualOwner": return task.getActualOwner()!= null ? task.getActualOwner() : ""; |
| case "TaskId": return task.getId(); |
| case "ProcessId": return task.getProcessId(); |
| case "ProcessInstanceId": return task.getProcessInstanceId(); |
| case "ProcessSessionId": return task.getProcessSessionId(); |
| default: return null; |
| } |
| } |
| |
| private String getFormattedValue(BPMTaskSummary task, String column){ |
| switch(column) { |
| case "Name": return task.getName(); |
| case "Priority": |
| return Integer.toString(task.getPriority()); |
| case "Status": |
| return task.getStatus().name(); |
| case "Subject": return task.getSubject(); |
| case "Description": return task.getDescription(); |
| case "ExpirationTime": |
| if (task.getExpirationTime() != null) { |
| return task.getExpirationTime().toString(); |
| } |
| return null; |
| case "CreatedOn": |
| if (task.getCreatedOn() != null) { |
| return task.getCreatedOn().toString(); |
| } |
| return null; |
| case "CreatedBy": |
| if (task.getCreatedBy() != null) { |
| return task.getCreatedBy(); |
| } |
| return null; |
| case "ActivationTime": |
| if (task.getActivationTime() != null) { |
| return task.getActivationTime().toString(); |
| } |
| return null; |
| case "ActualOwner": |
| if (task.getActualOwner() != null) { |
| return task.getActualOwner(); |
| } |
| return null; |
| case "TaskId": |
| return Long.toString(task.getId()); |
| case "ProcessId": |
| return task.getProcessId(); |
| case "ProcessInstanceId": |
| return Long.toString(task.getProcessInstanceId()); |
| case "ProcessSessionId": |
| return Integer.toString(task.getProcessSessionId()); |
| default: |
| return null; |
| } |
| |
| } |
| |
| private boolean isId(String columnName, Map<String, EType> idMap) { |
| return idMap.keySet().iterator().hasNext() && columnName.equals(idMap.keySet().iterator().next()); |
| } |
| |
| private EType getType(Map<String, EType> idMap) { |
| if(idMap.keySet().iterator().hasNext()) { |
| return idMap.get(idMap.keySet().iterator().next()); |
| } |
| return null; |
| } |
| |
| public SqlCellSet(ResultSet rs, ResultSetMetaData metaData, IUser user, Map<String, String> resultAttributes, Map<Integer,ArrayList<String>> axisMap, Map<String, EType> idMap, Map<String, String> aliasMap, Map<String, IDataMart.AttributeVisibility> hiddenMap, DatamartDtoMapper datamartDtoMapper, Class<?> operativeDtoClass, List<IDto> operativeDtos, List<DatamartPrimary<?>> primaryKeys, IUserAccessService pUserAccessService) { //NOSONAR |
| fCells = new ArrayList<>(); |
| fAxes = new ArrayList<>(); |
| sqlAxes = new ArrayList<>(); |
| this.userAccessService = pUserAccessService; |
| operativeDtoContainer = null; |
| Map<String, DatamartPrimary> primaryMap = new HashMap<>(); |
| for(DatamartPrimary<?> pr : primaryKeys) { |
| pr.clear(); |
| primaryMap.put(pr.getAlias(), pr); |
| } |
| int numColumns = 0; |
| SqlCellSetAxis sqlCellSetAxis = null; |
| try { |
| if(!rs.isClosed()) { |
| numColumns = metaData.getColumnCount(); |
| } |
| } catch (SQLException e) { |
| LOGGER.error(e.getLocalizedMessage()); |
| return; |
| } |
| try { |
| if(!rs.isClosed()) { |
| if (!axisMap.keySet().isEmpty()) { |
| for (int axisNumber : axisMap.keySet()) { |
| sqlCellSetAxis = new SqlCellSetAxis(this, axisNumber); |
| if (axisNumber == 0) { // the columns axis |
| int ordinal = 0; |
| for (String columnLabel : axisMap.get(0)) { |
| try { |
| int columnIdx = rs.findColumn(columnLabel); |
| sqlCellSetAxis.addPosition(axisNumber, ordinal, convertToMemberType(rs, metaData, columnIdx), metaData.getColumnName(columnIdx), metaData.getColumnLabel(columnIdx)); |
| ordinal ++; |
| } catch (SQLException e) {} |
| } |
| } |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| } |
| else { |
| sqlCellSetAxis = new SqlCellSetAxis(this, 0); |
| for (int idx=1; idx<=numColumns; idx++) { |
| sqlCellSetAxis.addPosition(0, idx-1, convertToMemberType(rs, metaData, idx), metaData.getColumnName(idx), metaData.getColumnLabel(idx)); |
| } |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| } |
| } catch (SQLException e) { |
| LOGGER.error(e.getLocalizedMessage()); |
| return; |
| } |
| // add a default row axis if none given |
| if (axisMap.keySet().size() < 2) { |
| sqlCellSetAxis = new SqlCellSetAxis(this, 1); |
| sqlAxes.add(sqlCellSetAxis); |
| } |
| numRowsFetched = 0; |
| if (numColumns > 0) { |
| try { |
| if(!rs.isClosed()) { |
| int targetRowNo = 0; |
| while (rs.next()) { |
| if(resultAttributes.isEmpty()) { |
| registerFirstLine(rs, metaData, user, resultAttributes); |
| } |
| if (operativeDtoContainer == null) { |
| operativeDtoContainer = new OperativeDtoContainer(datamartDtoMapper, operativeDtoClass, operativeDtos); |
| } |
| boolean displayRow = true; |
| if (operativeDtoContainer.getOperativeDtoIdColumn() != null) { |
| int columnIdx = rs.findColumn(operativeDtoContainer.getOperativeDtoIdColumn()); |
| Object value = getCastedValue(rs, metaData, columnIdx); |
| displayRow = (operativeDtoContainer.getOperativeDtoForId(value) != null); |
| } |
| if (displayRow) { |
| Cell[] row = null; |
| if (axisMap.keySet().size() > 1) { |
| int numCols = 0; |
| for (int idx=1; idx<=numColumns; idx++) { |
| String columnName = metaData.getColumnName(idx).toLowerCase(); |
| if (!axisMap.get(1).contains(columnName)) { |
| numCols ++; |
| } |
| } |
| row = new Cell[numCols]; |
| } |
| else { |
| row = new Cell[numColumns]; |
| } |
| int colNo = 0; |
| String formattedValue; |
| Object value; |
| if ( !axisMap.keySet().isEmpty() ) { |
| for (int axisNumber : axisMap.keySet()) { |
| int ordinal = 0; |
| for (String columnLabel : axisMap.get(axisNumber)) { |
| try { |
| int columnIdx = rs.findColumn(columnLabel); |
| formattedValue = ""; |
| value = null; |
| if (isColumnVisible(aliasMap, hiddenMap, columnLabel )) { |
| formattedValue = getFormattedValue(rs, metaData, columnIdx); |
| value = getCastedValue(rs, metaData, columnIdx); |
| } |
| |
| if(primaryMap.containsKey(columnLabel)) { |
| primaryMap.get(columnLabel).add(value); |
| } |
| if (axisMap.keySet().size() > 1 && axisMap.get(1).contains(columnLabel)) { |
| sqlAxes.get(1).addPosition(1, targetRowNo, convertToMemberType(rs, metaData, columnIdx), formattedValue, columnLabel); |
| } |
| else { |
| row[ordinal] = new SqlCell(this, targetRowNo, ordinal, value, formattedValue, isId(columnLabel, idMap), getType(idMap)); |
| ordinal ++; |
| } |
| } catch (SQLException e) {} |
| } |
| } |
| } |
| else { |
| for (int columnIdx=1; columnIdx<=numColumns; columnIdx++) { |
| String columnLabel = metaData.getColumnLabel(columnIdx); |
| formattedValue = ""; |
| value = null; |
| if (isColumnVisible(aliasMap, hiddenMap, columnLabel)){ |
| |
| formattedValue = getFormattedValue(rs, metaData, columnIdx); |
| value = getCastedValue(rs, metaData, columnIdx); |
| } |
| if(primaryMap.containsKey(columnLabel)) { |
| primaryMap.get(columnLabel).add(value); |
| } |
| row[colNo] = new SqlCell(this, targetRowNo, colNo, value, formattedValue, isId(columnLabel, idMap), getType(idMap)); |
| colNo ++; |
| } |
| } |
| if (axisMap.keySet().size() < 2) { |
| sqlAxes.get(1).addPosition(0, targetRowNo, MemberType.NULL, "", ""); |
| } |
| fCells.add(row); |
| targetRowNo++; |
| numRowsFetched ++; |
| } |
| } |
| } |
| } |
| catch (SQLException e) { |
| LOGGER.error(e.getLocalizedMessage()); |
| } |
| for(SqlCellSetAxis axis : sqlAxes) { |
| fAxes.add(axis); |
| } |
| } |
| } |
| |
| private boolean isColumnVisible(Map<String, String> aliasMap, Map<String, AttributeVisibility> hiddenMap, String columnLabel) { |
| |
| boolean retColumnIsVisible=true; |
| if (columnIsVisible.containsKey(columnLabel)) { |
| retColumnIsVisible = columnIsVisible.get(columnLabel); |
| } else if ( aliasMap.containsKey(columnLabel) ) { |
| String colFQN=aliasMap.get(columnLabel); |
| String entityFQNArray[] = colFQN.split("\\."); |
| String columnName=entityFQNArray[entityFQNArray.length-1]; |
| String entityFQN=StringUtils.join(ArrayUtils.remove(entityFQNArray, entityFQNArray.length-1),"."); |
| |
| boolean entityOk = userAccessService.isGranted(Group.ENTITY, Action.READABLE, entityFQN); |
| boolean beanOk = userAccessService.isGranted(Group.BEAN, Action.READABLE, entityFQN); |
| boolean attributeOk = true; |
| if (entityOk) { |
| attributeOk = !userAccessService.isVetoed(Group.ENTITY, Action.INVISIBLE, entityFQN, columnName); |
| } else if (beanOk) { |
| attributeOk = !userAccessService.isVetoed(Group.BEAN, Action.INVISIBLE, entityFQN, columnName); |
| } |
| boolean attributeHidden = hiddenMap.containsKey(columnName) && hiddenMap.get(columnName) == IDataMart.AttributeVisibility.HIDDEN; |
| |
| retColumnIsVisible = ( entityOk || beanOk ) && attributeOk && !attributeHidden; |
| columnIsVisible.put( columnLabel, retColumnIsVisible ); |
| } |
| return retColumnIsVisible; |
| } |
| |
| private MemberType convertToMemberType(ResultSet rs, ResultSetMetaData metaData, int idx) { |
| int type; |
| int scale; |
| try { |
| type = metaData.getColumnType(idx); |
| scale = metaData.getScale(idx); |
| } catch (SQLException e) { |
| return null; |
| } |
| |
| switch (type) { |
| case java.sql.Types.DATE: |
| case java.sql.Types.TIME: |
| case java.sql.Types.TIMESTAMP: |
| return Member.MemberType.REGULAR; |
| case java.sql.Types.TINYINT: |
| case java.sql.Types.SMALLINT: |
| case java.sql.Types.BIGINT: |
| case java.sql.Types.INTEGER: |
| return Member.MemberType.MEASURE; |
| case java.sql.Types.BOOLEAN: |
| case java.sql.Types.BIT: |
| return Member.MemberType.UNKNOWN; |
| case java.sql.Types.NUMERIC: |
| if(scale == 0) { |
| return Member.MemberType.UNKNOWN; |
| } |
| return Member.MemberType.MEASURE; |
| case java.sql.Types.DECIMAL: |
| case java.sql.Types.DOUBLE: |
| case java.sql.Types.FLOAT: |
| case java.sql.Types.REAL: |
| return Member.MemberType.MEASURE; |
| case java.sql.Types.CHAR: |
| case java.sql.Types.NCHAR: |
| case java.sql.Types.NVARCHAR: |
| case java.sql.Types.VARCHAR: |
| case java.sql.Types.LONGVARCHAR: |
| return Member.MemberType.REGULAR; |
| default: |
| return Member.MemberType.UNKNOWN; |
| } |
| } |
| |
| public OperativeDtoContainer getOperativeDtoContainer() { |
| return operativeDtoContainer; |
| } |
| |
| private Object getCastedValue(ResultSet rs, ResultSetMetaData metaData, int idx) throws SQLException { |
| int type = metaData.getColumnType(idx); |
| int scale = metaData.getScale(idx); |
| |
| switch (type) { |
| case java.sql.Types.DATE: |
| return rs.getDate(idx); |
| case java.sql.Types.TIME: |
| return rs.getTime(idx); |
| case java.sql.Types.TIMESTAMP: |
| return rs.getTimestamp(idx); |
| case java.sql.Types.TINYINT: |
| case java.sql.Types.SMALLINT: |
| return rs.getShort(idx); |
| case java.sql.Types.BIGINT: |
| return rs.getBigDecimal(idx); |
| case java.sql.Types.INTEGER: |
| case java.sql.Types.BOOLEAN: |
| case java.sql.Types.BIT: |
| return (int) rs.getInt(idx); |
| case java.sql.Types.NUMERIC: |
| if(scale == 0) { |
| return rs.getInt(idx); |
| } |
| return rs.getDouble(idx); |
| case java.sql.Types.DECIMAL: |
| case java.sql.Types.DOUBLE: |
| case java.sql.Types.REAL: |
| return rs.getDouble(idx); |
| case java.sql.Types.FLOAT: |
| return (double) rs.getFloat(idx); |
| case java.sql.Types.CHAR: |
| case java.sql.Types.NCHAR: |
| case java.sql.Types.NVARCHAR: |
| case java.sql.Types.VARCHAR: |
| case java.sql.Types.LONGVARCHAR: |
| return rs.getString(idx); |
| case java.sql.Types.LONGVARBINARY: |
| return rs.getBytes(idx) != null ? new String(Base64.getDecoder().decode(rs.getBytes(idx))) : ""; |
| case java.sql.Types.BLOB: |
| return rs.getBlob(idx); |
| case java.sql.Types.CLOB: |
| return rs.getClob(idx); |
| case java.sql.Types.NCLOB: |
| return rs.getNClob(idx); |
| case java.sql.Types.DATALINK: |
| return rs.getCharacterStream(idx); |
| case java.sql.Types.SQLXML: |
| return rs.getSQLXML(idx); |
| case java.sql.Types.ROWID: |
| return rs.getRowId(idx); |
| } |
| return null; |
| } |
| |
| private String getFormattedValue(ResultSet rs, ResultSetMetaData metaData, int idx) throws SQLException { |
| int type = metaData.getColumnType(idx); |
| String formattedValue = ""; |
| switch (type) { |
| case java.sql.Types.DATE: |
| case java.sql.Types.TIME: |
| case java.sql.Types.TIMESTAMP: |
| if (rs.getDate(idx)!=null) { |
| formattedValue = rs.getDate(idx).toString(); |
| } |
| break; |
| case java.sql.Types.TINYINT: |
| case java.sql.Types.SMALLINT: |
| case java.sql.Types.INTEGER: |
| case java.sql.Types.BIGINT: |
| case java.sql.Types.BOOLEAN: |
| case java.sql.Types.BIT: |
| case java.sql.Types.NUMERIC: |
| formattedValue = Integer.toString(rs.getInt(idx)); |
| break; |
| case java.sql.Types.DECIMAL: |
| case java.sql.Types.DOUBLE: |
| case java.sql.Types.REAL: |
| formattedValue = Double.toString(rs.getDouble(idx)); |
| break; |
| case java.sql.Types.FLOAT: |
| formattedValue = Float.toString(rs.getFloat(idx)); |
| break; |
| case java.sql.Types.CHAR: |
| case java.sql.Types.NCHAR: |
| case java.sql.Types.NVARCHAR: |
| case java.sql.Types.VARCHAR: |
| case java.sql.Types.LONGVARCHAR: |
| formattedValue = rs.getString(idx); |
| break; |
| case java.sql.Types.LONGVARBINARY: |
| formattedValue = rs.getBytes(idx) != null ? new String(Base64.getDecoder().decode(rs.getBytes(idx))) : ""; |
| break; |
| case java.sql.Types.BLOB: |
| case java.sql.Types.CLOB: |
| case java.sql.Types.NCLOB: |
| formattedValue = "LOB"; |
| break; |
| case java.sql.Types.DATALINK: |
| formattedValue = "DATALINK"; |
| break; |
| case java.sql.Types.SQLXML: |
| formattedValue = "SQLXML"; |
| break; |
| case java.sql.Types.ROWID: |
| RowId rowid = rs.getRowId(idx); |
| formattedValue = new String(rowid.getBytes()); |
| break; |
| |
| } |
| return formattedValue; |
| } |
| |
| @Override |
| public List<CellSetAxis> getAxes() { |
| return fAxes; |
| } |
| |
| @Override |
| public Cell getCell(List<Integer> position) { |
| try { |
| switch (fAxes.size()) { |
| case 2: |
| return fCells. |
| get(position.get(1)) |
| [position.get(0)]; |
| case 1: |
| case 3: |
| case 4: |
| case 5: |
| default: |
| return null; |
| } |
| } |
| catch (Exception e) { |
| LOGGER.error("SqlCellSet.getCell(): "+e.getClass().getSimpleName()+": "+e.getMessage()); |
| } |
| return null; |
| } |
| |
| /* ============== NOT NEEDED NOW ============== */ |
| |
| @Override |
| public boolean next() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public void close() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public boolean wasNull() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public String getString(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public boolean getBoolean(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public byte getByte(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public short getShort(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public int getInt(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public long getLong(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public float getFloat(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public double getDouble(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public BigDecimal getBigDecimal(int columnIndex, int scale) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public byte[] getBytes(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Date getDate(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Time getTime(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Timestamp getTimestamp(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getAsciiStream(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getUnicodeStream(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getBinaryStream(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public String getString(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public boolean getBoolean(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public byte getByte(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public short getShort(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public int getInt(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public long getLong(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public float getFloat(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public double getDouble(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public BigDecimal getBigDecimal(String columnLabel, int scale) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public byte[] getBytes(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Date getDate(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Time getTime(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Timestamp getTimestamp(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getAsciiStream(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getUnicodeStream(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public InputStream getBinaryStream(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public SQLWarning getWarnings() throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public void clearWarnings() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public String getCursorName() throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Object getObject(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Object getObject(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public int findColumn(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public Reader getCharacterStream(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Reader getCharacterStream(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public BigDecimal getBigDecimal(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public BigDecimal getBigDecimal(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public boolean isBeforeFirst() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean isAfterLast() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean isFirst() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean isLast() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public void beforeFirst() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void afterLast() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public boolean first() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean last() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public int getRow() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public boolean absolute(int row) throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean relative(int rows) throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean previous() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public void setFetchDirection(int direction) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public int getFetchDirection() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public void setFetchSize(int rows) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public int getFetchSize() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public int getType() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public int getConcurrency() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public boolean rowUpdated() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean rowInserted() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public boolean rowDeleted() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public void updateNull(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBoolean(int columnIndex, boolean x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateByte(int columnIndex, byte x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateShort(int columnIndex, short x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateInt(int columnIndex, int x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateLong(int columnIndex, long x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateFloat(int columnIndex, float x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateDouble(int columnIndex, double x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBigDecimal(int columnIndex, BigDecimal x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateString(int columnIndex, String x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBytes(int columnIndex, byte[] x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateDate(int columnIndex, Date x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateTime(int columnIndex, Time x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateTimestamp(int columnIndex, Timestamp x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(int columnIndex, InputStream x, int length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(int columnIndex, InputStream x, int length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(int columnIndex, Reader x, int length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateObject(int columnIndex, Object x, int scaleOrLength) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateObject(int columnIndex, Object x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNull(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBoolean(String columnLabel, boolean x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateByte(String columnLabel, byte x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateShort(String columnLabel, short x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateInt(String columnLabel, int x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateLong(String columnLabel, long x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateFloat(String columnLabel, float x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateDouble(String columnLabel, double x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBigDecimal(String columnLabel, BigDecimal x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateString(String columnLabel, String x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBytes(String columnLabel, byte[] x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateDate(String columnLabel, Date x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateTime(String columnLabel, Time x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateTimestamp(String columnLabel, Timestamp x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(String columnLabel, InputStream x, int length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(String columnLabel, InputStream x, int length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(String columnLabel, Reader reader, |
| int length) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateObject(String columnLabel, Object x, int scaleOrLength) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateObject(String columnLabel, Object x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void insertRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void deleteRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void refreshRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void cancelRowUpdates() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void moveToInsertRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void moveToCurrentRow() throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public Object getObject(int columnIndex, Map<String, Class<?>> map) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Ref getRef(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Blob getBlob(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Clob getClob(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Array getArray(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Object getObject(String columnLabel, Map<String, Class<?>> map) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Ref getRef(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Blob getBlob(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Clob getClob(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Array getArray(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Date getDate(int columnIndex, Calendar cal) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Date getDate(String columnLabel, Calendar cal) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Time getTime(int columnIndex, Calendar cal) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Time getTime(String columnLabel, Calendar cal) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Timestamp getTimestamp(int columnIndex, Calendar cal) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Timestamp getTimestamp(String columnLabel, Calendar cal) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public URL getURL(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public URL getURL(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public void updateRef(int columnIndex, Ref x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateRef(String columnLabel, Ref x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(int columnIndex, Blob x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(String columnLabel, Blob x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(int columnIndex, Clob x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(String columnLabel, Clob x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateArray(int columnIndex, Array x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateArray(String columnLabel, Array x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public RowId getRowId(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public RowId getRowId(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public void updateRowId(int columnIndex, RowId x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateRowId(String columnLabel, RowId x) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public int getHoldability() throws SQLException { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public boolean isClosed() throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public void updateNString(int columnIndex, String nString) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNString(String columnLabel, String nString) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(int columnIndex, NClob nClob) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(String columnLabel, NClob nClob) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public NClob getNClob(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public NClob getNClob(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public SQLXML getSQLXML(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public SQLXML getSQLXML(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public void updateSQLXML(int columnIndex, SQLXML xmlObject) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateSQLXML(String columnLabel, SQLXML xmlObject) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public String getNString(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public String getNString(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Reader getNCharacterStream(int columnIndex) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Reader getNCharacterStream(String columnLabel) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public void updateNCharacterStream(int columnIndex, Reader x, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNCharacterStream(String columnLabel, Reader reader, |
| long length) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(int columnIndex, InputStream x, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(int columnIndex, InputStream x, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(int columnIndex, Reader x, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(String columnLabel, InputStream x, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(String columnLabel, InputStream x, |
| long length) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(String columnLabel, Reader reader, |
| long length) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(int columnIndex, InputStream inputStream, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(String columnLabel, InputStream inputStream, |
| long length) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(int columnIndex, Reader reader, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(String columnLabel, Reader reader, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(int columnIndex, Reader reader, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(String columnLabel, Reader reader, long length) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNCharacterStream(int columnIndex, Reader x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNCharacterStream(String columnLabel, Reader reader) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(int columnIndex, InputStream x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(int columnIndex, InputStream x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(int columnIndex, Reader x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateAsciiStream(String columnLabel, InputStream x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBinaryStream(String columnLabel, InputStream x) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateCharacterStream(String columnLabel, Reader reader) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(int columnIndex, InputStream inputStream) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateBlob(String columnLabel, InputStream inputStream) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(int columnIndex, Reader reader) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateClob(String columnLabel, Reader reader) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(int columnIndex, Reader reader) throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public void updateNClob(String columnLabel, Reader reader) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| |
| } |
| |
| @Override |
| public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public <T> T getObject(String columnLabel, Class<T> type) |
| throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public <T> T unwrap(Class<T> iface) throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public boolean isWrapperFor(Class<?> iface) throws SQLException { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| @Override |
| public int coordinatesToOrdinal(List<Integer> arg0) { |
| // TODO Auto-generated method stub |
| return 0; |
| } |
| |
| @Override |
| public Cell getCell(int arg0) { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public Cell getCell(Position... arg0) { |
| if (arg0.length == 2) { |
| Position x = arg0[1]; |
| Position y = arg0[0]; |
| try { |
| switch (fAxes.size()) { |
| case 2: |
| try { |
| return fCells.get(x.getOrdinal())[y.getOrdinal()]; |
| } catch (ArrayIndexOutOfBoundsException e) { |
| return null; |
| } |
| case 1: |
| case 3: |
| case 4: |
| case 5: |
| default: |
| return null; |
| } |
| } |
| catch (Exception e) { |
| e.printStackTrace(); |
| } |
| } |
| else { |
| throw new IllegalArgumentException("only 2 dimensional axes are supported for now"); |
| } |
| return null; |
| } |
| |
| @Override |
| public CellSetAxis getFilterAxis() { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public CellSetMetaData getMetaData() throws OlapException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public OlapStatement getStatement() throws SQLException { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| @Override |
| public List<Integer> ordinalToCoordinates(int arg0) { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| public void registerFirstLine(ResultSet rs, ResultSetMetaData metaData, IUser user, Map<String, String> resultAttributes) throws SQLException { |
| for (int column = 1; column <= metaData.getColumnCount(); column++) { |
| int type = metaData.getColumnType(column); |
| switch (type) { |
| case java.sql.Types.DATE: |
| if (rs.getDate(column) != null) { |
| if (user == null) { |
| resultAttributes.put(metaData.getColumnName(column), rs.getDate(column).toString()); |
| } else { |
| resultAttributes.put(metaData.getColumnName(column), SimpleDateFormatter |
| .getFormat("LONGDATE", user.getLocale()).format(rs.getDate(column))); |
| } |
| } |
| break; |
| case java.sql.Types.TIMESTAMP: |
| if (rs.getTimestamp(column) != null) { |
| if (user == null) { |
| resultAttributes.put(metaData.getColumnName(column), |
| rs.getTimestamp(column).toString()); |
| } else { |
| resultAttributes.put(metaData.getColumnName(column), SimpleDateFormatter |
| .getFormat("LONGDATE", user.getLocale()).format(rs.getTimestamp(column))); |
| } |
| } |
| break; |
| case java.sql.Types.DECIMAL: |
| if (rs.getBigDecimal(column) != null) { |
| resultAttributes.put(metaData.getColumnName(column), |
| rs.getBigDecimal(column).toPlainString()); |
| } |
| break; |
| case java.sql.Types.NUMERIC: |
| case java.sql.Types.DOUBLE: |
| resultAttributes.put(metaData.getColumnName(column), Double.toString(rs.getDouble(column))); |
| break; |
| case java.sql.Types.FLOAT: |
| resultAttributes.put(metaData.getColumnName(column), Float.toString(rs.getFloat(column))); |
| break; |
| case java.sql.Types.CHAR: |
| case java.sql.Types.NCHAR: |
| case java.sql.Types.NVARCHAR: |
| case java.sql.Types.VARCHAR: |
| case java.sql.Types.LONGVARCHAR: |
| resultAttributes.put(metaData.getColumnName(column), rs.getString(column)); |
| break; |
| } |
| } |
| } |
| |
| public long getFetchedRows() { |
| return numRowsFetched; |
| } |
| } |