Java Code Examples for javax.jcr.Session#removeItem()
The following examples show how to use
javax.jcr.Session#removeItem() .
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: JcrMetadataRepositoryTest.java From archiva with Apache License 2.0 | 6 votes |
@Before @Override public void setUp() throws Exception { super.setUp(); super.assertMaxTries=5; super.assertRetrySleepMs = 500; try( JcrRepositorySession session = (JcrRepositorySession) getSessionFactory().createSession() ) { Session jcrSession = session.getJcrSession( ); if (jcrSession.itemExists( "/repositories/test" )) { jcrSession.removeItem( "/repositories/test" ); session.save( ); } } }
Example 2
Source File: ProductBindingCreator.java From commerce-cif-connector with Apache License 2.0 | 5 votes |
private void deleteJcrNode(Resource res) { Session session = resolver.adaptTo(Session.class); try { session.removeItem(res.getPath()); session.save(); } catch (RepositoryException e) { LOG.error(e.getMessage(), e); } }
Example 3
Source File: EncryptPostProcessor.java From sling-whiteboard with Apache License 2.0 | 5 votes |
@Override public void process(SlingHttpServletRequest slingRequest, List<Modification> modifications) throws Exception { Set<Modification> mods = modifications.stream() .filter(modification -> modification.getSource().endsWith(config.suffix())).collect(Collectors.toSet()); if (mods.isEmpty()) { return; } ResourceResolver resolver = slingRequest.getResourceResolver(); Session session = resolver.adaptTo(Session.class); for (Modification mod : mods) { String encryptPropertyPath = mod.getSource(); String propertyPath = encryptPropertyPath.substring(0, encryptPropertyPath.lastIndexOf(config.suffix())); String resourcePath = propertyPath.substring(0, propertyPath.lastIndexOf('/')); if (config.inline()) { session.move(encryptPropertyPath, propertyPath); } EncryptableValueMap map = resolver.resolve(resourcePath).adaptTo(EncryptableValueMap.class); map.encrypt(propertyPath.substring(resourcePath.length() + 1, propertyPath.length())); session.removeItem(encryptPropertyPath); } modifications.removeAll(mods); mods.forEach(mod -> { logger.debug("removed {} for source {}", mod.getType() , mod.getSource()); }); }
Example 4
Source File: ScriptStorageImpl.java From APM with Apache License 2.0 | 5 votes |
@Override public void remove(final Script script, ResourceResolver resolver) throws RepositoryException { scriptManager.getEventManager().trigger(Event.BEFORE_REMOVE, script); final Session session = resolver.adaptTo(Session.class); final String path = script.getPath(); if (path != null) { session.removeItem(path); session.save(); } }