Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.TagProperty


  }
 
  public void testFillIdTagAssertion() throws Exception{
    User user = new User("hchen1");
    UserTag subject = new UserTag("hchen1","webwork");
    TagProperty property = new TagProperty(3);
    UserTag object = new UserTag(2);
    TagAssertion asrt = new TagAssertion(subject,property,object,user);
    GnizrDaoUtil.fillId(tagAssertionDao, tagPrptDao, tagDao, userDao,asrt);
    assertEquals((1),asrt.getUser().getId());
    assertEquals((1),asrt.getSubject().getId());
View Full Code Here


    assertEquals((2),asrt.getObject().getId());
    assertEquals((3),asrt.getProperty().getId());
  }
 
  public void testFillIdTagProperty() throws Exception{
    TagProperty tp = new TagProperty();
    tp.setNamespacePrefix("skos");
    tp.setName("broader");
    GnizrDaoUtil.fillId(tagPrptDao, tp);
    assertEquals((2),tp.getId());
  }
View Full Code Here

 
  public void testFillObjectTagAssertion() throws Exception{
    User u = new User((1));
    UserTag s = new UserTag((1));
    UserTag o = new UserTag((2));
    TagProperty p = new TagProperty((3));
    TagAssertion ta = new TagAssertion(s,p,o,u);
    GnizrDaoUtil.fillObject(tagAssertionDao, tagPrptDao, tagDao, userDao,ta);
    assertEquals("hchen1",ta.getUser().getUsername());
    assertEquals("webwork",ta.getSubject().getTag().getLabel());
    assertEquals("wii",ta.getObject().getTag().getLabel());
View Full Code Here

    assertEquals("wii",ta.getObject().getTag().getLabel());
    assertEquals("narrower",ta.getProperty().getName());
  }
 
  public void testFillObjectTagProperty() throws Exception{
    TagProperty related = new TagProperty();
    related.setNamespacePrefix("skos");
    related.setName("related");
    GnizrDaoUtil.fillObject(tagPrptDao,related);
    assertEquals((1),related.getId());
    assertEquals(TagProperty.CARDINALITY_ONE_OR_MORE,related.getCardinality());
    assertEquals(TagProperty.TYPE_DEFAULT,related.getPropertyType());
  }
View Full Code Here

  public Boolean deleteTagProperty(TagProperty prpt)
      throws MissingIdException, NoSuchTagPropertyException {
    logger.debug("deleteTagProperty: tagPrpt=" + prpt);
    GnizrDaoUtil.checkNull(prpt);
    TagProperty obj = new TagProperty(prpt);
    if (GnizrDaoUtil.hasMissingId(obj)) {
      GnizrDaoUtil.fillId(tagPrptDao, obj);
      if (obj.getId() <= 0) {
        throw new MissingIdException("tagProperty missing id");
      }
    }
    return tagPrptDao.deleteTagProperty(obj.getId());
  }
View Full Code Here

    }
    UserTag objTag = assertion.getObject();
    if (GnizrDaoUtil.hasMissingId(objTag)) {
      GnizrDaoUtil.fillId(tagDao, userDao, objTag);
    }
    TagProperty prpt = assertion.getProperty();
    if (GnizrDaoUtil.hasMissingId(prpt)) {
      GnizrDaoUtil.fillId(tagPrptDao, prpt);
    }

    int id = tagAsrtDao.createTagAssertion(assertion);
View Full Code Here

      NoSuchUserTagException, NoSuchTagPropertyException,
      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

    assertNotNull(t);
    assertEquals(3,t.getId());
  }
 
  public void testAddTagProperty() throws Exception{
    TagProperty prpt = new TagProperty();
    prpt.setName("newprpt");
    prpt.setNamespacePrefix("gn");
    assertTrue(manager.addTagProperty(prpt));
   
    TagPropertyDao prptDao = getGnizrDao().getTagPropertyDao();
    prpt = prptDao.getTagProperty("gn","newprpt");
    Boolean okay = prptDao.deleteTagProperty(prpt.getId());
    assertTrue(okay);
  }
View Full Code Here

    Boolean okay = prptDao.deleteTagProperty(prpt.getId());
    assertTrue(okay);
  }

  public void testDeleteTagProperty() throws Exception{
    TagProperty prpt = new TagProperty(1);
    assertTrue(manager.deleteTagProperty(prpt));
    TagPropertyDao prptDao = getGnizrDao().getTagPropertyDao();
    assertNull(prptDao.getTagProperty("skos","related"));
    assertFalse(manager.deleteTagProperty(new TagProperty((3939))));
  }
View Full Code Here

  }
 
  public void testDeleteTagAssertion() throws Exception{
    User user = new User("hchen1");
    UserTag subjTag = new UserTag("hchen1","webwork");
    TagProperty prpt = new TagProperty(1);
    UserTag objTag = new UserTag("hchen1","wii");
    TagAssertion asrt = new TagAssertion(subjTag,prpt,objTag,user);
   
    List<TagAssertion> asrts = manager.listTagAssertion(user);
    assertEquals(4,asrts.size());
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.