diff options
author | Endi S. Dewata <edewata@redhat.com> | 2014-03-27 18:24:39 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-03-29 18:20:41 -0400 |
commit | 16ee3c262fbac7d1475ad006f40e35b6bb9a4213 (patch) | |
tree | 245523fe2787cae544f103ad1c3660fc0c245992 /base/common/src/com/netscape/certsrv/tps | |
parent | c6a22f99b1ee222d512b60fdca181e29e09ff96a (diff) | |
download | pki-16ee3c262fbac7d1475ad006f40e35b6bb9a4213.tar.gz pki-16ee3c262fbac7d1475ad006f40e35b6bb9a4213.tar.xz pki-16ee3c262fbac7d1475ad006f40e35b6bb9a4213.zip |
Refactored TPS profiles.
The TPS profile has been modified to use PATCH for update operation as
required by Backbone. The ProfileData class has been modified to accept
null properties to indicate that the properties are not being updated.
The ProfileModel class has been modified to use JSON data type for
enable and disable operations.
Ticket #654
Diffstat (limited to 'base/common/src/com/netscape/certsrv/tps')
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/profile/ProfileData.java | 29 | ||||
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/profile/ProfileResource.java | 4 |
2 files changed, 9 insertions, 24 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/profile/ProfileData.java b/base/common/src/com/netscape/certsrv/tps/profile/ProfileData.java index d733777aa..81e0dea3a 100644 --- a/base/common/src/com/netscape/certsrv/tps/profile/ProfileData.java +++ b/base/common/src/com/netscape/certsrv/tps/profile/ProfileData.java @@ -21,7 +21,6 @@ package com.netscape.certsrv.tps.profile; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; -import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -62,7 +61,7 @@ public class ProfileData { String id; String status; - Map<String, String> properties = new LinkedHashMap<String, String>(); + Map<String, String> properties; Link link; @@ -91,24 +90,7 @@ public class ProfileData { } public void setProperties(Map<String, String> properties) { - this.properties.clear(); - this.properties.putAll(properties); - } - - public Collection<String> getPropertyNames() { - return properties.keySet(); - } - - public String getProperty(String name) { - return properties.get(name); - } - - public void setProperty(String name, String value) { - properties.put(name, value); - } - - public String removeProperty(String name) { - return properties.remove(name); + this.properties = properties; } public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> { @@ -223,8 +205,11 @@ public class ProfileData { ProfileData before = new ProfileData(); before.setID("profile1"); before.setStatus("ENABLED"); - before.setProperty("param1", "value1"); - before.setProperty("param2", "value2"); + + Map<String, String> properties = new LinkedHashMap<String, String>(); + properties.put("param1", "value1"); + properties.put("param2", "value2"); + before.setProperties(properties); String string = before.toString(); System.out.println(string); diff --git a/base/common/src/com/netscape/certsrv/tps/profile/ProfileResource.java b/base/common/src/com/netscape/certsrv/tps/profile/ProfileResource.java index 50a205cd7..48d3a8c4d 100644 --- a/base/common/src/com/netscape/certsrv/tps/profile/ProfileResource.java +++ b/base/common/src/com/netscape/certsrv/tps/profile/ProfileResource.java @@ -20,7 +20,6 @@ package com.netscape.certsrv.tps.profile; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; @@ -30,6 +29,7 @@ import org.jboss.resteasy.annotations.ClientResponseType; import com.netscape.certsrv.acls.ACLMapping; import com.netscape.certsrv.authentication.AuthMethodMapping; +import com.netscape.certsrv.base.PATCH; /** @@ -57,7 +57,7 @@ public interface ProfileResource { @ClientResponseType(entityType=ProfileData.class) public Response addProfile(ProfileData profileData); - @PUT + @PATCH @Path("{profileID}") @ACLMapping("profiles.modify") @ClientResponseType(entityType=ProfileData.class) |