jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1488690 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Sun, 02 Jun 2013 12:06:54 GMT
Author: jukka
Date: Sun Jun  2 12:06:53 2013
New Revision: 1488690

URL: http://svn.apache.org/r1488690
Log:
OAK-168: Basic JCR VersionManager support

Throw VersionException from add/removeMixin() on a checked-in node

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1488690&r1=1488689&r2=1488690&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Sun Jun  2 12:06:53 2013
@@ -858,6 +858,13 @@ public class NodeImpl<T extends NodeDele
         final String oakTypeName = getOakName(checkNotNull(mixinName));
         perform(new ItemWriteOperation<Void>() {
             @Override
+            protected void checkPreconditions() throws RepositoryException {
+                super.checkPreconditions();
+                if (!isCheckedOut()) {
+                    throw new VersionException("Cannot add mixin type. Node is checked in.");
+                }
+            }
+            @Override
             public Void perform() throws RepositoryException {
                 dlg.addMixin(oakTypeName);
                 return null;
@@ -869,6 +876,13 @@ public class NodeImpl<T extends NodeDele
     public void removeMixin(final String mixinName) throws RepositoryException {
         perform(new ItemWriteOperation<Void>() {
             @Override
+            protected void checkPreconditions() throws RepositoryException {
+                super.checkPreconditions();
+                if (!isCheckedOut()) {
+                    throw new VersionException("Cannot remove mixin type. Node is checked
in.");
+                }
+            }
+            @Override
             public Void perform() throws RepositoryException {
                 PropertyDelegate propDlg = dlg.getPropertyOrNull(JcrConstants.JCR_MIXINTYPES);
                 String oakName = getOakName(mixinName);



Mime
View raw message