diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2014-09-09 07:44:01 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2014-09-09 07:44:01 -0700 |
commit | c2feb363e513c0dea83d507eb9ba1918748d4e8e (patch) | |
tree | 8ba314d14f86aff178adac5ba46ca35e037c6569 /src/com/p4square/f1oauth/F1User.java | |
parent | 66469ff2f76ac916e289e066377570b38554fdcc (diff) |
Moving F1OAuthHelper to F1Access.
F1Access will provide a collection of F1 API methods, rather than
placing all of those methods in F1User as I was originally planning.
Diffstat (limited to 'src/com/p4square/f1oauth/F1User.java')
-rw-r--r-- | src/com/p4square/f1oauth/F1User.java | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/src/com/p4square/f1oauth/F1User.java b/src/com/p4square/f1oauth/F1User.java index 942f534..e5ab487 100644 --- a/src/com/p4square/f1oauth/F1User.java +++ b/src/com/p4square/f1oauth/F1User.java @@ -19,7 +19,6 @@ public class F1User extends OAuthUser { public static final String LAST_NAME = "lastName"; public static final String ICODE = "@iCode"; - private final String mBaseUrl; private final Map mData; /** @@ -29,10 +28,9 @@ public class F1User extends OAuthUser { * @param data F1 Person Record. * @throws IllegalStateException if data.get("person") is null. */ - public F1User(String baseUrl, OAuthUser user, Map data) { + public F1User(OAuthUser user, Map data) { super(user.getLocation(), user.getToken()); - mBaseUrl = baseUrl; mData = (Map) data.get("person"); if (mData == null) { throw new IllegalStateException("Bad data"); @@ -69,72 +67,4 @@ public class F1User extends OAuthUser { public Object get(String key) { return mData.get(key); } - - /** - * @return the F1 API base url. - */ - public String getBaseUrl() { - return mBaseUrl; - } - - /* - public addAttribute(Attribute attribute, String comment) { - String baseUrl = getBaseUrl(); - Map newAttributeTemplate = null; - - // Get Attribute Template - Request request = new Request(Method.GET, - baseUrl + "People/" + getIdentifier() + "/Attributes/new.json"); - request.setChallengeResponse(getChallengeResponse()); - Response response = getContext().getClientDispatcher().handle(request); - - Representation representation = response.getEntity(); - try { - Status status = response.getStatus(); - if (status.isSuccess()) { - JacksonRepresentation<Map> entity = new JacksonRepresentation<Map>(response.getEntity(), Map.class); - newAttributeTemplate = entity.getObject(); - } - - } finally { - if (representation != null) { - representation.release(); - } - } - - if (newAttributeTemplate == null) { - LOG.error("Could not retrieve attribute template!"); - return; - } - - // Populate Attribute Template - - - // POST new attribute - Request request = new Request(Method.POST, - baseUrl + "People/" + getIdentifier() + "/Attributes.json"); - request.setChallengeResponse(getChallengeResponse()); - Response response = getContext().getClientDispatcher().handle(request); - - Representation representation = response.getEntity(); - try { - Status status = response.getStatus(); - if (status.isSuccess()) { - JacksonRepresentation<Map> entity = new JacksonRepresentation<Map>(response.getEntity(), Map.class); - newAttributeTemplate = entity.getObject(); - } - - } finally { - if (representation != null) { - representation.release(); - } - } - - if (newAttributeTemplate == null) { - LOG.error("Could retrieve attribute template!"); - return; - } - - } - */ } |