diff options
| author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-15 18:01:57 -0400 |
|---|---|---|
| committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-15 18:01:57 -0400 |
| commit | 3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb (patch) | |
| tree | b200cd753ebb56e0cb4a0d2ef95c75d7aa97e3c9 /proxy/code/src | |
| parent | 43f60b368c5402ae98fa80620d76356f24995b3f (diff) | |
| download | candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.tar.gz candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.tar.xz candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.zip | |
add entitlement api
Diffstat (limited to 'proxy/code/src')
3 files changed, 73 insertions, 0 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/EntitlementApi.java b/proxy/code/src/org/fedoraproject/candlepin/api/EntitlementApi.java new file mode 100644 index 0000000..c952143 --- /dev/null +++ b/proxy/code/src/org/fedoraproject/candlepin/api/EntitlementApi.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2008 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.api; + +import org.fedoraproject.candlepin.model.Entitlement; + +import javax.ws.rs.Path; + + +/** + * REST api gateway for the User object. + */ +@Path("/entitlement") +public class EntitlementApi extends BaseApi { + + /** + * {@inheritDoc} + */ + @Override + protected Class getApiClass() { + return Entitlement.class; + } + +} diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java b/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java index ad4b8d2..94e6c77 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java +++ b/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java @@ -48,6 +48,10 @@ public class UserApi extends BaseApi { return User.class; } + /* + * this works great but requires create a new class for each + * model type + */ @GET @Path("/listusers") @Produces(MediaType.APPLICATION_JSON) public Users listUsers() { @@ -60,6 +64,10 @@ public class UserApi extends BaseApi { return users; } + /* + * this works the best only requires that each api method + * have its own list method + */ @GET @Path("/uselist") @Produces(MediaType.APPLICATION_JSON) public List<User> listUsers1() { @@ -73,10 +81,17 @@ public class UserApi extends BaseApi { @GET @Path("/listobjects") @Produces(MediaType.APPLICATION_JSON) + /* + * does not work shown here for example + */ public List<Object> listObjects() { return ObjectFactory.get().listObjectsByClass(getApiClass()); } + /* + * This produces the output of a BaseModel but not + * that of the real object i.e. User. + */ @GET @Path("/listbasemodel") @Produces(MediaType.APPLICATION_JSON) public List<BaseModel> listUsers2() { diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java index c9d76e6..4bd4d92 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java @@ -16,14 +16,36 @@ package org.fedoraproject.candlepin.model; import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class Entitlement extends BaseModel { private Organization org; private List<Entitlement> childEntitlements; /** + * default ctor + */ + public Entitlement() { + super(null); + } + + /** + * @param uuid + */ + public Entitlement(String uuid) { + super(uuid); + } + + /** * @return the org */ + @XmlTransient public Organization getOrg() { return org; } |
