Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.TagAssertion


    boolean isOkay = false;
    List<TagAssertion> tagAssertion = new ArrayList<TagAssertion>();
    try {
      UserTag[] subjTag = createUserTag(user, instTags);
      for(int i = 0; i < subjTag.length; i++){
        TagAssertion ta = new TagAssertion();
        ta.setUser(user);
        ta.setSubject(subjTag[i]);
        ta.setProperty(rdfTypeProperty);
        ta.setObject(clsTag);
        tagAssertion.add(ta);
      }
      int size = tagAssertion.size();
      isOkay = tagAsrtDao.createTagAssertion(tagAssertion.toArray(new TagAssertion[size]));
    } catch (Exception e) {
View Full Code Here


    if (GnizrDaoUtil.hasMissingId(aUser)) {
      GnizrDaoUtil.fillId(userDao, aUser);
    }
    List<TagAssertion> result = tagAsrtDao.findTagAssertion(aUser);
    for (Iterator<TagAssertion> it = result.iterator(); it.hasNext();) {
      TagAssertion ta = it.next();
      GnizrDaoUtil
          .fillObject(tagAsrtDao, tagPrptDao, tagDao, userDao, ta);
    }
    return result;
  }
View Full Code Here

      throws NoSuchUserException, NoSuchTagException,
      NoSuchUserTagException, NoSuchTagPropertyException,
      NoSuchTagAssertionException, MissingIdException {
    logger.debug("deleteTagAssertion: assertion=" + assertion);
    GnizrDaoUtil.checkNull(assertion);
    TagAssertion obj = new TagAssertion(assertion);
    if (GnizrDaoUtil.hasMissingId(obj)) {
      GnizrDaoUtil.fillId(tagAsrtDao, tagPrptDao, tagDao, userDao, obj);
      if (obj.getId() <= 0) {
        throw new MissingIdException("tag assertion missing id");
      }
    }
    return tagAsrtDao.deleteTagAssertion(obj.getId());
  }
View Full Code Here

  public boolean isGeoTagTypeAssertion(TagAssertion tagAssertion)
      throws NoSuchUserException, NoSuchTagException,
      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

  public TagAssertion getTagAssertion(int id) throws NoSuchUserException,
      NoSuchTagException, NoSuchUserTagException,
      NoSuchTagPropertyException, NoSuchTagAssertionException,
      MissingIdException {
    TagAssertion asrt = tagAsrtDao.getTagAssertion(id);
    GnizrDaoUtil.fillObject(tagAsrtDao, tagPrptDao, tagDao, userDao, asrt);
    return asrt;
  }
View Full Code Here

  }

  private void addUserTagObjectToList(List<TagAssertion> tagAssertions,
      List<UserTag> userTags, int ignoreTagId) {
    for (Iterator<TagAssertion> it = tagAssertions.iterator(); it.hasNext();) {
      TagAssertion ta = it.next();
      UserTag ut = ta.getObject();
      if (ut != null) {
        if (ut.getId() != ignoreTagId && userTags.contains(ut) == false) {
          userTags.add(ut);
        }
      } else {
View Full Code Here

  }

  private void addUserTagSubjectToList(List<TagAssertion> tagAssertions,
      List<UserTag> userTags, int ignoreTagId) {
    for (Iterator<TagAssertion> it = tagAssertions.iterator(); it.hasNext();) {
      TagAssertion ta = it.next();
      UserTag ut = ta.getSubject();
      if (ut != null) {
        if (ut.getId() != ignoreTagId && userTags.contains(ut) == false) {
          userTags.add(ut);
        }
      } else {
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());
   
    boolean okay = manager.deleteTagAssertion(asrt);
View Full Code Here

    asrts = manager.listTagAssertion(user);
    assertEquals(3,asrts.size());
  }

  public void testIsGeoTagTypeAssertion() throws Exception{
    TagAssertion assertion = manager.getTagAssertion(3);
    assertFalse(manager.isGeoTagTypeAssertion(assertion));
    assertion = manager.getTagAssertion(4);
    assertTrue(manager.isGeoTagTypeAssertion(assertion));
  }
View Full Code Here

  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;
    try{
      manager.deleteTagAssertion(asrt);
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.