javax.jcr.ItemNotFoundException Java Examples

The following examples show how to use javax.jcr.ItemNotFoundException. 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: AbstractJcrDao.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
protected Node checkId(String id) throws NotFoundException {
	// TODO improve
	try {
		return getTemplate().getNodeByUUID(id);
	} catch (DataRetrievalFailureException e) {
		if (e.getCause() instanceof ItemNotFoundException) {
			throw new NotFoundException("Id '" + id + "' not found");
		}
		
		throw e;
	}		
}
 
Example #2
Source File: QueryWrapper.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Override
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException {
    try {
        return delegate.getStoredQueryPath();
    } catch (ItemNotFoundException ex) {
        try {
            return delegate.getStoredQueryPath();
        } catch (ItemNotFoundException ignore) {
            throw ex;
        }
    }
}
 
Example #3
Source File: ItemImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public Node getParent() throws ItemNotFoundException, RepositoryException {
    if (session.getRootNode() == this) throw new ItemNotFoundException();
    if (Strings.isNullOrEmpty(Paths.parent(path))) return session.getRootNode();
    return session.getNode(Paths.parent(path));
}
 
Example #4
Source File: ItemImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public Item getAncestor(int depth) throws ItemNotFoundException, RepositoryException {
    int myDepth = getDepth();
    if (depth > myDepth) throw new ItemNotFoundException();
    return (depth < myDepth) ? ((NodeImpl)getParent()).getAncestor(depth) : null;
}
 
Example #5
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 #6
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 #7
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 #8
Source File: QueryImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException {
    return null;
}
 
Example #9
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException {
    return null;  //not implemented
}
 
Example #10
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNode() throws ItemNotFoundException, ValueFormatException, RepositoryException {
    return null;  //not implemented
}
 
Example #11
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 #12
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public String getCorrespondingNodePath(String workspaceName) throws ItemNotFoundException, NoSuchWorkspaceException, AccessDeniedException, RepositoryException {
    return null;  //Not Implemented
}
 
Example #13
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Item getPrimaryItem() throws ItemNotFoundException, RepositoryException {
    return null;  //Not implemented
}
 
Example #14
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void orderBefore(String srcChildRelPath, String destChildRelPath) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
Example #15
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 #16
Source File: SessionImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
private Item storeItem(@Nonnull ItemImpl item) throws ItemNotFoundException {
    itemStore.put(item.getPath(), item);
    return item;
}
 
Example #17
Source File: SessionImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
Item changeItem(@Nonnull ItemImpl item) throws ItemNotFoundException {
    if (!addedItems.contains(item.getPath()))
        changedItems.add(item.getPath());
    return storeItem(item);
}
 
Example #18
Source File: ProductsSuggestionOmniSearchHandler.java    From commerce-cif-connector with Apache License 2.0 4 votes vote down vote up
@Override
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException {
    return null;
}
 
Example #19
Source File: SessionImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException {
    return null;  //TODO: Implement IDs
}
 
Example #20
Source File: SessionImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
    return null;  //TODO: Implement IDs
}
 
Example #21
Source File: SessionWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException {
    return objectWrapper.wrap(this, wrappedSession.getNodeByIdentifier(id));
}
 
Example #22
Source File: SessionWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
    return objectWrapper.wrap(this, wrappedSession.getNodeByUUID(uuid));
}
 
Example #23
Source File: ItemWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
    return this.sessionWrapper.getNode(this.delegate.getParent().getPath());
}
 
Example #24
Source File: ItemWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
    return this.sessionWrapper.getItem(this.delegate.getAncestor(depth).getPath());
}
 
Example #25
Source File: PropertyWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException {
    return this.sessionWrapper.getProperty(delegate.getProperty().getPath());
}
 
Example #26
Source File: PropertyWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Node getNode() throws ItemNotFoundException, ValueFormatException, RepositoryException {
    return this.sessionWrapper.getNode(delegate.getNode().getPath());
}
 
Example #27
Source File: NodeWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public String getCorrespondingNodePath(String workspaceName) throws ItemNotFoundException, NoSuchWorkspaceException, AccessDeniedException, RepositoryException {
    return this.delegate.getCorrespondingNodePath(workspaceName);
}
 
Example #28
Source File: NodeWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public Item getPrimaryItem() throws ItemNotFoundException, RepositoryException {
    return sessionWrapper.getObjectWrapper().wrap(sessionWrapper, delegate.getPrimaryItem());
}
 
Example #29
Source File: NodeWrapper.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Override
public void orderBefore(String srcChildRelPath, String destChildRelPath) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException {
    this.delegate.orderBefore(srcChildRelPath, destChildRelPath);
}
 
Example #30
Source File: ProductsSuggestionOmniSearchHandler.java    From commerce-cif-connector with Apache License 2.0 4 votes vote down vote up
@Override
public Value getValue(String columnName) throws ItemNotFoundException, RepositoryException {
    return value;
}