Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
fb25aca7
Commit
fb25aca7
authored
Jan 04, 2019
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dependencies updated
parent
47263d88
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
42 deletions
+62
-42
docker/Dockerfile
docker/Dockerfile
+1
-1
pom.xml
pom.xml
+20
-20
src/main/java/org/genesys2/server/service/impl/CSVResultSetHelper.java
.../org/genesys2/server/service/impl/CSVResultSetHelper.java
+41
-21
No files found.
docker/Dockerfile
View file @
fb25aca7
#
# Build Genesys server on top of jetty-alpine
#
FROM
jetty:9.4.1
1
FROM
jetty:9.4.1
2
LABEL
maintainer "Matija Obreza <matija.obreza@croptrust.org>"
...
...
pom.xml
View file @
fb25aca7
...
...
@@ -97,7 +97,7 @@
<swagger.version>
2.9.2
</swagger.version>
<!--Container -->
<jetty.version>
9.4.1
1.v20180605
</jetty.version>
<jetty.version>
9.4.1
2.v20180830
</jetty.version>
<maven.test.skip>
false
</maven.test.skip>
...
...
@@ -127,7 +127,7 @@
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-text
</artifactId>
<version>
1.
4
</version>
<version>
1.
5
</version>
</dependency>
<dependency>
...
...
@@ -171,7 +171,7 @@
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
1.1
0
</version>
<version>
1.1
1
</version>
</dependency>
<dependency>
...
...
@@ -203,7 +203,7 @@
<dependency>
<groupId>
javax.servlet.jsp
</groupId>
<artifactId>
javax.servlet.jsp-api
</artifactId>
<version>
2.3.1
</version>
<version>
2.3.
2-b0
1
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
...
...
@@ -310,7 +310,7 @@
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-spring
</artifactId>
<version>
2.
1
.0
</version>
<version>
2.
2
.0
</version>
</dependency>
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
...
...
@@ -391,12 +391,12 @@
<dependency>
<groupId>
org.apache.tomcat
</groupId>
<artifactId>
tomcat-jdbc
</artifactId>
<version>
7.0.4
2
</version>
<version>
7.0.4
7
</version>
</dependency>
<dependency>
<groupId>
com.googlecode.owasp-java-html-sanitizer
</groupId>
<artifactId>
owasp-java-html-sanitizer
</artifactId>
<version>
r2
09
</version>
<version>
r2
23
</version>
</dependency>
<dependency>
<groupId>
org.springframework.security.oauth
</groupId>
...
...
@@ -406,12 +406,12 @@
<dependency>
<groupId>
joda-time
</groupId>
<artifactId>
joda-time
</artifactId>
<version>
2.9.
3
</version>
<version>
2.9.
4
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-collections4
</artifactId>
<version>
4.
1
</version>
<version>
4.
2
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
...
...
@@ -444,7 +444,7 @@
<dependency>
<groupId>
org.jamel.dbf
</groupId>
<artifactId>
dbf-reader
</artifactId>
<version>
0.
1
.0
</version>
<version>
0.
2
.0
</version>
<scope>
test
</scope>
</dependency>
<dependency>
...
...
@@ -462,7 +462,7 @@
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-elasticsearch
</artifactId>
<version>
2.1.1
5
.RELEASE
</version>
<version>
2.1.1
6
.RELEASE
</version>
</dependency>
<dependency>
...
...
@@ -484,7 +484,7 @@
<dependency>
<groupId>
org.ocpsoft.prettytime
</groupId>
<artifactId>
prettytime
</artifactId>
<version>
3.2.
5
.Final
</version>
<version>
3.2.
7
.Final
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
...
...
@@ -519,12 +519,12 @@
<dependency>
<groupId>
org.jsoup
</groupId>
<artifactId>
jsoup
</artifactId>
<version>
1.
8.3
</version>
<version>
1.
9.1
</version>
</dependency>
<dependency>
<groupId>
com.opencsv
</groupId>
<artifactId>
opencsv
</artifactId>
<version>
3.
7
</version>
<version>
3.
8
</version>
</dependency>
<dependency>
<groupId>
org.liquibase.ext
</groupId>
...
...
@@ -550,7 +550,7 @@
<dependency>
<groupId>
com.vladsch.flexmark
</groupId>
<artifactId>
flexmark-all
</artifactId>
<version>
0.28.3
4
</version>
<version>
0.28.3
8
</version>
</dependency>
<dependency>
<groupId>
com.vdurmont
</groupId>
...
...
@@ -579,7 +579,7 @@
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<version>
2.19.
0
</version>
<version>
2.19.
1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
...
...
@@ -591,13 +591,13 @@
<dependency>
<groupId>
org.springframework.restdocs
</groupId>
<artifactId>
spring-restdocs-mockmvc
</artifactId>
<version>
1.2.
4
.RELEASE
</version>
<version>
1.2.
5
.RELEASE
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.jayway.jsonpath
</groupId>
<artifactId>
json-path
</artifactId>
<version>
2.
0
.0
</version>
<version>
2.
1
.0
</version>
<scope>
test
</scope>
</dependency>
<dependency>
...
...
@@ -609,7 +609,7 @@
<dependency>
<groupId>
net.java.dev.jna
</groupId>
<artifactId>
jna
</artifactId>
<version>
4.5.2
</version>
<version>
5.0.0
</version>
</dependency>
<dependency>
<groupId>
javax.validation
</groupId>
...
...
@@ -619,7 +619,7 @@
<dependency>
<groupId>
javax.el
</groupId>
<artifactId>
javax.el-api
</artifactId>
<version>
3.0.
0
</version>
<version>
3.0.
1-b01
</version>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
...
...
src/main/java/org/genesys2/server/service/impl/CSVResultSetHelper.java
View file @
fb25aca7
...
...
@@ -7,10 +7,13 @@ import java.sql.ResultSet;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.text.StrBuilder
;
import
org.genesys2.util.NumberUtils
;
import
com.opencsv.ResultSetHelperService
;
...
...
@@ -88,58 +91,78 @@ public class CSVResultSetHelper extends ResultSetHelperService {
return
sb
.
toString
();
}
private
String
getColumnValue
(
ResultSet
rs
,
int
colType
,
int
colIndex
,
boolean
trim
,
String
dateFormatString
,
String
timestampFormatString
)
throws
SQLException
,
IOException
{
private
String
getColumnValue
(
ResultSet
rs
,
int
colType
,
int
colIndex
,
boolean
trim
,
String
dateFormatString
,
String
timestampFormatString
)
throws
SQLException
,
IOException
{
String
value
=
""
;
switch
(
colType
)
{
case
Types
.
BIT
:
case
Types
.
JAVA_OBJECT
:
value
=
handleObject
(
rs
.
getObject
(
colIndex
));
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getObject(colIndex), "");
value
=
ObjectUtils
.
toString
(
rs
.
getObject
(
colIndex
),
""
);
break
;
case
Types
.
BOOLEAN
:
boolean
b
=
rs
.
getBoolean
(
colIndex
);
value
=
Boolean
.
valueOf
(
b
).
toString
();
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getBoolean(colIndex));
value
=
ObjectUtils
.
toString
(
rs
.
getBoolean
(
colIndex
));
break
;
case
NCLOB:
// todo : use rs.getNClob
case
Types
.
NCLOB
:
// todo : use rs.getNClob
case
Types
.
CLOB
:
Clob
c
=
rs
.
getClob
(
colIndex
);
if
(
c
!=
null
)
{
value
=
read
(
c
);
StrBuilder
sb
=
new
StrBuilder
();
sb
.
readFrom
(
c
.
getCharacterStream
());
value
=
sb
.
toString
();
}
break
;
case
Types
.
BIGINT
:
value
=
handleLong
(
rs
,
colIndex
);
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getLong(colIndex));
value
=
ObjectUtils
.
toString
(
rs
.
getLong
(
colIndex
));
break
;
case
Types
.
DECIMAL
:
case
Types
.
REAL
:
case
Types
.
NUMERIC
:
value
=
handleBigDecimal
(
rs
.
getBigDecimal
(
colIndex
));
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getBigDecimal(colIndex), "");
value
=
ObjectUtils
.
toString
(
rs
.
getBigDecimal
(
colIndex
),
""
);
break
;
case
Types
.
DOUBLE
:
value
=
handleDouble
(
rs
.
getDouble
(
colIndex
));
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getDouble(colIndex));
value
=
ObjectUtils
.
toString
(
rs
.
getDouble
(
colIndex
));
break
;
case
Types
.
FLOAT
:
value
=
handleFloat
(
rs
.
getFloat
(
colIndex
));
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getFloat(colIndex));
value
=
ObjectUtils
.
toString
(
rs
.
getFloat
(
colIndex
));
break
;
case
Types
.
INTEGER
:
case
Types
.
TINYINT
:
case
Types
.
SMALLINT
:
value
=
handleInteger
(
rs
,
colIndex
);
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getInt(colIndex));
value
=
ObjectUtils
.
toString
(
rs
.
getInt
(
colIndex
));
break
;
case
Types
.
DATE
:
value
=
handleDate
(
rs
,
colIndex
,
dateFormatString
);
java
.
sql
.
Date
date
=
rs
.
getDate
(
colIndex
);
if
(
date
!=
null
)
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
dateFormatString
);
value
=
df
.
format
(
date
);
}
break
;
case
Types
.
TIME
:
value
=
handleTime
(
rs
.
getTime
(
colIndex
));
// Once Java 7 is the minimum supported version.
// value = Objects.toString(rs.getTime(colIndex), "");
value
=
ObjectUtils
.
toString
(
rs
.
getTime
(
colIndex
),
""
);
break
;
case
Types
.
TIMESTAMP
:
value
=
handleTimestamp
(
rs
.
getTimestamp
(
colIndex
),
timestampFormatString
);
break
;
case
NVARCHAR:
// todo : use rs.getNString
case
NCHAR:
// todo : use rs.getNString
case
LONGNVARCHAR:
// todo : use rs.getNString
case
Types
.
NVARCHAR
:
// todo : use rs.getNString
case
Types
.
NCHAR
:
// todo : use rs.getNString
case
Types
.
LONGNVARCHAR
:
// todo : use rs.getNString
case
Types
.
LONGVARCHAR
:
case
Types
.
VARCHAR
:
case
Types
.
CHAR
:
...
...
@@ -150,14 +173,11 @@ public class CSVResultSetHelper extends ResultSetHelperService {
value
=
columnValue
;
}
break
;
case
Types
.
BINARY
:
value
=
handleBinary
(
rs
,
colIndex
);
break
;
default
:
value
=
""
;
}
if
(
value
==
null
)
{
if
(
rs
.
wasNull
()
||
value
==
null
)
{
value
=
""
;
}
...
...
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