Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
476aa66d
Commit
476aa66d
authored
12 years ago
by
jakubs
Browse files
Options
Downloads
Patches
Plain Diff
BIS-173 improve entity validation, to stop validation when some validation have already failed
SVN: 26621
parent
649ce5fb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityValidationInterceptor.java
+17
-6
17 additions, 6 deletions
...ric/server/dataaccess/db/EntityValidationInterceptor.java
with
17 additions
and
6 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityValidationInterceptor.java
+
17
−
6
View file @
476aa66d
...
@@ -72,6 +72,8 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
...
@@ -72,6 +72,8 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
totalEntitiesToValidateCount
=
0
;
totalEntitiesToValidateCount
=
0
;
entitiesValidatedCount
=
0
;
entitiesValidatedCount
=
0
;
isRolledBack
=
false
;
}
}
IHibernateTransactionManagerCallback
callback
;
IHibernateTransactionManagerCallback
callback
;
...
@@ -104,6 +106,12 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
...
@@ -104,6 +106,12 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
int
entitiesValidatedCount
;
int
entitiesValidatedCount
;
/**
* if true - than it means that at least one validation has failed, and we don't need to do any
* additional validations
*/
private
boolean
isRolledBack
;
private
void
updateListener
()
private
void
updateListener
()
{
{
progressListener
=
ServiceConversationsThreadContext
.
getProgressListener
();
progressListener
=
ServiceConversationsThreadContext
.
getProgressListener
();
...
@@ -143,12 +151,11 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
...
@@ -143,12 +151,11 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
IEntityInformationWithPropertiesHolder
entity
=
nextItemToValidate
();
IEntityInformationWithPropertiesHolder
entity
=
nextItemToValidate
();
validateEntity
(
tx
,
entity
);
validateEntity
(
tx
,
entity
);
}
}
}
}
private
boolean
hasMoreItemsToValidate
()
private
boolean
hasMoreItemsToValidate
()
{
{
return
entitiesToValidate
.
size
()
>
0
;
return
entitiesToValidate
.
size
()
>
0
&&
false
==
isRolledBack
;
}
}
private
IEntityInformationWithPropertiesHolder
nextItemToValidate
()
private
IEntityInformationWithPropertiesHolder
nextItemToValidate
()
...
@@ -218,15 +225,19 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
...
@@ -218,15 +225,19 @@ public class EntityValidationInterceptor extends EmptyInterceptor implements
result
=
calculate
(
script
,
entity
,
isNewEntity
);
result
=
calculate
(
script
,
entity
,
isNewEntity
);
}
catch
(
Throwable
e
)
}
catch
(
Throwable
e
)
{
{
callback
.
rollbackTransaction
(
tx
,
"Validation of "
+
entityDescription
(
entity
)
setRollback
(
tx
,
entity
,
" resulted in error. "
+
e
.
getMessage
());
+
" resulted in error. "
+
e
.
getMessage
());
}
}
if
(
result
!=
null
)
if
(
result
!=
null
)
{
{
callback
.
rollbackTransaction
(
tx
,
"Validation of "
+
entityDescription
(
entity
)
setRollback
(
tx
,
entity
,
" failed. "
+
result
);
+
" failed. "
+
result
);
}
}
}
private
void
setRollback
(
Transaction
tx
,
IEntityInformationWithPropertiesHolder
entity
,
String
msg
)
{
callback
.
rollbackTransaction
(
tx
,
"Validation of "
+
entityDescription
(
entity
)
+
msg
);
isRolledBack
=
true
;
}
}
private
String
entityDescription
(
IEntityInformationWithPropertiesHolder
entity
)
private
String
entityDescription
(
IEntityInformationWithPropertiesHolder
entity
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment