Package com.restfb.types

Examples of com.restfb.types.User


                                            String[] temp2 = temp1[0].split("=");
                                            System.out.println("access tocken=" + temp2);
                                            access_token = temp2[1];
                                            new GraphReaderExample(access_token).runEverything();
                                            facebookClient = new DefaultFacebookClient(access_token);
                                            User user = facebookClient.fetchObject("me", User.class);
                                            Page page = facebookClient.fetchObject("cocacola", Page.class);
                                            // userName = user.getName();
                                           //  userMail = user.getEmail();
                                           
                                            authFrame.dispose();
                                            /********/
                                            String userName = user.getName();
                                            String userMail = user.getEmail();
                                            UserDao udao = new UserDao();
                                            currentUser = new UserApp(userName, userMail);
                                            UserApp u = currentUser ;
                                         
                                            if (u.equals(udao.findByEmail(userMail))) {
View Full Code Here


   * Workaround where Facebook can return the illegal JSON "false" instead of an object - just map as null instead of
   * throwing an exception.
   */
  @Test
  public void testFalseInsteadOfObject() {
    User user = createJsonMapper().toJavaObject("false", User.class);
    assertTrue(user == null);
  }
View Full Code Here

  @Test
  public void testMultipleFieldsWithSameName() {
    JsonMapper jsonMapper = createJsonMapper();

    User user1 = jsonMapper.toJavaObject(jsonFromClasspath("user-with-hometown-v1"), User.class);
    assertTrue("Beograd".equals(user1.getHometownName()));
    assertTrue(user1.getHometown() == null);

    User user2 = jsonMapper.toJavaObject(jsonFromClasspath("user-with-hometown-v2"), User.class);
    assertTrue("Belgrade, Serbia".equals(user2.getHometown().getName()));
    assertTrue("Belgrade, Serbia".equals(user2.getHometownName()));

    Post post1 = jsonMapper.toJavaObject(jsonFromClasspath("post-with-likes-v1"), Post.class);
    assertTrue(post1.getLikesCount() == 4);
    assertTrue(post1.getLikes() == null);
View Full Code Here

    }
  }
 
  @Test
  public void jsonEmptyArray() {
      User u = createJsonMapper().toJavaObject("[]", User.class);
      assertNotNull(u);
      assertNull(u.getName());
  }
View Full Code Here

    try {
      FacebookClient facebookClient = new DefaultFacebookClient();

      // You'll notice that logging statements from this call are bridged from java.util.logging to Log4j
      User user = facebookClient.fetchObject("btaylor", User.class);

      // ...and of course this goes straight to Log4j
      logger.debug(user);
    } finally {
      // Make sure to tear down when you're done using the bridge
View Full Code Here

  }

  void fetchObject() {
    out.println("* Fetching single objects *");

    User user = facebookClient.fetchObject("me", User.class);
    Page page = facebookClient.fetchObject("cocacola", Page.class);

    out.println("User name: " + user.getName());
    out.println("Page likes: " + page.getLikes());
  }
View Full Code Here

    // Make the API call
    JsonObject results = facebookClient.fetchObjects(ids, JsonObject.class);

    // Pull out JSON data by key and map each type by hand.
    JsonMapper jsonMapper = new DefaultJsonMapper();
    User user = jsonMapper.toJavaObject(results.getString("btaylor"), User.class);
    Url url = jsonMapper.toJavaObject(results.getString("http://www.imdb.com/title/tt0117500/"), Url.class);

    out.println("User is " + user);
    out.println("URL is " + url);
  }
View Full Code Here

  }

  void metadata() {
    out.println("* Metadata *");

    User userWithMetadata = facebookClient.fetchObject("me", User.class, Parameter.with("metadata", 1));

    out.println("User metadata: has albums? " + userWithMetadata.getMetadata().getConnections().hasAlbums());
  }
View Full Code Here

  }

  void selection() {
    out.println("* Selecting specific fields *");

    User user = facebookClient.fetchObject("me", User.class, Parameter.with("fields", "id,name"));

    out.println("User name: " + user.getName());
  }
View Full Code Here

   *     since date
   *    
   */
  public void doSynchonization(String userId, Date sinceDate) {
    // get user information
    User user = getFbClient().getFacebookObjectByID(userId, User.class);
    // user to content
    Content content = user2Content(user);
    content.setContentUrl(URLUtils.makeContentURL(user.getId(), ContentTypeEnum.USER.name()));
    logger.debug(content);

    try {
      // check if content is available inside the graph
      if (getFbContentProvider().facebookIsExistingContent(content
View Full Code Here

TOP

Related Classes of com.restfb.types.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.