Ejemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.osaf.cosmo.model.copy.InterfaceCollectionItem#removeTombstone(org.osaf.cosmo.model.copy.Item)
  */
 public boolean removeTombstone(Item item) {
   for (Iterator<Tombstone> it = getTombstones().iterator(); it.hasNext(); ) {
     Tombstone ts = it.next();
     if (ts instanceof ItemTombstone) {
       if (((ItemTombstone) ts).getItemUid().equals(item.getUid())) {
         it.remove();
         return true;
       }
     }
   }
   return false;
 }
Ejemplo n.º 2
0
  public void testFindItem() throws Exception {
    User testuser2 = getUser(userDao, "testuser2");

    CollectionItem root = (CollectionItem) contentDao.getRootItem(testuser2);

    CollectionItem a = new HibCollectionItem();
    a.setName("a");
    a.setOwner(getUser(userDao, "testuser2"));

    a = contentDao.createCollection(root, a);

    clearSession();

    Item queryItem = contentDao.findItemByUid(a.getUid());
    Assert.assertNotNull(queryItem);
    Assert.assertTrue(queryItem instanceof CollectionItem);

    queryItem = contentDao.findItemByPath("/testuser2/a");
    Assert.assertNotNull(queryItem);
    Assert.assertTrue(queryItem instanceof CollectionItem);

    ContentItem item = generateTestContent();

    a = contentDao.findCollectionByUid(a.getUid());
    item = contentDao.createContent(a, item);

    clearSession();

    queryItem = contentDao.findItemByPath("/testuser2/a/test");
    Assert.assertNotNull(queryItem);
    Assert.assertTrue(queryItem instanceof ContentItem);

    clearSession();

    queryItem = contentDao.findItemParentByPath("/testuser2/a/test");
    Assert.assertNotNull(queryItem);
    Assert.assertEquals(a.getUid(), queryItem.getUid());
  }
Ejemplo n.º 3
0
 /* (non-Javadoc)
  * @see org.osaf.cosmo.model.copy.InterfaceCollectionItem#getChild(java.lang.String)
  */
 public Item getChild(String uid) {
   for (Item child : children) {
     if (child.getUid().equals(uid)) return child;
   }
   return null;
 }