diff options
Diffstat (limited to 'base/common/src/com/netscape/certsrv/key')
4 files changed, 22 insertions, 166 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java index 385996eed..272f8ca04 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyClient.java +++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java @@ -41,8 +41,9 @@ public class KeyClient extends Client { keyRequestClient = createProxy(KeyRequestResource.class); } - public KeyDataInfos findKeys(String clientID, String status, Integer maxSize, Integer maxTime) { - return keyClient.listKeys(clientID, status, maxSize, maxTime); + public KeyDataInfos findKeys(String clientID, String status, Integer maxSize, Integer maxTime, + Integer start, Integer size) { + return keyClient.listKeys(clientID, status, maxSize, maxTime, start, size); } public KeyData retrieveKey(KeyRecoveryRequest data) { diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java b/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java index d9fc885b4..eab8ae97c 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java +++ b/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java @@ -17,82 +17,18 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.key; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; -import com.netscape.certsrv.base.Link; +import com.netscape.certsrv.base.DataCollection; @XmlRootElement(name = "KeyDataInfos") -public class KeyDataInfos { +public class KeyDataInfos extends DataCollection<KeyDataInfo> { - protected Collection<KeyDataInfo> keyInfos = new ArrayList<KeyDataInfo>(); - protected List<Link> links = new ArrayList<Link>(); - - /** - * @return the keyInfos - */ @XmlElementRef public Collection<KeyDataInfo> getKeyInfos() { - return keyInfos; - } - - /** - * @param keyInfos the keyInfos to set - */ - public void setKeyInfos(Collection<KeyDataInfo> keyInfos) { - this.keyInfos = keyInfos; - } - - /** - * @param keyInfo the keyInfo to add - */ - public void addKeyInfo(KeyDataInfo keyInfo) { - keyInfos.add(keyInfo); - } - - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; + return super.getEntries(); } } diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java b/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java index 90756f8d3..403dc7d41 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java +++ b/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java @@ -19,84 +19,32 @@ package com.netscape.certsrv.key; import java.io.StringReader; import java.io.StringWriter; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; -import com.netscape.certsrv.base.Link; +import org.jboss.resteasy.plugins.providers.atom.Link; + +import com.netscape.certsrv.base.DataCollection; import com.netscape.certsrv.request.RequestStatus; @XmlRootElement(name = "KeyRequestInfos") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyRequestInfos { +public class KeyRequestInfos extends DataCollection<KeyRequestInfo> { @XmlElementRef - protected Collection<KeyRequestInfo> requests = new ArrayList<KeyRequestInfo>(); - - @XmlElement(name = "Link") - protected List<Link> links = new ArrayList<Link>(); - - /** - * @return the requests - */ - public Collection<KeyRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<KeyRequestInfo> requests) { - this.requests.clear(); - if (requests == null) return; - this.requests.addAll(requests); - } - - /** - * @param request the request to add - */ - public void addRequest(KeyRequestInfo request) { - requests.add(request); - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; + public Collection<KeyRequestInfo> getEntries() { + return super.getEntries(); } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links.clear(); - if (links == null) return; - this.links.addAll(links); - } - - /** - * @param links the link to add - */ - public void addLink(Link link) { - this.links.add(link); - } - @XmlTransient public String getNext() { - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); + for (Link link : getLinks()) { + if ("next".equals(link.getRel())) { + return link.getHref().toString(); } } return null; @@ -104,45 +52,14 @@ public class KeyRequestInfos { @XmlTransient public String getPrevious() { - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); + for (Link link : getLinks()) { + if ("previous".equals(link.getRel())) { + return link.getHref().toString(); } } return null; } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((links == null) ? 0 : links.hashCode()); - result = prime * result + ((requests == null) ? 0 : requests.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; - KeyRequestInfos other = (KeyRequestInfos) obj; - if (links == null) { - if (other.links != null) - return false; - } else if (!links.equals(other.links)) - return false; - if (requests == null) { - if (other.requests != null) - return false; - } else if (!requests.equals(other.requests)) - return false; - return true; - } - public String toString() { try { StringWriter sw = new StringWriter(); @@ -172,7 +89,7 @@ public class KeyRequestInfos { KeyRequestInfo request = new KeyRequestInfo(); request.setRequestType("securityDataEnrollment"); request.setRequestStatus(RequestStatus.COMPLETE); - before.addRequest(request); + before.addEntry(request); String string = before.toString(); System.out.println(string); diff --git a/base/common/src/com/netscape/certsrv/key/KeyResource.java b/base/common/src/com/netscape/certsrv/key/KeyResource.java index bcca6bb97..a574abb65 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyResource.java @@ -23,7 +23,9 @@ public interface KeyResource { public KeyDataInfos listKeys(@QueryParam("clientID") String clientID, @QueryParam("status") String status, @QueryParam("maxResults") Integer maxResults, - @QueryParam("maxTime") Integer maxTime); + @QueryParam("maxTime") Integer maxTime, + @QueryParam("start") Integer start, + @QueryParam("size") Integer size); /** |