Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.TagAssertion


  public void testAddTagAssertionForceTagCreate() throws Exception{
    User user = new User("hchen1");
    UserTag subjTag = new UserTag("hchen1","java");
    TagProperty prpt = new TagProperty(1);
    UserTag objTag = new UserTag("hchen1","java.logging");
    TagAssertion asrt = new TagAssertion(subjTag,prpt,objTag,user);
   
    boolean ok = manager.addTagAssertion(asrt,true);
    assertTrue(ok);
    ok = manager.deleteTagAssertion(asrt);
    assertTrue(ok);
View Full Code Here


    UserTag ut2 = manager.getUserTag(ut.getId());
    assertEquals(ut,ut2);
  }
 
  public void testGetTagAssertion() throws Exception{
    TagAssertion a = manager.getTagAssertion(2);
    assertNotNull(a);
    assertEquals(2,a.getSubject().getId());
    assertEquals(1,a.getProperty().getId());
    assertEquals(1,a.getObject().getId());
  }
View Full Code Here

      UserTag objTag = assertion.getObject();
      fillId(userDao, user);
      fillId(tagDao, userDao, subjTag);
      fillId(tagPrptDao, prpt);
      fillId(tagDao, userDao, objTag);
      TagAssertion obj = getTagAssertion(tagAssertionDao, user, subjTag,
          prpt, objTag);
      if (obj == null) {
        throw new NoSuchTagAssertionException(
            "no such tagAssertion: user=" + user + ",subjTag="
                + subjTag + ",prpt=" + prpt + ",objTag="
                + objTag);
      }
      assertion.setId(obj.getId());
    }
  }
View Full Code Here

      throw new MissingIdException("objectTag is missing a valid id");
    }
    if (hasMissingId(tagPrpt) == true) {
      throw new MissingIdException("tagProperty is missing a valid id");
    }
    TagAssertion asrt = null;
    List<TagAssertion> asrts = tagAssertionDao.findTagAssertion(user,
        subjTag, tagPrpt, objTag);
    if (asrts.isEmpty() == false) {
      asrt = asrts.get(0);
    }
View Full Code Here

      NoSuchTagPropertyException, NoSuchTagAssertionException,
      MissingIdException {
    if (hasMissingId(assertion) == true) {
      fillId(tagAssertionDao, tagPrptDao, tagDao, userDao, assertion);
    }
    TagAssertion ta = tagAssertionDao.getTagAssertion(assertion.getId());
    UserTag s = ta.getSubject();
    TagProperty p = ta.getProperty();
    UserTag o = ta.getObject();
    User u = ta.getUser();
    fillObject(tagDao, userDao, s);
    fillObject(tagDao, userDao, o);
    fillObject(tagPrptDao, p);
    fillObject(userDao, u);
    assertion.setUser(u);
View Full Code Here

   */
  private static final long serialVersionUID = 1L;
 
  public static TagAssertion createTagAssertionObject(ResultSet rs) throws SQLException {
    if(rs == null) return null;
    TagAssertion assertion = new TagAssertion();
    assertion.setId(rs.getInt(TagAssertionSchema.ID));     
    UserTag subjectUserTag = TagDBDao.createNamedUserTagObject("s_user_tag", "s_tag", "s_user", rs);
    UserTag objectUserTag = TagDBDao.createNamedUserTagObject("o_user_tag", "o_tag", "o_user", rs);
    TagProperty prpt = TagPropertyDBDao.createTagPropertyObject(rs);
    User user = UserDBDao.createUserObject("tag_assertion_user", rs);   
    assertion.setSubject(subjectUserTag);
    assertion.setProperty(prpt);
    assertion.setObject(objectUserTag);
    assertion.setUser(user);   
    return assertion;
  }
View Full Code Here

      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call findTagAssertionUserId(?)");
      stmt.setLong(1,user.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        TagAssertion asrt = createTagAssertionObject(rs);
        assertions.add(asrt);
        logger.debug("found: " + asrt);
      }
      if(assertions.size() == 0){
        logger.debug("found no matching tag assertion");
View Full Code Here

      stmt.setLong(1,user.getId());     
      stmt.setLong(2,tagPrpt.getId());
      stmt.setLong(3,objectTag.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        TagAssertion asrt = createTagAssertionObject(rs);
        assertions.add(asrt);
        logger.debug("found: " + asrt);
      }
      if(assertions.size() == 0){
        logger.debug("found no matching tag assertion");
View Full Code Here

      stmt.setLong(1,user.getId());
      stmt.setLong(2,subjectTag.getId());
      stmt.setLong(3,tagPrpt.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        TagAssertion asrt = createTagAssertionObject(rs);
        assertions.add(asrt);
        logger.debug("found: " + asrt);
      }
      if(assertions.size() == 0){
        logger.debug("found no matching tag assertion");
View Full Code Here

      stmt.setLong(2,subjectTag.getId());
      stmt.setLong(3,tagPrpt.getId());
      stmt.setLong(4,objectTag.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        TagAssertion asrt = createTagAssertionObject(rs);
        assertions.add(asrt);
        logger.debug("found: " + asrt);
      }
      if(assertions.size() == 0){
        logger.debug("found no matching tag assertion");
View Full Code Here

TOP

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

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.