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
5b920f3e
Commit
5b920f3e
authored
15 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
LMS-1204 Calculated Columns: better exception message when column expression is wrong
SVN: 12963
parent
825b36b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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/client/web/server/calculator/GridExpressionUtils.java
+15
-3
15 additions, 3 deletions
...ric/client/web/server/calculator/GridExpressionUtils.java
with
15 additions
and
3 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/GridExpressionUtils.java
+
15
−
3
View file @
5b920f3e
...
@@ -58,7 +58,7 @@ public class GridExpressionUtils
...
@@ -58,7 +58,7 @@ public class GridExpressionUtils
EVALUATION_SERIOUS_ERROR_MSG
+
"applying the filter: "
;
EVALUATION_SERIOUS_ERROR_MSG
+
"applying the filter: "
;
private
static
final
String
COLUMN_EVALUATION_SERIOUS_ERROR_TEMPLATE
=
private
static
final
String
COLUMN_EVALUATION_SERIOUS_ERROR_TEMPLATE
=
"Error: calculating the value of a custom column '%s' failed, con
n
tact you administrator: "
;
"Error: calculating the value of a custom column '%s' failed, contact you
r
administrator: "
;
private
static
final
String
COLUMN_EVALUATION_ERROR_TEMPLATE
=
private
static
final
String
COLUMN_EVALUATION_ERROR_TEMPLATE
=
COLUMN_EVALUATION_SERIOUS_ERROR_TEMPLATE
+
"invalid column definition. "
;
COLUMN_EVALUATION_SERIOUS_ERROR_TEMPLATE
+
"invalid column definition. "
;
...
@@ -115,8 +115,7 @@ public class GridExpressionUtils
...
@@ -115,8 +115,7 @@ public class GridExpressionUtils
Map
<
String
,
RowCalculator
<
T
>>
calculators
=
new
HashMap
<
String
,
RowCalculator
<
T
>>();
Map
<
String
,
RowCalculator
<
T
>>
calculators
=
new
HashMap
<
String
,
RowCalculator
<
T
>>();
for
(
GridCustomColumn
customColumn
:
customColumns
)
for
(
GridCustomColumn
customColumn
:
customColumns
)
{
{
String
expression
=
StringEscapeUtils
.
unescapeHtml
(
customColumn
.
getExpression
());
RowCalculator
<
T
>
rowCalculator
=
createRowCalculator
(
availableColumns
,
customColumn
);
RowCalculator
<
T
>
rowCalculator
=
new
RowCalculator
<
T
>(
availableColumns
,
expression
);
calculators
.
put
(
customColumn
.
getCode
(),
rowCalculator
);
calculators
.
put
(
customColumn
.
getCode
(),
rowCalculator
);
}
}
for
(
T
rowData
:
allRows
)
for
(
T
rowData
:
allRows
)
...
@@ -135,6 +134,19 @@ public class GridExpressionUtils
...
@@ -135,6 +134,19 @@ public class GridExpressionUtils
return
result
;
return
result
;
}
}
private
static
<
T
>
RowCalculator
<
T
>
createRowCalculator
(
Set
<
IColumnDefinition
<
T
>>
availableColumns
,
GridCustomColumn
customColumn
)
{
String
expression
=
StringEscapeUtils
.
unescapeHtml
(
customColumn
.
getExpression
());
try
{
return
new
RowCalculator
<
T
>(
availableColumns
,
expression
);
}
catch
(
Exception
ex
)
{
throw
new
UserFailureException
(
createCustomColumnErrorMessage
(
customColumn
,
ex
));
}
}
private
static
List
<
GridCustomColumnInfo
>
extractColumnInfos
(
private
static
List
<
GridCustomColumnInfo
>
extractColumnInfos
(
List
<
GridCustomColumn
>
customColumns
)
List
<
GridCustomColumn
>
customColumns
)
{
{
...
...
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