Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
2f50318e
Commit
2f50318e
authored
Jul 05, 2023
by
Owen Ryan Ang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBLookup Webservice Setup
parent
74f3c81a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
95 additions
and
7 deletions
+95
-7
org.eclipse.m2e.wtp.prefs
WebGde/.settings/org.eclipse.m2e.wtp.prefs
+2
-0
org.eclipse.wst.common.project.facet.core.xml
...e/.settings/org.eclipse.wst.common.project.facet.core.xml
+1
-1
config.ini
WebGde/WebContent/WEB-INF/config/config.ini
+6
-0
config.js
WebGde/WebContent/WebGde-Widgets/config.js
+3
-3
pom.xml
WebGde/pom.xml
+2
-1
ApplicationConfig.java
.../com/svi/webgde/restservice/config/ApplicationConfig.java
+6
-1
SecuredFilter.java
...ava/com/svi/webgde/restservice/filters/SecuredFilter.java
+0
-0
GDEWebServices.java
...a/com/svi/webgde/restservice/services/GDEWebServices.java
+15
-1
DBUtil.java
...rc/main/java/com/svi/webgde/restservice/utils/DBUtil.java
+60
-0
No files found.
WebGde/.settings/org.eclipse.m2e.wtp.prefs
0 → 100644
View file @
2f50318e
eclipse.preferences.version=1
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
WebGde/.settings/org.eclipse.wst.common.project.facet.core.xml
View file @
2f50318e
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime
name=
"Payara Server 5 (5.202
1.1)"
/>
<runtime
name=
"Payara Server 5 (5.202
2.5)"
/>
<fixed
facet=
"jst.web"
/>
<fixed
facet=
"java"
/>
<fixed
facet=
"wst.jsdt.web"
/>
...
...
WebGde/WebContent/WEB-INF/config/config.ini
View file @
2f50318e
...
...
@@ -17,3 +17,9 @@ GET_ROLE_RIGHTS_URL=http://localhost:8080/gfs-explorer/svc/gfs-rest/rights/
CHECK_RIGHT_URL
=
http://localhost:8080/gfs-explorer/svc/gfs-rest/check-right/
GET_SUB_URL
=
http://localhost:8080/gfs-explorer/svc/gfs-rest/get-sub/
[MARIADB CONFIG]
JDBC_URL
=
jdbc:mariadb://localhost:3307/
DB_NAME
=
webgde_db
USERNAME
=
root
PASSWORD
=
p455w0rd
WebGde/WebContent/WebGde-Widgets/config.js
View file @
2f50318e
...
...
@@ -38,9 +38,9 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export
const
ROOT_FOLDER
=
"/WebGde-Widgets"
;
//this determines if the images will be retrieved from the gfs
export
const
DOMAIN
=
"http://54.
173.201.199
:8080"
export
const
DOMAIN
=
"http://54.
211.206.117
:8080"
export
const
CONTEXTROOT
=
"gfs-explorer-ws"
export
const
GFS_URL
=
"http://54.
173.201.199
:8080"
+
"/WebGde/svc/gfs-rest"
export
const
GFS_URL
=
"http://54.
211.206.117
:8080"
+
"/WebGde/svc/gfs-rest"
export
const
FOLDER_URL
=
DOMAIN
+
"/"
+
CONTEXTROOT
+
"/svc/gfs-rest/get-folder?parentPath=/Users/"
export
const
DOWNLOAD_URL
=
DOMAIN
+
"/"
+
CONTEXTROOT
+
"/svc/gfs-rest/get-download-link"
export
const
IS_RETRIEVE_FROM_GFS
=
"N"
...
...
@@ -51,7 +51,7 @@ export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen
export
const
IS_RETRIEVE_FROM_BPO
=
"Y"
// export const BPO_URL = "http://35.171.20.94:8080/bpo-sqa/"
// export const CURRENT_NODE = "Web GDE"
export
const
BPO_URL
=
"http://54.
173.201.199
:8080/bpo/"
export
const
BPO_URL
=
"http://54.
211.206.117
:8080/bpo/"
export
const
CURRENT_NODE
=
"Web_GDE_DEV"
export
const
ENCODING_PASS
=
"PASS1"
export
const
NEXT_NODE
=
"Complete"
...
...
WebGde/pom.xml
View file @
2f50318e
...
...
@@ -42,10 +42,11 @@
<artifactId>
json-simple
</artifactId>
<version>
1.1.1
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
<groupId>
org.mariadb.jdbc
</groupId>
<artifactId>
mariadb-java-client
</artifactId>
<version>
JDBC 4
.2
</version>
<version>
2.7
.2
</version>
</dependency>
</dependencies>
<build>
...
...
WebGde/src/main/java/com/svi/webgde/restservice/config/ApplicationConfig.java
View file @
2f50318e
...
...
@@ -22,7 +22,12 @@ public enum ApplicationConfig {
GET_SUBFOLDERS_URL
(
"GET_SUBFOLDERS_URL"
),
GET_SUBFILES_URL
(
"GET_SUBFILES_URL"
),
METRICS_DIR
(
"METRICS_DIR"
);
METRICS_DIR
(
"METRICS_DIR"
),
JDBC_URL
(
"JDBC_URL"
),
DB_NAME
(
"DB_NAME"
),
USERNAME
(
"USERNAME"
),
PASSWORD
(
"PASSWORD"
);
private
String
value
=
""
;
private
static
Properties
prop
;
...
...
WebGde/src/main/java/com/svi/webgde/restservice/filters/SecuredFilter.java
View file @
2f50318e
WebGde/src/main/java/com/svi/webgde/restservice/services/GDEWebServices.java
View file @
2f50318e
...
...
@@ -23,12 +23,13 @@ import javax.ws.rs.core.Response;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
javax.ws.rs.core.StreamingOutput
;
import
org.json.JSONObject
;
import
org.json.
simple.
JSONObject
;
import
com.opencsv.CSVReader
;
import
com.opencsv.CSVWriter
;
import
com.svi.webgde.restservice.object.Request
;
import
com.svi.webgde.restservice.object.XMLContents
;
import
com.svi.webgde.restservice.utils.DBUtil
;
import
com.svi.webgde.restservice.utils.XMLUtil
;
@Path
(
"/gfs-rest"
)
...
...
@@ -43,6 +44,19 @@ public class GDEWebServices {
@POST
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_OCTET_STREAM
)
@Path
(
"/db-test"
)
public
Response
testDb
(
JsonObject
jsonObject
)
{
JSONObject
json
=
new
JSONObject
();
String
string
=
jsonObject
.
getString
(
"dbLookup"
);
json
=
DBUtil
.
dbLookup
(
string
);
return
Response
.
ok
(
json
.
toString
()).
build
();
}
@POST
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_OCTET_STREAM
)
@Path
(
"/get-file"
)
public
Response
getFile
(
JsonObject
jsonObject
)
{
File
file
=
new
File
(
jsonObject
.
getString
(
"filePath"
).
trim
());
...
...
WebGde/src/main/java/com/svi/webgde/restservice/utils/DBUtil.java
0 → 100644
View file @
2f50318e
package
com
.
svi
.
webgde
.
restservice
.
utils
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.json.simple.JSONArray
;
import
org.json.simple.JSONObject
;
import
com.svi.webgde.restservice.config.ApplicationConfig
;
public
class
DBUtil
{
public
static
JSONObject
dbLookup
(
String
dbLookup
)
{
try
{
Class
.
forName
(
"org.mariadb.jdbc.Driver"
);
}
catch
(
ClassNotFoundException
e1
)
{
// TODO Auto-generated catch block
e1
.
printStackTrace
();
}
String
jdbcURL
=
ApplicationConfig
.
JDBC_URL
.
value
()
+
ApplicationConfig
.
DB_NAME
.
value
();
String
username
=
ApplicationConfig
.
USERNAME
.
value
();
String
password
=
ApplicationConfig
.
PASSWORD
.
value
();
System
.
out
.
println
(
"url:"
+
jdbcURL
);
String
tableName
=
dbLookup
.
substring
(
0
,
dbLookup
.
indexOf
(
"~"
));
try
(
Connection
connection
=
DriverManager
.
getConnection
(
jdbcURL
,
username
,
password
))
{
String
query
=
"SELECT * FROM "
+
tableName
;
Statement
statement
=
connection
.
createStatement
();
ResultSet
resultSet
=
statement
.
executeQuery
(
query
);
JSONObject
jsonObject
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
columnCount
=
metaData
.
getColumnCount
();
while
(
resultSet
.
next
())
{
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
String
columnName
=
metaData
.
getColumnName
(
i
);
String
columnValue
=
resultSet
.
getString
(
i
);
jsonArray
.
add
(
columnValue
);
}
}
jsonObject
.
put
(
"tableData"
,
jsonArray
);
return
jsonObject
;
}
catch
(
SQLException
e
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"error"
,
"500"
);
e
.
printStackTrace
();
return
jsonObject
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment