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
U
Uploader
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Operations
Operations
Incidents
Environments
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
Uploader
Commits
5c614edc
Commit
5c614edc
authored
Oct 21, 2015
by
mobreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print upsert errors with WARN and successes with DEBUG
parent
6d3c009a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
11 deletions
+41
-11
.gitignore
.gitignore
+2
-1
anno-gui/src/main/java/org/genesys2/anno/gui/PushDialog.java
anno-gui/src/main/java/org/genesys2/anno/gui/PushDialog.java
+39
-10
No files found.
.gitignore
View file @
5c614edc
...
...
@@ -3,4 +3,5 @@
/.idea
*.iml
*/.settings
*/.classpath
\ No newline at end of file
*/.classpath
hs_err_pid*.log
anno-gui/src/main/java/org/genesys2/anno/gui/PushDialog.java
View file @
5c614edc
...
...
@@ -11,6 +11,7 @@ import java.util.concurrent.Future;
import
java.util.concurrent.LinkedBlockingDeque
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Consumer
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.log4j.Level
;
...
...
@@ -44,12 +45,13 @@ import org.genesys2.client.oauth.OAuthAuthenticationException;
import
org.genesys2.client.oauth.PleaseRetryException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
swing2swt.layout.BorderLayout
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
swing2swt.layout.BorderLayout
;
public
class
PushDialog
extends
Dialog
{
private
static
final
Logger
_log
=
Logger
.
getLogger
(
PushDialog
.
class
);
protected
static
final
int
BATCH_SIZE
=
50
;
...
...
@@ -71,8 +73,8 @@ public class PushDialog extends Dialog {
protected
DataSourceLoader
dataSourceLoader
;
BlockingQueue
<
Runnable
>
linkedBlockingDeque
=
new
LinkedBlockingDeque
<
Runnable
>(
4
);
private
ThreadPoolExecutor
executorService
=
new
ThreadPoolExecutor
(
1
,
2
,
30
,
TimeUnit
.
SECONDS
,
linkedBlockingDeque
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
private
ThreadPoolExecutor
executorService
=
new
ThreadPoolExecutor
(
1
,
2
,
30
,
TimeUnit
.
SECONDS
,
linkedBlockingDeque
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
protected
Object
result
;
protected
Shell
shell
;
...
...
@@ -183,8 +185,8 @@ public class PushDialog extends Dialog {
tltmPushToGenesys
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
SwtUtil
.
showYesNoPrompt
(
getParent
(),
"Confirmation required"
,
"Push data to Genesys server?\n"
+
settings
.
getOauthSettings
().
getServerUrl
()))
{
if
(
SwtUtil
.
showYesNoPrompt
(
getParent
(),
"Confirmation required"
,
"Push data to Genesys server?\n"
+
settings
.
getOauthSettings
().
getServerUrl
()))
{
_log
.
info
(
"Upsert confirmed"
);
doPush
(
GenesysOp
.
UPSERT
);
}
else
{
...
...
@@ -199,8 +201,8 @@ public class PushDialog extends Dialog {
tltmRemove
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
arg0
)
{
if
(
SwtUtil
.
showYesNoPrompt
(
getParent
(),
"Confirmation required"
,
"Delete data from Genesys server?\n"
+
settings
.
getOauthSettings
().
getServerUrl
()))
{
if
(
SwtUtil
.
showYesNoPrompt
(
getParent
(),
"Confirmation required"
,
"Delete data from Genesys server?\n"
+
settings
.
getOauthSettings
().
getServerUrl
()))
{
_log
.
info
(
"Delete confirmed"
);
doPush
(
GenesysOp
.
DELETE
);
}
else
{
...
...
@@ -458,10 +460,36 @@ public class PushDialog extends Dialog {
}
}
String
serverResponse
=
null
;
if
(
op
==
GenesysOp
.
UPSERT
)
genesysClient
.
updateAccessions
(
instCode
,
objectMapper
.
writeValueAsString
(
accns
));
serverResponse
=
genesysClient
.
updateAccessions
(
instCode
,
objectMapper
.
writeValueAsString
(
accns
));
else
if
(
op
==
GenesysOp
.
DELETE
)
genesysClient
.
deleteAccessionsByName
(
instCode
,
objectMapper
.
writeValueAsString
(
accns
));
serverResponse
=
genesysClient
.
deleteAccessionsByName
(
instCode
,
objectMapper
.
writeValueAsString
(
accns
));
if
(
_log
.
isDebugEnabled
())
_log
.
debug
(
serverResponse
);
_log
.
info
(
"Push done."
);
try
{
JsonNode
ri
=
objectMapper
.
readTree
(
serverResponse
);
ri
.
forEach
(
new
Consumer
<
JsonNode
>()
{
@Override
public
void
accept
(
JsonNode
t
)
{
if
(
t
.
has
(
"error"
)
&&
!
t
.
get
(
"error"
).
isNull
())
{
_log
.
error
(
t
.
get
(
"error"
));
}
else
if
(
t
.
has
(
"result"
)
&&
!
t
.
get
(
"result"
).
isNull
())
{
_log
.
debug
(
t
.
get
(
"result"
));
}
}
});
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
catch
(
OAuthAuthenticationException
e
)
{
_log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -478,6 +506,7 @@ public class PushDialog extends Dialog {
futures
.
add
(
future
);
instCodeBatch
.
clear
();
}
public
void
setDataSource
(
IDataSource
dataSource
)
{
...
...
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