diff options
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/request/model')
12 files changed, 0 insertions, 1468 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java deleted file mode 100644 index f06334f6b..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java +++ /dev/null @@ -1,91 +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.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestStatus; -import com.netscape.certsrv.request.RequestStatusAdapter; -@XmlAccessorType(XmlAccessType.FIELD) -public class CMSRequestInfo { - - @XmlElement - protected String requestType; - - @XmlElement - @XmlJavaTypeAdapter(RequestStatusAdapter.class) - protected RequestStatus requestStatus; - - @XmlElement - protected String requestURL; - - /** - * @return the requestType - */ - public String getRequestType() { - return requestType; - } - - /** - * @param requestType the requestType to set - */ - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - /** - * @return the requestStatus - */ - public RequestStatus getRequestStatus() { - return requestStatus; - } - - /** - * @param requestStatus the requestStatus to set - */ - public void setRequestStatus(RequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - /** - * @return the requestURL - */ - public String getRequestURL() { - return requestURL; - } - - /** - * @return the request ID in the requestURL - */ - public RequestId getRequestId() { - String id = requestURL.substring(requestURL.lastIndexOf("/") + 1); - return new RequestId(id); - } - - /** - * @param requestURL the requestURL to set - */ - public void setRequestURL(String requestURL) { - this.requestURL = requestURL; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java deleted file mode 100644 index 63b2e56b1..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java +++ /dev/null @@ -1,59 +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.cms.servlet.request.model; - -import java.util.Collection; -import java.util.List; - -import com.netscape.cms.servlet.base.model.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; - - /** - * @return the requests - */ - public Collection<CMSRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<CMSRequestInfo> requests) { - this.requests = requests; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java deleted file mode 100644 index a249d657d..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java +++ /dev/null @@ -1,321 +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.cms.servlet.request.model; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -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.XmlRootElement; - -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.profile.model.ProfileOutput; - -/** - * @author jmagne - * - */ - -@XmlRootElement(name = "CertEnrollmentRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertEnrollmentRequest { - - private static final String PROFILE_ID = "profileId"; - private static final String RENEWAL = "renewal"; - private static final String SERIAL_NUM = "serial_num"; - - @XmlElement - protected String profileId; - - @XmlElement - protected boolean isRenewal; - - @XmlElement - protected String serialNum; // used for one type of renewal - - @XmlElement - protected String remoteHost; - - @XmlElement - protected String remoteAddr; - - @XmlElement(name = "Input") - protected List<ProfileInput> inputs = new ArrayList<ProfileInput>(); - - @XmlElement(name = "Output") - protected List<ProfileOutput> outputs = new ArrayList<ProfileOutput>(); - - public CertEnrollmentRequest() { - // required for jaxb - } - - public CertEnrollmentRequest(MultivaluedMap<String, String> form) { - profileId = form.getFirst(PROFILE_ID); - String renewalStr = form.getFirst(RENEWAL); - serialNum = form.getFirst(SERIAL_NUM); - isRenewal = new Boolean(renewalStr); - } - - /** - * @return the profileId - */ - public String getProfileId() { - return profileId; - } - - /** - * @param profileId the profileId to set - */ - - public void setProfileId(String profileId) { - this.profileId = profileId; - } - - /** - * @return renewal - */ - - public boolean getIsRenewal() { - return isRenewal; - } - - public void addInput(ProfileInput input) { - ProfileInput curInput = getInput(input.getInputId()); - if (curInput != null) { - getInputs().remove(curInput); - } - getInputs().add(input); - } - - public void deleteInput(ProfileInput input) { - ProfileInput curInput = getInput(input.getInputId()); - if (curInput != null) { - getInputs().remove(curInput); - } - } - - public ProfileInput createInput(String name) { - - ProfileInput oldInput = getInput(name); - - if (oldInput != null) - return oldInput; - - ProfileInput newInput = new ProfileInput(); - newInput.setInputId(name); - - getInputs().add(newInput); - - return newInput; - } - - public ProfileInput getInput(String name) { - - ProfileInput input = null; - - Iterator<ProfileInput> it = getInputs().iterator(); - - ProfileInput curInput = null; - while (it.hasNext()) { - curInput = it.next(); - if (curInput != null && curInput.getInputId().equals(name)) - break; - } - - return input; - } - - public void addOutput(ProfileOutput output) { - ProfileOutput curOutput = getOutput(output.getOutputId()); - if (curOutput != null) { - getOutputs().remove(curOutput); - } - getOutputs().add(output); - } - - public void deleteOutput(ProfileOutput output) { - ProfileOutput curOutput = getOutput(output.getOutputId()); - if (curOutput != null) { - getInputs().remove(curOutput); - } - } - - public ProfileOutput getOutput(String name) { - ProfileOutput output = null; - ProfileOutput curOutput = null; - - Iterator<ProfileOutput> it = getOutputs().iterator(); - while (it.hasNext()) { - curOutput = it.next(); - if (curOutput != null && curOutput.getOutputId().equals(name)) - break; - } - - return output; - } - - /** - * @param renewal the renewal to set - */ - public void setIsRenewal(boolean isRenewal) { - this.isRenewal = isRenewal; - } - - public HashMap<String, String> toParams() { - HashMap<String, String> ret = new HashMap<String, String>(); - ret.put("isRenewal", Boolean.valueOf(isRenewal).toString()); - if (profileId != null) ret.put(PROFILE_ID, profileId); - if (serialNum != null) ret.put(SERIAL_NUM, serialNum); - if (remoteHost != null) ret.put("remoteHost", remoteHost); - if (remoteAddr != null) ret.put("remoteAddr", remoteAddr); - - for (ProfileInput input: inputs) { - Map<String, String> attrs = input.getAttributes(); - for (Map.Entry<String, String> entry: attrs.entrySet()) { - ret.put(entry.getKey(), entry.getValue()); - } - } - - return ret; - } - - public static void main(String args[]) throws Exception { - CertEnrollmentRequest data = new CertEnrollmentRequest(); - data.setProfileId("caUserCert"); - data.setIsRenewal(false); - - //Simulate a "caUserCert" Profile enrollment - - ProfileInput certReq = data.createInput("KeyGenInput"); - certReq.setInputAttr("cert_request_type", "crmf"); - certReq.setInputAttr( - "cert_request", - "MIIBozCCAZ8wggEFAgQBMQp8MIHHgAECpQ4wDDEKMAgGA1UEAxMBeKaBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2NgaPHp0jiohcP4M+ufrJOZEqH8GV+liu5JLbT8nWpkfhC+8EUBqT6g+n3qroSxIcNVGNdcsBEqs1utvpItzyslAbpdyat3WwQep1dWMzo6RHrPDuIoxNA0Yka1n3qEX4U//08cLQtUv2bYglYgN/hOCNQemLV6vZWAv0n7zelkCAwEAAakQMA4GA1UdDwEB/wQEAwIF4DAzMBUGCSsGAQUFBwUBAQwIcmVnVG9rZW4wGgYJKwYBBQUHBQECDA1hdXRoZW50aWNhdG9yoYGTMA0GCSqGSIb3DQEBBQUAA4GBAJ1VOQcaSEhdHa94s8kifVbSZ2WZeYE5//qxL6wVlEst20vq4ybj13CetnbN3+WT49Zkwp7Fg+6lALKgSk47suTg3EbbQDm+8yOrC0nc/q4PTRoHl0alMmUxIhirYc1t3xoCMqJewmjX1bNP8lpVIZAYFZo4eZCpZaiSkM5BeHhz"); - - ProfileInput subjectName = data.createInput("SubjectNameInput"); - subjectName.setInputAttr("sn_uid", "jmagne"); - subjectName.setInputAttr("sn_e", "jmagne@redhat.com"); - subjectName.setInputAttr("sn_c", "US"); - subjectName.setInputAttr("sn_ou", "Development"); - subjectName.setInputAttr("sn_ou1", "IPA"); - subjectName.setInputAttr("sn_ou2", "Dogtag"); - subjectName.setInputAttr("sn_ou3", "CA"); - subjectName.setInputAttr("sn_cn", "Common"); - subjectName.setInputAttr("sn_o", "RedHat"); - - ProfileInput submitter = data.createInput("SubmitterInfoInput"); - submitter.setInputAttr("requestor_name", "admin"); - submitter.setInputAttr("requestor_email", "admin@redhat.com"); - submitter.setInputAttr("requestor_phone", "650-555-5555"); - - try { - JAXBContext context = JAXBContext.newInstance(CertEnrollmentRequest.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - marshaller.marshal(data, stream); - - System.out.println("Originally marshalled enrollment object. \n"); - - System.out.println(stream.toString()); - - //Try to unmarshall - - Unmarshaller unmarshaller = context.createUnmarshaller(); - - ByteArrayInputStream bais = new ByteArrayInputStream(stream.toByteArray()); - Object unmarshalled = unmarshaller.unmarshal(bais); - - //Try re-marshalling, unmarshalled object to compare - - stream.reset(); - - marshaller.marshal(unmarshalled, stream); - - System.out.println("Remarshalled unmarshalled enrollment object. \n"); - - System.out.println(stream.toString()); - - } catch (JAXBException e) { - System.out.println(e.toString()); - } - } - - public String getSerialNum() { - return serialNum; - } - - public void setSerialNum(String serialNum) { - this.serialNum = serialNum; - } - - public List<ProfileInput> getInputs() { - return inputs; - } - - public void setInputs(List<ProfileInput> inputs) { - this.inputs = inputs; - } - - public String getRemoteAddr() { - return remoteAddr; - } - - public void setRemoteAddr(String remoteAddr) { - this.remoteAddr = remoteAddr; - } - - public String getRemoteHost() { - return remoteHost; - } - - public void setRemoteHost(String remoteHost) { - this.remoteHost = remoteHost; - } - - public List<ProfileOutput> getOutputs() { - return outputs; - } - - public void setOutputs(List<ProfileOutput> outputs) { - this.outputs = outputs; - } - - public void setRenewal(boolean isRenewal) { - this.isRenewal = isRenewal; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java deleted file mode 100644 index 0754fe547..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java +++ /dev/null @@ -1,84 +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.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.dbs.certdb.CertId; - -@XmlRootElement(name = "CertRequestInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertRequestInfo extends CMSRequestInfo { - - public static final String REQ_COMPLETE = "complete"; - - @XmlElement - protected String certURL; - - @XmlElement - protected String certRequestType; - - public CertRequestInfo() { - // required to be here for JAXB (defaults) - } - - /** - * @param certRequestType to set - */ - - public void setCertRequestType(String certRequestType) { - this.certRequestType = certRequestType; - } - - /** - * @return the certRequestType - */ - - public String getCertRequestType() { - return certRequestType; - } - - /** - * @set the certURL - */ - public void setCertURL(String certURL) { - this.certURL = certURL; - } - - /** - * @return the certURL - */ - public String getCertURL() { - return certURL; - } - - /** - * @return the certId - */ - - public CertId getCertId() { - if (certURL == null) return null; - String id = certURL.substring(certURL.lastIndexOf("/") + 1); - return new CertId(id); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java deleted file mode 100644 index a4c39a33e..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java +++ /dev/null @@ -1,89 +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.cms.servlet.request.model; - -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.cms.servlet.base.model.Link; - -@XmlRootElement(name = "CertRequestInfos") -public class CertRequestInfos { - protected Collection<CertRequestInfo> requests; - protected List<Link> links; - - /** - * @return the requests - */ - @XmlElementRef - public Collection<CertRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<CertRequestInfo> requests) { - this.requests = requests; - } - - /** - * @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; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java deleted file mode 100644 index 9b8caacd9..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java +++ /dev/null @@ -1,78 +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.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.certsrv.dbs.certdb.CertIdAdapter; -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name = "CertRetrievalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertRetrievalRequest { - - private static final String CERT_ID = "certId"; - - @XmlElement - @XmlJavaTypeAdapter(CertIdAdapter.class) - protected CertId certId; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - public CertRetrievalRequest() { - // required for JAXB (defaults) - } - - public CertRetrievalRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(CERT_ID)) { - certId = new CertId(form.getFirst(CERT_ID)); - } - } - - /** - * @return the CertId - */ - public CertId getCertId() { - return certId; - } - - /** - * @param CertId the CertId to set - */ - public void setCertId(CertId certId) { - this.certId = certId; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java b/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java deleted file mode 100644 index 3bec6bada..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java +++ /dev/null @@ -1,252 +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.cms.servlet.request.model; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestIdAdapter; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfilePolicy; -import com.netscape.cms.servlet.profile.model.ProfilePolicySet; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class CertReviewResponse extends CertEnrollmentRequest { - - @XmlElement(name="ProfilePolicySet") - protected List<ProfilePolicySet> policySets = new ArrayList<ProfilePolicySet>(); - - protected String nonce; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - protected String requestType; - - protected String requestStatus; - - protected String requestOwner; - - protected String requestCreationTime; - - protected String requestModificationTime; - - protected String requestNotes; - - protected String profileApprovedBy; - - protected String profileSetId; - - protected String profileIsVisible; - - protected String profileName; - - protected String profileDescription; - - protected String profileRemoteHost; - - protected String profileRemoteAddr; - - public String getNonce() { - return nonce; - } - - public void setNonce(String nonce) { - this.nonce = nonce; - } - - public RequestId getRequestId() { - return requestId; - } - - public void setRequestId(RequestId requestId) { - this.requestId = requestId; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public String getRequestStatus() { - return requestStatus; - } - - public void setRequestStatus(String requestStatus) { - this.requestStatus = requestStatus; - } - - public String getRequestOwner() { - return requestOwner; - } - - public void setRequestOwner(String requestOwner) { - this.requestOwner = requestOwner; - } - - public String getRequestCreationTime() { - return requestCreationTime; - } - - public void setRequestCreationTime(String requestCreationTime) { - this.requestCreationTime = requestCreationTime; - } - - public String getRequestModificationTime() { - return requestModificationTime; - } - - public void setRequestModificationTime(String requestModificationTime) { - this.requestModificationTime = requestModificationTime; - } - - public String getRequestNotes() { - return requestNotes; - } - - public void setRequestNotes(String requestNotes) { - this.requestNotes = requestNotes; - } - - public String getProfileApprovedBy() { - return profileApprovedBy; - } - - public void setProfileApprovedBy(String profileApprovedBy) { - this.profileApprovedBy = profileApprovedBy; - } - - public String getProfileSetId() { - return profileSetId; - } - - public void setProfileSetId(String profileSetId) { - this.profileSetId = profileSetId; - } - - public String getProfileIsVisible() { - return profileIsVisible; - } - - public void setProfileIsVisible(String profileIsVisible) { - this.profileIsVisible = profileIsVisible; - } - - public String getProfileName() { - return profileName; - } - - public void setProfileName(String profileName) { - this.profileName = profileName; - } - - public String getProfileDescription() { - return profileDescription; - } - - public void setProfileDescription(String profileDescription) { - this.profileDescription = profileDescription; - } - - public String getProfileRemoteHost() { - return profileRemoteHost; - } - - public void setProfileRemoteHost(String profileRemoteHost) { - this.profileRemoteHost = profileRemoteHost; - } - - public String getProfileRemoteAddr() { - return profileRemoteAddr; - } - - public void setProfileRemoteAddr(String profileRemoteAddr) { - this.profileRemoteAddr = profileRemoteAddr; - } - - public String toString() { - try { - JAXBContext context = JAXBContext.newInstance(CertReviewResponse.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - marshaller.marshal(this, stream); - return stream.toString(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public List<ProfilePolicySet> getPolicySets() { - return policySets; - } - - public void setPolicySets(List<ProfilePolicySet> policySets) { - this.policySets = policySets; - } - - public void addProfilePolicySet(ProfilePolicySet policySet) { - policySets.add(policySet); - } - - public void removeProfilePolicySet(ProfilePolicySet policySet) { - policySets.remove(policySet); - } - - @Override - public HashMap<String,String> toParams() { - HashMap<String,String> ret = super.toParams(); - - if (requestId != null) ret.put("requestId", requestId.toString()); - if (requestNotes != null) ret.put("requestNotes", requestNotes); - if (nonce != null) ret.put("nonces", nonce); - if (requestType != null) ret.put("requestType", requestType); - - for (ProfilePolicySet policySet: policySets) { - for (ProfilePolicy policy: policySet.getPolicies()) { - PolicyDefault def = policy.getDef(); - List<ProfileAttribute> attrs = def.getAttributes(); - for (ProfileAttribute attr: attrs) { - ret.put(attr.getName(), attr.getValue()); - } - } - } - return ret; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java deleted file mode 100644 index 9cd544ff8..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java +++ /dev/null @@ -1,123 +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.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="KeyArchivalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyArchivalRequest { - - private static final String CLIENT_ID = "clientID"; - private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey"; - private static final String DATA_TYPE = "dataType"; - private static final String WRAPPED_PRIVATE_DATA = "wrappedPrivateData"; - - @XmlElement - protected String clientId; - - @XmlElement - protected String transWrappedSessionKey; - - @XmlElement - protected String dataType; - - @XmlElement - protected String wrappedPrivateData; - - public KeyArchivalRequest() { - // required for JAXB (defaults) - } - - public KeyArchivalRequest(MultivaluedMap<String, String> form) { - clientId = form.getFirst(CLIENT_ID); - transWrappedSessionKey = form.getFirst(TRANS_WRAPPED_SESSION_KEY); - dataType = form.getFirst(DATA_TYPE); - wrappedPrivateData = form.getFirst(WRAPPED_PRIVATE_DATA); - } - - /** - * @return the clientId - */ - public String getClientId() { - return clientId; - } - - /** - * @param clientId the clientId to set - */ - public void setClientId(String clientId) { - this.clientId = clientId; - } - - /** - * @return the transWrappedSessionKey - */ - public String getTransWrappedSessionKey() { - return transWrappedSessionKey; - } - - /** - * @param transWrappedSessionKey the transWrappedSessionKey to set - */ - public void setTransWrappedSessionKey(String transWrappedSessionKey) { - this.transWrappedSessionKey = transWrappedSessionKey; - } - - /** - * @return the dataType - */ - public String getDataType() { - return dataType; - } - - /** - * @param dataType the dataType to set - */ - public void setDataType(String dataType) { - this.dataType = dataType; - } - - /** - * @return the wrappedPrivateData - */ - public String getWrappedPrivateData() { - return wrappedPrivateData; - } - - /** - * @param wrappedPrivateData the wrappedPrivateData to set - */ - public void setWrappedPrivateData(String wrappedPrivateData) { - this.wrappedPrivateData = wrappedPrivateData; - } - - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java deleted file mode 100644 index 3cb17d283..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java +++ /dev/null @@ -1,155 +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.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.dbs.keydb.KeyId; -import com.netscape.certsrv.dbs.keydb.KeyIdAdapter; -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name="KeyRecoveryRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyRecoveryRequest { - - private static final String KEY_ID = "keyId"; - private static final String REQUEST_ID = "requestId"; - private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey"; - private static final String SESSION_WRAPPED_PASSPHRASE = "sessionWrappedPassphrase"; - private static final String NONCE_DATA = "nonceData"; - - @XmlElement - @XmlJavaTypeAdapter(KeyIdAdapter.class) - protected KeyId keyId; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - @XmlElement - protected String transWrappedSessionKey; - - @XmlElement - protected String sessionWrappedPassphrase; - - @XmlElement - protected String nonceData; - - public KeyRecoveryRequest() { - // required for JAXB (defaults) - } - - public KeyRecoveryRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(KEY_ID)) { - keyId = new KeyId(form.getFirst(KEY_ID)); - } - if (form.containsKey(REQUEST_ID)) { - requestId = new RequestId(form.getFirst(REQUEST_ID)); - } - transWrappedSessionKey = form.getFirst(TRANS_WRAPPED_SESSION_KEY); - sessionWrappedPassphrase = form.getFirst(SESSION_WRAPPED_PASSPHRASE); - nonceData = form.getFirst(NONCE_DATA); - } - - /** - * @return the keyId - */ - public KeyId getKeyId() { - return keyId; - } - - /** - * @param keyId the keyId to set - */ - public void setKeyId(KeyId keyId) { - this.keyId = keyId; - } - - /** - * @return the requestId - */ - public RequestId getRequestId() { - return requestId; - } - - /** - * @param requestId the requestId to set - */ - public void setRequestId(RequestId requestId) { - this.requestId = requestId; - } - - /** - * @return the transWrappedSessionKey - */ - public String getTransWrappedSessionKey() { - return transWrappedSessionKey; - } - - /** - * @param transWrappedSessionKey the transWrappedSessionKey to set - */ - public void setTransWrappedSessionKey(String transWrappedSessionKey) { - this.transWrappedSessionKey = transWrappedSessionKey; - } - - /** - * @return the sessionWrappedPassphrase - */ - public String getSessionWrappedPassphrase() { - return sessionWrappedPassphrase; - } - - /** - * @param sessionWrappedPassphrase the sessionWrappedPassphrase to set - */ - public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) { - this.sessionWrappedPassphrase = sessionWrappedPassphrase; - } - - /** - * @return nonceData - */ - - public String getNonceData() { - return nonceData; - } - - /** - * @param nonceData the nonceData to set - */ - - public void setNonceData(String nonceData) { - this.nonceData = nonceData; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java deleted file mode 100644 index 91d5f8210..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java +++ /dev/null @@ -1,60 +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.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.dbs.keydb.KeyId; - -@XmlRootElement(name = "SecurityDataRequestInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyRequestInfo extends CMSRequestInfo { - - @XmlElement - protected String keyURL; - - public KeyRequestInfo() { - // required to be here for JAXB (defaults) - } - - /** - * @return the keyURL - */ - public String getKeyURL() { - return keyURL; - } - - /** - * @return the key ID in the keyURL - */ - public KeyId getKeyId() { - String id = keyURL.substring(keyURL.lastIndexOf("/") + 1); - return new KeyId(id); - } - - /** - * @param keyURL the keyURL to set - */ - public void setKeyURL(String keyURL) { - this.keyURL = keyURL; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java deleted file mode 100644 index dc1b6a5e4..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java +++ /dev/null @@ -1,89 +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.cms.servlet.request.model; - -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.cms.servlet.base.model.Link; - -@XmlRootElement(name = "SecurityDataRequestInfos") -public class KeyRequestInfos { - protected Collection<KeyRequestInfo> requests; - protected List<Link> links; - - /** - * @return the requests - */ - @XmlElementRef - public Collection<KeyRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<KeyRequestInfo> requests) { - this.requests = requests; - } - - /** - * @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; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java deleted file mode 100644 index 8670605fc..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java +++ /dev/null @@ -1,67 +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.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name = "ProfileRetrievalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileRetrievalRequest { - - private static final String PROFILE_ID = "profileId"; - - @XmlElement - protected String profileId; - - public ProfileRetrievalRequest() { - // required for JAXB (defaults) - } - - public ProfileRetrievalRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(PROFILE_ID)) { - profileId = form.getFirst(PROFILE_ID); - } - } - - /** - * @return the ProfileId - */ - public String getProfileId() { - return profileId; - } - - /** - * @param ProfileId the ProfileId to set - */ - public void setProfileId(String profileId) { - this.profileId = profileId; - } - -}
\ No newline at end of file |