From 93cafafbc6fe53628be1b4ef08b6d9ca48ec6bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 14 Jan 2020 22:50:10 +0100 Subject: Add validation in Stanik --- .../java/pl/edu/mimuw/cloudatlas/querysigner/QueryData.java | 7 +++++++ .../java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java | 11 +++++++++++ 2 files changed, 18 insertions(+) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/querysigner') 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() + ); + } } -- cgit v1.2.3