Commit 44740216 authored by Francesco Lucchi's avatar Francesco Lucchi
Browse files

Fix selections with timestamps

parent df0ed3f9
......@@ -126,16 +126,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var formattedSelection = {};
var datasetSelection = selections[widgetDataset.label];
for(var s in datasetSelection){
var columnObject = $scope.getColumnObjectFromName($scope.ngModel.content.columnSelectedOfDataset[widgetDatasetId],s);
formattedSelection[columnObject.alias] = {
"values":[],
"type": columnObject.fieldType
};
var columnObject = scope.getColumnObjectFromName(scope.ngModel.content.columnSelectedOfDataset,s);
if (!columnObject){
columnObject = scope.getColumnObjectFromName(widgetDataset.metadata.fieldsMeta,s);
}
formattedSelection[columnObject.aliasToShow || columnObject.alias] = {"values":[], "type": columnObject.fieldType};
for(var k in datasetSelection[s]){
// clean the value from the parenthesis ( )
var x = datasetSelection[s][k].replace(/[()]/g, '').replace(/['']/g, '').split(/[,]/g);
for(var i=0; i<x.length; i++){
formattedSelection[columnObject.aliasToShow].values.push(x[i]);
formattedSelection[columnObject.aliasToShow || columnObject.alias].values.push(x[i]);
}
}
}
......@@ -404,7 +405,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
layer.setZIndex(layerDef.order*1000);
layer.modalSelectionColumn = layerDef.modalSelectionColumn;
layer.hasShownDetails = layerDef.hasShownDetails;
if ($scope.map)
if ($scope.map)
$scope.map.addLayer(layer); //add layer to ol.Map
else{
sbiModule_messaging.showInfoMessage("The map object isn't available for adding layer, please reload the document.", 'Title', 3000);
......@@ -412,7 +413,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
$scope.hideWidgetSpinner();
}, 3000)
}
$scope.addLayer(layerDef.name, layer); //add layer to internal object
$scope.setLayerProperty (layerDef.name, 'geoColumn',geoColumn),
$scope.values[layerDef.name] = data; //add values to internal object
......@@ -581,7 +582,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
$timeout(function() {
$scope.hideWidgetSpinner();
}, 3000);
});
}
......
......@@ -116,7 +116,7 @@ angular.module('cockpitModule')
$scope.doSelection($scope.ngModel.content.selectedColumn.aliasToShow,dates);
}else if((!newStartDate && oldStartDate) || (!newEndDate && oldEndDate)){
var item = {};
item.aggregated = false;
item.aggregated = $scope.aggregated;
item.columnName = $scope.ngModel.content.selectedColumn.aliasToShow;
item.columnAlias = $scope.ngModel.content.selectedColumn.aliasToShow;
item.ds = $scope.ngModel.dataset.name;
......@@ -331,20 +331,20 @@ angular.module('cockpitModule')
var formattedSelection = {};
var datasetSelection = selections[widgetDataset.label];
for(var s in datasetSelection){
var columnObject = $scope.getColumnObjectFromName($scope.ngModel.content.columnSelectedOfDataset,s);
formattedSelection[columnObject.aliasToShow] = {
"values":[],
"type": columnObject.fieldType
};
var columnObject = scope.getColumnObjectFromName(scope.ngModel.content.columnSelectedOfDataset,s);
if (!columnObject){
columnObject = scope.getColumnObjectFromName(widgetDataset.metadata.fieldsMeta,s);
}
formattedSelection[columnObject.aliasToShow || columnObject.alias] = {"values":[], "type": columnObject.fieldType};
for(var k in datasetSelection[s]){
// clean the value from the parenthesis ( )
var x = datasetSelection[s][k].replace(/[()]/g, '').replace(/['']/g, '').split(/[,]/g);
for(var i=0; i<x.length; i++){
formattedSelection[columnObject.aliasToShow].values.push(x[i]);
formattedSelection[columnObject.aliasToShow || columnObject.alias].values.push(x[i]);
}
}
}
}
}
return formattedSelection;
......
......@@ -522,19 +522,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var datasetSelection = selections[widgetDataset.label];
for(var s in datasetSelection){
var columnObject = scope.getColumnObjectFromName(scope.ngModel.content.columnSelectedOfDataset,s);
formattedSelection[columnObject.aliasToShow] = {
"values":[],
"type": columnObject.fieldType
};
if (!columnObject){
columnObject = scope.getColumnObjectFromName(widgetDataset.metadata.fieldsMeta,s);
}
formattedSelection[columnObject.aliasToShow || columnObject.alias] = {"values":[], "type": columnObject.fieldType};
for(var k in datasetSelection[s]){
// clean the value from the parenthesis ( )
var x = datasetSelection[s][k].replace(/[()]/g, '').replace(/['']/g, '').split(/[,]/g);
for(var i=0; i<x.length; i++){
formattedSelection[columnObject.aliasToShow].values.push(x[i]);
formattedSelection[columnObject.aliasToShow || columnObject.alias].values.push(x[i]);
}
}
}
}
}
return formattedSelection;
......
......@@ -78,7 +78,13 @@ public class JDBCAssociativeDatasetContainer extends AssociativeDatasetContainer
for (int i = 0; i < values.size(); i++) {
int parameterIndex = i + 1;
Object value = values.get(i);
if (java.util.Date.class.isAssignableFrom(value.getClass())) {
if (java.sql.Timestamp.class.isAssignableFrom(value.getClass())) {
java.sql.Timestamp timestamp = (java.sql.Timestamp) value;
stmt.setTimestamp(parameterIndex, timestamp);
} else if (java.sql.Date.class.isAssignableFrom(value.getClass())) {
java.sql.Date date = (java.sql.Date) value;
stmt.setDate(parameterIndex, date);
} else if (java.util.Date.class.isAssignableFrom(value.getClass())) {
java.util.Date date = (java.util.Date) value;
stmt.setDate(parameterIndex, new java.sql.Date(date.getTime()));
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment