Repository: nifi
Updated Branches:
  refs/heads/master acc9e0b45 -> e65aad8fe


NIFI-2994: - Setting the default position for remote process groups.

Signed-off-by: Yolanda M. Davis <[email protected]>

This closes #1303


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e65aad8f
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e65aad8f
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e65aad8f

Branch: refs/heads/master
Commit: e65aad8fe61a806540d13a91e06bfdf22c51bf2f
Parents: acc9e0b
Author: Matt Gilman <[email protected]>
Authored: Mon Nov 7 11:58:27 2016 -0500
Committer: Yolanda M. Davis <[email protected]>
Committed: Thu Dec 22 14:39:56 2016 -0500

----------------------------------------------------------------------
 .../nifi/remote/StandardRemoteProcessGroup.java |  2 +-
 .../apache/nifi/web/api/ConnectionResource.java | 11 ++++
 .../org/apache/nifi/web/api/FunnelResource.java |  8 +++
 .../apache/nifi/web/api/InputPortResource.java  |  8 +++
 .../org/apache/nifi/web/api/LabelResource.java  |  8 +++
 .../apache/nifi/web/api/OutputPortResource.java |  8 +++
 .../nifi/web/api/ProcessGroupResource.java      | 67 ++++++++++++++++++++
 .../apache/nifi/web/api/ProcessorResource.java  |  8 +++
 .../web/api/RemoteProcessGroupResource.java     |  8 +++
 9 files changed, 127 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
index 1fd4d32..855dab7 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java
@@ -95,7 +95,7 @@ public class StandardRemoteProcessGroup implements 
RemoteProcessGroup {
     private final NiFiProperties nifiProperties;
 
     private final AtomicReference<String> name = new AtomicReference<>();
-    private final AtomicReference<Position> position = new AtomicReference<>();
+    private final AtomicReference<Position> position = new 
AtomicReference<>(new Position(0D, 0D));
     private final AtomicReference<String> comments = new AtomicReference<>();
     private final AtomicReference<ProcessGroup> processGroup;
     private final AtomicBoolean transmitting = new AtomicBoolean(false);

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java
index cf6aada..4527e87 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java
@@ -33,6 +33,7 @@ import org.apache.nifi.connectable.ConnectableType;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.ConnectionDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.entity.ConnectionEntity;
 import org.apache.nifi.web.api.request.ClientIdParameter;
 import org.apache.nifi.web.api.request.LongParameter;
@@ -51,6 +52,7 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -214,6 +216,15 @@ public class ConnectionResource extends 
ApplicationResource {
             }
         }
 
+        final List<PositionDTO> proposedBends = requestConnection.getBends();
+        if (proposedBends != null) {
+            for (final PositionDTO proposedBend : proposedBends) {
+                if (proposedBend.getX() == null || proposedBend.getY() == 
null) {
+                    throw new IllegalArgumentException("The x and y coordinate 
of the each bend must be specified.");
+                }
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestConnectionEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java
index a6747d8..dcb35fa 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java
@@ -30,6 +30,7 @@ import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.FunnelDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.entity.FunnelEntity;
 import org.apache.nifi.web.api.request.ClientIdParameter;
 import org.apache.nifi.web.api.request.LongParameter;
@@ -192,6 +193,13 @@ public class FunnelResource extends ApplicationResource {
                     + "funnel id of the requested resource (%s).", 
requestFunnelDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = requestFunnelDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestFunnelEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java
index a295fc6..65e871e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java
@@ -30,6 +30,7 @@ import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.PortDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.entity.PortEntity;
 import org.apache.nifi.web.api.request.ClientIdParameter;
 import org.apache.nifi.web.api.request.LongParameter;
@@ -192,6 +193,13 @@ public class InputPortResource extends ApplicationResource 
{
                     + "input port id of the requested resource (%s).", 
requestPortDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = requestPortDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestPortEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java
index 78c7287..34f62f5 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java
@@ -30,6 +30,7 @@ import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.LabelDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.entity.LabelEntity;
 import org.apache.nifi.web.api.request.ClientIdParameter;
 import org.apache.nifi.web.api.request.LongParameter;
@@ -192,6 +193,13 @@ public class LabelResource extends ApplicationResource {
                     + "label id of the requested resource (%s).", 
requestLabelDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = requestLabelDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestLabelEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java
index 4070415..442473c 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java
@@ -30,6 +30,7 @@ import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.PortDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.entity.PortEntity;
 import org.apache.nifi.web.api.request.ClientIdParameter;
 import org.apache.nifi.web.api.request.LongParameter;
@@ -192,6 +193,13 @@ public class OutputPortResource extends 
ApplicationResource {
                     + "output port id of the requested resource (%s).", 
requestPortDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = requestPortDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestPortEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
index df9b476..4a8f8a9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
@@ -43,6 +43,7 @@ import org.apache.nifi.web.ResourceNotFoundException;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.api.dto.ConnectionDTO;
 import org.apache.nifi.web.api.dto.ControllerServiceDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.dto.ProcessGroupDTO;
 import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
 import org.apache.nifi.web.api.dto.ProcessorDTO;
@@ -101,6 +102,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -287,6 +289,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
                     + "not equal the process group id of the requested 
resource (%s).", requestProcessGroupDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = 
requestProcessGroupDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestProcessGroupEntity);
         }
@@ -445,6 +454,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Process group ID cannot be 
specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestProcessGroupEntity.getComponent().getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestProcessGroupEntity.getComponent().getParentGroupId() != 
null && 
!groupId.equals(requestProcessGroupEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     
requestProcessGroupEntity.getComponent().getParentGroupId(), groupId));
@@ -602,6 +618,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("The type of processor to 
create must be specified.");
         }
 
+        final PositionDTO proposedPosition = requestProcessor.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestProcessor.getParentGroupId() != null && 
!groupId.equals(requestProcessor.getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestProcessor.getParentGroupId(), groupId));
@@ -760,6 +783,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Input port ID cannot be 
specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestPortEntity.getComponent().getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestPortEntity.getComponent().getParentGroupId() != null && 
!groupId.equals(requestPortEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestPortEntity.getComponent().getParentGroupId(), 
groupId));
@@ -901,6 +931,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Output port ID cannot be 
specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestPortEntity.getComponent().getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestPortEntity.getComponent().getParentGroupId() != null && 
!groupId.equals(requestPortEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestPortEntity.getComponent().getParentGroupId(), 
groupId));
@@ -1043,6 +1080,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Funnel ID cannot be 
specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestFunnelEntity.getComponent().getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestFunnelEntity.getComponent().getParentGroupId() != null && 
!groupId.equals(requestFunnelEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestFunnelEntity.getComponent().getParentGroupId(), 
groupId));
@@ -1185,6 +1229,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Label ID cannot be 
specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestLabelEntity.getComponent().getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestLabelEntity.getComponent().getParentGroupId() != null && 
!groupId.equals(requestLabelEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestLabelEntity.getComponent().getParentGroupId(), 
groupId));
@@ -1334,6 +1385,13 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("The URI of the process group 
must be specified.");
         }
 
+        final PositionDTO proposedPosition = 
requestRemoteProcessGroupDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (requestRemoteProcessGroupDTO.getParentGroupId() != null && 
!groupId.equals(requestRemoteProcessGroupDTO.getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestRemoteProcessGroupDTO.getParentGroupId(), groupId));
@@ -1493,6 +1551,15 @@ public class ProcessGroupResource extends 
ApplicationResource {
             throw new IllegalArgumentException("Connection ID cannot be 
specified.");
         }
 
+        final List<PositionDTO> proposedBends = 
requestConnectionEntity.getComponent().getBends();
+        if (proposedBends != null) {
+            for (final PositionDTO proposedBend : proposedBends) {
+                if (proposedBend.getX() == null || proposedBend.getY() == 
null) {
+                    throw new IllegalArgumentException("The x and y coordinate 
of the each bend must be specified.");
+                }
+            }
+        }
+
         if (requestConnectionEntity.getComponent().getParentGroupId() != null 
&& !groupId.equals(requestConnectionEntity.getComponent().getParentGroupId())) {
             throw new IllegalArgumentException(String.format("If specified, 
the parent process group id %s must be the same as specified in the URI %s",
                     requestConnectionEntity.getComponent().getParentGroupId(), 
groupId));

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
index 9bd02d4..d17f7ac 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java
@@ -36,6 +36,7 @@ import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
 import org.apache.nifi.web.UiExtensionType;
 import org.apache.nifi.web.api.dto.ComponentStateDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
 import org.apache.nifi.web.api.dto.ProcessorDTO;
 import org.apache.nifi.web.api.dto.PropertyDescriptorDTO;
@@ -435,6 +436,13 @@ public class ProcessorResource extends ApplicationResource 
{
                     + "not equal the processor id of the requested resource 
(%s).", requestProcessorDTO.getId(), id));
         }
 
+        final PositionDTO proposedPosition = requestProcessorDTO.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestProcessorEntity);
         }

http://git-wip-us.apache.org/repos/asf/nifi/blob/e65aad8f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
index 5380d51..3aef47e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
@@ -29,6 +29,7 @@ import org.apache.nifi.authorization.resource.Authorizable;
 import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.web.NiFiServiceFacade;
 import org.apache.nifi.web.Revision;
+import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
 import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
 import org.apache.nifi.web.api.dto.RevisionDTO;
@@ -471,6 +472,13 @@ public class RemoteProcessGroupResource extends 
ApplicationResource {
                     + "remote process group id of the requested resource 
(%s).", requestRemoteProcessGroup.getId(), id));
         }
 
+        final PositionDTO proposedPosition = 
requestRemoteProcessGroup.getPosition();
+        if (proposedPosition != null) {
+            if (proposedPosition.getX() == null || proposedPosition.getY() == 
null) {
+                throw new IllegalArgumentException("The x and y coordinate of 
the proposed position must be specified.");
+            }
+        }
+
         if (isReplicateRequest()) {
             return replicate(HttpMethod.PUT, requestRemoteProcessGroupEntity);
         }

Reply via email to