Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 dd46d53f
authored
Apr 07, 2012
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.insomnia.fi:/data/bortal
2 parents
eb014086
943d0c49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
3 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Certificate.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Certificate.java
0 → 100644
View file @
dd46d53
package
fi
.
insomnia
.
bortal
.
model
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.io.StringReader
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
org.bouncycastle.openssl.PEMReader
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
/**
* Entity implementation class for Entity: Certificate
*
*/
@Entity
@Table
(
name
=
"certificate"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Certificate
extends
GenericEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
name
=
"common_name"
)
private
String
commonName
;
private
String
certificate
;
public
Certificate
()
{
super
();
}
public
String
getCommonName
()
{
return
this
.
commonName
;
}
public
void
setCommonName
(
String
commonName
)
{
this
.
commonName
=
commonName
;
}
public
String
getCertificate
()
{
return
this
.
certificate
;
}
public
X509Certificate
getX509Certificate
()
throws
CertificateException
,
IOException
{
StringReader
sr
=
new
StringReader
(
this
.
certificate
);
PEMReader
pemReader
=
new
PEMReader
(
sr
);
X509Certificate
cert
=
(
X509Certificate
)
pemReader
.
readObject
();
return
cert
;
}
public
void
setCertificate
(
String
certificate
)
{
this
.
certificate
=
certificate
;
}
public
void
set509Certificate
(
X509Certificate
cert
)
{
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
View file @
dd46d53
...
@@ -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