Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.TagProperty


  }
 
  public void testAddTagAssertion() throws Exception{
    User user = new User("hchen1");
    UserTag subjTag = new UserTag("hchen1","videogame");
    TagProperty prpt = new TagProperty(1);
    UserTag objTag = new UserTag("hchen1","wii");
    TagAssertion asrt = new TagAssertion(subjTag,prpt,objTag,user);
   
    // we shouldnt be able to delete a non-existing tag assertion
    boolean caughtException = false;
View Full Code Here


  }
 
  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);
View Full Code Here

  }

  public static void fillId(TagPropertyDao tagPrptDao, TagProperty tagPrpt)
      throws NoSuchTagPropertyException {
    if (hasMissingId(tagPrpt) == true) {
      TagProperty obj = null;
      String name = tagPrpt.getName();
      String ns = tagPrpt.getNamespacePrefix();
      if (name != null && ns != null) {
        obj = tagPrptDao.getTagProperty(ns, name);
      }
      if (obj == null) {
        throw new NoSuchTagPropertyException("no such tagPrpt: ns="
            + ns + ",name=" + name);
      }
      tagPrpt.setId(obj.getId());
    }
  }
View Full Code Here

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

  }

  public static void fillObject(TagPropertyDao tagPrptDao, TagProperty tagPrpt)
      throws NoSuchTagPropertyException {
    fillId(tagPrptDao, tagPrpt);
    TagProperty p = tagPrptDao.getTagProperty(tagPrpt.getId());
    tagPrpt.setName(p.getName());
    tagPrpt.setDescription(p.getDescription());
    tagPrpt.setNamespacePrefix(p.getNamespacePrefix());
    tagPrpt.setPropertyType(p.getPropertyType());
    tagPrpt.setCardinality(p.getCardinality());
  }
View Full Code Here

    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);
View Full Code Here

  }

 
  public TagProperty getTagProperty(int id) {
    logger.debug("input: id="+id);
    TagProperty tagPrpt = null;
    PreparedStatement stmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call getTagProperty(?);");
View Full Code Here

    return tagPrpt;
  }

  public static TagProperty createTagPropertyObject(ResultSet rs) throws SQLException {
    if(rs == null) return null;
    TagProperty tagPrpt = new TagProperty();
    tagPrpt.setId(rs.getInt(TagPropertySchema.ID));
    tagPrpt.setName(rs.getString(TagPropertySchema.NAME));
    tagPrpt.setDescription(rs.getString(TagPropertySchema.DESCRIPTION));
    tagPrpt.setNamespacePrefix(rs.getString(TagPropertySchema.NS_PREFIX));
    tagPrpt.setPropertyType(rs.getString(TagPropertySchema.PRPT_TYPE));
    tagPrpt.setCardinality(rs.getInt(TagPropertySchema.CARDINALITY));
    return tagPrpt;
  }
View Full Code Here

    try{
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call listAllTagProperty();");
      ResultSet rs = stmt.executeQuery();     
      while(rs.next()){
        TagProperty tp = createTagPropertyObject(rs);
        logger.debug("found tagPrpt="+tp);
        tagPrpts.add(tp);
      }
    }catch(SQLException e){
      logger.fatal(e);
View Full Code Here

  public TagProperty getTagProperty(String nsPrefix, String name) {
    logger.debug("getTagProperty: nsPrefix="+nsPrefix+",name="+name);
    Connection conn = null;
    PreparedStatement stmt = null;
    TagProperty tagPrpt = null;
    try{
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call getTagPropertyNSPrefixName(?,?);");
      stmt.setString(1,nsPrefix);
      stmt.setString(2,name);
      ResultSet rs = stmt.executeQuery();     
      if(rs.next()){
        TagProperty tp = createTagPropertyObject(rs);
        logger.debug("found tagPrpt="+tp);
        tagPrpt = tp;
      }
    }catch(SQLException e){
      logger.fatal(e);
View Full Code Here

TOP

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

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.