diff options
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/model/RequestModel.java')
-rw-r--r-- | DocumentService/src/eu/stork/documentservice/model/RequestModel.java | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/model/RequestModel.java b/DocumentService/src/eu/stork/documentservice/model/RequestModel.java new file mode 100644 index 000000000..638af419e --- /dev/null +++ b/DocumentService/src/eu/stork/documentservice/model/RequestModel.java @@ -0,0 +1,106 @@ +package eu.stork.documentservice.model; + +import java.util.Date; + +import eu.stork.documentservice.exceptions.ModelException; + +/** + * The request model class + * @author sveinbjorno + * + */ +public class RequestModel { + + private String requestid; + private String docid; + private String destcountry; + private String spcountry; + private String spid; + private String xmlrequest; + private String xmlresponse; + private Date reqtimestamp; + private Date restimestamp; + + public String getRequestid() { + return requestid; + } + public void setRequestid(String requestid) { + this.requestid = requestid; + } + public String getDocid() { + return docid; + } + public void setDocid(String docid) { + this.docid = docid; + } + public String getDestcountry() { + return destcountry; + } + public void setDestcountry(String destcountry) { + this.destcountry = destcountry; + } + public String getSpcountry() { + return spcountry; + } + public void setSpcountry(String spcountry) { + this.spcountry = spcountry; + } + public String getSpid() { + return spid; + } + public void setSpid(String spid) { + this.spid = spid; + } + public String getXmlrequest() { + return xmlrequest; + } + public void setXmlrequest(String xmlrequest) { + this.xmlrequest = xmlrequest; + } + public String getXmlresponse() { + return xmlresponse; + } + public void setXmlresponse(String xmlresponse) { + this.xmlresponse = xmlresponse; + } + public Date getReqtimestamp() { + return reqtimestamp; + } + public void setReqtimestamp(Date reqtimestamp) { + this.reqtimestamp = reqtimestamp; + } + public Date getRestimestamp() { + return restimestamp; + } + public void setRestimestamp(Date restimestamp) { + this.restimestamp = restimestamp; + } + + public String getFullDocID() + { + return this.spcountry + "/" + this.destcountry + "/" + this.docid; + } + + public void insertValidate() throws ModelException + { + if (this.requestid == null || this.requestid.isEmpty()) + throw new ModelException("Request ID is null or empty"); + if (this.destcountry == null || this.destcountry.isEmpty()) + throw new ModelException("Destination country is null or empty."); + if (this.spcountry == null || this.spcountry.isEmpty()) + throw new ModelException("SP country is null or empty."); + if (this.destcountry == null || this.destcountry.isEmpty()) + throw new ModelException("Destination country is null or empty."); + if (this.xmlrequest== null || this.xmlrequest.isEmpty()) + throw new ModelException("XML request is null or empty."); + } + + public void updateValidate() throws ModelException + { + this.insertValidate(); + if (this.docid == null || this.docid.isEmpty()) + throw new ModelException("Document ID is null or empty"); + if (this.reqtimestamp == null) + throw new ModelException("Request timestamp is null or empty"); + } +} |