Package com.iqser.core.model

Examples of com.iqser.core.model.Content


    assertTrue(repo.getContentByProvider(fbcp.getId(), true).size() == 1)
   
  }
 
  public void testPerformActionThrowsException() throws IQserTechnicalException {   
    Content content = createDummyContentFromUrl("facebook/atk1/100/user");
    try{
      fbcp.performAction("unknownAction", content);
      fail();
    }catch(IQserRuntimeException ire){
     
View Full Code Here


    String postJsonString = IOUtils.toString(getClass().getResourceAsStream(path));
    return jsonMapper.toJavaList(postJsonString, clazz);
  }
 
  private Content createDummyContentFromUrl(String contentUrl){
    Content content = new Content();
    content.setProvider(fbcp.getId());
    content.setContentUrl(contentUrl);
   
    return content;
  }
View Full Code Here

   */
  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    Post post = getFbClient().getFacebookObjectByID(fbid, Post.class);

    Content content = post2Content(post);
    content.setContentUrl(contentURL);

    return content;
  }
View Full Code Here

   */
  private List<Content> contents4Synch(Post post) {
    List<Content> contentList = new ArrayList<Content>();

    // post
    Content postContent = post2Content(post);
    contentList.add(postContent);

    // comments
    if (post.getComments() != null) {
      List<Comment> comments = post.getComments().getData();
      for (Comment comment : comments) {
        Content commentContent = comment2Content(comment);
        contentList.add(commentContent);
      }
    }

    return contentList;
View Full Code Here

   *            - facebook post
   *
   * @return a Content object
   */
  private Content post2Content(Post post) {
    Content content = new Content();
    content.setProvider(getFbContentProvider().getId());
    content.setType(ContentTypeEnum.POST.name());
    content.setContentUrl(URLUtils.makeContentURL( post.getId(), ContentTypeEnum.POST.name()));
    // set modification date
    if (post.getUpdatedTime() != null) {
      content.setModificationDate(post.getUpdatedTime().getTime());
    } else {
      content.setModificationDate(new Date().getTime());
    }

    if (post.getMessage() != null) {
      content.setFulltext(post.getMessage());
    }

    addAttribute(content, "facebooktype", post.getType());
    addAttribute(content, "id", post.getId());
    addAttribute(content, "from_id", post.getFrom().getId());
View Full Code Here

    String fbid = resp.getId();

    String contentURL = URLUtils.makeContentURL(fbid, "post");

    // get object from facebook
    Content newContent = getContent(contentURL);
    // add object in GIN graph
    getFbContentProvider().facebookAddContent(newContent);

    // change content URL
    content.setContentUrl(contentURL);
View Full Code Here

    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
    //register behavior
    EasyMock.replay(mockFactory, mockFbClient);

    Content content = fbcp.getContent(contentUrl);
   
    //verify
    EasyMock.verify();
       
    //assertions
    assertNotNull(content);
    assertNotNull(content.getModificationDate());
    assertEquals("MyPost", content.getType())
    assertEquals(fbcp.getId(), content.getProvider());

    //look for a changed attribute name
    //[from_id=fromId][from_name=fromName][message=text]
    assertEquals("Facebook Platform",content.getAttributeByName("fromName").getValue());
    assertEquals("19292868552",content.getAttributeByName("fromId").getValue());
    assertNotNull(content.getAttributeByName("text"));
   
    assertTrue(content.getAttributes().size() > 0);
   
 
View Full Code Here

    //determine accessToken and object type from content URL
    String type = URLUtils.getObjectType(contentURL);   

    IFacebookContentBuilder builder = createBuilder(type, accessToken);

    Content content = builder.getContent(contentURL);
   
    customizeContent(content);
   
    return content;
  }
View Full Code Here

   */
  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    Note note = getFbClient().getFacebookObjectByID(fbid, Note.class);

    Content content = note2Content(note);
    content.setContentUrl(contentURL);

    // the API does not retrieve comments and likes
    // add comments
    List<Comment> noteComments = getFbClient().getFacebookConnectionByID(
        note.getId() + "/comments", Comment.class);
View Full Code Here

   *            - access token key
   *
   * @return a Content object
   */
  private Content note2Content(Note note) {
    Content content = new Content();
    content.setProvider(getFbContentProvider().getId());
    content.setType(ContentTypeEnum.NOTE.name());
    content.setContentUrl(URLUtils.makeContentURL(note.getId(), ContentTypeEnum.NOTE.name()));

    // set modification date
    content.setModificationDate(note.getUpdatedTime().getTime());

    if (note.getMessage() != null) {
      content.setFulltext(note.getMessage());
    }

    addAttribute(content, "id", note.getId());
    addAttribute(content, "from_id", note.getFrom().getId());
    addAttribute(content, "from_name", note.getFrom().getName());
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.