@Override public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException { getWrappedProperty().save(); }
@Override public void save() throws RepositoryException { if (isExist()) { getJCRProperty().save(); } }
public void testSetValue() throws RepositoryException { Property p = (Property) readOnlySession.getItem(testPropertyPath); try { p.setValue("otherValue"); p.save(); fail("A read only session must not be allowed to modify a property value"); } catch (AccessDeniedException e) { // success } }
/** * Test the restore of a OnParentVersion-COMPUTE property * * @throws javax.jcr.RepositoryException */ public void testRestoreProp() throws RepositoryException { Node propParent = p.getParent(); propParent.checkout(); Version v = propParent.checkin(); propParent.checkout(); p.setValue(newPropValue); p.save(); propParent.restore(v, false); assertEquals("On restore of a OnParentVersion-COMPUTE property P, the current P in the workspace will be left unchanged.", p.getString(), newPropValue); }
/** * Test the restore of a OnParentVersion-INITIALIZE property * * @throws javax.jcr.RepositoryException */ public void testRestoreProp() throws RepositoryException { Node propParent = p.getParent(); propParent.checkout(); Version v = propParent.checkin(); propParent.checkout(); p.setValue(newPropValue); p.save(); propParent.restore(v, false); assertEquals("On restore of a OnParentVersion-INITIALIZE property P, the current value of P must be left unchanged.", p.getString(), newPropValue); }
/** * Test the restore of a OnParentVersion-IGNORE property * * @throws javax.jcr.RepositoryException */ public void testRestoreProp() throws RepositoryException { Node propParent = p.getParent(); propParent.checkout(); Version v = propParent.checkin(); propParent.checkout(); p.setValue(newPropValue); p.save(); propParent.restore(v, false); assertEquals("On restore of a OnParentVersion-IGNORE property P, the current value of P must be left unchanged.", p.getString(), newPropValue); }
@Test public void saveOnNewProperty() throws RepositoryException { assumeTrue(!NodeImpl.SAVE_SESSION); try { foo.setProperty("p3", "v3").save(); fail("Expected UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException e) { assertTrue(e.getCause() instanceof CommitFailedException); } finally { session.refresh(false); } }
@Test public void saveMissesProperty() throws RepositoryException { assumeTrue(!NodeImpl.SAVE_SESSION); try { prop1.setValue("changed"); prop2.setValue("changed"); prop1.save(); fail("Expected UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException e) { assertTrue(e.getCause() instanceof CommitFailedException); } finally { session.refresh(false); } }