Examples of UserTag


Examples of com.gnizr.db.dao.UserTag

 
  public void testAddTagCountOne() throws Exception{
    Tag tag4 = tagDao.getTag(4);
    assertEquals(0,tag4.getCount());
   
    UserTag uTag4 = tagDao.getUserTag(4000);
    assertEquals(0,uTag4.getCount());
   
    LinkTag lTag4 = tagDao.getLinkTag(400);
    assertEquals(0,lTag4.getCount());
   
    BookmarkTag bTag4 = tagDao.getBookmarkTag(40);
    assertEquals(0,bTag4.getCount());
       
    User user1 = new User(1);
    Link link1 = new Link(1);
    Bookmark bmark1 = new Bookmark(1);
       
    boolean[] opOkay = tagDao.addTagCountOne(new Tag[]{tag4}, user1, link1, bmark1);
    assertTrue(opOkay[0]);
   
    tag4 = tagDao.getTag(4);
    assertEquals(1,tag4.getCount());
   
    uTag4 = tagDao.getUserTag(4000);
    assertEquals(1,uTag4.getCount());
   
    lTag4 = tagDao.getLinkTag(400);
    assertEquals(1,lTag4.getCount());
   
    bTag4 = tagDao.getBookmarkTag(40);
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

 
  public void testSubtractTagCountOne() throws Exception{
    Tag tag = tagDao.getTag(2);
    BookmarkTag btag = tagDao.getBookmarkTag(2);
    LinkTag ltag = tagDao.getLinkTag(2);
    UserTag utag = tagDao.getUserTag(2);
   
    assertEquals(100,tag.getCount());
    assertEquals(1,btag.getCount());
    assertEquals(1,ltag.getCount());
    assertEquals(1,utag.getCount());
   
    boolean[] opOkay = tagDao.subtractTagCountOne(new Tag[]{tag}, new User(1), new Link(1), new Bookmark(1));
    assertTrue(opOkay[0]);
   
    tag = tagDao.getTag(2);
    btag = tagDao.getBookmarkTag(2);
    ltag = tagDao.getLinkTag(2);
    utag = tagDao.getUserTag(2);
   
    assertEquals(99,tag.getCount());
    assertEquals(0,btag.getCount());
    assertEquals(0,ltag.getCount());
    assertEquals(0,utag.getCount());
  }
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

  private UserTag[] createUserTag(User user, List<String> tags) throws NoSuchUserException{
    List<UserTag> objectTag = new ArrayList<UserTag>();
    for(String ctag : tags){
      User userX = null;
      String tagX = null;
      UserTag ut = null;
      if(TagUtil.isPrefixedUserTag(ctag)){
        UserTag tmpObj = TagUtil.parsePrefixedUserTag(ctag);
        if((tmpObj.getUser().getId() <= 0) && tmpObj.getUser().getUsername() != null){
          userX = GnizrDaoUtil.getUser(userDao,tmpObj.getUser().getUsername());       
          if(userX == null){
            throw new NoSuchUserException(tmpObj.getUser().getUsername());
          }
        }else{
          userX = user;
        }
        tagX = tmpObj.getTag().getLabel();
      }else{
        userX = user;
        tagX = ctag;
      }
      ut = createUserTag(userX, tagX);     
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

    GnizrDaoUtil.checkNull(assertion.getObject());
    GnizrDaoUtil.checkNull(assertion.getProperty());

    User defaultUser = assertion.getUser();
    if (createTags == true) {
      UserTag subject = assertion.getSubject();
      UserTag object = assertion.getObject();
      if (GnizrDaoUtil.hasMissingId(subject)) {
        String subjTag = subject.getTag().getLabel();
        int id = GnizrDaoUtil.createUserTagIfNotExist(tagDao, userDao,
            subjTag, defaultUser);
        if (id > 0) {
          subject.setId(id);
        }
      }
      if (GnizrDaoUtil.hasMissingId(object)) {
        String objTag = object.getTag().getLabel();
        int id = GnizrDaoUtil.createUserTagIfNotExist(tagDao, userDao,
            objTag, defaultUser);
        if (id > 0) {
          object.setId(id);
        }
      }
    }
    return addTagAssertion(assertion);
  }
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

    GnizrDaoUtil.checkNull(assertion);
    User user = assertion.getUser();
    if (GnizrDaoUtil.hasMissingId(user)) {
      GnizrDaoUtil.fillId(userDao, user);
    }
    UserTag subjTag = assertion.getSubject();
    if (GnizrDaoUtil.hasMissingId(subjTag)) {
      GnizrDaoUtil.fillId(tagDao, userDao, subjTag);
    }
    UserTag objTag = assertion.getObject();
    if (GnizrDaoUtil.hasMissingId(objTag)) {
      GnizrDaoUtil.fillId(tagDao, userDao, objTag);
    }
    TagProperty prpt = assertion.getProperty();
    if (GnizrDaoUtil.hasMissingId(prpt)) {
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

      NoSuchTagAssertionException, MissingIdException {
    GnizrDaoUtil.checkNull(tagAssertion);
    TagAssertion obj = new TagAssertion(tagAssertion);
    GnizrDaoUtil.fillId(tagAsrtDao, tagPrptDao, tagDao, userDao, obj);
    TagProperty property = obj.getProperty();
    UserTag objectTag = obj.getObject();
    if (property.getId() == rdfTypeProperty.getId()
        && objectTag.getId() == gnizrPlaceTag.getId()) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

    }
    List<UserTag> r = tagDao.findUserTag(user, tag);
    if(r != null && r.size() > 0){
      return r.get(0);
    }else{
      int utid = tagDao.createUserTag(new UserTag(user,tag));
      return tagDao.getUserTag(utid);
    }
  }
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

 

  public UserTag getUserTag(int id) throws NoSuchUserException,
      NoSuchTagException, NoSuchUserTagException, MissingIdException {
    logger.debug("getUserTag: id=" + id);
    UserTag ut = tagDao.getUserTag(id);
    GnizrDaoUtil.fillObject(tagDao, userDao, ut);
    return ut;
  }
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

    return ut;
  }

 
  public UserTag createUserTag(User user, String tag) {
    UserTag ut = null;
    try {
      int id = tagDao.createTag(new Tag(tag));
      Tag tagObj = tagDao.getTag(id);
      id = tagDao.createUserTag(new UserTag(user, tagObj));
      ut = tagDao.getUserTag(id);
    } catch (Exception e) {
      logger.debug(e);
    }
    return ut;
View Full Code Here

Examples of com.gnizr.db.dao.UserTag

      aList = tagAssertionDao.findTagAssertion(user, null,
          skosNarrowerPrpt, subject);
      addUserTagSubjectToList(aList, tempResult, sourceTagId);

      for (Iterator<UserTag> it = tempResult.iterator(); it.hasNext();) {
        UserTag next2seek = it.next();
        if (result.contains(next2seek) == false) {
          result.add(next2seek);
          seekBroader(user, next2seek, result, sourceTagId);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.