Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111504927
RequestDecryption.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 2, 18:23
Size
2 KB
Mime Type
text/x-java
Expires
Sun, May 4, 18:23 (2 d)
Engine
blob
Format
Raw Data
Handle
25915183
Attached To
R3229 Genome Privacy - SHCS App
RequestDecryption.java
View Options
package
framework.request
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
crypto.elgamal.fragment.FragmentEncoded
;
import
framework.Type
;
import
framework.test.TestResultEncoded
;
import
framework.test.TestResultEncrypted
;
public
class
RequestDecryption
extends
Request
{
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RequestDecryption
.
class
.
getName
());
private
long
timestamp
;
private
LinkedList
<
TestResultEncoded
>
encodedResults
;
private
ArrayList
<
LinkedList
<
FragmentEncoded
>>
encodedHLAs
;
public
RequestDecryption
(
int
id_p
,
LinkedList
<
TestResultEncoded
>
encodedResults
,
ArrayList
<
LinkedList
<
FragmentEncoded
>>
encodedHLAs
)
{
super
(
Type
.
DECRYPT
,
id_p
);
this
.
encodedResults
=
encodedResults
;
this
.
encodedHLAs
=
encodedHLAs
;
}
public
RequestDecryption
(
int
id_p
,
ArrayList
<
LinkedList
<
FragmentEncoded
>>
encodedHLAs
,
LinkedList
<
TestResultEncrypted
>
encryptedResults
)
{
super
(
Type
.
DECRYPT
,
id_p
);
this
.
encodedResults
=
new
LinkedList
<>();
if
(
encryptedResults
!=
null
)
{
addAllEncryptedResults
(
encryptedResults
);
}
this
.
encodedHLAs
=
encodedHLAs
;
}
private
void
addAllEncryptedResults
(
LinkedList
<
TestResultEncrypted
>
encryptedResults
)
{
for
(
TestResultEncrypted
testResultEncrypted
:
encryptedResults
)
{
if
(
testResultEncrypted
!=
null
)
{
encodedResults
.
add
(
new
TestResultEncoded
(
testResultEncrypted
));
}
else
{
encodedResults
.
add
(
null
);
}
}
}
public
LinkedList
<
TestResultEncoded
>
getEncodedResults
()
{
return
encodedResults
;
}
public
ArrayList
<
LinkedList
<
FragmentEncoded
>>
getEncodedHLAs
()
{
return
encodedHLAs
;
}
public
JSONObject
getJSONRqt
()
throws
JSONException
{
JSONObject
jsonRqtDecrypt
=
new
JSONObject
();
jsonRqtDecrypt
.
put
(
Request
.
JSON_KEY_TYPE
,
Type
.
DECRYPT
);
jsonRqtDecrypt
.
put
(
Request
.
JSON_KEY_RQT
,
this
);
return
jsonRqtDecrypt
;
}
public
static
RequestDecryption
getRequestDecrypt
(
JSONObject
jsonRqtDecrypt
)
{
try
{
RequestDecryption
rqtDecrypt
=
(
RequestDecryption
)
jsonRqtDecrypt
.
get
(
Request
.
JSON_KEY_RQT
);
return
rqtDecrypt
;
}
catch
(
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
null
,
e
);
return
null
;
}
}
public
long
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
long
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
}
Event Timeline
Log In to Comment