javax.jcr.ItemExistsException Java Examples

The following examples show how to use javax.jcr.ItemExistsException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JcrPackageManagerImpl.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public JcrPackage upload(File file, boolean isTmpFile, boolean replace, String nameHint, boolean strict)
        throws RepositoryException, IOException {
    ZipVaultPackage pack = new ZipVaultPackage(file, isTmpFile, strict);
    try {
        return registry.upload(pack, replace);
    } catch (PackageExistsException e) {
        throw new ItemExistsException(e.getMessage(), e);
    }
}
 
Example #2
Source File: JcrPackageManagerImpl.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public JcrPackage upload(InputStream in, boolean replace, boolean strict)
        throws RepositoryException, IOException {
    try {
        return registry.upload(in, replace);
    } catch (PackageExistsException e) {
        throw new ItemExistsException(e.getMessage(), e);
    }
}
 
Example #3
Source File: ResourceResolverImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
private NodeImpl createNode(@Nonnull String path, @Nonnull Map<String, Object> properties) throws ItemNotFoundException, ItemExistsException {
    NodeImpl node = new NodeImpl((SessionImpl)session, path);

    for (String propName : properties.keySet()) {
        Object mapVal = properties.get(propName);
        setNodeProperty(node, propName, mapVal);
    }
    return node;
}
 
Example #4
Source File: NodeImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
public Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
    Node node = new NodeImpl(session, Paths.resolve(getPath(), relPath));
    node.setPrimaryType(primaryNodeTypeName);
    session.changeItem(this);
    return node;
}
 
Example #5
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
}
 
Example #6
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
/**
 * Construct a new NodeImpl.
 */
public NodeImpl(@Nonnull SessionImpl session, String path) throws ItemNotFoundException, ItemExistsException {
    super(session, path);
}
 
Example #7
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Node addNode(String relPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
    return addNode(relPath, DEFAULT_NODETYPE);
}
 
Example #8
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void restore(String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
Example #9
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
Example #10
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
Example #11
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
Example #12
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
}
 
Example #13
Source File: SessionImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
Item addItem(@Nonnull ItemImpl item) throws ItemNotFoundException, ItemExistsException {
    if (itemStore.containsKey(item.getPath())) throw new ItemExistsException();
    addedItems.add(item.getPath());
    return storeItem(item);
}
 
Example #14
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
}
 
Example #15
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
}
 
Example #16
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
}
 
Example #17
Source File: WorkspaceImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException {
}
 
Example #18
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
public PropertyImpl(@Nonnull SessionImpl session, @Nonnull String path) throws ItemNotFoundException, ItemExistsException {
    super(session, path);
}
 
Example #19
Source File: QueryImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
    return null;
}
 
Example #20
Source File: SessionFactoryUtils.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Jcr exception translator - it converts specific JSR-170 checked exceptions into unchecked Spring DA
 * exception.
 * @author Guillaume Bort <[email protected]>
 * @author Costin Leau
 * @author Sergio Bossa
 * @author Salvatore Incandela
 * @param ex
 * @return
 */
public static DataAccessException translateException(RepositoryException ex) {
    if (ex instanceof AccessDeniedException) {
        return new DataRetrievalFailureException("Access denied to this data", ex);
    }
    if (ex instanceof ConstraintViolationException) {
        return new DataIntegrityViolationException("Constraint has been violated", ex);
    }
    if (ex instanceof InvalidItemStateException) {
        return new ConcurrencyFailureException("Invalid item state", ex);
    }
    if (ex instanceof InvalidQueryException) {
        return new DataRetrievalFailureException("Invalid query", ex);
    }
    if (ex instanceof InvalidSerializedDataException) {
        return new DataRetrievalFailureException("Invalid serialized data", ex);
    }
    if (ex instanceof ItemExistsException) {
        return new DataIntegrityViolationException("An item already exists", ex);
    }
    if (ex instanceof ItemNotFoundException) {
        return new DataRetrievalFailureException("Item not found", ex);
    }
    if (ex instanceof LoginException) {
        return new DataAccessResourceFailureException("Bad login", ex);
    }
    if (ex instanceof LockException) {
        return new ConcurrencyFailureException("Item is locked", ex);
    }
    if (ex instanceof MergeException) {
        return new DataIntegrityViolationException("Merge failed", ex);
    }
    if (ex instanceof NamespaceException) {
        return new InvalidDataAccessApiUsageException("Namespace not registred", ex);
    }
    if (ex instanceof NoSuchNodeTypeException) {
        return new InvalidDataAccessApiUsageException("No such node type", ex);
    }
    if (ex instanceof NoSuchWorkspaceException) {
        return new DataAccessResourceFailureException("Workspace not found", ex);
    }
    if (ex instanceof PathNotFoundException) {
        return new DataRetrievalFailureException("Path not found", ex);
    }
    if (ex instanceof ReferentialIntegrityException) {
        return new DataIntegrityViolationException("Referential integrity violated", ex);
    }
    if (ex instanceof UnsupportedRepositoryOperationException) {
        return new InvalidDataAccessApiUsageException("Unsupported operation", ex);
    }
    if (ex instanceof ValueFormatException) {
        return new InvalidDataAccessApiUsageException("Incorrect value format", ex);
    }
    if (ex instanceof VersionException) {
        return new DataIntegrityViolationException("Invalid version graph operation", ex);
    }
    // fallback
    return new JcrSystemException(ex);
}
 
Example #21
Source File: NodeWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
    return sessionWrapper.addNode(getPath(), concat(getPath(), relPath), relPath, primaryNodeTypeName);
}
 
Example #22
Source File: QueryWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
    return sessionWrapper.getObjectWrapper().wrap(sessionWrapper, delegate.storeAsNode(absPath));
}
 
Example #23
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException {
    this.sessionWrapper.importXML(parentAbsPath, in, uuidBehavior);
}
 
Example #24
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
    delegate.copy(srcAbsPath, destAbsPath);
}
 
Example #25
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
    delegate.copy(srcWorkspace, srcAbsPath, destAbsPath);
}
 
Example #26
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
    delegate.clone(srcWorkspace, srcAbsPath, destAbsPath, removeExisting);
}
 
Example #27
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
    delegate.move(srcAbsPath, destAbsPath);
}
 
Example #28
Source File: WorkspaceWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
    delegate.restore(versions, removeExisting);
}
 
Example #29
Source File: NodeWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node addNode(String relPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
    return sessionWrapper.addNode(getPath(), concat(getPath(), relPath), relPath);
}
 
Example #30
Source File: ProductsSuggestionOmniSearchHandler.java    From commerce-cif-connector with Apache License 2.0 4 votes vote down vote up
@Override
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException,
    ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
    return null;
}