Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Tag


    assertEquals("javadevelopment",ut2.getTag().getLabel());
    assertEquals(ut.getId(),ut2.getId());
  }
 
  public void testGetTag() throws Exception {
    Tag t = manager.getTag("videogame");
    assertNotNull(t);
    assertEquals(3,t.getId());
  }
View Full Code Here


    tagDao.deleteTag(subjTag.getTag().getId());
    tagDao.deleteTag(objTag.getTag().getId());
  }
 
  public void testGetUserTag() throws Exception{
    UserTag ut = manager.getUserTag(new User("hchen1"),new Tag("wii"));
    assertNotNull(ut);
    assertEquals((2),ut.getTag().getId());
    assertEquals("Harry Chen",ut.getUser().getFullname());
   
    ut = manager.getUserTag(new User((1)),new Tag("webwork"));
    assertNotNull(ut);
    assertEquals((1),ut.getTag().getId());
    assertEquals("hchen1",ut.getUser().getUsername());
   
    UserTag ut2 = manager.getUserTag(ut.getId());
View Full Code Here

  public static void fillId(TagDao tagDao, UserDao userDao, UserTag userTag)
      throws NoSuchUserException, NoSuchTagException,
      NoSuchUserTagException, MissingIdException {
    if (hasMissingId(userTag) == true) {
      User user = userTag.getUser();
      Tag tag = userTag.getTag();
      fillId(userDao, user);
      fillId(tagDao, tag);
      UserTag obj = getUserTag(tagDao, user, tag);
      if (obj == null) {
        throw new NoSuchUserTagException("no such userTag: user="
            + user.getUsername() + ",tag=" + tag.getLabel());
      }
      userTag.setId(obj.getId());
    }
  }
View Full Code Here

  public static void fillId(TagDao tagDao, LinkDao linkDao, LinkTag linkTag)
      throws NoSuchLinkException, NoSuchTagException, MissingIdException,
      NoSuchLinkTagException {
    if (hasMissingId(linkTag) == true) {
      Link link = linkTag.getLink();
      Tag tag = linkTag.getTag();
      fillId(linkDao, link);
      fillId(tagDao, tag);
      LinkTag obj = getLinkTag(tagDao, link, tag);
      if (obj == null) {
        throw new NoSuchLinkTagException("no such linkTag=" + linkTag);
View Full Code Here

    }
  }

  public static void fillId(TagDao tagDao, Tag tag) throws NoSuchTagException {
    if (hasMissingId(tag) == true) {
      Tag obj = getTag(tagDao, tag.getLabel());
      if (obj == null) {
        throw new NoSuchTagException("no such tag=" + tag);
      }
      tag.setId(obj.getId());
    }
  }
View Full Code Here

  public static Tag getTag(TagDao tagDao, String tag) {
    if (tag == null) {
      throw new NullPointerException("tag is NULL");
    }
    Tag aTag = null;
    List<Tag> tags = tagDao.findTag(tag);
    if (tags.isEmpty() == false) {
      aTag = tags.get(0);
    }
    return aTag;
View Full Code Here

      NoSuchUserTagException, MissingIdException {
    if (hasMissingId(userTag) == true) {
      fillId(tagDao, userDao, userTag);
    }
    UserTag ut = tagDao.getUserTag(userTag.getId());
    Tag t = ut.getTag();
    User u = ut.getUser();
    fillObject(tagDao, t);
    fillObject(userDao, u);
    userTag.setTag(t);
    userTag.setUser(u);
View Full Code Here

    if (hasMissingId(linkTag) == true) {
      fillId(tagDao, linkDao, linkTag);
    }
    LinkTag obj = tagDao.getLinkTag(linkTag.getId());
    Link l = obj.getLink();
    Tag t = obj.getTag();
    fillObject(linkDao, l);
    fillObject(tagDao, t);
    linkTag.setLink(l);
    linkTag.setTag(t);
    linkTag.setCount(obj.getCount());
View Full Code Here

  }

  public static void fillObject(TagDao tagDao, Tag tag)
      throws NoSuchTagException {
    fillId(tagDao, tag);
    Tag t = tagDao.getTag(tag.getId());
    tag.setLabel(t.getLabel());
    tag.setCount(t.getCount());
  }
View Full Code Here

   * the input <code>tag</code> string.
   *
   */
  public static int createTagIfNotExist(TagDao tagDao, String tag)
      throws ParseTagException {
    Tag tagObj = null;
    String tagLabel = null;
    if (TagUtil.isPrefixedUserTag(tag) == true) {
      UserTag ut = TagUtil.parsePrefixedUserTag(tag);
      if (ut != null) {
        tagLabel = ut.getTag().getLabel();
      } else {
        throw new ParseTagException("unable to parse tag: " + tag);
      }
    } else {
      tagLabel = tag;
    }
    List<Tag> tags = tagDao.findTag(tagLabel);
    if (tags.isEmpty()) {
      tagObj = new Tag(tagLabel);
      int id = tagDao.createTag(tagObj);
      tagObj.setId(id);
    } else {
      tagObj = tags.get(0);
    }
    return tagObj.getId();
  }
View Full Code Here

TOP

Related Classes of com.gnizr.db.dao.Tag

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.