javax.jcr.PathNotFoundException Java Examples
The following examples show how to use
javax.jcr.PathNotFoundException.
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: StorageUpdate8.java From nextreports-server with Apache License 2.0 | 6 votes |
private void updateInternalSettings() throws RepositoryException { // find all internalSettings nodes from DASHBOARDS and change chartId property in entityId String statement = "/jcr:root" + ISO9075.encodePath(StorageConstants.DASHBOARDS_ROOT) + "//*[fn:name()='internalSettings']"; QueryResult queryResult = getTemplate().query(statement); NodeIterator nodes = queryResult.getNodes(); LOG.info("Found " + nodes.getSize() + " internalSettings nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); try { Property prop = node.getProperty("chartId"); node.setProperty("entityId", prop.getValue()); prop.remove(); } catch (PathNotFoundException ex) { // if property not found we have nothing to do } } }
Example #2
Source File: DefaultWorkspaceFilter.java From jackrabbit-filevault with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void dumpCoverage(Session session, ProgressTrackerListener listener, boolean skipJcrContent) throws RepositoryException { ProgressTracker tracker = new ProgressTracker(listener); // get common ancestor Tree<PathFilterSet> tree = new Tree<PathFilterSet>(); for (PathFilterSet set: nodesFilterSets) { tree.put(set.getRoot(), set); } String rootPath = tree.getRootPath(); javax.jcr.Node rootNode; if (session.nodeExists(rootPath)) { rootNode = session.getNode(rootPath); } else if (session.nodeExists("/")) { log.warn("Common ancestor {} not found. Using root node", rootPath); rootNode = session.getRootNode(); rootPath = "/"; } else { throw new PathNotFoundException("Common ancestor " + rootPath+ " not found."); } log.debug("Starting coverage dump at {} (skipJcrContent={})", rootPath, skipJcrContent); dumpCoverage(rootNode, tracker, skipJcrContent); }
Example #3
Source File: LinkHelper.java From sling-samples with Apache License 2.0 | 5 votes |
public void createLink(Node source, Node target, String name) throws PathNotFoundException, RepositoryException { String targetPath = target.getPath(); ArrayList<String> newSourceLinks = new ArrayList<String>(); if (source.hasProperty(name)) { Value[] sourceLinks = source.getProperty(name).getValues(); for (Value sourceLink : sourceLinks) { newSourceLinks.add(sourceLink.getString()); } } if (!newSourceLinks.contains(targetPath)) { newSourceLinks.add(targetPath); } String[] newSourceLinksArray = new String[newSourceLinks.size()]; source.setProperty(name, newSourceLinks.toArray(newSourceLinksArray)); }
Example #4
Source File: NodeImpl.java From jackalope with Apache License 2.0 | 5 votes |
@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: ProductsSuggestionOmniSearchHandler.java From commerce-cif-connector with Apache License 2.0 | 5 votes |
@Activate protected void activate(ComponentContext componentContext) throws LoginException, PathNotFoundException, RepositoryException { if (resolver == null) { resolver = getResourceResolver(); init(resolver); jsonMapper = new ObjectMapper(); } }
Example #6
Source File: TestSubPackages.java From jackrabbit-filevault with Apache License 2.0 | 5 votes |
@Test public void testDowngradeInstallationOfSubpackages() throws PathNotFoundException, RepositoryException, IOException, PackageException { try (JcrPackage packNewer = packMgr.upload(getStream("/test-packages/subtest_extract_contains_newer_version.zip"), false)) { assertNotNull(packNewer); // install package that contains newer version of the sub package first ImportOptions opts = getDefaultOptions(); packNewer.install(opts); } // check for sub packages version 1.0.1 exists assertPackageNodeExists(PACKAGE_ID_SUB_TEST_101); try (JcrPackage subPackage = packMgr.open(admin.getNode(getInstallationPath(PACKAGE_ID_SUB_TEST_101)))) { assertTrue(subPackage.isInstalled()); } assertNodeExists("/tmp/b"); // now install package which is supposed to downgrade try (JcrPackage packOlder = packMgr.upload(getStream("/test-packages/subtest_extract_contains_older_version_force_downgrade.zip"), false)) { assertNotNull(packOlder); packOlder.install(getDefaultOptions()); } assertPackageNodeExists(PACKAGE_ID_SUB_TEST_10); try (JcrPackage subPackage = packMgr.open(admin.getNode(getInstallationPath(PACKAGE_ID_SUB_TEST_10)))) { assertTrue("Older Subpackage is not installed, although it is explicitly requested to downgrade", subPackage.isInstalled()); } assertNodeExists("/tmp/a"); }
Example #7
Source File: JcrPackageManagerImplTest.java From jackrabbit-filevault with Apache License 2.0 | 5 votes |
@Test public void testGetPackageRootNoCreateAccess() throws Exception { // TODO: maybe rather change the setup of the test-base to not assume that everyone has full read-access AccessControlManager acMgr = admin.getAccessControlManager(); JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, "/"); for (AccessControlEntry ace : acl.getAccessControlEntries()) { acl.removeAccessControlEntry(ace); } acl.addEntry(AccessControlUtils.getEveryonePrincipal(admin), AccessControlUtils.privilegesFromNames(admin, javax.jcr.security.Privilege.JCR_READ), true, Collections.singletonMap("rep:glob", admin.getValueFactory().createValue("etc/*"))); admin.save(); Session anonymous = repository.login(new GuestCredentials()); try { JcrPackageManagerImpl jcrPackageManager = new JcrPackageManagerImpl(anonymous, new String[0]); assertNull(jcrPackageManager.getPackageRoot(true)); try { jcrPackageManager.getPackageRoot(false); fail(); } catch (AccessDeniedException | PathNotFoundException e) { // success } } finally { anonymous.logout(); } }
Example #8
Source File: LinkHelper.java From sling-samples with Apache License 2.0 | 5 votes |
public void removeLink(Node source, Node target, String name) throws PathNotFoundException, RepositoryException { String targetPath = target.getPath(); Value[] sourceLinks = source.getProperty(name).getValues(); ArrayList<String> newSourceLinks = new ArrayList<String>(); for (Value sourceLink : sourceLinks) { String link = sourceLink.getString(); if (!link.equals(target.getPath())) { newSourceLinks.add(link); } } String[] newSourceLinksArray = new String[newSourceLinks.size()]; source.setProperty(name, newSourceLinks.toArray(newSourceLinksArray)); }
Example #9
Source File: StorageUpdater.java From nextreports-server with Apache License 2.0 | 5 votes |
private void resetFirstUsageDates() throws Exception { LOG.info("Reset firstUsage.date for all users"); String statement = "/jcr:root" + ISO9075.encodePath(StorageConstants.USERS_ROOT) + "//*[@className='ro.nextreports.server.domain.UserPreferences']"; QueryResult queryResult = jcrTemplate.query(statement); NodeIterator nodes = queryResult.getNodes(); LOG.info("Found " + nodes.getSize() + " user preferences nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); Node pNode = node.getNode("preferences"); try { Property property = pNode.getProperty("firstUsage.date"); if (property.getValue() != null) { LOG.info(" removed firstUsage.date = " + property.getString() + " for user " + node.getParent().getName()); String s = null; pNode.setProperty("firstUsage.date", s); } } catch (PathNotFoundException ex) { // nothing to do } } jcrTemplate.save(); }
Example #10
Source File: SessionWrapper.java From sling-whiteboard with Apache License 2.0 | 4 votes |
@Override public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException { this.wrappedSession.exportDocumentView(absPath, contentHandler, skipBinary, noRecurse); }
Example #11
Source File: NodeImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { throw new UnsupportedRepositoryOperationException(); }
Example #12
Source File: WorkspaceImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException { }
Example #13
Source File: WorkspaceImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, AccessDeniedException, RepositoryException { return null; }
Example #14
Source File: WorkspaceImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { }
Example #15
Source File: QueryImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException { return null; }
Example #16
Source File: IntegrationTestBase.java From jackrabbit-filevault with Apache License 2.0 | 4 votes |
public void assertNodeHasPrimaryType(String path, String primaryType) throws PathNotFoundException, RepositoryException { Node node = admin.getNode(path); assertNotNull("Node at '" + path + "' must exist", node); assertEquals("Node at '" + path + "' does not have the expected node type", primaryType, node.getPrimaryNodeType().getName()); }
Example #17
Source File: SessionFactoryUtils.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
/** * 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 #18
Source File: WorkspaceImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException { }
Example #19
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException { }
Example #20
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException { }
Example #21
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException { }
Example #22
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException { }
Example #23
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException, VersionException, InvalidSerializedDataException, LockException, RepositoryException { }
Example #24
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException { return null; }
Example #25
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public Property getProperty(String absPath) throws PathNotFoundException { return (Property)getItem(absPath); }
Example #26
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public Node getNode(String absPath) throws PathNotFoundException { return (Node)getItem(absPath); }
Example #27
Source File: SessionImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public Item getItem(String absPath) throws PathNotFoundException { if (!itemExists(absPath)) throw new PathNotFoundException(); return getItemImpl(absPath); }
Example #28
Source File: SessionWrapper.java From sling-whiteboard with Apache License 2.0 | 4 votes |
@Override public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException { this.wrappedSession.move(srcAbsPath, destAbsPath); }
Example #29
Source File: SessionWrapper.java From sling-whiteboard with Apache License 2.0 | 4 votes |
@Override public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException { this.wrappedSession.exportDocumentView(absPath, out, skipBinary, noRecurse); }
Example #30
Source File: SessionWrapper.java From sling-whiteboard with Apache License 2.0 | 4 votes |
@Override public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException { this.wrappedSession.exportSystemView(absPath, contentHandler, skipBinary, noRecurse); }