From 811b8ace7705f45bfb30aa0d0580e30104fa598e Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Tue, 28 Jan 2014 12:02:38 -0500 Subject: Rename KeyDataInfos and KeyrequestInfos --- .../src/com/netscape/certsrv/key/KeyClient.java | 4 +- .../certsrv/key/KeyDataInfoCollection.java | 34 +++++++ .../src/com/netscape/certsrv/key/KeyDataInfos.java | 34 ------- .../certsrv/key/KeyRequestInfoCollection.java | 102 +++++++++++++++++++++ .../com/netscape/certsrv/key/KeyRequestInfos.java | 102 --------------------- .../netscape/certsrv/key/KeyRequestResource.java | 2 +- .../src/com/netscape/certsrv/key/KeyResource.java | 2 +- 7 files changed, 140 insertions(+), 140 deletions(-) create mode 100644 base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java delete mode 100644 base/common/src/com/netscape/certsrv/key/KeyDataInfos.java create mode 100644 base/common/src/com/netscape/certsrv/key/KeyRequestInfoCollection.java delete mode 100644 base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java (limited to 'base/common/src/com/netscape/certsrv/key') diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java index 272f8ca04..81519509e 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyClient.java +++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java @@ -41,7 +41,7 @@ public class KeyClient extends Client { keyRequestClient = createProxy(KeyRequestResource.class); } - public KeyDataInfos findKeys(String clientID, String status, Integer maxSize, Integer maxTime, + public KeyDataInfoCollection findKeys(String clientID, String status, Integer maxSize, Integer maxTime, Integer start, Integer size) { return keyClient.listKeys(clientID, status, maxSize, maxTime, start, size); } @@ -50,7 +50,7 @@ public class KeyClient extends Client { return keyClient.retrieveKey(data); } - public KeyRequestInfos findKeyRequests( + public KeyRequestInfoCollection findKeyRequests( String requestState, String requestType, String clientID, diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java b/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java new file mode 100644 index 000000000..4e67e2a44 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java @@ -0,0 +1,34 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2012 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.key; + +import java.util.Collection; + +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; + +import com.netscape.certsrv.base.DataCollection; + +@XmlRootElement(name = "KeyDataInfos") +public class KeyDataInfoCollection extends DataCollection { + + @XmlElementRef + public Collection getEntries() { + return super.getEntries(); + } +} diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java b/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java deleted file mode 100644 index 8f02348a5..000000000 --- a/base/common/src/com/netscape/certsrv/key/KeyDataInfos.java +++ /dev/null @@ -1,34 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2012 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.certsrv.key; - -import java.util.Collection; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.base.DataCollection; - -@XmlRootElement(name = "KeyDataInfos") -public class KeyDataInfos extends DataCollection { - - @XmlElementRef - public Collection getEntries() { - return super.getEntries(); - } -} diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestInfoCollection.java b/base/common/src/com/netscape/certsrv/key/KeyRequestInfoCollection.java new file mode 100644 index 000000000..5f4d2ab87 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/key/KeyRequestInfoCollection.java @@ -0,0 +1,102 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2011 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.key; + +import java.io.StringReader; +import java.io.StringWriter; +import java.util.Collection; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +import org.jboss.resteasy.plugins.providers.atom.Link; + +import com.netscape.certsrv.base.DataCollection; +import com.netscape.certsrv.request.RequestStatus; + +@XmlRootElement(name = "KeyRequestInfos") +public class KeyRequestInfoCollection extends DataCollection { + + @XmlElementRef + public Collection getEntries() { + return super.getEntries(); + } + @XmlTransient + public String getNext() { + for (Link link : getLinks()) { + if ("next".equals(link.getRel())) { + return link.getHref().toString(); + } + } + return null; + } + + @XmlTransient + public String getPrevious() { + for (Link link : getLinks()) { + if ("previous".equals(link.getRel())) { + return link.getHref().toString(); + } + } + return null; + } + + public String toString() { + try { + StringWriter sw = new StringWriter(); + Marshaller marshaller = JAXBContext.newInstance(KeyRequestInfoCollection.class).createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(this, sw); + return sw.toString(); + + } catch (Exception e) { + return super.toString(); + } + } + + public static KeyRequestInfoCollection valueOf(String string) throws Exception { + try { + Unmarshaller unmarshaller = JAXBContext.newInstance(KeyRequestInfoCollection.class).createUnmarshaller(); + return (KeyRequestInfoCollection)unmarshaller.unmarshal(new StringReader(string)); + } catch (Exception e) { + return null; + } + } + + public static void main(String args[]) throws Exception { + + KeyRequestInfoCollection before = new KeyRequestInfoCollection(); + + KeyRequestInfo request = new KeyRequestInfo(); + request.setRequestType("securityDataEnrollment"); + request.setRequestStatus(RequestStatus.COMPLETE); + before.addEntry(request); + + String string = before.toString(); + System.out.println(string); + + KeyRequestInfoCollection after = KeyRequestInfoCollection.valueOf(string); + System.out.println(after); + + System.out.println(before.equals(after)); + } +} diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java b/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java deleted file mode 100644 index 403dc7d41..000000000 --- a/base/common/src/com/netscape/certsrv/key/KeyRequestInfos.java +++ /dev/null @@ -1,102 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.certsrv.key; - -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Collection; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import org.jboss.resteasy.plugins.providers.atom.Link; - -import com.netscape.certsrv.base.DataCollection; -import com.netscape.certsrv.request.RequestStatus; - -@XmlRootElement(name = "KeyRequestInfos") -public class KeyRequestInfos extends DataCollection { - - @XmlElementRef - public Collection getEntries() { - return super.getEntries(); - } - @XmlTransient - public String getNext() { - for (Link link : getLinks()) { - if ("next".equals(link.getRel())) { - return link.getHref().toString(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - for (Link link : getLinks()) { - if ("previous".equals(link.getRel())) { - return link.getHref().toString(); - } - } - return null; - } - - public String toString() { - try { - StringWriter sw = new StringWriter(); - Marshaller marshaller = JAXBContext.newInstance(KeyRequestInfos.class).createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(this, sw); - return sw.toString(); - - } catch (Exception e) { - return super.toString(); - } - } - - public static KeyRequestInfos valueOf(String string) throws Exception { - try { - Unmarshaller unmarshaller = JAXBContext.newInstance(KeyRequestInfos.class).createUnmarshaller(); - return (KeyRequestInfos)unmarshaller.unmarshal(new StringReader(string)); - } catch (Exception e) { - return null; - } - } - - public static void main(String args[]) throws Exception { - - KeyRequestInfos before = new KeyRequestInfos(); - - KeyRequestInfo request = new KeyRequestInfo(); - request.setRequestType("securityDataEnrollment"); - request.setRequestStatus(RequestStatus.COMPLETE); - before.addEntry(request); - - String string = before.toString(); - System.out.println(string); - - KeyRequestInfos after = KeyRequestInfos.valueOf(string); - System.out.println(after); - - System.out.println(before.equals(after)); - } -} diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java index 17e8a67e5..3f2536100 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java @@ -37,7 +37,7 @@ public interface KeyRequestResource { */ @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfos listRequests(@QueryParam("requestState") String requestState, + public KeyRequestInfoCollection listRequests(@QueryParam("requestState") String requestState, @QueryParam("requestType") String requestType, @QueryParam("clientID") String clientID, @QueryParam("start") RequestId start, diff --git a/base/common/src/com/netscape/certsrv/key/KeyResource.java b/base/common/src/com/netscape/certsrv/key/KeyResource.java index c420e0d45..68efb7770 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyResource.java @@ -20,7 +20,7 @@ public interface KeyResource { @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyDataInfos listKeys(@QueryParam("clientID") String clientID, + public KeyDataInfoCollection listKeys(@QueryParam("clientID") String clientID, @QueryParam("status") String status, @QueryParam("maxResults") Integer maxResults, @QueryParam("maxTime") Integer maxTime, -- cgit