Tabnine Logo
PersonImpl
Code IndexAdd Tabnine to your IDE (free)

How to use
PersonImpl
in
org.apache.shindig.social.core.model

Best Java code snippets using org.apache.shindig.social.core.model.PersonImpl (Showing top 20 results out of 315)

origin: org.apache.shindig/shindig-social-api

public void setProfileUrl(String profileUrl) {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 if (url != null) {
  url.setValue(profileUrl);
 } else {
  if (profileUrl != null)
   setUrls(addListField(new UrlImpl(profileUrl, null, PROFILE_URL_TYPE), getUrls()));
 }
}
origin: org.apache.shindig/shindig-social-api

public void setThumbnailUrl(String thumbnailUrl) {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 if (photo != null) {
  photo.setValue(thumbnailUrl);
 } else {
  if (thumbnailUrl != null)
   setPhotos(addListField(new ListFieldImpl(THUMBNAIL_PHOTO_TYPE, thumbnailUrl), getPhotos()));
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

public String getProfileUrl() {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 return url == null ? null : url.getValue();
}
origin: org.apache.shindig/shindig-social-api

/** {@inheritDoc} */
public Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token)
  throws ProtocolException {
 if (id != null && AnonymousSecurityToken.ANONYMOUS_ID.equals(id.getUserId())) {
  Person anonymous = new PersonImpl();
  anonymous.setId(AnonymousSecurityToken.ANONYMOUS_ID);
  anonymous.setName(new NameImpl(ANONYMOUS_NAME));
  anonymous.setNickname(ANONYMOUS_NAME);
  return Futures.immediateFuture(anonymous);
 }
 try {
  JSONArray people = db.getJSONArray(PEOPLE_TABLE);
  for (int i = 0; i < people.length(); i++) {
   JSONObject person = people.getJSONObject(i);
   if (id != null && person.get(Person.Field.ID.toString()).equals(id.getUserId(token))) {
    Person personObj = filterFields(person, fields, Person.class);
    Map<String, Object> appData = getPersonAppData(person.getString(Person.Field.ID
      .toString()), fields);
    personObj.setAppData(appData);
    return Futures.immediateFuture(personObj);
   }
  }
  throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Person '" + id.getUserId(token) + "' not found");
 } catch (JSONException je) {
  throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
    je);
 }
}
origin: org.apache.shindig/shindig-social-api

public String getThumbnailUrl() {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 return photo == null ? null : photo.getValue();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/** {@inheritDoc} */
public Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token)
  throws ProtocolException {
 if (id != null && AnonymousSecurityToken.ANONYMOUS_ID.equals(id.getUserId())) {
  Person anonymous = new PersonImpl();
  anonymous.setId(AnonymousSecurityToken.ANONYMOUS_ID);
  anonymous.setName(new NameImpl(ANONYMOUS_NAME));
  anonymous.setNickname(ANONYMOUS_NAME);
  return Futures.immediateFuture(anonymous);
 }
 try {
  JSONArray people = db.getJSONArray(PEOPLE_TABLE);
  for (int i = 0; i < people.length(); i++) {
   JSONObject person = people.getJSONObject(i);
   if (id != null && person.get(Person.Field.ID.toString()).equals(id.getUserId(token))) {
    Person personObj = filterFields(person, fields, Person.class);
    Map<String, Object> appData = getPersonAppData(person.getString(Person.Field.ID
      .toString()), fields);
    personObj.setAppData(appData);
    return Futures.immediateFuture(personObj);
   }
  }
  throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Person '" + id.getUserId(token) + "' not found");
 } catch (JSONException je) {
  throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
    je);
 }
}
origin: org.apache.shindig/shindig-social-api

public String getProfileUrl() {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 return url == null ? null : url.getValue();
}
origin: com.lmco.shindig/shindig-social-api

public String getThumbnailUrl() {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 return photo == null ? null : photo.getValue();
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleGetSelf() throws Exception {
 String path = "/people/john.doe/@self";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Person data = new PersonImpl();
 expect(personService.getPerson(eq(JOHN_DOE.iterator().next()),
   eq(DEFAULT_FIELDS), eq(token))).andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

public void setProfileUrl(String profileUrl) {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 if (url != null) {
  url.setValue(profileUrl);
 } else {
  if (profileUrl != null)
   setUrls(addListField(new UrlImpl(profileUrl, null, PROFILE_URL_TYPE), getUrls()));
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

public void setThumbnailUrl(String thumbnailUrl) {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 if (photo != null) {
  photo.setValue(thumbnailUrl);
 } else {
  if (thumbnailUrl != null)
   setPhotos(addListField(new ListFieldImpl(THUMBNAIL_PHOTO_TYPE, thumbnailUrl), getPhotos()));
 }
}
origin: com.lmco.shindig/shindig-social-api

public String getProfileUrl() {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 return url == null ? null : url.getValue();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

public String getThumbnailUrl() {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 return photo == null ? null : photo.getValue();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetSelf() throws Exception {
 String path = "/people/john.doe/@self";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Person data = new PersonImpl();
 expect(personService.getPerson(eq(JOHN_DOE.iterator().next()),
   eq(DEFAULT_FIELDS), eq(token))).andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: com.lmco.shindig/shindig-social-api

public void setProfileUrl(String profileUrl) {
 Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
 if (url != null) {
  url.setValue(profileUrl);
 } else {
  if (profileUrl != null)
   setUrls(addListField(new UrlImpl(profileUrl, null, PROFILE_URL_TYPE), getUrls()));
 }
}
origin: com.lmco.shindig/shindig-social-api

public void setThumbnailUrl(String thumbnailUrl) {
 ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
 if (photo != null) {
  photo.setValue(thumbnailUrl);
 } else {
  if (thumbnailUrl != null)
   setPhotos(addListField(new ListFieldImpl(THUMBNAIL_PHOTO_TYPE, thumbnailUrl), getPhotos()));
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandlePut() throws Exception {
 String jsonPerson = "{person: {aboutMe: 'A person'}}";
 String path = "/people/john.doe/@self";
 RestHandler operation = registry.getRestHandler(path, "PUT");
 Person person = new PersonImpl();
 expect(converter.convertToObject(eq(jsonPerson), eq(Person.class)))
   .andReturn(person);
 expect(personService.updatePerson(eq(JOHN_DOE.iterator().next()),
   eq(person),
   eq(token))).andReturn(Futures.immediateFuture(person));
 replay();
 assertEquals(person, operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonPerson), token, converter).get());
 verify();
}
origin: com.lmco.shindig/shindig-social-api

@Test
public void testHandleGetSelf() throws Exception {
 String path = "/people/john.doe/@self";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Person data = new PersonImpl();
 expect(personService.getPerson(eq(JOHN_DOE.iterator().next()),
   eq(DEFAULT_FIELDS), eq(token))).andReturn(ImmediateFuture.newInstance(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandlePut() throws Exception {
 String jsonPerson = "{person: {aboutMe: 'A person'}}";
 String path = "/people/john.doe/@self";
 RestHandler operation = registry.getRestHandler(path, "PUT");
 Person person = new PersonImpl();
 expect(converter.convertToObject(eq(jsonPerson), eq(Person.class)))
   .andReturn(person);
 expect(personService.updatePerson(eq(JOHN_DOE.iterator().next()),
   eq(person),
   eq(token))).andReturn(Futures.immediateFuture(person));
 replay();
 assertEquals(person, operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonPerson), token, converter).get());
 verify();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleAnonymousUser() throws Exception {
 String path = "/people/-1";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Person data = new PersonImpl();
 expect(personService.getPerson(eq(ANONYMOUS),
   eq(DEFAULT_FIELDS), eq(token))).andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
org.apache.shindig.social.core.modelPersonImpl

Javadoc

Default Implementation of the Person object in the model.

Most used methods

  • <init>
    A constructor which contains all of the required fields on a person object
  • addListField
  • getListFieldWithType
  • getPhotos
  • getUrls
  • setPhotos
  • setUrls

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Notification (javax.management)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now