m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/querysigner
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-14 22:50:10 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-14 22:50:10 +0100
commit93cafafbc6fe53628be1b4ef08b6d9ca48ec6bc9 (patch)
treefa8169af492e6cc58034f28f550549d16635d00f /src/main/java/pl/edu/mimuw/cloudatlas/querysigner
parent9681d76b15cc68f2f8246972ae8266522b92fefe (diff)
Add validation in Stanik
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/querysigner')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java7
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java11
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java
index 87b965c..a9e039e 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java
@@ -19,6 +19,13 @@ public class QueryData implements Serializable {
this.installed = true;
}
+ public QueryData(String code, byte[] signature, long timestamp, boolean installed) {
+ this.code = code;
+ this.signature = signature;
+ this.timestamp = timestamp;
+ this.installed = installed;
+ }
+
public String getCode() {
return code;
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java
index 6ec62f4..c46e32d 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java
@@ -1,5 +1,7 @@
package pl.edu.mimuw.cloudatlas.querysigner;
+import pl.edu.mimuw.cloudatlas.model.ValueQuery;
+
import java.rmi.RemoteException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -13,4 +15,13 @@ public class QueryUtils {
throw new RemoteException("Invalid query identifier");
}
}
+
+ public static QueryData constructQueryData(ValueQuery valueQuery) {
+ return new QueryData(
+ valueQuery.getCode(),
+ valueQuery.getSignature(),
+ valueQuery.getTimestamp(),
+ valueQuery.isInstalled()
+ );
+ }
}