javax.jcr.Item.remove()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中javax.jcr.Item.remove()方法的一些代码示例,展示了Item.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.remove()方法的具体详情如下:
包路径:javax.jcr.Item
类名称:Item
方法名:remove

Item.remove介绍

[英]Removes this item (and its subgraph).

To persist a removal, a save must be performed that includes the (former) parent of the removed item within its scope.

If a node with same-name siblings is removed, this decrements by one the indices of all the siblings with indices greater than that of the removed node. In other words, a removal compacts the array of same-name siblings and causes the minimal re-numbering required to maintain the original order but leave no gaps in the numbering.
[中]删除this项(及其子图)。
若要持续删除,必须执行save,将删除项的(前)父项包含在其范围内。
如果移除同名同级节点,则索引大于移除节点索引的所有同级节点的索引将递减一。换言之,删除操作会压缩同名同级的数组,并导致维持原始顺序所需的最小重新编号,但不会在编号中留下任何间隙。

代码示例

代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector

/** {@inheritDoc} */
public void remove() throws VersionException, LockException, RepositoryException {
  item.remove();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Removes the identified item. Implemented by calling
 * {@link Item#remove()} on the item removed by {@link #getItem(String)}.
 *
 * @see Session#removeItem(String)
 * @param absPath An absolute path of the item to be removed
 * @throws RepositoryException if the item can not be removed
 */
public void removeItem(String absPath) throws RepositoryException {
  getItem(absPath).remove();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Removes the identified item. Implemented by calling
 * {@link Item#remove()} on the item removed by {@link #getItem(String)}.
 *
 * @see Session#removeItem(String)
 * @param absPath An absolute path of the item to be removed
 * @throws RepositoryException if the item can not be removed
 */
public void removeItem(String absPath) throws RepositoryException {
  getItem(absPath).remove();
}

代码示例来源:origin: apache/jackrabbit

/** {@inheritDoc} */
public void remove() throws RepositoryException, RemoteException {
  try {
    item.remove();
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}

代码示例来源:origin: org.onehippo.cms7/jcrdiff-core

public void remove() throws JcrDiffException {
  try {
    jcrItem.remove();
  } catch (RepositoryException e) {
    throw new JcrDiffException("Could not remove tree item", e);
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Removes the identified item. Implemented by calling
 * {@link Item#remove()} on the item removed by {@link #getItem(String)}.
 *
 * @see Session#removeItem(String)
 * @param absPath An absolute path of the item to be removed
 * @throws RepositoryException if the item can not be removed
 */
public void removeItem(String absPath) throws RepositoryException {
  getItem(absPath).remove();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi

/**
 * @see Session#removeItem(String)
 */
@Override
public void removeItem(String absPath) throws RepositoryException {
  Item item = getItem(absPath);
  item.remove();
}

代码示例来源:origin: apache/jackrabbit

/**
 * @see Session#removeItem(String)
 */
@Override
public void removeItem(String absPath) throws RepositoryException {
  Item item = getItem(absPath);
  item.remove();
}

代码示例来源:origin: brix-cms/brix-cms

public void remove() throws RepositoryException {
    // handler is notified from subclasses
    getDelegate().remove();
  }
}

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item;
  try {
   item = session.getItem( absPath );
  } catch ( PathNotFoundException e ) {
   return null;
  }
  item.remove();
  session.save();
  return null;
 }
} );

代码示例来源:origin: ModeShape/modeshape

protected void doDelete( String path,
             Session session ) throws RepositoryException {
  Item item;
  try {
    item = session.getItem(path);
  } catch (PathNotFoundException pnfe) {
    throw new NotFoundException(pnfe.getMessage(), pnfe);
  }
  item.remove();
}

代码示例来源:origin: org.exoplatform.jcr/exo.jcr.framework.command

public boolean execute(Context context) throws Exception
{
 Session session = ((JCRAppContext)context).getSession();
 session.getItem((String)context.get(pathKey)).remove();
 return true;
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public boolean execute(Context ctx) throws Exception {
  log.debug("Going to remove item [{}].", getPath());
  Item jcrItem = MgnlContext.getJCRSession(this.getRepository()).getItem(getPath());
  jcrItem.remove();
  jcrItem.getSession().save();
  return true;
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test if a node, that has been transiently removed is not 'New'.
 */
public void testNotNewRemovedItem() throws RepositoryException {
  removeItem.remove();
  assertFalse("Transiently removed node must not be 'new'.", removeItem.isNew());
}

代码示例来源:origin: org.apache/jackrabbit-ocm

public void remove(String path) {
  try {
    if (!session.nodeExists(path)) {
      throw new ObjectContentManagerException("Path does not exist : " + path);
    } else {
      checkIfNodeLocked(path);
    }
    Item item = session.getItem(path);
    item.remove();
  } catch (RepositoryException e) {
    throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to remove the object at " + path);
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test if a node, that has be transiently remove is not 'Modified'.
 */
public void testNotModifiedRemovedItem() throws RepositoryException {
  removeItem.remove();
  assertFalse("Transiently removed node must not be 'modified'.", removeItem.isModified());
}

代码示例来源:origin: apache/jackrabbit

/**
 * Same as {@link #testNotModifiedRemovedItem()} but calls save() before
 * executing the test.
 */
public void testNotModifiedRemovedItem2() throws RepositoryException {
  removeItem.remove();
  testRootNode.save();
  assertFalse("Removed node must not be 'modified'.", removeItem.isModified());
}

代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr

public void removeItem(String path) throws RepositoryException {
  Item item = getSession().getItem(path);
  if (item.isNode()) {
    new NodeProxy((Node) item).remove();
  } else {
    item.remove();
    processChanges(Text.getRelativeParent(path, 1), path);
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Same as {@link #testNotNewRemovedItem()} but calls save() before
 * executing the test.
 */
public void testNotNewRemovedItem2() throws RepositoryException {
  removeItem.remove();
  testRootNode.save();
  assertFalse("Removed node must not be 'new'.", removeItem.isNew());
}

代码示例来源:origin: apache/jackrabbit

public void testRevert() throws RepositoryException {
  String srcPath = moveNode.getPath();
  doMove(srcPath, destinationPath);
  // now remove the moved node
  testRootNode.getSession().getItem(destinationPath).remove();
  testRootNode.refresh(false);
  assertTrue(superuser.itemExists(srcPath));
  assertFalse(superuser.itemExists(destinationPath));
  assertFalse(moveNode.isModified());
  assertFalse(destParentNode.isModified());
  assertFalse(srcParentNode.isModified());
}

相关文章