From 1aa02e5207514d210e903d23e1d698b85fc29344 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Sat, 11 Aug 2012 09:47:39 -0500 Subject: Reorganized REST common classes. The common classes used by REST client and services have been moved into the com.netscape.certsrv. packages. Ticket #215 --- .../servlet/profile/PolicyConstraintFactory.java | 4 +- .../cms/servlet/profile/PolicyDefaultFactory.java | 4 +- .../cms/servlet/profile/ProfileInputFactory.java | 2 +- .../servlet/profile/ProfileNotFoundException.java | 62 --------- .../cms/servlet/profile/ProfileOutputFactory.java | 4 +- .../cms/servlet/profile/ProfileProcessServlet.java | 6 +- .../cms/servlet/profile/ProfileResource.java | 45 ------- .../cms/servlet/profile/ProfileService.java | 10 +- .../servlet/profile/model/PolicyConstraint.java | 73 ---------- .../profile/model/PolicyConstraintValue.java | 61 --------- .../cms/servlet/profile/model/PolicyDefault.java | 73 ---------- .../servlet/profile/model/ProfileAttribute.java | 80 ----------- .../cms/servlet/profile/model/ProfileData.java | 147 --------------------- .../cms/servlet/profile/model/ProfileDataInfo.java | 68 ---------- .../servlet/profile/model/ProfileDataInfos.java | 90 ------------- .../cms/servlet/profile/model/ProfileInput.java | 94 ------------- .../cms/servlet/profile/model/ProfileOutput.java | 84 ------------ .../cms/servlet/profile/model/ProfilePolicy.java | 82 ------------ .../servlet/profile/model/ProfilePolicySet.java | 50 ------- 19 files changed, 16 insertions(+), 1023 deletions(-) delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java (limited to 'base/common/src/com/netscape/cms/servlet/profile') diff --git a/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java b/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java index 5ceecd4a5..6c1d92a72 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java @@ -21,9 +21,9 @@ import java.util.Enumeration; import java.util.Locale; import com.netscape.certsrv.profile.IPolicyConstraint; +import com.netscape.certsrv.profile.PolicyConstraint; +import com.netscape.certsrv.profile.PolicyConstraintValue; import com.netscape.certsrv.property.Descriptor; -import com.netscape.cms.servlet.profile.model.PolicyConstraint; -import com.netscape.cms.servlet.profile.model.PolicyConstraintValue; public class PolicyConstraintFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java b/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java index 01c19936d..fe6b436ab 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java @@ -22,11 +22,11 @@ import java.util.Locale; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.profile.IPolicyDefault; +import com.netscape.certsrv.profile.PolicyDefault; +import com.netscape.certsrv.profile.ProfileAttribute; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; public class PolicyDefaultFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java index 1e9f4598c..f5a9e7556 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java @@ -6,8 +6,8 @@ import java.util.Locale; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfileInput; +import com.netscape.certsrv.profile.ProfileInput; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.ProfileInput; public class ProfileInputFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java deleted file mode 100644 index e597f471e..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java +++ /dev/null @@ -1,62 +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) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.profile; - -import javax.ws.rs.core.Response; - -import com.netscape.cms.servlet.base.PKIException; - -public class ProfileNotFoundException extends PKIException { - - private static final long serialVersionUID = -4784839378360933483L; - - public String profileId; - - public ProfileNotFoundException(String profileId) { - this(profileId, "Profile ID " + profileId + " not found"); - } - - public ProfileNotFoundException(String profileId, String message) { - super(Response.Status.NOT_FOUND, message); - this.profileId = profileId; - } - - public ProfileNotFoundException(String profileId, String message, Throwable cause) { - super(Response.Status.NOT_FOUND, message, cause); - this.profileId = profileId; - } - - public ProfileNotFoundException(Data data) { - super(data); - profileId = data.getAttribute("profileId"); - } - - public Data getData() { - Data data = super.getData(); - data.setAttribute("profileId", profileId); - return data; - } - - public String getProfileId() { - return profileId; - } - - public void setRequestId(String profileId) { - this.profileId = profileId; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java index e15875eff..278acf488 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java @@ -22,10 +22,10 @@ import java.util.Locale; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfileOutput; +import com.netscape.certsrv.profile.ProfileAttribute; +import com.netscape.certsrv.profile.ProfileOutput; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfileOutput; public class ProfileOutputFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java index 56f754874..dcde4b019 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java @@ -29,10 +29,13 @@ import com.netscape.certsrv.authentication.EAuthException; import com.netscape.certsrv.authorization.EAuthzException; import com.netscape.certsrv.base.BadRequestDataException; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.profile.EDeferException; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.ERejectException; +import com.netscape.certsrv.profile.ProfileAttribute; +import com.netscape.certsrv.profile.ProfileOutput; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; @@ -41,9 +44,6 @@ import com.netscape.certsrv.template.ArgSet; import com.netscape.certsrv.template.ArgString; import com.netscape.cms.servlet.cert.RequestProcessor; import com.netscape.cms.servlet.common.CMSRequest; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfileOutput; -import com.netscape.cms.servlet.request.model.CertReviewResponse; /** * This servlet approves profile-based request. diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java deleted file mode 100644 index cc32234b2..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.netscape.cms.servlet.profile; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import com.netscape.cms.servlet.profile.model.ProfileData; -import com.netscape.cms.servlet.profile.model.ProfileDataInfos; - -@Path("agent/profiles") -public interface ProfileResource { - - @GET - @Path("{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileData retrieveProfile(@PathParam("id") String id); - - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileDataInfos listProfiles(); - - /** - * Used to retrieve a key - * - * @param data - * @return - */ - - /* - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileData retrieveProfile(ProfileRetrievalRequestData request); - - // retrieval - used to test integration with a browser - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public ProfileData retrievProfile(MultivaluedMap form); - */ -} \ No newline at end of file diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java index 0c13b8bba..2b790b8cb 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java @@ -32,11 +32,13 @@ import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileInput; import com.netscape.certsrv.profile.IProfileSubsystem; +import com.netscape.certsrv.profile.ProfileData; +import com.netscape.certsrv.profile.ProfileDataInfo; +import com.netscape.certsrv.profile.ProfileDataInfos; +import com.netscape.certsrv.profile.ProfileInput; +import com.netscape.certsrv.profile.ProfileNotFoundException; +import com.netscape.certsrv.profile.ProfileResource; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.profile.model.ProfileData; -import com.netscape.cms.servlet.profile.model.ProfileDataInfo; -import com.netscape.cms.servlet.profile.model.ProfileDataInfos; -import com.netscape.cms.servlet.profile.model.ProfileInput; /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java deleted file mode 100644 index 588431a83..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java +++ /dev/null @@ -1,73 +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.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyConstraint { - @XmlAttribute(name="id") - private String name; - - @XmlElement(name="description") - private String text; - - @XmlElement(name = "constraint") - private List constraints = new ArrayList(); - - public PolicyConstraint() { - // required for jaxb - } - - public void addConstraint(PolicyConstraintValue constraint) { - constraints.add(constraint); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public List getConstraints() { - return constraints; - } - - public void setConstraints(List constraints) { - this.constraints = constraints; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java deleted file mode 100644 index 7b60e7ea6..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java +++ /dev/null @@ -1,61 +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.profile.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.property.Descriptor; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyConstraintValue { - @XmlAttribute(name="id") - private String name; - - @XmlElement - private Descriptor descriptor; - - public PolicyConstraintValue() { - // required for jax-b - } - - public PolicyConstraintValue(String name, Descriptor descriptor) { - this.name = name; - this.descriptor = descriptor; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Descriptor getDescriptor() { - return descriptor; - } - - public void setDescriptor(Descriptor descriptor) { - this.descriptor = descriptor; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java deleted file mode 100644 index 2c66fc9dc..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java +++ /dev/null @@ -1,73 +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.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyDefault { - @XmlAttribute(name="id") - private String name; - - @XmlElement(name="description") - private String text; - - @XmlElement(name="policyAttribute") - private List attributes = new ArrayList(); - - public PolicyDefault() { - // required for jaxb - } - - public void addAttribute(ProfileAttribute attr) { - attributes.add(attr); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public List getAttributes() { - return attributes; - } - - public void setAttributes(List attributes) { - this.attributes = attributes; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java deleted file mode 100644 index 616c0695d..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java +++ /dev/null @@ -1,80 +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.profile.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.property.Descriptor; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileAttribute { - - @XmlAttribute - private String name; - - @XmlElement - private String value; - - @XmlElement - private Descriptor descriptor; - - public ProfileAttribute() { - // required for jax-b - } - - public ProfileAttribute(String name, String value, Descriptor descriptor) { - this.name = name; - this.value = value; - this.descriptor = descriptor; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public Descriptor getDescriptor() { - return descriptor; - } - - public void setDescriptor(Descriptor descriptor) { - this.descriptor = descriptor; - } - - @Override - public String toString() { - return "PolicyAttribute [name=" + name + ", value=" + value + ", descriptor=" + descriptor + "]"; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java deleted file mode 100644 index 7f7f26b29..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java +++ /dev/null @@ -1,147 +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.profile.model; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -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 jmagne - * - */ - -@XmlRootElement(name = "ProfileData") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileData { - - @XmlElement - protected String id; - - @XmlElement - protected String name; - - @XmlElement - protected String description; - - @XmlElement - protected boolean isEnabled; - - @XmlElement - protected boolean isVisible; - - @XmlElement - protected String enabledBy; - - @XmlElement(name = "Input") - protected List inputs = new ArrayList(); - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public void setIsEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - } - - public boolean getIsEnabled() { - return isEnabled; - } - - public void setIsVisible(boolean isVisible) { - this.isVisible = isVisible; - } - - public boolean getIsVisible() { - return isVisible; - } - - public void setEnabledBy(String enabledBy) { - this.enabledBy = enabledBy; - } - - public String getEnabledBy() { - return enabledBy; - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - public ProfileInput addProfileInput(String name) { - - ProfileInput oldInput = getProfileInput(name); - - if (oldInput != null) - return oldInput; - - ProfileInput newInput = new ProfileInput(); - newInput.setInputId(name); - - inputs.add(newInput); - - return newInput; - } - - public ProfileInput getProfileInput(String name) { - - ProfileInput input = null; - - Iterator it = inputs.iterator(); - - ProfileInput curInput = null; - while (it.hasNext()) { - curInput = it.next(); - - if (curInput != null && curInput.getInputId().equals(name)) - break; - } - - return input; - } - - public List getProfileInputsList() { - return inputs; - } - -} \ No newline at end of file diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java deleted file mode 100644 index d5083c7a4..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java +++ /dev/null @@ -1,68 +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.profile.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; - -/** - * @author alee - * - */ -@XmlRootElement(name = "ProfileDataInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileDataInfo { - - @XmlElement - protected String profileURL; - - @XmlElement - protected String profileId; - - public ProfileDataInfo() { - // required for JAXB (defaults) - } - - /** - * @return the profileURL - */ - public String getProfileURL() { - return profileURL; - } - - /** - * @param keyURL the profileURL to set - */ - public void setProfileURL(String profileURL) { - this.profileURL = profileURL; - } - - public void setProfileId(String profileId) { - this.profileId = profileId; - } - - /** - * @return the profile ID in the profileURL - */ - public String getProfileId() { - return profileId; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java deleted file mode 100644 index e14ac6641..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java +++ /dev/null @@ -1,90 +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.profile.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 = "ProfileDataInfos") -public class ProfileDataInfos { - - protected Collection profileInfos; - protected List links; - - /** - * @return the ProfileInfos - */ - @XmlElementRef - public Collection getProfileInfos() { - return profileInfos; - } - - /** - * @param ProfileInfos theProfileInfos to set - */ - public void setProfileInfos(Collection profileInfos) { - this.profileInfos = profileInfos; - } - - /** - * @return the links - */ - @XmlElementRef - public List getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List 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/profile/model/ProfileInput.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java deleted file mode 100644 index 631a013cc..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java +++ /dev/null @@ -1,94 +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) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -public class ProfileInput { - - public ProfileInput() { - // required for jaxb - } - - @XmlElement - public String getInputId() { - return inputId; - } - - private String inputId; - - @XmlJavaTypeAdapter(InputAttrsAdapter.class) - public Map InputAttrs = new LinkedHashMap(); - - public void setInputAttr(String name, String value) { - InputAttrs.put(name, value); - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - public static class InputAttrsAdapter extends XmlAdapter> { - - public InputAttrList marshal(Map map) { - InputAttrList list = new InputAttrList(); - for (Map.Entry entry : map.entrySet()) { - Attribute attribute = new Attribute(); - attribute.name = entry.getKey(); - attribute.value = entry.getValue(); - list.attributes.add(attribute); - } - return list; - } - - public Map unmarshal(InputAttrList list) { - Map map = new LinkedHashMap(); - for (Attribute attribute : list.attributes) { - map.put(attribute.name, attribute.value); - } - return map; - } - } - - public static class InputAttrList { - @XmlElement(name = "InputAttr") - public List attributes = new ArrayList(); - } - - public static class Attribute { - - @XmlAttribute - public String name; - - @XmlValue - public String value; - } - - public Map getAttributes() { - return InputAttrs; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java deleted file mode 100644 index f27db4101..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.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) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileOutput { - - public ProfileOutput() { - // required for jaxb - } - - @XmlElement - private String outputId; - - @XmlElement(name = "attributes") - private List attrs = new ArrayList(); - - @XmlElement - private String name; - - @XmlElement - private String text; - - public String getOutputId() { - return outputId; - } - - public void setOutputId(String OutputId) { - this.outputId = OutputId; - } - - public List getAttrs() { - return attrs; - } - - public void setAttrs(List attrs) { - this.attrs = attrs; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public void addAttribute(ProfileAttribute attr) { - attrs.add(attr); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java deleted file mode 100644 index a24f93619..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java +++ /dev/null @@ -1,82 +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.profile.model; - -import java.io.ByteArrayOutputStream; - -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.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfilePolicy { - @XmlAttribute - private String id = null; - - @XmlElement - private PolicyDefault def = null; - - @XmlElement - private PolicyConstraint constraint = null; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public PolicyDefault getDef() { - return def; - } - - public void setDef(PolicyDefault def) { - this.def = def; - } - - public PolicyConstraint getConstraint() { - return constraint; - } - - public void setConstraint(PolicyConstraint constraint) { - this.constraint = constraint; - } - - public String toString() { - try { - JAXBContext context = JAXBContext.newInstance(ProfilePolicy.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; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java deleted file mode 100644 index 784f5670d..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java +++ /dev/null @@ -1,50 +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.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfilePolicySet { - @XmlElement - protected List policies = new ArrayList(); - - public List getPolicies() { - return policies; - } - - public void setPolicies(List policies) { - this.policies = policies; - } - - public void addPolicy(ProfilePolicy policy) { - policies.add(policy); - } - - public void removePolicy(ProfilePolicy policy) { - policies.remove(policy); - } - -} -- cgit