diff options
Diffstat (limited to 'base/common/src/com/netscape/certsrv/request')
-rw-r--r-- | base/common/src/com/netscape/certsrv/request/CMSRequestInfo.java | 36 | ||||
-rw-r--r-- | base/common/src/com/netscape/certsrv/request/CMSRequestInfos.java | 26 |
2 files changed, 58 insertions, 4 deletions
diff --git a/base/common/src/com/netscape/certsrv/request/CMSRequestInfo.java b/base/common/src/com/netscape/certsrv/request/CMSRequestInfo.java index 0be24fbb4..f7b34f0a2 100644 --- a/base/common/src/com/netscape/certsrv/request/CMSRequestInfo.java +++ b/base/common/src/com/netscape/certsrv/request/CMSRequestInfo.java @@ -85,4 +85,40 @@ public class CMSRequestInfo { this.requestURL = requestURL; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode()); + result = prime * result + ((requestType == null) ? 0 : requestType.hashCode()); + result = prime * result + ((requestURL == null) ? 0 : requestURL.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CMSRequestInfo other = (CMSRequestInfo) obj; + if (requestStatus == null) { + if (other.requestStatus != null) + return false; + } else if (!requestStatus.equals(other.requestStatus)) + return false; + if (requestType == null) { + if (other.requestType != null) + return false; + } else if (!requestType.equals(other.requestType)) + return false; + if (requestURL == null) { + if (other.requestURL != null) + return false; + } else if (!requestURL.equals(other.requestURL)) + return false; + return true; + } } diff --git a/base/common/src/com/netscape/certsrv/request/CMSRequestInfos.java b/base/common/src/com/netscape/certsrv/request/CMSRequestInfos.java index cb07caf71..7e9445dbc 100644 --- a/base/common/src/com/netscape/certsrv/request/CMSRequestInfos.java +++ b/base/common/src/com/netscape/certsrv/request/CMSRequestInfos.java @@ -17,6 +17,7 @@ //--- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -25,8 +26,8 @@ import com.netscape.certsrv.base.Link; //Convenience class to simply hold a Collection of CMSRequests and a List of Links. public class CMSRequestInfos { - protected Collection<CMSRequestInfo> requests; - protected List<Link> links; + protected Collection<CMSRequestInfo> requests = new ArrayList<CMSRequestInfo>(); + protected List<Link> links = new ArrayList<Link>(); /** * @return the requests @@ -39,7 +40,16 @@ public class CMSRequestInfos { * @param requests the requests to set */ public void setRequests(Collection<CMSRequestInfo> requests) { - this.requests = requests; + this.requests.clear(); + if (requests == null) return; + this.requests.addAll(requests); + } + + /** + * @param requests the requests to add + */ + public void addRequest(CMSRequestInfo request) { + requests.add(request); } /** @@ -53,7 +63,15 @@ public class CMSRequestInfos { * @param links the links to set */ public void setLinks(List<Link> links) { - this.links = links; + this.links.clear(); + if (links == null) return; + this.links.addAll(links); } + /** + * @param links the link to add + */ + public void addLink(Link link) { + links.add(link); + } } |