Package com.iqser.core.model

Examples of com.iqser.core.model.Content


    }
  }

  public void testGetContent() {
    String contentURL = "facebook/accessTokenKey/543824877/user";
    Content c = userBuilder.getContent(contentURL);

    assertEquals(contentProvider.getId(), c.getProvider());
    assertEquals(ContentTypeEnum.USER.name(), c.getType());
    assertEquals(contentURL, c.getContentUrl());

    assertTrue(c.getAttributes().size() > 0);

    assertEquals("543824877", c.getAttributeByName("id").getValue());
    assertEquals("George Boosley", c.getAttributeByName("name").getValue());
    assertEquals("George", c.getAttributeByName("firstName").getValue());
    assertEquals("Boosley", c.getAttributeByName("lastName").getValue());
    assertEquals("male", c.getAttributeByName("gender").getValue());
    assertEquals("en_US", c.getAttributeByName("locale").getValue());
    assertEquals("http://www.facebook.com/profile.php?id=543824877", c
        .getAttributeByName("link").getValue());

  }
View Full Code Here


   */
  public void doSynchonization(String userId, Date sinceDate) {
    List<Event> events = getFbClient().getFacebookConnectionByID(userId
        + "/events", Event.class, sinceDate);
    for (Event e : events) {
      Content content = event2Content(e);
      try {
        if (getFbContentProvider().facebookIsExistingContent(content
            .getContentUrl())) {
          getFbContentProvider().facebookUpdateContent(content);
        } else {
          getFbContentProvider().facebookAddContent(content);
        }
View Full Code Here

   */
  public Content getContent(String contentURL) {
    String fbID = URLUtils.getFbId(contentURL);
    Event event = getFbClient().getFacebookObjectByID(fbID, Event.class);

    Content content = event2Content(event);
    content.setContentUrl(contentURL);

    return content;
  }
View Full Code Here

    // update graph
    String contentURL = URLUtils.makeContentURL(postedEvent.getId(), ContentTypeEnum.EVENT.name());

    // fetch newly created object
    Content newContent = getContent(contentURL);

    // add object to graph
    getFbContentProvider().facebookAddContent(newContent);
    content.setContentUrl(contentURL);
  }
View Full Code Here

    getFbContentProvider().facebookAddContent(newContent);
    content.setContentUrl(contentURL);
  }

  private Content event2Content(Event e) {
    Content content = new Content();

    content.setProvider(getFbContentProvider().getId());
    content.setType(ContentTypeEnum.EVENT.name());
    content.setContentUrl(URLUtils.makeContentURL(e.getId(),
        ContentTypeEnum.EVENT.name()));

    if (e.getUpdatedTime() != null) {
      content.setModificationDate(e.getUpdatedTime().getTime());
    } else {
      content.setModificationDate(new Date().getTime());
    }

    if (e.getDescription() != null) {
      content.setFulltext(e.getDescription());
    }

    addAttribute(content, "id", e.getId());
    if (e.getOwner() != null) {
      addAttribute(content, "from_name", e.getOwner().getName());
View Full Code Here

   */
  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    Comment comment = getFbClient().getFacebookObjectByID(fbid, Comment.class);
   
    Content content = comment2Content(comment);
    content.setContentUrl(contentURL);
   
    return content;
 
View Full Code Here

   * @param comment - facebook comment
   *
   * @return a Content object
   */
  public Content comment2Content(Comment comment) {
    Content content = new Content();
    content.setProvider(getFbContentProvider().getId());
    content.setType(ContentTypeEnum.COMMENT.name());
    content.setContentUrl(URLUtils.makeContentURL(comment.getId(), ContentTypeEnum.COMMENT.name()));   
    //set modification date
    content.setModificationDate(comment.getCreatedTime().getTime());
       
    content.setFulltext(comment.getMessage());   
   
    addAttribute(content, "id", comment.getId());
    addAttribute(content, "parent_id", getParentIDForComment(comment.getId()));
    addAttribute(content, "from_id", comment.getFrom().getId());
    addAttribute(content, "from_name", comment.getFrom().getName());
View Full Code Here

   */
  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
          .getContentUrl())) {
        getFbContentProvider().facebookUpdateContent(content);
      } else {
        getFbContentProvider().facebookAddContent(content);
      }
View Full Code Here

    logger.debug(fbid);
    // get user information
    // User user = fbClient.getFacebookUserProfile(fbid);
    User user = getFbClient().getFacebookObjectByID(fbid, User.class);
    // user to content
    Content content = user2Content(user);
    content.setContentUrl(contentURL);

    return content;
  }
View Full Code Here

    return content;
  }

  private Content user2Content(User user) {
    Content userContent = new Content();

    userContent.setType(ContentTypeEnum.USER.name());
    userContent.setProvider(getFbContentProvider().getId());

    if (user.getUpdatedTime() != null) {
      userContent.setModificationDate(user.getUpdatedTime().getTime());
    } else {
      userContent.setModificationDate(new Date().getTime());
    }

    addAttribute(userContent, "id", user.getId());
    addAttribute(userContent, "name", user.getName());
    addAttribute(userContent, "first_name", user.getFirstName());
View Full Code Here

TOP

Related Classes of com.iqser.core.model.Content

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.