You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/03/29 13:12:25 UTC
svn commit: r1789360 - in
/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl:
helper/ operations/
Author: cziegeler
Date: Wed Mar 29 13:12:25 2017
New Revision: 1789360
URL: http://svn.apache.org/viewvc?rev=1789360&view=rev
Log:
SLING-6723 : Make dependency to javax.jcr, jcr.contentloader and jcr.api optional
Modified:
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/HtmlPostResponseProxy.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ReferenceParser.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/StreamedChunk.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCopyMoveOperation.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCreateOperation.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupport.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupportImpl.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/MoveOperation.java
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/HtmlPostResponseProxy.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/HtmlPostResponseProxy.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/HtmlPostResponseProxy.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/HtmlPostResponseProxy.java Wed Mar 29 13:12:25 2017
@@ -33,7 +33,9 @@ import org.apache.sling.servlets.post.Po
* {@link org.apache.sling.servlets.post.AbstractSlingPostOperation} for
* bridging into the new
* {@link org.apache.sling.servlets.post.AbstractPostOperation}.
+ * @deprecated
*/
+@Deprecated
public class HtmlPostResponseProxy implements PostResponse {
private final HtmlResponse apiHtmlResponse;
@@ -46,18 +48,22 @@ public class HtmlPostResponseProxy imple
return apiHtmlResponse;
}
+ @Override
public Throwable getError() {
return apiHtmlResponse.getError();
}
+ @Override
public String getLocation() {
return apiHtmlResponse.getLocation();
}
+ @Override
public String getParentLocation() {
return apiHtmlResponse.getParentLocation();
}
+ @Override
public String getPath() {
return apiHtmlResponse.getPath();
}
@@ -70,71 +76,88 @@ public class HtmlPostResponseProxy imple
return apiHtmlResponse.getProperty(name);
}
+ @Override
public String getReferer() {
return apiHtmlResponse.getReferer();
}
+ @Override
public int getStatusCode() {
return apiHtmlResponse.getStatusCode();
}
+ @Override
public String getStatusMessage() {
return apiHtmlResponse.getStatusMessage();
}
+ @Override
public boolean isCreateRequest() {
return apiHtmlResponse.isCreateRequest();
}
+ @Override
public boolean isSuccessful() {
return apiHtmlResponse.isSuccessful();
}
+ @Override
public void onChange(String type, String... arguments) {
apiHtmlResponse.onChange(type, arguments);
}
+ @Override
public void onCopied(String srcPath, String dstPath) {
apiHtmlResponse.onCopied(srcPath, dstPath);
}
+ @Override
public void onCreated(String path) {
apiHtmlResponse.onCreated(path);
}
+ @Override
public void onDeleted(String path) {
apiHtmlResponse.onDeleted(path);
}
+ @Override
public void onModified(String path) {
apiHtmlResponse.onModified(path);
}
+ @Override
public void onMoved(String srcPath, String dstPath) {
apiHtmlResponse.onMoved(srcPath, dstPath);
}
+ @Override
public void send(HttpServletResponse response, boolean setStatus)
throws IOException {
apiHtmlResponse.send(response, setStatus);
}
+ @Override
public void setCreateRequest(boolean isCreateRequest) {
apiHtmlResponse.setCreateRequest(isCreateRequest);
}
+ @Override
public void setError(Throwable error) {
apiHtmlResponse.setError(error);
}
+ @Override
public void setLocation(String location) {
apiHtmlResponse.setLocation(location);
}
+ @Override
public void setParentLocation(String parentLocation) {
apiHtmlResponse.setParentLocation(parentLocation);
}
+ @Override
public void setPath(String path) {
apiHtmlResponse.setPath(path);
}
@@ -143,14 +166,17 @@ public class HtmlPostResponseProxy imple
apiHtmlResponse.setProperty(name, value);
}
+ @Override
public void setReferer(String referer) {
apiHtmlResponse.setReferer(referer);
}
+ @Override
public void setStatus(int code, String message) {
apiHtmlResponse.setStatus(code, message);
}
+ @Override
public void setTitle(String title) {
apiHtmlResponse.setTitle(title);
}
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ReferenceParser.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ReferenceParser.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ReferenceParser.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ReferenceParser.java Wed Mar 29 13:12:25 2017
@@ -109,7 +109,7 @@ public class ReferenceParser {
// we ignore this
}
try {
- return session.getNodeByUUID(value);
+ return session.getNodeByIdentifier(value);
} catch (RepositoryException ignore) {
// we ignore this
}
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/StreamedChunk.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/StreamedChunk.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/StreamedChunk.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/StreamedChunk.java Wed Mar 29 13:12:25 2017
@@ -17,16 +17,6 @@
package org.apache.sling.servlets.post.impl.helper;
-import org.apache.sling.api.resource.ModifiableValueMap;
-import org.apache.sling.api.resource.PersistenceException;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.servlets.post.Modification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.Part;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -40,6 +30,17 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.servlet.ServletContext;
+import javax.servlet.http.Part;
+
+import org.apache.sling.api.resource.ModifiableValueMap;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.servlets.post.Modification;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Supports streamed uploads including where the stream is made up of partial body parts.
* The behaviour is documented here https://cwiki.apache.org/confluence/display/SLING/Chunked+File+Upload+Support, adding the ability
@@ -82,7 +83,6 @@ public class StreamedChunk {
private final long chunkLength;
private final long fileLength;
private final Part part;
- private final Map<String, List<String>> formFields;
private ServletContext servletContext;
private final boolean completed;
private final boolean chunked;
@@ -97,7 +97,6 @@ public class StreamedChunk {
*/
public StreamedChunk(Part part, Map<String, List<String>> formFields, ServletContext servletContext) {
this.part = part;
- this.formFields = formFields;
this.servletContext = servletContext;
String contentRangeHeader = part.getHeader("Content-Range");
@@ -187,14 +186,14 @@ public class StreamedChunk {
vm.put(JCR_MIMETYPE, getContentType(part));
if (chunked) {
if ( vm.containsKey(SLING_FILE_LENGTH)) {
- long previousFileLength = (Long) vm.get(SLING_FILE_LENGTH, Long.class);
+ long previousFileLength = vm.get(SLING_FILE_LENGTH, Long.class);
if (previousFileLength != fileLength) {
throw new IllegalStateException("Chunk file length has changed while cunks were being uploaded expected " + previousFileLength + " chunk contained " + fileLength);
}
}
long previousChunksLength = 0;
if ( vm.containsKey(SLING_CHUNKS_LENGTH)) {
- previousChunksLength = (Long) vm.get(SLING_CHUNKS_LENGTH, Long.class);
+ previousChunksLength = vm.get(SLING_CHUNKS_LENGTH, Long.class);
if (previousChunksLength != offset) {
throw new IllegalStateException("Chunks recieved out of order, was expecting chunk starting at " + offset + " found last chunk ending at " + previousChunksLength);
}
@@ -218,7 +217,7 @@ public class StreamedChunk {
* @throws PersistenceException
*/
private Resource initState(Resource fileResource, List<Modification> changes) throws PersistenceException {
- Map<String, Object> resourceProps = new HashMap<String, Object>();
+ Map<String, Object> resourceProps = new HashMap<>();
resourceProps.put(JCR_PRIMARY_TYPE, NT_RESOURCE);
resourceProps.put(JCR_LASTMODIFIED, Calendar.getInstance());
resourceProps.put(JCR_MIMETYPE, getContentType(part));
@@ -252,7 +251,7 @@ public class StreamedChunk {
*/
private void storeChunk(Resource contentResource, List<Modification> changes) throws PersistenceException {
if (chunked) {
- Map<String, Object> chunkProperties = new HashMap<String, Object>();
+ Map<String, Object> chunkProperties = new HashMap<>();
chunkProperties.put(JCR_PRIMARY_TYPE, SLING_CHUNK_NT);
chunkProperties.put(SLING_OFFSET, offset);
try {
@@ -314,7 +313,7 @@ public class StreamedChunk {
* @return
*/
private InputStream getChunksInputStream(Resource contentResource) {
- List<Resource> chunkResources = new ArrayList<Resource>();
+ List<Resource> chunkResources = new ArrayList<>();
for ( Resource r : contentResource.getChildren()) {
if (r.isResourceType(SLING_CHUNK_NT)) {
chunkResources.add(r);
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCopyMoveOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCopyMoveOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCopyMoveOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCopyMoveOperation.java Wed Mar 29 13:12:25 2017
@@ -82,7 +82,7 @@ abstract class AbstractCopyMoveOperation
+ dest + ": destination exists");
return;
} else {
- checkoutIfNecessary(request.getResourceResolver().getResource(dstParent),
+ this.jcrSsupport.checkoutIfNecessary(request.getResourceResolver().getResource(dstParent),
changes, versioningConfiguration);
}
@@ -93,7 +93,7 @@ abstract class AbstractCopyMoveOperation
if (!dstParent.equals("")) {
final Resource parentResource = request.getResourceResolver().getResource(dstParent);
if (parentResource != null ) {
- checkoutIfNecessary(parentResource, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(parentResource, changes, versioningConfiguration);
} else {
response.setStatus(HttpServletResponse.SC_PRECONDITION_FAILED,
"Cannot " + getOperationName() + " " + resource + " to "
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCreateOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCreateOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCreateOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractCreateOperation.java Wed Mar 29 13:12:25 2017
@@ -159,6 +159,10 @@ abstract class AbstractCreateOperation e
}
}
+ private boolean isVersionable(final Node node) throws RepositoryException {
+ return node.isNodeType("mix:versionable");
+ }
+
protected void updateNodeType(final ResourceResolver resolver,
final String path,
final Map<String, RequestProperty> reqProperties,
@@ -174,7 +178,7 @@ abstract class AbstractCreateOperation e
final boolean wasVersionable = (node == null ? false : isVersionable(node));
if ( node != null ) {
- checkoutIfNecessary(rsrc, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(rsrc, changes, versioningConfiguration);
node.setPrimaryType(nodeType);
} else {
mvm.put("jcr:primaryType", nodeType);
@@ -212,7 +216,7 @@ abstract class AbstractCreateOperation e
// clear existing mixins first
if ( node != null ) {
- checkoutIfNecessary(rsrc, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(rsrc, changes, versioningConfiguration);
for (NodeType mixin : node.getMixinNodeTypes()) {
String mixinName = mixin.getName();
if (!newMixins.remove(mixinName)) {
@@ -610,7 +614,7 @@ abstract class AbstractCreateOperation e
// check for node type
final String nodeType = getPrimaryType(reqProperties, tmpPath);
- checkoutIfNecessary(resource, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resource, changes, versioningConfiguration);
try {
final Map<String, Object> props = new HashMap<>();
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java Wed Mar 29 13:12:25 2017
@@ -26,9 +26,6 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.api.SlingHttpServletRequest;
@@ -59,6 +56,7 @@ public abstract class AbstractPostOperat
*/
protected final Logger log = LoggerFactory.getLogger(getClass());
+ /** The JCR support provides additional functionality if the resources a backed up by JCR. */
protected final JCRSupport jcrSsupport = JCRSupport.INSTANCE;
/**
@@ -309,45 +307,6 @@ public abstract class AbstractPostOperat
return request.getResource().getPath();
}
- private Node findVersionableAncestor(Node node) throws RepositoryException {
- if (isVersionable(node)) {
- return node;
- }
- try {
- node = node.getParent();
- return findVersionableAncestor(node);
- } catch (ItemNotFoundException e) {
- // top-level
- return null;
- }
- }
-
- protected boolean isVersionable(Node node) throws RepositoryException {
- return node.isNodeType("mix:versionable");
- }
-
- protected void checkoutIfNecessary(final Resource resource,
- final List<Modification> changes,
- final VersioningConfiguration versioningConfiguration)
- throws PersistenceException {
- if (resource != null && versioningConfiguration.isAutoCheckout()) {
- final Node node = resource.adaptTo(Node.class);
- if ( node != null ) {
- try {
- Node versionableNode = findVersionableAncestor(node);
- if (versionableNode != null) {
- if (!versionableNode.isCheckedOut()) {
- versionableNode.getSession().getWorkspace().getVersionManager().checkout(versionableNode.getPath());
- changes.add(Modification.onCheckout(versionableNode.getPath()));
- }
- }
- } catch ( final RepositoryException re) {
- throw new PersistenceException(re.getMessage(), re);
- }
- }
- }
- }
-
private static class ApplyToIterator implements Iterator<Resource> {
private final ResourceResolver resolver;
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java Wed Mar 29 13:12:25 2017
@@ -103,7 +103,7 @@ public class DeleteOperation extends Abs
uploadHandler.deleteChunks(node);
}
} else {
- checkoutIfNecessary(resource.getParent(), changes,
+ this.jcrSsupport.checkoutIfNecessary(resource.getParent(), changes,
versioningConfiguration);
}
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupport.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupport.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupport.java Wed Mar 29 13:12:25 2017
@@ -24,6 +24,7 @@ import org.apache.sling.api.SlingHttpSer
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.servlets.post.Modification;
+import org.apache.sling.servlets.post.VersioningConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,4 +63,13 @@ public class JCRSupport {
}
return false;
}
+
+ public void checkoutIfNecessary(final Resource rsrc,
+ final List<Modification> changes,
+ final VersioningConfiguration versioningConfiguration)
+ throws PersistenceException {
+ if ( rsrc != null && supportImpl != null ) {
+ ((JCRSupportImpl)supportImpl).checkoutIfNecessary(rsrc, changes, versioningConfiguration);
+ }
+ }
}
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupportImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupportImpl.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupportImpl.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/JCRSupportImpl.java Wed Mar 29 13:12:25 2017
@@ -20,6 +20,7 @@ package org.apache.sling.servlets.post.i
import java.util.List;
+import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
@@ -29,6 +30,7 @@ import org.apache.sling.api.resource.Per
import org.apache.sling.api.resource.Resource;
import org.apache.sling.servlets.post.Modification;
import org.apache.sling.servlets.post.SlingPostConstants;
+import org.apache.sling.servlets.post.VersioningConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -160,4 +162,39 @@ public class JCRSupportImpl {
}
return false;
}
+
+ private Node findVersionableAncestor(Node node) throws RepositoryException {
+ if (isVersionable(node)) {
+ return node;
+ }
+ try {
+ node = node.getParent();
+ return findVersionableAncestor(node);
+ } catch (ItemNotFoundException e) {
+ // top-level
+ return null;
+ }
+ }
+
+ public void checkoutIfNecessary(final Resource resource,
+ final List<Modification> changes,
+ final VersioningConfiguration versioningConfiguration)
+ throws PersistenceException {
+ if (resource != null && versioningConfiguration.isAutoCheckout()) {
+ final Node node = resource.adaptTo(Node.class);
+ if ( node != null ) {
+ try {
+ Node versionableNode = findVersionableAncestor(node);
+ if (versionableNode != null) {
+ if (!versionableNode.isCheckedOut()) {
+ versionableNode.getSession().getWorkspace().getVersionManager().checkout(versionableNode.getPath());
+ changes.add(Modification.onCheckout(versionableNode.getPath()));
+ }
+ }
+ } catch ( final RepositoryException re) {
+ throw new PersistenceException(re.getMessage(), re);
+ }
+ }
+ }
+ }
}
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java Wed Mar 29 13:12:25 2017
@@ -249,14 +249,14 @@ public class ModifyOperation extends Abs
// first, otherwise ensure the parent location
if (session.itemExists(propPath)) {
Node parent = session.getItem(propPath).getParent();
- checkoutIfNecessary(resolver.getResource(parent.getPath()), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resolver.getResource(parent.getPath()), changes, versioningConfiguration);
session.getItem(propPath).remove();
changes.add(Modification.onDeleted(propPath));
} else {
Resource parent = deepGetOrCreateNode(resolver, property.getParentPath(),
reqProperties, changes, versioningConfiguration);
- checkoutIfNecessary(parent, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(parent, changes, versioningConfiguration);
}
// move through the session and record operation
@@ -265,12 +265,12 @@ public class ModifyOperation extends Abs
// node move/copy through session
if (isMove) {
- checkoutIfNecessary(resolver.getResource(sourceItem.getParent().getPath()), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resolver.getResource(sourceItem.getParent().getPath()), changes, versioningConfiguration);
session.move(source, propPath);
} else {
Node sourceNode = (Node) sourceItem;
Node destParent = (Node) session.getItem(property.getParentPath());
- checkoutIfNecessary(resolver.getResource(destParent.getPath()), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resolver.getResource(destParent.getPath()), changes, versioningConfiguration);
CopyOperation.copy(sourceNode, destParent,
property.getName());
}
@@ -282,12 +282,12 @@ public class ModifyOperation extends Abs
// create destination property
Node destParent = (Node) session.getItem(property.getParentPath());
- checkoutIfNecessary(resolver.getResource(destParent.getPath()), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resolver.getResource(destParent.getPath()), changes, versioningConfiguration);
CopyOperation.copy(sourceProperty, destParent, null);
// remove source property (if not just copying)
if (isMove) {
- checkoutIfNecessary(resolver.getResource(sourceProperty.getParent().getPath()), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(resolver.getResource(sourceProperty.getParent().getPath()), changes, versioningConfiguration);
sourceProperty.remove();
}
}
@@ -334,7 +334,7 @@ public class ModifyOperation extends Abs
final Node parentNode = parent.adaptTo(Node.class);
if ( parentNode != null ) {
- checkoutIfNecessary(parent, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(parent, changes, versioningConfiguration);
if (property.getName().equals("jcr:mixinTypes")) {
@@ -385,7 +385,7 @@ public class ModifyOperation extends Abs
final Resource parent = deepGetOrCreateNode(resolver,
prop.getParentPath(), reqProperties, changes, versioningConfiguration);
- checkoutIfNecessary(parent, changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(parent, changes, versioningConfiguration);
// skip jcr special properties
if (prop.getName().equals("jcr:primaryType")
Modified: sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/MoveOperation.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/MoveOperation.java?rev=1789360&r1=1789359&r2=1789360&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/MoveOperation.java (original)
+++ sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/operations/MoveOperation.java Wed Mar 29 13:12:25 2017
@@ -61,7 +61,7 @@ public class MoveOperation extends Abstr
String destPath = destParent + "/" + destName;
Session session = item.getSession();
- checkoutIfNecessary(source.getParent(), changes, versioningConfiguration);
+ this.jcrSsupport.checkoutIfNecessary(source.getParent(), changes, versioningConfiguration);
if (session.itemExists(destPath)) {
session.getItem(destPath).remove();