code cleanup with eslint and checkstyle
This commit is contained in:
parent
9afd19be0a
commit
cccd722f44
28
extensions/database/.eslintrc.json
Normal file
28
extensions/database/.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
@ -20,10 +20,16 @@
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
<nature>ch.acanda.eclipse.pmd.builder.PMDNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
@ -1,12 +1,12 @@
|
||||
This project is an extension for Google Refine that provides a way to import database data using JDBC.
|
||||
This project is an extension for OpenRefine that provides a way to import database data using JDBC.
|
||||
|
||||
|
||||
INSTALL
|
||||
|
||||
1. Before installing this extension download Google Refine code from http://code.google.com/p/google-refine/source/checkout.
|
||||
1. Before installing this extension download OpenRefine code from http://code.google.com/p/google-refine/source/checkout.
|
||||
|
||||
2. Pull this extension's code into folder database under folder /extensions.
|
||||
For more information on how to write a Google Refine extensions and where to put the files see http://code.google.com/p/google-refine/wiki/WriteAnExtension
|
||||
For more information on how to write a OpenRefine extensions and where to put the files see http://code.google.com/p/google-refine/wiki/WriteAnExtension
|
||||
|
||||
The folder structure should resemble this:
|
||||
grefine-all/
|
||||
|
@ -1,34 +1,30 @@
|
||||
/*
|
||||
|
||||
Copyright 2010, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,11 +59,11 @@ function registerCommands() {
|
||||
}
|
||||
|
||||
function registerOperations() {
|
||||
logger.info("Database Operations Registered successfully...");
|
||||
logger.info("Database Operations Registered successfully...");
|
||||
}
|
||||
|
||||
function registerFunctions() {
|
||||
logger.info("Database Functions Registered successfully...");
|
||||
logger.info("Database Functions Registered successfully...");
|
||||
}
|
||||
|
||||
|
||||
@ -112,8 +108,8 @@ function init() {
|
||||
module,
|
||||
[
|
||||
"styles/jquery.contextMenu.css",
|
||||
"styles/pure.css",
|
||||
"styles/bootstrap.css",
|
||||
"styles/pure.css",
|
||||
"styles/bootstrap.css",
|
||||
"styles/database-import.less"
|
||||
|
||||
]
|
||||
@ -134,13 +130,13 @@ function init() {
|
||||
* Function invoked to handle each request in a custom way.
|
||||
*/
|
||||
function process(path, request, response) {
|
||||
|
||||
|
||||
|
||||
|
||||
var method = request.getMethod();
|
||||
|
||||
logger.info('receiving request for ' + path);
|
||||
logger.info('receiving method for ' + method);
|
||||
|
||||
|
||||
if (path == "/" || path == "") {
|
||||
var context = {};
|
||||
context.version = version;
|
||||
|
@ -3,13 +3,13 @@
|
||||
*#
|
||||
<html>
|
||||
<head>
|
||||
<title>Google Refine Database Extension v$version</title>
|
||||
<title>OpenRefine Database Extension v$version</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Google Refine DATABASE Extension v$version</h1>
|
||||
<h2>by Tony O <tcbuzor@gmail.com></h2>
|
||||
<h1>OpenRefine DATABASE Extension v$version</h1>
|
||||
<h2>by Tony Opara <tcbuzor@gmail.com></h2>
|
||||
<p>The JDBC extension allows OpenRefine to read
|
||||
(and write, soon) data from JDBC compatible databases(MySQL, PostgreSQL, Oracle).
|
||||
(and write, soon) data from JDBC compatible databases(MySQL, PostgreSQL, MariaDB).
|
||||
</p>
|
||||
<h3>Known Limitations</h3>
|
||||
<ul>
|
||||
|
@ -1,35 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
Copyright 2010, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
$(function(){
|
||||
$.contextMenu({
|
||||
selector: '.context-menu-one',
|
||||
@ -61,146 +58,140 @@ var DatabaseExtension = {};
|
||||
DatabaseExtension.currentConnection = {};
|
||||
|
||||
DatabaseExtension.handleSavedConnectionClicked = function(menuKey, connectionName) {
|
||||
var jdbcConnectionInfo = {};
|
||||
jdbcConnectionInfo.connectionName = connectionName;
|
||||
|
||||
if(menuKey == "edit"){
|
||||
DatabaseExtension.handleEditConnectionClicked(connectionName);
|
||||
|
||||
}else if(menuKey == "delete"){
|
||||
DatabaseExtension.handleDeleteConnectionClicked(connectionName);
|
||||
|
||||
}else if(menuKey == "connect"){
|
||||
DatabaseExtension.handleConnectClicked(connectionName);
|
||||
}
|
||||
var jdbcConnectionInfo = {};
|
||||
jdbcConnectionInfo.connectionName = connectionName;
|
||||
|
||||
if(menuKey === "edit"){
|
||||
DatabaseExtension.handleEditConnectionClicked(connectionName);
|
||||
|
||||
}else if(menuKey === "delete"){
|
||||
DatabaseExtension.handleDeleteConnectionClicked(connectionName);
|
||||
|
||||
}else if(menuKey === "connect"){
|
||||
DatabaseExtension.handleConnectClicked(connectionName);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
DatabaseExtension.handleConnectClicked = function(connectionName) {
|
||||
|
||||
$.get(
|
||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||
null,
|
||||
|
||||
function(savedDatabaseConfig) {
|
||||
|
||||
if(savedDatabaseConfig){
|
||||
|
||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||
var databaseConfig = {};
|
||||
databaseConfig.connectionName = savedConfig.connectionName;
|
||||
databaseConfig.databaseType = savedConfig.databaseType;
|
||||
databaseConfig.databaseServer = savedConfig.databaseHost;
|
||||
databaseConfig.databasePort = savedConfig.databasePort;
|
||||
databaseConfig.databaseUser = savedConfig.databaseUser;
|
||||
databaseConfig.databasePassword = savedConfig.databasePassword;
|
||||
databaseConfig.initialDatabase = savedConfig.databaseName;
|
||||
databaseConfig.initialSchema = savedConfig.databaseSchema;
|
||||
|
||||
$.post(
|
||||
"command/database/connect",
|
||||
databaseConfig,
|
||||
|
||||
function(databaseInfo) {
|
||||
|
||||
if(databaseInfo){
|
||||
DatabaseExtension.currentConnection.databaseInfo;
|
||||
$( "#currentConnectionNameInput" ).val(databaseConfig.connectionName);
|
||||
$( "#currentDatabaseTypeInput" ).val(databaseConfig.databaseType);
|
||||
$( "#currentDatabaseUserInput" ).val(databaseConfig.databaseUser);
|
||||
$( "#currentDatabasePasswordInput" ).val(databaseConfig.databasePassword);
|
||||
$( "#currentDatabaseHostInput" ).val(databaseConfig.databaseServer);
|
||||
$( "#currentDatabasePortInput" ).val(databaseConfig.databasePort);
|
||||
$( "#currentInitialDatabaseInput" ).val(databaseConfig.initialDatabase);
|
||||
|
||||
var connectionParam = "Connection[" + databaseConfig.connectionName + "] :: "
|
||||
+ "jdbc:"
|
||||
+ databaseConfig.databaseType + "://"
|
||||
+ databaseConfig.databaseServer + ":"
|
||||
+ databaseConfig.databasePort + "/"
|
||||
+ databaseConfig.initialDatabase;
|
||||
|
||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||
$( "#newConnectionDiv" ).hide();
|
||||
$( "#sqlEditorDiv" ).show();
|
||||
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
|
||||
$.get(
|
||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||
null,
|
||||
|
||||
function(savedDatabaseConfig) {
|
||||
|
||||
if(savedDatabaseConfig){
|
||||
|
||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||
var databaseConfig = {};
|
||||
databaseConfig.connectionName = savedConfig.connectionName;
|
||||
databaseConfig.databaseType = savedConfig.databaseType;
|
||||
databaseConfig.databaseServer = savedConfig.databaseHost;
|
||||
databaseConfig.databasePort = savedConfig.databasePort;
|
||||
databaseConfig.databaseUser = savedConfig.databaseUser;
|
||||
databaseConfig.databasePassword = savedConfig.databasePassword;
|
||||
databaseConfig.initialDatabase = savedConfig.databaseName;
|
||||
databaseConfig.initialSchema = savedConfig.databaseSchema;
|
||||
|
||||
$.post(
|
||||
"command/database/connect",
|
||||
databaseConfig,
|
||||
|
||||
function(databaseInfo) {
|
||||
|
||||
if(databaseInfo){
|
||||
DatabaseExtension.currentConnection.databaseInfo;
|
||||
$( "#currentConnectionNameInput" ).val(databaseConfig.connectionName);
|
||||
$( "#currentDatabaseTypeInput" ).val(databaseConfig.databaseType);
|
||||
$( "#currentDatabaseUserInput" ).val(databaseConfig.databaseUser);
|
||||
$( "#currentDatabasePasswordInput" ).val(databaseConfig.databasePassword);
|
||||
$( "#currentDatabaseHostInput" ).val(databaseConfig.databaseServer);
|
||||
$( "#currentDatabasePortInput" ).val(databaseConfig.databasePort);
|
||||
$( "#currentInitialDatabaseInput" ).val(databaseConfig.initialDatabase);
|
||||
|
||||
var connectionParam = "Connection[" + databaseConfig.connectionName + "] :: "
|
||||
+ "jdbc:"
|
||||
+ databaseConfig.databaseType + "://"
|
||||
+ databaseConfig.databaseServer + ":"
|
||||
+ databaseConfig.databasePort + "/"
|
||||
+ databaseConfig.initialDatabase;
|
||||
|
||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||
$( "#newConnectionDiv" ).hide();
|
||||
$( "#sqlEditorDiv" ).show();
|
||||
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
||||
DatabaseExtension.handleDeleteConnectionClicked = function(connectionName) {
|
||||
$.ajax({
|
||||
url: 'command/database/saved-connection' + '?' + $.param({"connectionName": connectionName}),
|
||||
type: 'DELETE',
|
||||
contentType:'application/json',
|
||||
data: null,
|
||||
success: function(settings) {
|
||||
if(settings){
|
||||
|
||||
$( "#menuListUl" ).empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
|
||||
// items.push('<li class="context-menu-one pure-menu-item"><a href="#" class="pure-menu-link">'
|
||||
// + savedConnection.connectionName
|
||||
// + '</a></li>');
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
$( "#menuListUl" ).append(items.join(''));
|
||||
}
|
||||
}
|
||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
$.ajax({
|
||||
url: 'command/database/saved-connection' + '?' + $.param({"connectionName": connectionName}),
|
||||
type: 'DELETE',
|
||||
contentType:'application/json',
|
||||
data: null,
|
||||
success: function(settings) {
|
||||
if(settings){
|
||||
|
||||
$( "#menuListUl" ).empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
$( "#menuListUl" ).append(items.join(''));
|
||||
}
|
||||
}
|
||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
}
|
||||
|
||||
DatabaseExtension.handleEditConnectionClicked = function(connectionName) {
|
||||
|
||||
$.get(
|
||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||
null,
|
||||
function(savedDatabaseConfig) {
|
||||
|
||||
if(savedDatabaseConfig){
|
||||
|
||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||
$( "#connectionName" ).val(savedConfig.connectionName);
|
||||
$( "#databaseTypeSelect" ).val(savedConfig.databaseType);
|
||||
$( "#databaseHost" ).val(savedConfig.databaseHost);
|
||||
$( "#databasePort" ).val(savedConfig.databasePort);
|
||||
$( "#databaseUser" ).val(savedConfig.databaseUser);
|
||||
$( "#databasePassword" ).val(savedConfig.databasePassword);
|
||||
$( "#initialDatabase" ).val(savedConfig.databaseName);
|
||||
$( "#initialSchema" ).val(savedConfig.databaseSchema);
|
||||
$( "#newConnectionControlDiv" ).hide();
|
||||
$( "#editConnectionControlDiv" ).show();
|
||||
$( "#newConnectionDiv" ).show();
|
||||
$('#sqlEditorDiv').hide();
|
||||
$("#connectionName").attr('readonly', 'readonly');
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
$.get(
|
||||
"command/database/saved-connection" + '?' + $.param({"connectionName": connectionName}),
|
||||
null,
|
||||
function(savedDatabaseConfig) {
|
||||
|
||||
if(savedDatabaseConfig){
|
||||
|
||||
var savedConfig = savedDatabaseConfig.savedConnections[0];
|
||||
$( "#connectionName" ).val(savedConfig.connectionName);
|
||||
$( "#databaseTypeSelect" ).val(savedConfig.databaseType);
|
||||
$( "#databaseHost" ).val(savedConfig.databaseHost);
|
||||
$( "#databasePort" ).val(savedConfig.databasePort);
|
||||
$( "#databaseUser" ).val(savedConfig.databaseUser);
|
||||
$( "#databasePassword" ).val(savedConfig.databasePassword);
|
||||
$( "#initialDatabase" ).val(savedConfig.databaseName);
|
||||
$( "#initialSchema" ).val(savedConfig.databaseSchema);
|
||||
$( "#newConnectionControlDiv" ).hide();
|
||||
$( "#editConnectionControlDiv" ).show();
|
||||
$( "#newConnectionDiv" ).show();
|
||||
$('#sqlEditorDiv').hide();
|
||||
$("#connectionName").attr('readonly', 'readonly');
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,50 +1,46 @@
|
||||
/*
|
||||
|
||||
Copyright 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//Internationalization init
|
||||
var lang = navigator.language.split("-")[0]
|
||||
|| navigator.userLanguage.split("-")[0];
|
||||
|| navigator.userLanguage.split("-")[0];
|
||||
var dictionary = "";
|
||||
$.ajax({
|
||||
url : "command/core/load-language?",
|
||||
type : "POST",
|
||||
async : false,
|
||||
data : {
|
||||
module : "database",
|
||||
},
|
||||
success : function(data) {
|
||||
dictionary = data;
|
||||
}
|
||||
url : "command/core/load-language?",
|
||||
type : "POST",
|
||||
async : false,
|
||||
data : {
|
||||
module : "database",
|
||||
},
|
||||
success : function(data) {
|
||||
dictionary = data;
|
||||
}
|
||||
});
|
||||
$.i18n.setDictionary(dictionary);
|
||||
// End internationalization
|
||||
@ -64,312 +60,312 @@ Refine.DatabaseImportController = function(createProjectUI) {
|
||||
Refine.CreateProjectUI.controllers.push(Refine.DatabaseImportController);
|
||||
|
||||
Refine.DatabaseImportController.prototype.startImportingDocument = function(queryInfo) {
|
||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["preparing"]);
|
||||
//alert(queryInfo.query);
|
||||
var self = this;
|
||||
|
||||
$.post(
|
||||
"command/core/create-importing-job",
|
||||
null,
|
||||
function(data) {
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"subCommand": "initialize-parser-ui"
|
||||
}),
|
||||
queryInfo,
|
||||
|
||||
function(data2) {
|
||||
dismiss();
|
||||
|
||||
if (data2.status == 'ok') {
|
||||
self._queryInfo = queryInfo;
|
||||
self._jobID = data.jobID;
|
||||
self._options = data2.options;
|
||||
|
||||
self._showParsingPanel();
|
||||
|
||||
} else {
|
||||
alert(data2.message);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["preparing"]);
|
||||
//alert(queryInfo.query);
|
||||
var self = this;
|
||||
|
||||
$.post(
|
||||
"command/core/create-importing-job",
|
||||
null,
|
||||
function(data) {
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"subCommand": "initialize-parser-ui"
|
||||
}),
|
||||
queryInfo,
|
||||
|
||||
function(data2) {
|
||||
dismiss();
|
||||
|
||||
if (data2.status == 'ok') {
|
||||
self._queryInfo = queryInfo;
|
||||
self._jobID = data.jobID;
|
||||
self._options = data2.options;
|
||||
|
||||
self._showParsingPanel();
|
||||
|
||||
} else {
|
||||
alert(data2.message);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype.getOptions = function() {
|
||||
var options = {
|
||||
|
||||
};
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
return def;
|
||||
};
|
||||
var options = {
|
||||
|
||||
};
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
return def;
|
||||
};
|
||||
|
||||
|
||||
if (this._parsingPanelElmts.skipCheckbox[0].checked) {
|
||||
options.skipDataLines = parseIntDefault(this._parsingPanelElmts.skipInput[0].value, 0);
|
||||
} else {
|
||||
options.skipDataLines = 0;
|
||||
}
|
||||
if (this._parsingPanelElmts.limitCheckbox[0].checked) {
|
||||
options.limit = parseIntDefault(this._parsingPanelElmts.limitInput[0].value, -1);
|
||||
} else {
|
||||
options.limit = -1;
|
||||
}
|
||||
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
|
||||
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
|
||||
|
||||
if (this._parsingPanelElmts.skipCheckbox[0].checked) {
|
||||
options.skipDataLines = parseIntDefault(this._parsingPanelElmts.skipInput[0].value, 0);
|
||||
} else {
|
||||
options.skipDataLines = 0;
|
||||
}
|
||||
if (this._parsingPanelElmts.limitCheckbox[0].checked) {
|
||||
options.limit = parseIntDefault(this._parsingPanelElmts.limitInput[0].value, -1);
|
||||
} else {
|
||||
options.limit = -1;
|
||||
}
|
||||
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
|
||||
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
|
||||
|
||||
return options;
|
||||
return options;
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype._showParsingPanel = function() {
|
||||
var self = this;
|
||||
|
||||
this._parsingPanel.unbind().empty().html(
|
||||
DOM.loadHTML("database",'scripts/index/database-parsing-panel.html'));
|
||||
|
||||
this._parsingPanelElmts = DOM.bind(this._parsingPanel);
|
||||
var self = this;
|
||||
|
||||
this._parsingPanel.unbind().empty().html(
|
||||
DOM.loadHTML("database",'scripts/index/database-parsing-panel.html'));
|
||||
|
||||
this._parsingPanelElmts = DOM.bind(this._parsingPanel);
|
||||
|
||||
this._parsingPanelElmts.startOverButton.html($.i18n._('database-parsing')["start-over"]);
|
||||
this._parsingPanelElmts.database_conf_pars.html($.i18n._('database-parsing')["conf-pars"]);
|
||||
this._parsingPanelElmts.database_proj_name.html($.i18n._('database-parsing')["proj-name"]);
|
||||
this._parsingPanelElmts.createProjectButton.html($.i18n._('database-parsing')["create-proj"]);
|
||||
this._parsingPanelElmts.database_options.html($.i18n._('database-parsing')["option"]);
|
||||
this._parsingPanelElmts.previewButton.html($.i18n._('database-parsing')["preview-button"]);
|
||||
this._parsingPanelElmts.database_updating.html($.i18n._('database-parsing')["updating-preview"]);
|
||||
this._parsingPanelElmts.database_discard_next.html($.i18n._('database-parsing')["discard-next"]);
|
||||
this._parsingPanelElmts.database_discard.html($.i18n._('database-parsing')["discard"]);
|
||||
this._parsingPanelElmts.database_limit_next.html($.i18n._('database-parsing')["limit-next"]);
|
||||
this._parsingPanelElmts.database_limit.html($.i18n._('database-parsing')["limit"]);
|
||||
this._parsingPanelElmts.database_store_row.html($.i18n._('database-parsing')["store-row"]);
|
||||
this._parsingPanelElmts.database_store_cell.html($.i18n._('database-parsing')["store-cell"]);
|
||||
|
||||
if (this._parsingPanelResizer) {
|
||||
$(window).unbind('resize', this._parsingPanelResizer);
|
||||
}
|
||||
|
||||
this._parsingPanelResizer = function() {
|
||||
var elmts = self._parsingPanelElmts;
|
||||
var width = self._parsingPanel.width();
|
||||
var height = self._parsingPanel.height();
|
||||
var headerHeight = elmts.wizardHeader.outerHeight(true);
|
||||
var controlPanelHeight = 250;
|
||||
this._parsingPanelElmts.startOverButton.html($.i18n._('database-parsing')["start-over"]);
|
||||
this._parsingPanelElmts.database_conf_pars.html($.i18n._('database-parsing')["conf-pars"]);
|
||||
this._parsingPanelElmts.database_proj_name.html($.i18n._('database-parsing')["proj-name"]);
|
||||
this._parsingPanelElmts.createProjectButton.html($.i18n._('database-parsing')["create-proj"]);
|
||||
this._parsingPanelElmts.database_options.html($.i18n._('database-parsing')["option"]);
|
||||
this._parsingPanelElmts.previewButton.html($.i18n._('database-parsing')["preview-button"]);
|
||||
this._parsingPanelElmts.database_updating.html($.i18n._('database-parsing')["updating-preview"]);
|
||||
this._parsingPanelElmts.database_discard_next.html($.i18n._('database-parsing')["discard-next"]);
|
||||
this._parsingPanelElmts.database_discard.html($.i18n._('database-parsing')["discard"]);
|
||||
this._parsingPanelElmts.database_limit_next.html($.i18n._('database-parsing')["limit-next"]);
|
||||
this._parsingPanelElmts.database_limit.html($.i18n._('database-parsing')["limit"]);
|
||||
this._parsingPanelElmts.database_store_row.html($.i18n._('database-parsing')["store-row"]);
|
||||
this._parsingPanelElmts.database_store_cell.html($.i18n._('database-parsing')["store-cell"]);
|
||||
|
||||
if (this._parsingPanelResizer) {
|
||||
$(window).unbind('resize', this._parsingPanelResizer);
|
||||
}
|
||||
|
||||
this._parsingPanelResizer = function() {
|
||||
var elmts = self._parsingPanelElmts;
|
||||
var width = self._parsingPanel.width();
|
||||
var height = self._parsingPanel.height();
|
||||
var headerHeight = elmts.wizardHeader.outerHeight(true);
|
||||
var controlPanelHeight = 250;
|
||||
|
||||
elmts.dataPanel
|
||||
.css("left", "0px")
|
||||
.css("top", headerHeight + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.dataPanel)) + "px")
|
||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.dataPanel)) + "px");
|
||||
elmts.progressPanel
|
||||
.css("left", "0px")
|
||||
.css("top", headerHeight + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.progressPanel)) + "px")
|
||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.progressPanel)) + "px");
|
||||
elmts.dataPanel
|
||||
.css("left", "0px")
|
||||
.css("top", headerHeight + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.dataPanel)) + "px")
|
||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.dataPanel)) + "px");
|
||||
elmts.progressPanel
|
||||
.css("left", "0px")
|
||||
.css("top", headerHeight + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.progressPanel)) + "px")
|
||||
.css("height", (height - headerHeight - controlPanelHeight - DOM.getVPaddings(elmts.progressPanel)) + "px");
|
||||
|
||||
elmts.controlPanel
|
||||
.css("left", "0px")
|
||||
.css("top", (height - controlPanelHeight) + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.controlPanel)) + "px")
|
||||
.css("height", (controlPanelHeight - DOM.getVPaddings(elmts.controlPanel)) + "px");
|
||||
};
|
||||
|
||||
$(window).resize(this._parsingPanelResizer);
|
||||
this._parsingPanelResizer();
|
||||
|
||||
this._parsingPanelElmts.startOverButton.click(function() {
|
||||
// explicitly cancel the import job
|
||||
Refine.CreateProjectUI.cancelImportingJob(self._jobID);
|
||||
|
||||
delete self._jobID;
|
||||
delete self._options;
|
||||
|
||||
self._createProjectUI.showSourceSelectionPanel();
|
||||
});
|
||||
|
||||
this._parsingPanelElmts.createProjectButton.click(function() { self._createProject(); });
|
||||
this._parsingPanelElmts.previewButton.click(function() { self._updatePreview(); });
|
||||
//alert("datetime::" + $.now());
|
||||
//this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.connectionName + "_" + this._queryInfo.databaseUser + "_" + $.now();
|
||||
this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.databaseServer + "_" + this._queryInfo.initialDatabase + "_" + $.now();
|
||||
elmts.controlPanel
|
||||
.css("left", "0px")
|
||||
.css("top", (height - controlPanelHeight) + "px")
|
||||
.css("width", (width - DOM.getHPaddings(elmts.controlPanel)) + "px")
|
||||
.css("height", (controlPanelHeight - DOM.getVPaddings(elmts.controlPanel)) + "px");
|
||||
};
|
||||
|
||||
$(window).resize(this._parsingPanelResizer);
|
||||
this._parsingPanelResizer();
|
||||
|
||||
this._parsingPanelElmts.startOverButton.click(function() {
|
||||
// explicitly cancel the import job
|
||||
Refine.CreateProjectUI.cancelImportingJob(self._jobID);
|
||||
|
||||
delete self._jobID;
|
||||
delete self._options;
|
||||
|
||||
self._createProjectUI.showSourceSelectionPanel();
|
||||
});
|
||||
|
||||
this._parsingPanelElmts.createProjectButton.click(function() { self._createProject(); });
|
||||
this._parsingPanelElmts.previewButton.click(function() { self._updatePreview(); });
|
||||
//alert("datetime::" + $.now());
|
||||
//this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.connectionName + "_" + this._queryInfo.databaseUser + "_" + $.now();
|
||||
this._parsingPanelElmts.projectNameInput[0].value = this._queryInfo.databaseServer + "_" + this._queryInfo.initialDatabase + "_" + $.now();
|
||||
|
||||
|
||||
if (this._options.limit > 0) {
|
||||
this._parsingPanelElmts.limitCheckbox.prop("checked", true);
|
||||
this._parsingPanelElmts.limitInput[0].value = this._options.limit.toString();
|
||||
}
|
||||
if (this._options.skipDataLines > 0) {
|
||||
this._parsingPanelElmts.skipCheckbox.prop("checked", true);
|
||||
this._parsingPanelElmts.skipInput.value[0].value = this._options.skipDataLines.toString();
|
||||
}
|
||||
if (this._options.storeBlankRows) {
|
||||
this._parsingPanelElmts.storeBlankRowsCheckbox.prop("checked", true);
|
||||
}
|
||||
if (this._options.storeBlankCellsAsNulls) {
|
||||
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
|
||||
}
|
||||
|
||||
if (this._options.limit > 0) {
|
||||
this._parsingPanelElmts.limitCheckbox.prop("checked", true);
|
||||
this._parsingPanelElmts.limitInput[0].value = this._options.limit.toString();
|
||||
}
|
||||
if (this._options.skipDataLines > 0) {
|
||||
this._parsingPanelElmts.skipCheckbox.prop("checked", true);
|
||||
this._parsingPanelElmts.skipInput.value[0].value = this._options.skipDataLines.toString();
|
||||
}
|
||||
if (this._options.storeBlankRows) {
|
||||
this._parsingPanelElmts.storeBlankRowsCheckbox.prop("checked", true);
|
||||
}
|
||||
if (this._options.storeBlankCellsAsNulls) {
|
||||
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
|
||||
}
|
||||
|
||||
var onChange = function() {
|
||||
self._scheduleUpdatePreview();
|
||||
};
|
||||
this._parsingPanel.find("input").bind("change", onChange);
|
||||
this._parsingPanel.find("select").bind("change", onChange);
|
||||
|
||||
this._createProjectUI.showCustomPanel(this._parsingPanel);
|
||||
this._updatePreview();
|
||||
var onChange = function() {
|
||||
self._scheduleUpdatePreview();
|
||||
};
|
||||
this._parsingPanel.find("input").bind("change", onChange);
|
||||
this._parsingPanel.find("select").bind("change", onChange);
|
||||
|
||||
this._createProjectUI.showCustomPanel(this._parsingPanel);
|
||||
this._updatePreview();
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
if (this._timerID != null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this._timerID = window.setTimeout(function() {
|
||||
self._timerID = null;
|
||||
self._updatePreview();
|
||||
}, 500); // 0.5 second
|
||||
};
|
||||
var self = this;
|
||||
this._timerID = window.setTimeout(function() {
|
||||
self._timerID = null;
|
||||
self._updatePreview();
|
||||
}, 500); // 0.5 second
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype._updatePreview = function() {
|
||||
var self = this;
|
||||
// alert("query::" + this._queryInfo.query);
|
||||
this._parsingPanelElmts.dataPanel.hide();
|
||||
this._parsingPanelElmts.progressPanel.show();
|
||||
this._queryInfo.options = JSON.stringify(this.getOptions());
|
||||
//alert("options:" + this._queryInfo.options);
|
||||
var self = this;
|
||||
// alert("query::" + this._queryInfo.query);
|
||||
this._parsingPanelElmts.dataPanel.hide();
|
||||
this._parsingPanelElmts.progressPanel.show();
|
||||
this._queryInfo.options = JSON.stringify(this.getOptions());
|
||||
//alert("options:" + this._queryInfo.options);
|
||||
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"jobID": this._jobID,
|
||||
"subCommand": "parse-preview"
|
||||
}),
|
||||
|
||||
this._queryInfo,
|
||||
|
||||
function(result) {
|
||||
if (result.status == "ok") {
|
||||
self._getPreviewData(function(projectData) {
|
||||
self._parsingPanelElmts.progressPanel.hide();
|
||||
self._parsingPanelElmts.dataPanel.show();
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"jobID": this._jobID,
|
||||
"subCommand": "parse-preview"
|
||||
}),
|
||||
|
||||
this._queryInfo,
|
||||
|
||||
function(result) {
|
||||
if (result.status == "ok") {
|
||||
self._getPreviewData(function(projectData) {
|
||||
self._parsingPanelElmts.progressPanel.hide();
|
||||
self._parsingPanelElmts.dataPanel.show();
|
||||
|
||||
new Refine.PreviewTable(projectData, self._parsingPanelElmts.dataPanel.unbind().empty());
|
||||
});
|
||||
} else {
|
||||
alert(result.message);
|
||||
//self._parsingPanelElmts.progressPanel.hide();
|
||||
alert('Errors:\n' +
|
||||
(result.message) ? result.message : Refine.CreateProjectUI.composeErrorMessage(job));
|
||||
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
new Refine.PreviewTable(projectData, self._parsingPanelElmts.dataPanel.unbind().empty());
|
||||
});
|
||||
} else {
|
||||
alert(result.message);
|
||||
//self._parsingPanelElmts.progressPanel.hide();
|
||||
alert('Errors:\n' +
|
||||
(result.message) ? result.message : Refine.CreateProjectUI.composeErrorMessage(job));
|
||||
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype._getPreviewData = function(callback, numRows) {
|
||||
var self = this;
|
||||
var result = {};
|
||||
var self = this;
|
||||
var result = {};
|
||||
|
||||
$.post(
|
||||
"command/core/get-models?" + $.param({ "importingJobID" : this._jobID }),
|
||||
null,
|
||||
function(data) {
|
||||
for (var n in data) {
|
||||
if (data.hasOwnProperty(n)) {
|
||||
result[n] = data[n];
|
||||
}
|
||||
}
|
||||
|
||||
$.post(
|
||||
"command/core/get-rows?" + $.param({
|
||||
"importingJobID" : self._jobID,
|
||||
"start" : 0,
|
||||
"limit" : numRows || 100 // More than we parse for preview anyway
|
||||
}),
|
||||
null,
|
||||
function(data) {
|
||||
result.rowModel = data;
|
||||
callback(result);
|
||||
},
|
||||
"jsonp"
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
$.post(
|
||||
"command/core/get-models?" + $.param({ "importingJobID" : this._jobID }),
|
||||
null,
|
||||
function(data) {
|
||||
for (var n in data) {
|
||||
if (data.hasOwnProperty(n)) {
|
||||
result[n] = data[n];
|
||||
}
|
||||
}
|
||||
|
||||
$.post(
|
||||
"command/core/get-rows?" + $.param({
|
||||
"importingJobID" : self._jobID,
|
||||
"start" : 0,
|
||||
"limit" : numRows || 100 // More than we parse for preview anyway
|
||||
}),
|
||||
null,
|
||||
function(data) {
|
||||
result.rowModel = data;
|
||||
callback(result);
|
||||
},
|
||||
"jsonp"
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
||||
Refine.DatabaseImportController.prototype._createProject = function() {
|
||||
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
|
||||
if (projectName.length == 0) {
|
||||
window.alert("Please name the project.");
|
||||
this._parsingPanelElmts.projectNameInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var options = this.getOptions();
|
||||
options.projectName = projectName;
|
||||
|
||||
this._queryInfo.options = JSON.stringify(options);
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"jobID": this._jobID,
|
||||
"subCommand": "create-project"
|
||||
}),
|
||||
this._queryInfo,
|
||||
function(o) {
|
||||
if (o.status == 'error') {
|
||||
alert(o.message);
|
||||
} else {
|
||||
var start = new Date();
|
||||
var timerID = window.setInterval(
|
||||
function() {
|
||||
self._createProjectUI.pollImportJob(
|
||||
start,
|
||||
self._jobID,
|
||||
timerID,
|
||||
function(job) {
|
||||
return "projectID" in job.config;
|
||||
},
|
||||
function(jobID, job) {
|
||||
//alert("jobID::" + jobID + " job :" + job);
|
||||
window.clearInterval(timerID);
|
||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||
document.location = "project?project=" + job.config.projectID;
|
||||
},
|
||||
function(job) {
|
||||
alert(Refine.CreateProjectUI.composeErrorMessage(job));
|
||||
}
|
||||
);
|
||||
},
|
||||
1000
|
||||
);
|
||||
self._createProjectUI.showImportProgressPanel($.i18n._('database-import')["creating"], function() {
|
||||
// stop the timed polling
|
||||
window.clearInterval(timerID);
|
||||
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
|
||||
if (projectName.length == 0) {
|
||||
window.alert("Please name the project.");
|
||||
this._parsingPanelElmts.projectNameInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var options = this.getOptions();
|
||||
options.projectName = projectName;
|
||||
|
||||
this._queryInfo.options = JSON.stringify(options);
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "database/database-import-controller",
|
||||
"jobID": this._jobID,
|
||||
"subCommand": "create-project"
|
||||
}),
|
||||
this._queryInfo,
|
||||
function(o) {
|
||||
if (o.status == 'error') {
|
||||
alert(o.message);
|
||||
} else {
|
||||
var start = new Date();
|
||||
var timerID = window.setInterval(
|
||||
function() {
|
||||
self._createProjectUI.pollImportJob(
|
||||
start,
|
||||
self._jobID,
|
||||
timerID,
|
||||
function(job) {
|
||||
return "projectID" in job.config;
|
||||
},
|
||||
function(jobID, job) {
|
||||
//alert("jobID::" + jobID + " job :" + job);
|
||||
window.clearInterval(timerID);
|
||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||
document.location = "project?project=" + job.config.projectID;
|
||||
},
|
||||
function(job) {
|
||||
alert(Refine.CreateProjectUI.composeErrorMessage(job));
|
||||
}
|
||||
);
|
||||
},
|
||||
1000
|
||||
);
|
||||
self._createProjectUI.showImportProgressPanel($.i18n._('database-import')["creating"], function() {
|
||||
// stop the timed polling
|
||||
window.clearInterval(timerID);
|
||||
|
||||
// explicitly cancel the import job
|
||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||
// explicitly cancel the import job
|
||||
Refine.CreateProjectUI.cancelImportingJob(jobID);
|
||||
|
||||
self._createProjectUI.showSourceSelectionPanel();
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
self._createProjectUI.showSourceSelectionPanel();
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
@ -1,15 +1,15 @@
|
||||
<div bind="wizardHeader" class="database-importing-wizard-header">
|
||||
<div class="grid-layout layout-tightest layout-full">
|
||||
<table>
|
||||
<tr>
|
||||
<td width="1%"><button bind="startOverButton" class="button">« Start Over</button></td>
|
||||
<td width="98%" bind="database_conf_pars"></td>
|
||||
<td style="text-align: right;" bind="database_proj_name"></td>
|
||||
<td width="1%"><input class="inline" type="text" size="30" bind="projectNameInput" /></td>
|
||||
<td width="1%"><button bind="createProjectButton" class="button button-primary"></button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="grid-layout layout-tightest layout-full">
|
||||
<table>
|
||||
<tr>
|
||||
<td width="1%"><button bind="startOverButton" class="button">« Start Over</button></td>
|
||||
<td width="98%" bind="database_conf_pars"></td>
|
||||
<td style="text-align: right;" bind="database_proj_name"></td>
|
||||
<td width="1%"><input class="inline" type="text" size="30" bind="projectNameInput" /></td>
|
||||
<td width="1%"><button bind="createProjectButton" class="button button-primary"></button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div bind="dataPanel" class="database-importing-parsing-data-panel"></div>
|
||||
<div bind="progressPanel" class="database-importing-progress-data-panel">
|
||||
@ -17,37 +17,37 @@
|
||||
<span bind="database_updating"></span>
|
||||
</div>
|
||||
<div bind="controlPanel" class="database-importing-parsing-control-panel">
|
||||
<div class="grid-layout layout-normal">
|
||||
<table>
|
||||
<tr>
|
||||
<td bind="database_options"></td>
|
||||
<td><button class="button" bind="previewButton"></button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="grid-layout layout-tightest">
|
||||
<table>
|
||||
<tr><td width="1%"><input type="checkbox" bind="skipCheckbox" id="$skip"/></td>
|
||||
<td><label for="$skip" bind="database_discard_next"></label></td>
|
||||
<td><input bind="skipInput" type="text" class="lightweight" size="2" value="0" />
|
||||
<label for="$skip" bind="database_discard"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="limitCheckbox" id="$limit" /></td>
|
||||
<td><label for="$limit" bind="database_limit_next"></label></td>
|
||||
<td><input bind="limitInput" type="text" class="lightweight" size="10" value="0" />
|
||||
<label for="$limit" bind="database_limit"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankRowsCheckbox" id="$store-blank-rows" /></td>
|
||||
<td colspan="2"><label for="$store-blank-rows" bind="database_store_row"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankCellsAsNullsCheckbox" id="$store-blank-cells" /></td>
|
||||
<td colspan="2"><label for="$store-blank-cells" bind="database_store_cell"></label></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="grid-layout layout-normal">
|
||||
<table>
|
||||
<tr>
|
||||
<td bind="database_options"></td>
|
||||
<td><button class="button" bind="previewButton"></button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="grid-layout layout-tightest">
|
||||
<table>
|
||||
<tr><td width="1%"><input type="checkbox" bind="skipCheckbox" id="$skip"/></td>
|
||||
<td><label for="$skip" bind="database_discard_next"></label></td>
|
||||
<td><input bind="skipInput" type="text" class="lightweight" size="2" value="0" />
|
||||
<label for="$skip" bind="database_discard"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="limitCheckbox" id="$limit" /></td>
|
||||
<td><label for="$limit" bind="database_limit_next"></label></td>
|
||||
<td><input bind="limitInput" type="text" class="lightweight" size="10" value="0" />
|
||||
<label for="$limit" bind="database_limit"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankRowsCheckbox" id="$store-blank-rows" /></td>
|
||||
<td colspan="2"><label for="$store-blank-rows" bind="database_store_row"></label></td>
|
||||
</tr>
|
||||
<tr><td width="1%"><input type="checkbox" bind="storeBlankCellsAsNullsCheckbox" id="$store-blank-cells" /></td>
|
||||
<td colspan="2"><label for="$store-blank-cells" bind="database_store_cell"></label></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -1,34 +1,30 @@
|
||||
/*
|
||||
|
||||
Copyright 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
Refine.DatabaseSourceUI = function(controller) {
|
||||
@ -59,108 +55,108 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
|
||||
|
||||
|
||||
this._elmts.newConnectionButton.click(function(evt) {
|
||||
self._resetDatabaseImportForm();
|
||||
$( "#newConnectionDiv" ).show();
|
||||
$( "#sqlEditorDiv" ).hide();
|
||||
// self._body.find('.newConnectionDiv').show();
|
||||
// self._body.find('.sqlEditorDiv').hide();
|
||||
|
||||
self._resetDatabaseImportForm();
|
||||
$( "#newConnectionDiv" ).show();
|
||||
$( "#sqlEditorDiv" ).hide();
|
||||
// self._body.find('.newConnectionDiv').show();
|
||||
// self._body.find('.sqlEditorDiv').hide();
|
||||
|
||||
});
|
||||
|
||||
|
||||
this._elmts.databaseTypeSelect.change(function(event) {
|
||||
var type = $( "#databaseTypeSelect" ).val();
|
||||
if(type === "postgresql"){
|
||||
$( "#databaseUser" ).val("postgres");
|
||||
$( "#databasePort" ).val("5432");
|
||||
}else if(type === "mysql"){
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}else if(type === "mariadb"){
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}else{
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}
|
||||
var type = $( "#databaseTypeSelect" ).val();
|
||||
if(type === "postgresql"){
|
||||
$( "#databaseUser" ).val("postgres");
|
||||
$( "#databasePort" ).val("5432");
|
||||
}else if(type === "mysql"){
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}else if(type === "mariadb"){
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}else{
|
||||
$( "#databaseUser" ).val("root");
|
||||
$( "#databasePort" ).val("3306");
|
||||
}
|
||||
});
|
||||
|
||||
this._elmts.testDatabaseButton.click(function(evt) {
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
self._testDatabaseConnect(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
|
||||
if(self._validateNewConnectionForm() === true){
|
||||
self._testDatabaseConnect(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this._elmts.databaseConnectButton.click(function(evt) {
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
self._connect(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
if(self._validateNewConnectionForm() === true){
|
||||
self._connect(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
this._elmts.saveConnectionButton.click(function(evt) {
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
if (connectionNameInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||
} else{
|
||||
self._saveConnection(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
if (connectionNameInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||
} else{
|
||||
self._saveConnection(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this._elmts.executeQueryButton.click(function(evt) {
|
||||
var jdbcQueryInfo = {};
|
||||
jdbcQueryInfo.connectionName = $( "#currentConnectionNameInput" ).val();
|
||||
jdbcQueryInfo.databaseType = $( "#currentDatabaseTypeInput" ).val();
|
||||
jdbcQueryInfo.databaseServer = $( "#currentDatabaseHostInput" ).val();
|
||||
jdbcQueryInfo.databasePort = $( "#currentDatabasePortInput" ).val();
|
||||
jdbcQueryInfo.databaseUser = $( "#currentDatabaseUserInput" ).val();
|
||||
jdbcQueryInfo.databasePassword = $( "#currentDatabasePasswordInput" ).val();
|
||||
jdbcQueryInfo.initialDatabase = $( "#currentInitialDatabaseInput" ).val();
|
||||
jdbcQueryInfo.query = $.trim($( "#queryTextArea" ).val());
|
||||
|
||||
var jdbcQueryInfo = {};
|
||||
jdbcQueryInfo.connectionName = $( "#currentConnectionNameInput" ).val();
|
||||
jdbcQueryInfo.databaseType = $( "#currentDatabaseTypeInput" ).val();
|
||||
jdbcQueryInfo.databaseServer = $( "#currentDatabaseHostInput" ).val();
|
||||
jdbcQueryInfo.databasePort = $( "#currentDatabasePortInput" ).val();
|
||||
jdbcQueryInfo.databaseUser = $( "#currentDatabaseUserInput" ).val();
|
||||
jdbcQueryInfo.databasePassword = $( "#currentDatabasePasswordInput" ).val();
|
||||
jdbcQueryInfo.initialDatabase = $( "#currentInitialDatabaseInput" ).val();
|
||||
jdbcQueryInfo.query = $.trim($( "#queryTextArea" ).val());
|
||||
|
||||
// if(jdbcQueryInfo.query && jdbcQueryInfo.query.length > 0 ) {
|
||||
// self._executeQuery(jdbcQueryInfo);
|
||||
// }else{
|
||||
// window.alert($.i18n._('database-source')["alert-query"]);
|
||||
// }
|
||||
|
||||
if(self.validateQuery(jdbcQueryInfo.query)) {
|
||||
self._executeQuery(jdbcQueryInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(self.validateQuery(jdbcQueryInfo.query)) {
|
||||
self._executeQuery(jdbcQueryInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
this._elmts.editConnectionButton.click(function(evt) {
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
if (connectionNameInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||
} else{
|
||||
self._editConnection(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(self._validateNewConnectionForm() == true){
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
if (connectionNameInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-connection-name"]);
|
||||
} else{
|
||||
self._editConnection(self._getConnectionInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this._elmts.cancelEditConnectionButton.click(function(evt) {
|
||||
self._resetDatabaseImportForm();
|
||||
|
||||
self._resetDatabaseImportForm();
|
||||
|
||||
});
|
||||
|
||||
//load saved connections from settings file in user home directory
|
||||
@ -174,43 +170,43 @@ Refine.DatabaseSourceUI.prototype.focus = function() {
|
||||
|
||||
|
||||
Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
|
||||
//alert("query::" + query);
|
||||
if(!query || query.length <= 0 ) {
|
||||
window.alert($.i18n._('database-source')["alert-query"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
var allCapsQuery = query.toUpperCase();
|
||||
|
||||
if(allCapsQuery.indexOf('DROP') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DROP");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('TRUNCATE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " TRUNCATE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('DELETE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DELETE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('ROLLBACK') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ROLLBACK");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('SHUTDOWN') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " SHUTDOWN");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('INSERT') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " INSERT");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('ALTER') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ALTER");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('UPDATE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " UPDATE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('LIMIT') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " LIMIT");
|
||||
return false;
|
||||
}
|
||||
|
||||
//alert("query::" + query);
|
||||
if(!query || query.length <= 0 ) {
|
||||
window.alert($.i18n._('database-source')["alert-query"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
var allCapsQuery = query.toUpperCase();
|
||||
|
||||
if(allCapsQuery.indexOf('DROP') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DROP");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('TRUNCATE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " TRUNCATE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('DELETE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " DELETE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('ROLLBACK') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ROLLBACK");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('SHUTDOWN') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " SHUTDOWN");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('INSERT') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " INSERT");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('ALTER') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " ALTER");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('UPDATE') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " UPDATE");
|
||||
return false;
|
||||
}else if(allCapsQuery.indexOf('LIMIT') > -1){
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-keyword"] + " LIMIT");
|
||||
return false;
|
||||
}
|
||||
|
||||
// if ((allCapsQuery.indexOf('DROP') > -1) || (allCapsQuery.indexOf('TRUNCATE') > -1) ||
|
||||
// (allCapsQuery.indexOf('DELETE') > -1) || (allCapsQuery.indexOf('ROLLBACK') > -1)
|
||||
// || (allCapsQuery.indexOf('SHUTDOWN') > -1) || (allCapsQuery.indexOf('INSERT') > -1)
|
||||
@ -219,265 +215,265 @@ Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
|
||||
// window.alert($.i18n._('database-source')["alert-invalid-query-keyword"]);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(!allCapsQuery.startsWith('SELECT')) {
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-select"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!allCapsQuery.startsWith('SELECT')) {
|
||||
window.alert($.i18n._('database-source')["alert-invalid-query-select"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._editConnection = function(connectionInfo) {
|
||||
//alert("database user:" + connectionInfo.databaseUser);
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: 'command/database/saved-connection',
|
||||
type: 'PUT',
|
||||
contentType:'application/x-www-form-urlencoded',
|
||||
data: connectionInfo,
|
||||
success: function(settings) {
|
||||
if(settings){
|
||||
$( "#menuListUl" ).empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
//alert("database user:" + connectionInfo.databaseUser);
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: 'command/database/saved-connection',
|
||||
type: 'PUT',
|
||||
contentType:'application/x-www-form-urlencoded',
|
||||
data: connectionInfo,
|
||||
success: function(settings) {
|
||||
if(settings){
|
||||
$( "#menuListUl" ).empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
||||
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
$( "#menuListUl" ).append(items.join(''));
|
||||
window.alert($.i18n._('database-source')["alert-connection-edit"]);
|
||||
}
|
||||
}
|
||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
$( "#menuListUl" ).append(items.join(''));
|
||||
window.alert($.i18n._('database-source')["alert-connection-edit"]);
|
||||
}
|
||||
}
|
||||
}).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._executeQuery = function(jdbcQueryInfo) {
|
||||
var self = this;
|
||||
//remove start line
|
||||
|
||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["checking"]);
|
||||
//$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled');
|
||||
var self = this;
|
||||
//remove start line
|
||||
|
||||
$.post(
|
||||
"command/database/test-query",
|
||||
jdbcQueryInfo,
|
||||
function(jdbcConnectionResult) {
|
||||
// $("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||
dismiss();
|
||||
self._controller.startImportingDocument(jdbcQueryInfo);
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
//$("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||
dismiss();
|
||||
var dismiss = DialogSystem.showBusy($.i18n._('database-import')["checking"]);
|
||||
//$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled');
|
||||
|
||||
$.post(
|
||||
"command/database/test-query",
|
||||
jdbcQueryInfo,
|
||||
function(jdbcConnectionResult) {
|
||||
// $("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||
dismiss();
|
||||
self._controller.startImportingDocument(jdbcQueryInfo);
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
//$("#executeQueryBtn").text('Preview Query Result').removeAttr('disabled');
|
||||
dismiss();
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
//remove end line
|
||||
|
||||
//self._controller.startImportingDocument(jdbcQueryInfo);
|
||||
|
||||
//self._controller.startImportingDocument(jdbcQueryInfo);
|
||||
}
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._saveConnection = function(jdbcConnectionInfo) {
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/saved-connection",
|
||||
jdbcConnectionInfo,
|
||||
function(settings) {
|
||||
if(settings){
|
||||
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/saved-connection",
|
||||
jdbcConnectionInfo,
|
||||
function(settings) {
|
||||
if(settings){
|
||||
|
||||
// self._elmts.scListGroupDiv.empty();
|
||||
self._elmts.menuListUl.empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
|
||||
self._elmts.menuListUl.empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
|
||||
// items.push('<a href="#" class="list-group-item list-group-item-action">'
|
||||
// + '<span class="context-menu-one context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
self._elmts.menuListUl.append(items.join(''));
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
})
|
||||
|
||||
self._elmts.menuListUl.append(items.join(''));
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._loadSavedConnections = function() {
|
||||
var self = this;
|
||||
$.get(
|
||||
"command/database/saved-connection",
|
||||
null,
|
||||
function(settings) {
|
||||
if(settings){
|
||||
|
||||
self._elmts.menuListUl.empty();
|
||||
//self._elmts.scListGroupDiv.empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
|
||||
var self = this;
|
||||
$.get(
|
||||
"command/database/saved-connection",
|
||||
null,
|
||||
function(settings) {
|
||||
if(settings){
|
||||
|
||||
self._elmts.menuListUl.empty();
|
||||
//self._elmts.scListGroupDiv.empty();
|
||||
var items = [];
|
||||
$.each(settings.savedConnections,function(index,savedConnection){
|
||||
|
||||
// items.push('<a href="#" class="list-group-item list-group-item-action context-menu-one">'
|
||||
// + '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
// + '<span class="sc-context-more-vert pull-right"> </span> </a>');
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
|
||||
items.push('<li class="pure-menu-item sc-list"><a href="#" class="pure-menu-link context-menu-one">'
|
||||
+ '<span class="context-menu-text" >' + savedConnection.connectionName + '</span>'
|
||||
+ '<span class="sc-context-more-vert pull-right"> </span></a></li>');
|
||||
|
||||
})
|
||||
|
||||
self._elmts.menuListUl.append(items.join(''));
|
||||
// self._elmts.scListGroupDiv.append(items.join(''));
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
);
|
||||
})
|
||||
|
||||
self._elmts.menuListUl.append(items.join(''));
|
||||
// self._elmts.scListGroupDiv.append(items.join(''));
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._testDatabaseConnect = function(jdbcConnectionInfo) {
|
||||
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/test-connect",
|
||||
jdbcConnectionInfo,
|
||||
function(jdbcConnectionResult) {
|
||||
if(jdbcConnectionResult && jdbcConnectionResult.connectionResult == true){
|
||||
window.alert("Test Connection Succeeded!");
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/test-connect",
|
||||
jdbcConnectionInfo,
|
||||
function(jdbcConnectionResult) {
|
||||
if(jdbcConnectionResult && jdbcConnectionResult.connectionResult == true){
|
||||
window.alert("Test Connection Succeeded!");
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._connect = function(jdbcConnectionInfo) {
|
||||
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/connect",
|
||||
jdbcConnectionInfo,
|
||||
function(databaseInfo) {
|
||||
|
||||
if(databaseInfo){
|
||||
$( "#currentConnectionNameInput" ).val(jdbcConnectionInfo.connectionName);
|
||||
$( "#currentDatabaseTypeInput" ).val(jdbcConnectionInfo.databaseType);
|
||||
$( "#currentDatabaseUserInput" ).val(jdbcConnectionInfo.databaseUser);
|
||||
$( "#currentDatabasePasswordInput" ).val(jdbcConnectionInfo.databasePassword);
|
||||
$( "#currentDatabaseHostInput" ).val(jdbcConnectionInfo.databaseServer);
|
||||
$( "#currentDatabasePortInput" ).val(jdbcConnectionInfo.databasePort);
|
||||
$( "#currentInitialDatabaseInput" ).val(jdbcConnectionInfo.initialDatabase);
|
||||
|
||||
var connectionParam = "Connection :: "
|
||||
+ "jdbc:"
|
||||
+ jdbcConnectionInfo.databaseType + "://"
|
||||
+ jdbcConnectionInfo.databaseServer + ":"
|
||||
+ jdbcConnectionInfo.databasePort + "/"
|
||||
+ jdbcConnectionInfo.initialDatabase;
|
||||
|
||||
//alert("connectionParam::" + connectionParam);
|
||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||
// self._body.find('.newConnectionDiv').hide();
|
||||
// self._body.find('.sqlEditorDiv').show();
|
||||
$( "#newConnectionDiv" ).hide();
|
||||
$( "#sqlEditorDiv" ).show();
|
||||
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
return;
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
|
||||
var self = this;
|
||||
$.post(
|
||||
"command/database/connect",
|
||||
jdbcConnectionInfo,
|
||||
function(databaseInfo) {
|
||||
|
||||
if(databaseInfo){
|
||||
$( "#currentConnectionNameInput" ).val(jdbcConnectionInfo.connectionName);
|
||||
$( "#currentDatabaseTypeInput" ).val(jdbcConnectionInfo.databaseType);
|
||||
$( "#currentDatabaseUserInput" ).val(jdbcConnectionInfo.databaseUser);
|
||||
$( "#currentDatabasePasswordInput" ).val(jdbcConnectionInfo.databasePassword);
|
||||
$( "#currentDatabaseHostInput" ).val(jdbcConnectionInfo.databaseServer);
|
||||
$( "#currentDatabasePortInput" ).val(jdbcConnectionInfo.databasePort);
|
||||
$( "#currentInitialDatabaseInput" ).val(jdbcConnectionInfo.initialDatabase);
|
||||
|
||||
var connectionParam = "Connection :: "
|
||||
+ "jdbc:"
|
||||
+ jdbcConnectionInfo.databaseType + "://"
|
||||
+ jdbcConnectionInfo.databaseServer + ":"
|
||||
+ jdbcConnectionInfo.databasePort + "/"
|
||||
+ jdbcConnectionInfo.initialDatabase;
|
||||
|
||||
//alert("connectionParam::" + connectionParam);
|
||||
$( "#connectionParameterSpan" ).text(connectionParam);
|
||||
// self._body.find('.newConnectionDiv').hide();
|
||||
// self._body.find('.sqlEditorDiv').show();
|
||||
$( "#newConnectionDiv" ).hide();
|
||||
$( "#sqlEditorDiv" ).show();
|
||||
|
||||
}else{
|
||||
window.alert("Unable to establish connection to database");
|
||||
return;
|
||||
}
|
||||
|
||||
},
|
||||
"json"
|
||||
).fail(function( jqXhr, textStatus, errorThrown ){
|
||||
alert( textStatus + ':' + errorThrown );
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._getConnectionInfo = function() {
|
||||
var self = this;
|
||||
var jdbcConnectionInfo = {};
|
||||
jdbcConnectionInfo.connectionName = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
jdbcConnectionInfo.databaseType = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||
jdbcConnectionInfo.databaseServer = $.trim(self._elmts.databaseHostInput[0].value);
|
||||
jdbcConnectionInfo.databasePort = $.trim(self._elmts.databasePortInput[0].value);
|
||||
jdbcConnectionInfo.databaseUser = $.trim(self._elmts.databaseUserInput[0].value);
|
||||
jdbcConnectionInfo.databasePassword = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||
jdbcConnectionInfo.initialDatabase = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||
jdbcConnectionInfo.initialSchema = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||
return jdbcConnectionInfo;
|
||||
|
||||
var self = this;
|
||||
var jdbcConnectionInfo = {};
|
||||
jdbcConnectionInfo.connectionName = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
jdbcConnectionInfo.databaseType = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||
jdbcConnectionInfo.databaseServer = $.trim(self._elmts.databaseHostInput[0].value);
|
||||
jdbcConnectionInfo.databasePort = $.trim(self._elmts.databasePortInput[0].value);
|
||||
jdbcConnectionInfo.databaseUser = $.trim(self._elmts.databaseUserInput[0].value);
|
||||
jdbcConnectionInfo.databasePassword = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||
jdbcConnectionInfo.initialDatabase = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||
jdbcConnectionInfo.initialSchema = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||
return jdbcConnectionInfo;
|
||||
|
||||
}
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._validateNewConnectionForm = function() {
|
||||
|
||||
var self = this;
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
var databaseTypeSelect = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||
var databaseHostInput = $.trim(self._elmts.databaseHostInput[0].value);
|
||||
var databasePortInput = $.trim(self._elmts.databasePortInput[0].value);
|
||||
var databaseUserInput = $.trim(self._elmts.databaseUserInput[0].value);
|
||||
var databasePasswordInput = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||
var initialDatabaseInput = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||
var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||
|
||||
if (databaseHostInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-server"]);
|
||||
return false;
|
||||
}else if(databasePortInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-port"]);
|
||||
return false;
|
||||
}else if(databaseUserInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-user"]);
|
||||
return false;
|
||||
}else if(initialDatabaseInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-initial-database"]);
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
|
||||
var self = this;
|
||||
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
|
||||
var databaseTypeSelect = $.trim(self._elmts.databaseTypeSelect[0].value);
|
||||
var databaseHostInput = $.trim(self._elmts.databaseHostInput[0].value);
|
||||
var databasePortInput = $.trim(self._elmts.databasePortInput[0].value);
|
||||
var databaseUserInput = $.trim(self._elmts.databaseUserInput[0].value);
|
||||
var databasePasswordInput = $.trim(self._elmts.databasePasswordInput[0].value);
|
||||
var initialDatabaseInput = $.trim(self._elmts.initialDatabaseInput[0].value);
|
||||
var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value);
|
||||
|
||||
if (databaseHostInput.length === 0) {
|
||||
window.alert($.i18n._('database-source')["alert-server"]);
|
||||
return false;
|
||||
}else if(databasePortInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-port"]);
|
||||
return false;
|
||||
}else if(databaseUserInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-user"]);
|
||||
return false;
|
||||
}else if(initialDatabaseInput.length === 0){
|
||||
window.alert($.i18n._('database-source')["alert-initial-database"]);
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Refine.DatabaseSourceUI.prototype._resetDatabaseImportForm = function() {
|
||||
var self = this;
|
||||
$( "#connectionName" ).val("127.0.0.1");
|
||||
$( "#databaseTypeSelect" ).val("postgresql");
|
||||
$( "#databaseHost" ).val("127.0.0.1");
|
||||
$( "#databasePort" ).val("5432");
|
||||
$( "#databaseUser" ).val("postgres");
|
||||
$( "#databasePassword" ).val("");
|
||||
$( "#initialDatabase" ).val("");
|
||||
$( "#initialSchema" ).val("");
|
||||
|
||||
$( "#editConnectionControlDiv" ).hide();
|
||||
$( "#newConnectionControlDiv" ).show();
|
||||
$('#connectionName').removeAttr('readonly');
|
||||
|
||||
var self = this;
|
||||
$( "#connectionName" ).val("127.0.0.1");
|
||||
$( "#databaseTypeSelect" ).val("postgresql");
|
||||
$( "#databaseHost" ).val("127.0.0.1");
|
||||
$( "#databasePort" ).val("5432");
|
||||
$( "#databaseUser" ).val("postgres");
|
||||
$( "#databasePassword" ).val("");
|
||||
$( "#initialDatabase" ).val("");
|
||||
$( "#initialSchema" ).val("");
|
||||
|
||||
$( "#editConnectionControlDiv" ).hide();
|
||||
$( "#newConnectionControlDiv" ).show();
|
||||
$('#connectionName').removeAttr('readonly');
|
||||
|
||||
};
|
||||
|
@ -1,48 +1,44 @@
|
||||
/*
|
||||
|
||||
Copyright 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var dictionary = "";
|
||||
$.ajax({
|
||||
url : "command/core/load-language?",
|
||||
type : "POST",
|
||||
async : false,
|
||||
data : {
|
||||
module : "database",
|
||||
url : "command/core/load-language?",
|
||||
type : "POST",
|
||||
async : false,
|
||||
data : {
|
||||
module : "database",
|
||||
|
||||
},
|
||||
success : function(data) {
|
||||
dictionary = data;
|
||||
}
|
||||
},
|
||||
success : function(data) {
|
||||
dictionary = data;
|
||||
}
|
||||
});
|
||||
$.i18n.setDictionary(dictionary);
|
||||
// End internationalization
|
||||
|
@ -1,36 +1,31 @@
|
||||
/*
|
||||
|
||||
Copyright 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
@import-less url("theme.less");
|
||||
|
||||
.database-container {
|
||||
@ -85,10 +80,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
background: white;
|
||||
padding: @padding_looser;
|
||||
}
|
||||
|
||||
|
||||
.context-menu-text {
|
||||
padding: 4px 4px 2px 2px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.custom-restricted {
|
||||
@ -114,7 +109,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
.layout-div {
|
||||
width : 100%;
|
||||
|
||||
|
||||
}
|
||||
.layout-div .connection-div-layout {
|
||||
min-width: 400px;
|
||||
@ -132,7 +127,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.new-connection-div {
|
||||
margin-left:40px;
|
||||
padding-left:20px;
|
||||
}
|
||||
}
|
||||
.new-connection-fieldset {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
@ -148,5 +143,5 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
|
||||
|
||||
}
|
||||
|
@ -505,9 +505,9 @@ th {
|
||||
|
||||
/* IE10 display: -ms-flexbox (and display: flex in IE 11) does not work inside a table; fall back to block and rely on font hack */
|
||||
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
||||
table .pure-g {
|
||||
display: block;
|
||||
}
|
||||
table .pure-g {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/* Opera as of 12 on Windows needs word-spacing.
|
||||
|
@ -1,34 +1,30 @@
|
||||
/*
|
||||
|
||||
Copyright 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
* Copyright (c) 2017, Tony Opara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Google nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
@import-less url("../../../../main/webapp/modules/core/styles/theme.less");
|
||||
|
@ -44,7 +44,7 @@ import com.google.refine.importing.ImportingJob;
|
||||
|
||||
public class DBQueryResultImportReader implements TableDataReader {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("DBQueryResultImportReader");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DBQueryResultImportReader");
|
||||
|
||||
private final ImportingJob job;
|
||||
private final String querySource;
|
||||
|
@ -44,7 +44,7 @@ import com.google.refine.importing.ImportingJob;
|
||||
|
||||
public class DBQueryResultPreviewReader implements TableDataReader {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("DBQueryResultPreviewReader");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DBQueryResultPreviewReader");
|
||||
|
||||
private final ImportingJob job;
|
||||
private final String querySource;
|
||||
|
@ -63,7 +63,7 @@ import com.google.refine.util.ParsingUtilities;
|
||||
|
||||
public class DatabaseImportController implements ImportingController {
|
||||
|
||||
final static Logger logger = LoggerFactory.getLogger("DatabaseImportController");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DatabaseImportController");
|
||||
protected RefineServlet servlet;
|
||||
public static int DEFAULT_PREVIEW_LIMIT = 100;
|
||||
public static String OPTIONS_KEY = "options";
|
||||
|
@ -47,7 +47,7 @@ import edu.mit.simile.butterfly.ButterflyModuleImpl;
|
||||
|
||||
public class DatabaseModuleImpl extends ButterflyModuleImpl implements Jsonizable {
|
||||
|
||||
final static Logger logger = LoggerFactory.getLogger("DatabaseModuleImpl");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DatabaseModuleImpl");
|
||||
|
||||
public static DatabaseModuleImpl instance;
|
||||
|
||||
|
@ -45,7 +45,7 @@ import com.google.refine.extension.database.pgsql.PgSQLDatabaseService;
|
||||
|
||||
public abstract class DatabaseService {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("DatabaseService");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DatabaseService");
|
||||
|
||||
|
||||
public static class DBType {
|
||||
|
@ -46,7 +46,7 @@ import com.google.refine.io.FileProjectManager;
|
||||
|
||||
public class DatabaseUtils {
|
||||
|
||||
final static Logger logger = LoggerFactory.getLogger("DatabaseUtils");
|
||||
private static final Logger logger = LoggerFactory.getLogger("DatabaseUtils");
|
||||
|
||||
|
||||
private final static String DATABASE_EXTENSION_DIR = "dbextension";
|
||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
||||
|
||||
public class ConnectCommand extends DatabaseCommand {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("ConnectCommand");
|
||||
private static final Logger logger = LoggerFactory.getLogger("ConnectCommand");
|
||||
|
||||
@Override
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
|
@ -44,7 +44,6 @@ import com.google.refine.extension.database.DatabaseServiceException;
|
||||
|
||||
public abstract class DatabaseCommand extends Command {
|
||||
|
||||
final static protected Logger logger = LoggerFactory.getLogger("jdbcCommand");
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
||||
|
||||
public class ExecuteQueryCommand extends DatabaseCommand {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("QueryCommand");
|
||||
private static final Logger logger = LoggerFactory.getLogger("ExecuteQueryCommand");
|
||||
|
||||
@Override
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
|
@ -48,7 +48,7 @@ import com.google.refine.extension.database.DatabaseUtils;
|
||||
|
||||
public class SavedConnectionCommand extends DatabaseCommand {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("SavedConnectionCommand");
|
||||
private static final Logger logger = LoggerFactory.getLogger("SavedConnectionCommand");
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ import com.google.refine.extension.database.DatabaseServiceException;
|
||||
|
||||
public class TestConnectCommand extends DatabaseCommand {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("TestConnectCommand");
|
||||
private static final Logger logger = LoggerFactory.getLogger("TestConnectCommand");
|
||||
|
||||
@Override
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
|
@ -50,7 +50,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
|
||||
|
||||
public class TestQueryCommand extends DatabaseCommand {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("TestQueryCommand");
|
||||
private static final Logger logger = LoggerFactory.getLogger("TestQueryCommand");
|
||||
|
||||
@Override
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
|
@ -43,7 +43,7 @@ import com.google.refine.extension.database.SQLType;
|
||||
|
||||
public class MariaDBConnectionManager {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("MariaDBConnectionManager");
|
||||
private static final Logger logger = LoggerFactory.getLogger("MariaDBConnectionManager");
|
||||
private Connection connection;
|
||||
private SQLType type;
|
||||
|
||||
|
@ -54,7 +54,7 @@ import com.google.refine.extension.database.mysql.MySQLConnectionManager;
|
||||
|
||||
public class MariaDBDatabaseService extends DatabaseService {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("MariaDBDatabaseService");
|
||||
private static final Logger logger = LoggerFactory.getLogger("MariaDBDatabaseService");
|
||||
|
||||
public static final String DB_NAME = "mariadb";
|
||||
public static final String DB_DRIVER = "org.mariadb.jdbc.Driver";
|
||||
|
@ -42,7 +42,7 @@ import com.google.refine.extension.database.SQLType;
|
||||
|
||||
public class MySQLConnectionManager {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("MySQLConnectionManager");
|
||||
private static final Logger logger = LoggerFactory.getLogger("MySQLConnectionManager");
|
||||
private Connection connection;
|
||||
private SQLType type;
|
||||
|
||||
|
@ -51,7 +51,7 @@ import com.mysql.jdbc.ResultSetMetaData;
|
||||
public class MySQLDatabaseService extends DatabaseService {
|
||||
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger("MySQLDatabaseService");
|
||||
private static final Logger logger = LoggerFactory.getLogger("MySQLDatabaseService");
|
||||
|
||||
public static final String DB_NAME = "mysql";
|
||||
public static final String DB_DRIVER = "com.mysql.jdbc.Driver";
|
||||
|
@ -43,7 +43,7 @@ import com.google.refine.extension.database.SQLType;
|
||||
|
||||
public class PgSQLConnectionManager {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger("PgSQLConnectionManager");
|
||||
private static final Logger logger = LoggerFactory.getLogger("PgSQLConnectionManager");
|
||||
private Connection connection;
|
||||
private SQLType type;
|
||||
|
||||
|
@ -51,7 +51,7 @@ import com.google.refine.extension.database.mysql.MySQLConnectionManager;
|
||||
|
||||
public class PgSQLDatabaseService extends DatabaseService {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger("PgSQLDatabaseService");
|
||||
private static final Logger logger = LoggerFactory.getLogger("PgSQLDatabaseService");
|
||||
|
||||
public static final String DB_NAME = "postgresql";
|
||||
public static final String DB_DRIVER = "org.postgresql.Driver";
|
||||
|
@ -198,8 +198,8 @@ public class DBExtensionTestUtils {
|
||||
|
||||
}
|
||||
|
||||
private String getNextIMEI(int i) {
|
||||
|
||||
private String getNextIMEI(int index) {
|
||||
index++;
|
||||
// byte[] array = new byte[16]; // length is bounded by 7
|
||||
// new Random().nextBytes(array);
|
||||
// String generatedString = new String(array, Charset.forName("UTF-8"));
|
||||
@ -210,27 +210,32 @@ public class DBExtensionTestUtils {
|
||||
|
||||
|
||||
|
||||
private int getMNC(int i) {
|
||||
private int getMNC(int index) {
|
||||
index++;
|
||||
// TODO Auto-generated method stub
|
||||
return mncMap.get(rand.nextInt(3));
|
||||
}
|
||||
|
||||
private int getMCC(int i) {
|
||||
private int getMCC(int index) {
|
||||
index++;
|
||||
// System.out.println(rand.nextInt(3));
|
||||
return mccMap.get(rand.nextInt(3));
|
||||
}
|
||||
|
||||
private Date getNextEndDate(int i) {
|
||||
private Date getNextEndDate(int index) {
|
||||
// TODO Auto-generated method stub
|
||||
index++;
|
||||
return new Date(System.currentTimeMillis() + 1);
|
||||
}
|
||||
|
||||
private Date getNextStartDate(int i) {
|
||||
private Date getNextStartDate(int index) {
|
||||
// TODO Auto-generated method stub
|
||||
index++;
|
||||
return new Date(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private String getNextUeId(int i) {
|
||||
private String getNextUeId(int index) {
|
||||
index++;
|
||||
int n = 300000000 + rand.nextInt(900000000);
|
||||
|
||||
return "" + n;
|
||||
|
@ -7,11 +7,12 @@ public class DBQueryResultImportReaderTest {
|
||||
|
||||
@BeforeTest
|
||||
public void beforeTest() {
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextRowOfCells() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,11 +7,12 @@ public class DBQueryResultPreviewReaderTest {
|
||||
|
||||
@BeforeTest
|
||||
public void beforeTest() {
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextRowOfCells() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,17 +9,18 @@ public class DatabaseImportControllerTest {
|
||||
|
||||
@BeforeTest
|
||||
public void beforeTest() {
|
||||
//add test logic
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDoGet() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoPost() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,17 +76,17 @@ public class SavedConnectionCommandTest {
|
||||
|
||||
@Test
|
||||
public void testDoGet() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoPut() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoDelete() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,51 +7,52 @@ public class MariaDBDatabaseServiceTest {
|
||||
|
||||
@BeforeTest
|
||||
public void beforeTest() {
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDatabaseUrl() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetConnection() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTestConnection() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnect() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteQuery() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildLimitQuery() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRows() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInstance() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetColumnsDatabaseConfigurationString() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,51 +7,52 @@ public class MySQLDatabaseServiceTest {
|
||||
|
||||
@BeforeTest
|
||||
public void beforeTest() {
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDatabaseUrl() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetConnection() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTestConnection() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnect() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteQuery() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildLimitQuery() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRows() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInstance() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetColumnsDatabaseConfigurationString() {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,25 +36,25 @@ public class PgSQLDatabaseServiceTest {
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testGetConnection(@Optional("postgres") String dbName) {
|
||||
System.out.println("dbName::" + dbName);
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testTestConnection(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testConnect(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testExecuteQuery(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -67,19 +67,19 @@ public class PgSQLDatabaseServiceTest {
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testGetRows(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testGetInstance(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters("dbName")
|
||||
public void testGetColumns(@Optional("postgres") String dbName) {
|
||||
|
||||
//add test logic
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user