Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 943d0c49
authored
Apr 06, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GenericIntegerEntityConvert to support null values...
1 parent
46437a83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
View file @
943d0c4
...
@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
...
@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
T
ret
=
null
;
T
ret
=
null
;
Integer
id
=
null
;
Integer
id
=
null
;
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
id
=
Integer
.
parseInt
(
value
);
try
{
if
(
id
!=
null
)
{
id
=
Integer
.
parseInt
(
value
);
ret
=
find
(
id
);
if
(
id
!=
null
)
{
ret
=
find
(
id
);
}
}
catch
(
NumberFormatException
nfe
)
{
if
(
value
==
null
||
!
value
.
equals
(
"null"
))
{
throw
nfe
;
}
}
}
}
}
logger
.
debug
(
"Converted String {} to Integer {} became object {}"
,
new
Object
[]
{
value
,
id
,
ret
});
logger
.
debug
(
"Converted String {} to Integer {} became object {}"
,
new
Object
[]
{
value
,
id
,
ret
});
...
@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
...
@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
ret
=
entity
.
getId
().
toString
();
ret
=
entity
.
getId
().
toString
();
}
}
}
}
if
(
ret
==
null
)
{
ret
=
"null"
;
}
return
ret
;
return
ret
;
}
}
//
//
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment