This is an automated email from the ASF dual-hosted git repository.
tpalfy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new da05ba0165 NIFI-10213: Create GetShopify processor
da05ba0165 is described below
commit da05ba0165615bc53248ad0cc8fc1eb0a30c7d02
Author: Lehel <[email protected]>
AuthorDate: Tue Aug 16 00:08:55 2022 +0200
NIFI-10213: Create GetShopify processor
This closes #6303.
Signed-off-by: Tamas Palfy <[email protected]>
---
nifi-assembly/pom.xml | 6 +
.../nifi-shopify-bundle/nifi-shopify-nar/pom.xml | 46 +++
.../src/main/resources/META-INF/LICENSE | 202 ++++++++++
.../src/main/resources/META-INF/NOTICE | 37 ++
.../nifi-shopify-processors/pom.xml | 96 +++++
.../apache/nifi/processors/shopify/GetShopify.java | 411 +++++++++++++++++++++
.../shopify/model/IncrementalLoadingParameter.java | 23 ++
.../nifi/processors/shopify/model/Resource.java | 26 ++
.../shopify/model/ResourceDirectory.java | 152 ++++++++
.../processors/shopify/model/ResourceType.java | 129 +++++++
.../processors/shopify/model/ShopifyResource.java | 66 ++++
.../shopify/rest/ShopifyRestService.java | 121 ++++++
.../processors/shopify/util/IncrementalTimers.java | 66 ++++
.../services/org.apache.nifi.processor.Processor | 15 +
.../additionalDetails.html | 83 +++++
.../nifi/processors/shopify/GetShopifyIT.java | 215 +++++++++++
.../shopify/rest/ShopifyRestServiceTest.java | 119 ++++++
.../shopify/util/TestIncrementalTimers.java | 81 ++++
.../src/test/resources/collection_listings.json | 26 ++
.../src/test/resources/simple_response.json | 235 ++++++++++++
nifi-nar-bundles/nifi-shopify-bundle/pom.xml | 32 ++
nifi-nar-bundles/pom.xml | 1 +
22 files changed, 2188 insertions(+)
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index 05ec98e555..54ebecbea0 100644
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -922,6 +922,12 @@ language governing permissions and limitations under the
License. -->
<version>1.18.0-SNAPSHOT</version>
<type>nar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-shopify-nar</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ <type>nar</type>
+ </dependency>
<!-- dependencies for jaxb/activation/annotation for running NiFi on
Java 11 -->
<!-- TODO: remove these once minimum Java version is 11 -->
<dependency>
diff --git a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/pom.xml
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/pom.xml
new file mode 100644
index 0000000000..f2ad595f1d
--- /dev/null
+++ b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>nifi-shopify-bundle</artifactId>
+ <groupId>org.apache.nifi</groupId>
+ <version>1.18.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>nifi-shopify-nar</artifactId>
+
+ <packaging>nar</packaging>
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <source.skip>true</source.skip>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-shopify-processors</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-standard-services-api-nar</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ <type>nar</type>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/LICENSE
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/NOTICE
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..24284796e8
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-nar/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,37 @@
+nifi-shopify-nar
+Copyright 2014-2022 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+**************************
+Apache Software License v2
+**************************
+
+ (ASLv2) Apache Commons IO
+ The following NOTICE information applies:
+ Apache Commons IO
+ Copyright 2002-2016 The Apache Software Foundation
+
+ (ASLv2) Jackson JSON processor
+ The following NOTICE information applies:
+ # Jackson JSON processor
+
+ Jackson is a high-performance, Free/Open Source JSON processing library.
+ It was originally written by Tatu Saloranta ([email protected]), and
has
+ been in development since 2007.
+ It is currently developed by a community of developers, as well as
supported
+ commercially by FasterXML.com.
+
+ ## Licensing
+
+ Jackson core and extension components may licensed under different
licenses.
+ To find the details that apply to this artifact see the accompanying
LICENSE file.
+ For more information, including possible other licensing options, contact
+ FasterXML.com (http://fasterxml.com).
+
+ ## Credits
+
+ A list of contributors may be found from CREDITS file, which is included
+ in some artifacts (usually source distributions); but is always available
+ from the source code management (SCM) system project uses.
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/pom.xml
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/pom.xml
new file mode 100644
index 0000000000..fa513e90ee
--- /dev/null
+++ b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>nifi-shopify-bundle</artifactId>
+ <groupId>org.apache.nifi</groupId>
+ <version>1.18.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>nifi-shopify-processors</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-utils</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-web-client-provider-api</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-mock</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-web-client-provider-service</artifactId>
+ <version>1.18.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>mockwebserver</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-ssl-context-service-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-proxy-configuration-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- test data -->
+ <exclude>src/test/resources/**/*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/GetShopify.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/GetShopify.java
new file mode 100644
index 0000000000..1cb04c5d7b
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/GetShopify.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify;
+
+import com.fasterxml.jackson.core.JsonEncoding;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
+import org.apache.nifi.annotation.behavior.PrimaryNodeOnly;
+import org.apache.nifi.annotation.behavior.Stateful;
+import org.apache.nifi.annotation.behavior.TriggerSerially;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.state.Scope;
+import org.apache.nifi.components.state.StateMap;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.OutputStreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.shopify.model.IncrementalLoadingParameter;
+import org.apache.nifi.processors.shopify.model.ResourceType;
+import org.apache.nifi.processors.shopify.model.ShopifyResource;
+import org.apache.nifi.processors.shopify.rest.ShopifyRestService;
+import org.apache.nifi.processors.shopify.util.IncrementalTimers;
+import org.apache.nifi.web.client.api.HttpResponseEntity;
+import org.apache.nifi.web.client.api.HttpResponseStatus;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+
+import java.io.IOException;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+@PrimaryNodeOnly
+@TriggerSerially
+@InputRequirement(Requirement.INPUT_FORBIDDEN)
+@Tags({"shopify"})
+@Stateful(scopes = Scope.CLUSTER, description = "For a few resources the
processor supports incremental loading." +
+ " The list of the resources with the supported parameters can be found
in the additional details.")
+@CapabilityDescription("Retrieves objects from a custom Shopify store. The
processor yield time must be set to the account's rate limit accordingly.")
+public class GetShopify extends AbstractProcessor {
+
+ static final PropertyDescriptor STORE_DOMAIN = new
PropertyDescriptor.Builder()
+ .name("store-domain")
+ .displayName("Store Domain")
+ .description("The domain of the Shopify store, e.g.
nifistore.myshopify.com")
+ .required(true)
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .build();
+
+ static final PropertyDescriptor ACCESS_TOKEN = new
PropertyDescriptor.Builder()
+ .name("access-token")
+ .displayName("Access Token")
+ .description("Access Token to authenticate requests")
+ .required(true)
+ .sensitive(true)
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .build();
+
+ static final PropertyDescriptor API_VERSION = new
PropertyDescriptor.Builder()
+ .name("api-version")
+ .displayName("API Version")
+ .description("The Shopify REST API version")
+ .required(true)
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .defaultValue("2022-10")
+ .build();
+
+ static final PropertyDescriptor OBJECT_CATEGORY = new
PropertyDescriptor.Builder()
+ .name("object-category")
+ .displayName("Object Category")
+ .description("Shopify object category")
+ .required(true)
+ .allowableValues(ResourceType.class)
+ .build();
+
+ static final PropertyDescriptor RESULT_LIMIT = new
PropertyDescriptor.Builder()
+ .name("result-limit")
+ .displayName("Result Limit")
+ .description("The maximum number of results to request for each
invocation of the Processor")
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .required(false)
+ .addValidator(StandardValidators.createLongValidator(1, 100, true))
+ .build();
+
+ static final PropertyDescriptor IS_INCREMENTAL = new
PropertyDescriptor.Builder()
+ .name("is-incremental")
+ .displayName("Incremental Loading")
+ .description("The processor can incrementally load the queried
objects so that each object is queried exactly once." +
+ " For each query, the processor queries objects which were
created or modified after the previous run time" +
+ " but before the current time.")
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("true")
+ .build();
+
+ static final PropertyDescriptor INCREMENTAL_DELAY = new
PropertyDescriptor.Builder()
+ .name("incremental-delay")
+ .displayName("Incremental Delay")
+ .description("The ending timestamp of the time window will be
adjusted earlier by the amount configured in this property." +
+ " For example, with a property value of 10 seconds, an
ending timestamp of 12:30:45 would be changed to 12:30:35." +
+ " Set this property to avoid missing objects when the
clock of your local machines and Shopify servers' clock are not in sync.")
+ .required(false)
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
+ .dependsOn(IS_INCREMENTAL, "true")
+ .defaultValue("3 sec")
+ .build();
+
+ static final PropertyDescriptor INCREMENTAL_INITIAL_START_TIME = new
PropertyDescriptor.Builder()
+ .name("incremental-initial-start-time")
+ .displayName("Incremental Initial Start Time")
+ .description("This property specifies the start time when running
the first request." +
+ " Represents an ISO 8601-encoded date and time string. For
example, 3:50 pm on September 7, 2019" +
+ " in the time zone of UTC (Coordinated Universal Time) is
represented as \"2019-09-07T15:50:00Z\".")
+ .required(false)
+
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .addValidator(StandardValidators.ISO8601_INSTANT_VALIDATOR)
+ .dependsOn(IS_INCREMENTAL, "true")
+ .build();
+
+ public static final PropertyDescriptor WEB_CLIENT_PROVIDER = new
PropertyDescriptor.Builder()
+ .name("web-client-service-provider")
+ .displayName("Web Client Service Provider")
+ .description("Controller service for HTTP client operations")
+ .required(true)
+ .identifiesControllerService(WebClientServiceProvider.class)
+ .build();
+
+ static final Relationship REL_SUCCESS = new Relationship.Builder()
+ .name("success")
+ .description("For FlowFiles created as a result of a successful
query.")
+ .build();
+
+ private static final Map<ResourceType, PropertyDescriptor> propertyMap =
new EnumMap<>(ResourceType.class);
+ private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS =
createPropertyDescriptors();
+ private static final Set<Relationship> RELATIONSHIPS =
Collections.singleton(REL_SUCCESS);
+
+ private static List<PropertyDescriptor> createPropertyDescriptors() {
+ final List<PropertyDescriptor> resourceDescriptors =
Arrays.stream(ResourceType.values())
+ .map(resourceType -> {
+ final PropertyDescriptor resourceDescriptor = new
PropertyDescriptor.Builder()
+ .name(resourceType.getValue())
+ .displayName(resourceType.getPropertyDisplayName())
+ .description(resourceType.getPropertyDescription())
+ .required(true)
+ .dependsOn(OBJECT_CATEGORY,
resourceType.getValue())
+
.allowableValues(resourceType.getResourcesAsAllowableValues())
+
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .build();
+ propertyMap.put(resourceType, resourceDescriptor);
+ return resourceDescriptor;
+ })
+ .collect(Collectors.toList());
+ final List<PropertyDescriptor> propertyDescriptors = new
ArrayList<>(Arrays.asList(
+ STORE_DOMAIN,
+ ACCESS_TOKEN,
+ API_VERSION,
+ OBJECT_CATEGORY
+ ));
+ propertyDescriptors.addAll(resourceDescriptors);
+ propertyDescriptors.addAll(Arrays.asList(
+ RESULT_LIMIT,
+ IS_INCREMENTAL,
+ INCREMENTAL_DELAY,
+ INCREMENTAL_INITIAL_START_TIME,
+ WEB_CLIENT_PROVIDER)
+ );
+ return Collections.unmodifiableList(propertyDescriptors);
+ }
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+ private static final JsonFactory JSON_FACTORY = OBJECT_MAPPER.getFactory();
+ private static final int TOO_MANY_REQUESTS = 429;
+ private static final Pattern CURSOR_PATTERN = Pattern.compile("<([^<]*)>;
rel=\"next\"");
+ private static final String LAST_EXECUTION_TIME_KEY =
"last_execution_time";
+ private static final int EXCLUSIVE_TIME_WINDOW_ADJUSTMENT = 1;
+ private static final List<String> RESET_STATE_PROPERTY_NAMES;
+
+ static {
+ RESET_STATE_PROPERTY_NAMES = Arrays.stream(ResourceType.values())
+ .map(ResourceType::getValue)
+ .collect(Collectors.toList());
+ RESET_STATE_PROPERTY_NAMES.add(OBJECT_CATEGORY.getName());
+ RESET_STATE_PROPERTY_NAMES.add(IS_INCREMENTAL.getName());
+ }
+
+
+ private volatile ShopifyRestService shopifyRestService;
+ private volatile String resourceName;
+ private volatile boolean isResetState;
+
+ public void onPropertyModified(final PropertyDescriptor descriptor, final
String oldValue, final String newValue) {
+ if (RESET_STATE_PROPERTY_NAMES.contains(descriptor.getName())) {
+ isResetState = true;
+ }
+ }
+
+ @OnScheduled
+ public void onScheduled(final ProcessContext context) {
+ if (isResetState) {
+ clearState(context);
+ isResetState = false;
+ }
+ final WebClientServiceProvider webClientServiceProvider =
+
context.getProperty(WEB_CLIENT_PROVIDER).asControllerService(WebClientServiceProvider.class);
+
+ final String apiVersion =
context.getProperty(API_VERSION).evaluateAttributeExpressions().getValue();
+ final String baseUrl =
context.getProperty(STORE_DOMAIN).evaluateAttributeExpressions().getValue();
+ final String accessToken =
context.getProperty(ACCESS_TOKEN).evaluateAttributeExpressions().getValue();
+
+ final String category =
context.getProperty(OBJECT_CATEGORY).getValue();
+ final ResourceType resourceType = ResourceType.valueOf(category);
+ resourceName =
context.getProperty(propertyMap.get(resourceType)).getValue();
+ final String limit =
context.getProperty(RESULT_LIMIT).evaluateAttributeExpressions().getValue();
+
+ final ShopifyResource shopifyResource =
resourceType.getResource(resourceName);
+
+ shopifyRestService = getShopifyRestService(webClientServiceProvider,
apiVersion, baseUrl, accessToken, resourceName,
+ limit, shopifyResource.getIncrementalLoadingParameter());
+ }
+
+ ShopifyRestService getShopifyRestService(final WebClientServiceProvider
webClientServiceProvider, final String apiVersion,
+ final String baseUrl, final
String accessToken, final String resourceName,
+ final String limit, final
IncrementalLoadingParameter incrementalLoadingParameter) {
+ return new ShopifyRestService(
+ webClientServiceProvider,
+ apiVersion,
+ baseUrl,
+ accessToken,
+ resourceName,
+ limit,
+ incrementalLoadingParameter
+ );
+ }
+
+ @Override
+ protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+ @Override
+ public Set<Relationship> getRelationships() {
+ return RELATIONSHIPS;
+ }
+
+ @Override
+ public void onTrigger(final ProcessContext context, final ProcessSession
session) throws ProcessException {
+ final Map<String, String> stateMap = getStateMap(session);
+ final boolean isIncremental =
context.getProperty(IS_INCREMENTAL).asBoolean();
+ final String initialStartTime =
context.getProperty(INCREMENTAL_INITIAL_START_TIME).evaluateAttributeExpressions().getValue();
+ final Long incrDelayMs =
context.getProperty(INCREMENTAL_DELAY).evaluateAttributeExpressions().asTimePeriod(TimeUnit.MILLISECONDS);
+
+ IncrementalTimers timers = null;
+ if (isIncremental) {
+ timers = IncrementalTimers.ofState(stateMap, initialStartTime,
incrDelayMs, Instant.now());
+ }
+ String cursor = null;
+ HttpResponseEntity response = null;
+
+ do {
+ try {
+ if (cursor != null) {
+ response = shopifyRestService.getShopifyObjects(cursor);
+ } else if (isIncremental) {
+ response =
shopifyRestService.getShopifyObjects(timers.getStartTime(),
timers.getExclusiveEndTime());
+ } else {
+ response = shopifyRestService.getShopifyObjects();
+ }
+
+ final AtomicInteger objectCountHolder = new AtomicInteger();
+ cursor = getPageCursor(response);
+ if (response.statusCode() == HttpResponseStatus.OK.getCode()) {
+ FlowFile flowFile = session.create();
+ flowFile = session.write(flowFile,
parseHttpResponse(response, objectCountHolder));
+ if (cursor == null && isIncremental) {
+ final Map<String, String> updatedStateMap = new
HashMap<>(stateMap);
+ updatedStateMap.put(LAST_EXECUTION_TIME_KEY,
timers.getEndTime());
+ updateState(session, updatedStateMap);
+ }
+ if (objectCountHolder.get() > 0) {
+ session.transfer(flowFile, REL_SUCCESS);
+ } else {
+ getLogger().debug("Empty response when requested
Shopify resource: [{}]", resourceName);
+ session.remove(flowFile);
+ context.yield();
+ }
+ } else if (response.statusCode() < 200 ||
response.statusCode() >= 300) {
+ if (response.statusCode() == TOO_MANY_REQUESTS) {
+ context.yield();
+ throw new ProcessException(String.format(
+ "Rate limit exceeded, yielding before retrying
request. HTTP %d error for requested URI [%s]",
+ response.statusCode(), resourceName));
+ } else {
+ context.yield();
+ getLogger().warn("HTTP {} error for requested Shopify
resource [{}]", response.statusCode(),
+ resourceName);
+ }
+ }
+ } finally {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ getLogger().error("Could not close http response", e);
+ }
+ }
+
+ } while (cursor != null);
+ }
+
+ private String getPageCursor(HttpResponseEntity response) {
+ Optional<String> link = response.headers().getFirstHeader("Link");
+ String s = null;
+ if (link.isPresent()) {
+ final Matcher matcher = CURSOR_PATTERN.matcher(link.get());
+ while (matcher.find()) {
+ s = matcher.group(1);
+ }
+ }
+ return s;
+ }
+
+ private OutputStreamCallback parseHttpResponse(final HttpResponseEntity
response,
+ final AtomicInteger
objectCountHolder) {
+ return out -> {
+ try (JsonParser jsonParser =
JSON_FACTORY.createParser(response.body());
+ final JsonGenerator jsonGenerator =
JSON_FACTORY.createGenerator(out, JsonEncoding.UTF8)) {
+ while (jsonParser.nextToken() != null) {
+ if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME
&& jsonParser.getCurrentName()
+ .equals(resourceName)) {
+ jsonParser.nextToken();
+ jsonGenerator.writeStartArray();
+ while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
+ jsonGenerator.copyCurrentStructure(jsonParser);
+ objectCountHolder.incrementAndGet();
+ }
+ jsonGenerator.writeEndArray();
+ }
+ }
+ }
+ };
+ }
+
+ private Map<String, String> getStateMap(final ProcessSession session) {
+ StateMap state;
+ try {
+ state = session.getState(Scope.CLUSTER);
+ } catch (IOException e) {
+ throw new ProcessException("State retrieval failed", e);
+ }
+ return state.toMap();
+ }
+
+ void updateState(ProcessSession session, Map<String, String> newState) {
+ try {
+ session.setState(newState, Scope.CLUSTER);
+ } catch (IOException e) {
+ throw new ProcessException("State update failed", e);
+ }
+ }
+
+ private void clearState(ProcessContext context) {
+ try {
+ context.getStateManager().clear(Scope.CLUSTER);
+ } catch (IOException e) {
+ throw new ProcessException("Clearing state failed", e);
+ }
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/IncrementalLoadingParameter.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/IncrementalLoadingParameter.java
new file mode 100644
index 0000000000..42fe637d5b
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/IncrementalLoadingParameter.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.model;
+
+public enum IncrementalLoadingParameter {
+ CREATED_AT,
+ UPDATED_AT,
+ NONE
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/Resource.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/Resource.java
new file mode 100644
index 0000000000..8aa38093cf
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/Resource.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.model;
+
+import org.apache.nifi.components.AllowableValue;
+
+public interface Resource {
+
+ IncrementalLoadingParameter getIncrementalLoadingParameter();
+
+ AllowableValue getAllowableValue();
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceDirectory.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceDirectory.java
new file mode 100644
index 0000000000..6bf8e358d8
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceDirectory.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.model;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public class ResourceDirectory {
+
+ public static final List<ShopifyResource> CUSTOMER_RESOURCES =
+ Collections.singletonList(ShopifyResource.newInstance(
+ "customers",
+ "Customers",
+ "The Customer resource stores information about a shop's
customers, such as their contact details,"
+ + " their order history, and whether they've
agreed to receive email marketing.",
+ IncrementalLoadingParameter.UPDATED_AT
+ ));
+ public static final List<ShopifyResource> DISCOUNT_RESOURCES =
+ Collections.singletonList(ShopifyResource.newInstance(
+ "price_rules",
+ "Price Rules",
+ "The PriceRule resource can be used to get discounts using
conditions",
+ IncrementalLoadingParameter.UPDATED_AT
+ ));
+ public static final List<ShopifyResource> INVENTORY_RESOURCES =
+ Collections.singletonList(ShopifyResource.newInstance(
+ "locations",
+ "Locations",
+ "A location represents a geographical location where your
stores, pop-up stores, headquarters and warehouses exist.",
+ IncrementalLoadingParameter.NONE
+ ));
+ public static final List<ShopifyResource> ONLINE_STORE_RESOURCES =
+
Collections.unmodifiableList(Arrays.asList(ShopifyResource.newInstance(
+ "blogs",
+ "Blogs",
+ "Shopify shops come with a built-in blogging engine,
allowing a shop to have one or more blogs.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "comments",
+ "Comments",
+ "A comment is a reader's response to an article in a
blog.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "pages",
+ "Pages",
+ "Shopify stores come with a tool for creating basic HTML
web pages.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "redirects",
+ "Redirects",
+ "A redirect causes a visitor on a specific path on the
shop's site to be automatically sent to a different location.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "script_tags",
+ "Script Tags",
+ "The ScriptTag resource represents remote JavaScript code
that is loaded into the pages of a shop's storefront or the order status page
of checkout.",
+ IncrementalLoadingParameter.UPDATED_AT
+ ), ShopifyResource.newInstance(
+ "themes",
+ "Themes",
+ "A theme controls the look and feel of a Shopify online
store.",
+ IncrementalLoadingParameter.NONE
+ )));
+ public static final List<ShopifyResource> ORDER_RESOURCES =
+
Collections.unmodifiableList(Arrays.asList(ShopifyResource.newInstance(
+ "checkouts",
+ "Abandoned Checkouts",
+ "A checkout is considered abandoned after the customer has
added contact information, but before the customer has completed their
purchase.",
+ IncrementalLoadingParameter.UPDATED_AT
+ ), ShopifyResource.newInstance(
+ "draft_orders",
+ "Draft Orders",
+ "Merchants can use draft orders to create orders on behalf
of their customers.",
+ IncrementalLoadingParameter.UPDATED_AT
+ ), ShopifyResource.newInstance(
+ "orders",
+ "Orders",
+ "An order is a customer's request to purchase one or more
products from a shop.",
+ IncrementalLoadingParameter.UPDATED_AT
+ )));
+ public static final List<ShopifyResource> PRODUCT_RESOURCES =
+
Collections.unmodifiableList(Arrays.asList(ShopifyResource.newInstance(
+ "collects",
+ "Collects",
+ "Collects are meant for managing the relationship between
products and custom collections.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "custom_collections",
+ "Custom Collections",
+ "A custom collection is a grouping of products that a
merchant can create to make their store easier to browse. ",
+ IncrementalLoadingParameter.UPDATED_AT
+ ), ShopifyResource.newInstance(
+ "products",
+ "Products",
+ "Get products in a merchant's store ",
+ IncrementalLoadingParameter.UPDATED_AT
+ ), ShopifyResource.newInstance(
+ "smart_collections",
+ "Smart Collections",
+ "A smart collection is a grouping of products defined by
rules that are set by the merchant.",
+ IncrementalLoadingParameter.UPDATED_AT
+ )));
+ public static final List<ShopifyResource> SALES_CHANNEL_RESOURCES =
+
Collections.unmodifiableList(Arrays.asList(ShopifyResource.newInstance(
+ "collection_listings",
+ "Collection Listings",
+ "A CollectionListing resource represents a product
collection that a merchant has made available to your sales channel.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "product_listings",
+ "Product Listings",
+ "A ProductListing resource represents a Product which is
available to your sales channel.",
+ IncrementalLoadingParameter.UPDATED_AT
+ )));
+ public static final List<ShopifyResource> STORE_PROPERTY_RESOURCES =
+
Collections.unmodifiableList(Arrays.asList(ShopifyResource.newInstance(
+ "countries",
+ "Countries",
+ "The Country resource represents the tax rates applied to
orders from the different countries where a shop sells its products.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "currencies",
+ "Currencies",
+ "Merchants who use Shopify Payments can allow customers to
pay in their local currency on the online store.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "policies",
+ "Policies",
+ "Policy resource can be used to access the policies that a
merchant has configured for their shop, such as their refund and privacy
policies.",
+ IncrementalLoadingParameter.NONE
+ ), ShopifyResource.newInstance(
+ "shipping_zones",
+ "Shipping Zones",
+ "ShippingZone resource can be used to view shipping zones
and their countries, provinces, and shipping rates.",
+ IncrementalLoadingParameter.UPDATED_AT
+ )));
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceType.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceType.java
new file mode 100644
index 0000000000..b7bec1d854
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ResourceType.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.model;
+
+import java.util.List;
+import org.apache.nifi.components.AllowableValue;
+import org.apache.nifi.components.DescribedValue;
+
+public enum ResourceType implements DescribedValue {
+
+ CUSTOMERS(
+ "Customers",
+ "Query a Customer resource",
+ "Customer Category",
+ "Customer resource to query",
+ ResourceDirectory.CUSTOMER_RESOURCES
+ ),
+ DISCOUNTS(
+ "Discounts",
+ "Query a Discount resource",
+ "Discount Category",
+ "Discount resource to query",
+ ResourceDirectory.DISCOUNT_RESOURCES
+ ),
+ INVENTORY(
+ "Inventory",
+ "Query an Inventory resource",
+ "Inventory Category",
+ "Inventory resource to query",
+ ResourceDirectory.INVENTORY_RESOURCES
+ ),
+ ONLINE_STORE(
+ "Online Store",
+ "Query an Online Store resource",
+ "Online Store Category",
+ "Online Store resource to query",
+ ResourceDirectory.ONLINE_STORE_RESOURCES
+ ),
+ ORDERS(
+ "Orders",
+ "Query an Order resource",
+ "Order Category",
+ "Order resource to query",
+ ResourceDirectory.ORDER_RESOURCES
+ ),
+ PRODUCT(
+ "Products",
+ "Query a Product resource",
+ "Product Category",
+ "Product resource to query",
+ ResourceDirectory.PRODUCT_RESOURCES
+ ),
+ SALES_CHANNELS(
+ "Sales Channels",
+ "Query a Sales Channel resource",
+ "Sales Channel Category",
+ "Sales Channel resource to query",
+ ResourceDirectory.SALES_CHANNEL_RESOURCES
+ ),
+ STORE_PROPERTIES(
+ "Store Properties",
+ "Query a Store Property resource",
+ "Store Property Category",
+ "Store Property resource to query",
+ ResourceDirectory.STORE_PROPERTY_RESOURCES
+ );
+
+ private final String allowableValueDisplayName;
+ private final String allowableValueDescription;
+ private final String propertyDisplayName;
+ private final String propertyDescription;
+ private final List<ShopifyResource> resources;
+
+ ResourceType(
+ final String allowableValueDisplayName,
+ final String allowableValueDescription,
+ String propertyDisplayName, String propertyDescription,
List<ShopifyResource> resources
+ ) {
+ this.allowableValueDisplayName = allowableValueDisplayName;
+ this.allowableValueDescription = allowableValueDescription;
+ this.propertyDisplayName = propertyDisplayName;
+ this.propertyDescription = propertyDescription;
+ this.resources = resources;
+ }
+ @Override
+ public String getValue() {
+ return name();
+ }
+ @Override
+ public String getDisplayName() {
+ return allowableValueDisplayName;
+ }
+ @Override
+ public String getDescription() {
+ return allowableValueDescription;
+ }
+ public String getPropertyDescription() {
+ return propertyDescription;
+ }
+ public String getPropertyDisplayName() {
+ return propertyDisplayName;
+ }
+ public List<ShopifyResource> getResources() {
+ return resources;
+ }
+ public ShopifyResource getResource(final String value) {
+ return getResources().stream()
+ .filter(s -> s.getValue().equals(value))
+ .findFirst()
+ .get();
+ }
+ public AllowableValue[] getResourcesAsAllowableValues() {
+ return
getResources().stream().map(ShopifyResource::getAllowableValue).toArray(AllowableValue[]::new);
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ShopifyResource.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ShopifyResource.java
new file mode 100644
index 0000000000..11e6e82104
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/model/ShopifyResource.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.model;
+
+import org.apache.nifi.components.AllowableValue;
+import org.apache.nifi.components.DescribedValue;
+
+public class ShopifyResource implements DescribedValue, Resource {
+
+ private final String value;
+ private final String displayName;
+ private final String description;
+ private final IncrementalLoadingParameter incrementalLoadingParameter;
+
+ public ShopifyResource(final String value, final String displayName, final
String description,
+ final IncrementalLoadingParameter
incrementalLoadingParameter) {
+ this.value = value;
+ this.displayName = displayName;
+ this.description = description;
+ this.incrementalLoadingParameter = incrementalLoadingParameter;
+ }
+
+ public static ShopifyResource newInstance(final String value, final String
displayName, final String description,
+ final IncrementalLoadingParameter incrementalLoadingParameter) {
+ return new ShopifyResource(value, displayName, description,
incrementalLoadingParameter);
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public IncrementalLoadingParameter getIncrementalLoadingParameter() {
+ return incrementalLoadingParameter;
+ }
+
+ @Override
+ public AllowableValue getAllowableValue() {
+ return new AllowableValue(value, displayName, description);
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/rest/ShopifyRestService.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/rest/ShopifyRestService.java
new file mode 100644
index 0000000000..5bc7ad2f88
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/rest/ShopifyRestService.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.rest;
+
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processors.shopify.model.IncrementalLoadingParameter;
+import org.apache.nifi.web.client.api.HttpResponseEntity;
+import org.apache.nifi.web.client.api.HttpUriBuilder;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Locale;
+
+public class ShopifyRestService {
+
+ private static final String HTTPS = "https";
+ static final String ACCESS_TOKEN_KEY = "X-Shopify-Access-Token";
+
+ private final WebClientServiceProvider webClientServiceProvider;
+ private final String version;
+ private final String baseUrl;
+ private final String accessToken;
+ private final String resourceName;
+ private final String limit;
+ private final IncrementalLoadingParameter incrementalLoadingParameter;
+
+ public ShopifyRestService(
+ final WebClientServiceProvider webClientServiceProvider,
+ final String version,
+ final String baseUrl,
+ final String accessToken,
+ final String resourceName,
+ final String limit,
+ final IncrementalLoadingParameter incrementalLoadingParameter) {
+ this.webClientServiceProvider = webClientServiceProvider;
+ this.version = version;
+ this.baseUrl = baseUrl;
+ this.accessToken = accessToken;
+ this.resourceName = resourceName;
+ this.limit = limit;
+ this.incrementalLoadingParameter = incrementalLoadingParameter;
+ }
+
+ public HttpResponseEntity getShopifyObjects() {
+ final URI uri = getUri();
+ return retrieveResponse(uri);
+ }
+
+ public HttpResponseEntity getShopifyObjects(final String startTime, final
String endTime) {
+ final URI uri = getIncrementalUri(startTime, endTime);
+ return retrieveResponse(uri);
+ }
+
+ public HttpResponseEntity getShopifyObjects(final String cursor) {
+ final URI uri;
+ try {
+ uri = new URI(cursor);
+ } catch (URISyntaxException e) {
+ throw new ProcessException("Could not create URI from cursor while
paging", e);
+ }
+ return retrieveResponse(uri);
+ }
+
+ private HttpResponseEntity retrieveResponse(URI uri) {
+ return webClientServiceProvider.getWebClientService()
+ .get()
+ .uri(uri)
+ .header(ACCESS_TOKEN_KEY, accessToken)
+ .retrieve();
+ }
+
+ protected HttpUriBuilder getBaseUri() {
+ return webClientServiceProvider.getHttpUriBuilder()
+ .scheme(HTTPS)
+ .host(baseUrl)
+ .addPathSegment("admin")
+ .addPathSegment("api")
+ .addPathSegment(version)
+ .addPathSegment(resourceName + ".json");
+ }
+
+ URI getUri() {
+ final HttpUriBuilder uriBuilder = getBaseUri();
+ if (limit != null) {
+ uriBuilder.addQueryParameter("limit", limit);
+ }
+ return uriBuilder.build();
+ }
+
+ URI getIncrementalUri(final String startTime, final String endTime) {
+ final HttpUriBuilder uriBuilder = getBaseUri();
+ if (limit != null) {
+ uriBuilder.addQueryParameter("limit", limit);
+ }
+ if (incrementalLoadingParameter != IncrementalLoadingParameter.NONE) {
+ if (startTime != null) {
+ final String minTime =
incrementalLoadingParameter.name().toLowerCase(Locale.ROOT) + "_min";
+ uriBuilder.addQueryParameter(minTime, startTime);
+ }
+ final String maxTime =
incrementalLoadingParameter.name().toLowerCase(Locale.ROOT) + "_max";
+ uriBuilder.addQueryParameter(maxTime, endTime);
+ }
+
+ return uriBuilder.build();
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/util/IncrementalTimers.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/util/IncrementalTimers.java
new file mode 100644
index 0000000000..0477ec4872
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/java/org/apache/nifi/processors/shopify/util/IncrementalTimers.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.util;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.Map;
+
+public class IncrementalTimers {
+
+ static final Duration EXCLUSIVE_TIME_WINDOW_ADJUSTMENT =
Duration.ofMillis(1);
+ static final String LAST_EXECUTION_TIME_KEY = "last_execution_time";
+
+ private final String startTime;
+ private final String endTime;
+ private final String exclusiveEndTime;
+
+ private IncrementalTimers(String startTime, String endTime, String
exclusiveEndTime) {
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.exclusiveEndTime = exclusiveEndTime;
+ }
+
+ public static IncrementalTimers ofState(final Map<String, String>
stateMap, final String initialStartTime, final Long incrDelayMs,
+ Instant currentExecutionTime) {
+ String startTime = stateMap.get(LAST_EXECUTION_TIME_KEY);
+ if (startTime == null && initialStartTime != null) {
+ startTime = initialStartTime;
+ }
+
+ if (incrDelayMs != null) {
+ currentExecutionTime = currentExecutionTime.minus(incrDelayMs,
ChronoUnit.MILLIS);
+ }
+ currentExecutionTime =
currentExecutionTime.truncatedTo(ChronoUnit.SECONDS);
+ final String endTime = currentExecutionTime.toString();
+ final String exclusiveEndTime =
currentExecutionTime.minus(EXCLUSIVE_TIME_WINDOW_ADJUSTMENT).toString();
+ return new IncrementalTimers(startTime, endTime, exclusiveEndTime);
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public String getEndTime() {
+ return endTime;
+ }
+
+ public String getExclusiveEndTime() {
+ return exclusiveEndTime;
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
new file mode 100644
index 0000000000..54c5ecf117
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
@@ -0,0 +1,15 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+org.apache.nifi.processors.shopify.GetShopify
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/docs/org.apache.nifi.processors.shopify.GetShopify/additionalDetails.html
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/docs/org.apache.nifi.processors.shopify.GetShopify/additionalDetails.html
new file mode 100644
index 0000000000..5f76de72de
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/main/resources/docs/org.apache.nifi.processors.shopify.GetShopify/additionalDetails.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<head>
+ <meta charset="utf-8"/>
+ <title>GetShopify</title>
+ <link rel="stylesheet" href="../../../../../css/component-usage.css"
type="text/css"/>
+</head>
+
+<body>
+<h2>Setting Up a Custom App</h2>
+<p>
+ Follow the <a
href="https://help.shopify.com/en/manual/apps/custom-apps">Shopify tutorial</a>
to enable and create
+ private apps, set API Scopes and generate API tokens.
+</p>
+<h2>Incremental Loading</h2>
+<p>
+ Some resources can be processed incrementally by NiFi. This means that
only resources created or modified after the
+ last run time of the processor are displayed. The processor state can be
reset in the context menu. The following
+ list shows which date-time fields are incremented for which resources.
+<ul>
+ <li>Customers
+ <ul>
+ <li>Customers: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Discounts
+ <ul>
+ <li>Price Rules: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Inventory
+ <ul>
+ <li>Inventory Levels: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Online Store
+ <ul>
+ <li>Script Tags: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Orders
+ <ul>
+ <li>Abandoned Checkouts: updated_at_min</li>
+ <li>Draft Orders: updated_at_min</li>
+ <li>Orders: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Product
+ <ul>
+ <li>Custom Collections: updated_at_min</li>
+ <li>Products: updated_at_min</li>
+ <li>Smart Collections: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Sales Channels
+ <ul>
+ <li>Product Listings: updated_at_min</li>
+ </ul>
+ </li>
+ <li>Store Properties
+ <ul>
+ <li>Shipping Zones: updated_at_min</li>
+ </ul>
+ </li>
+</ul>
+
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/GetShopifyIT.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/GetShopifyIT.java
new file mode 100644
index 0000000000..a964c58580
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/GetShopifyIT.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify;
+
+import okhttp3.HttpUrl;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
+import org.apache.commons.io.IOUtils;
+import org.apache.nifi.processors.shopify.model.IncrementalLoadingParameter;
+import org.apache.nifi.processors.shopify.model.ResourceType;
+import org.apache.nifi.processors.shopify.rest.ShopifyRestService;
+import org.apache.nifi.reporting.InitializationException;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.MockProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.nifi.web.client.StandardHttpUriBuilder;
+import org.apache.nifi.web.client.api.HttpUriBuilder;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+import
org.apache.nifi.web.client.provider.service.StandardWebClientServiceProvider;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.time.Instant;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+class GetShopifyIT {
+
+ private static final String BASE_URL = "/test/shopify";
+ private static MockWebServer server;
+ private static HttpUrl baseUrl;
+
+ @BeforeEach
+ void setup() throws IOException {
+ server = new MockWebServer();
+ server.start();
+ baseUrl = server.url(BASE_URL);
+ }
+
+ @AfterEach
+ void tearDown() throws IOException {
+ if (server != null) {
+ server.shutdown();
+ server = null;
+ }
+ }
+
+ @Test
+ void testStateIsUpdatedIfIncrementalAndNotPaging() throws
InitializationException, IOException {
+ final String lastExecutionTimeKey = "last_execution_time";
+
+ final MockResponse mockResponse = new MockResponse()
+ .setResponseCode(200)
+ .setBody(getResourceAsString("simple_response.json"));
+
+ server.enqueue(mockResponse);
+
+ final StandardWebClientServiceProvider
standardWebClientServiceProvider =
+ new StandardWebClientServiceProvider();
+ final CustomGetShopify customGetShopify = spy(new CustomGetShopify());
+
+ TestRunner runner = TestRunners.newTestRunner(customGetShopify);
+ runner.addControllerService("standardWebClientServiceProvider",
standardWebClientServiceProvider);
+ runner.enableControllerService(standardWebClientServiceProvider);
+
+ runner.setProperty(GetShopify.WEB_CLIENT_PROVIDER,
standardWebClientServiceProvider.getIdentifier());
+ runner.setProperty(GetShopify.ACCESS_TOKEN, "testAccessToken");
+ runner.setProperty(GetShopify.OBJECT_CATEGORY,
ResourceType.PRODUCT.getValue());
+ runner.setProperty(GetShopify.STORE_DOMAIN, "test.shopify.nifi");
+ runner.setProperty(ResourceType.PRODUCT.getValue(), "products");
+ runner.setProperty(GetShopify.IS_INCREMENTAL, "true");
+
+ runner.run(1);
+
+ verify(customGetShopify).updateState(any(), any());
+ }
+
+ @Test
+ void testHttpError429() throws InitializationException {
+ server.enqueue(new MockResponse().setResponseCode(429));
+
+ final StandardWebClientServiceProvider
standardWebClientServiceProvider =
+ new StandardWebClientServiceProvider();
+ final CustomGetShopify customGetShopify = new CustomGetShopify();
+
+ TestRunner runner = TestRunners.newTestRunner(customGetShopify);
+ runner.addControllerService("standardWebClientServiceProvider",
standardWebClientServiceProvider);
+ runner.enableControllerService(standardWebClientServiceProvider);
+
+ runner.setProperty(GetShopify.WEB_CLIENT_PROVIDER,
standardWebClientServiceProvider.getIdentifier());
+ runner.setProperty(GetShopify.ACCESS_TOKEN, "testAccessToken");
+ runner.setProperty(GetShopify.OBJECT_CATEGORY,
ResourceType.PRODUCT.getValue());
+ runner.setProperty(GetShopify.STORE_DOMAIN, "test.shopify.nifi");
+ runner.setProperty(ResourceType.PRODUCT.getValue(), "products");
+
+ assertThrows(AssertionError.class, () -> runner.run(1));
+ assertTrue(((MockProcessContext)
runner.getProcessContext()).isYieldCalled(),
+ "In case of 429 the processor should be yielded.");
+ }
+
+ @Test
+ void testHttpError404() throws InitializationException {
+ server.enqueue(new MockResponse().setResponseCode(404));
+
+ final StandardWebClientServiceProvider
standardWebClientServiceProvider =
+ new StandardWebClientServiceProvider();
+ final CustomGetShopify customGetShopify = new CustomGetShopify();
+
+ TestRunner runner = TestRunners.newTestRunner(customGetShopify);
+ runner.addControllerService("standardWebClientServiceProvider",
standardWebClientServiceProvider);
+ runner.enableControllerService(standardWebClientServiceProvider);
+
+ runner.setProperty(GetShopify.WEB_CLIENT_PROVIDER,
standardWebClientServiceProvider.getIdentifier());
+ runner.setProperty(GetShopify.ACCESS_TOKEN, "testAccessToken");
+ runner.setProperty(GetShopify.OBJECT_CATEGORY,
ResourceType.PRODUCT.getValue());
+ runner.setProperty(GetShopify.STORE_DOMAIN, "test.shopify.nifi");
+ runner.setProperty(ResourceType.PRODUCT.getValue(), "products");
+
+ runner.run(1);
+
+ assertTrue(((MockProcessContext)
runner.getProcessContext()).isYieldCalled(),
+ "In case of 404 the processor should be yielded.");
+ }
+
+ @Test
+ void testNonEmptyJsonResponseSentToSuccess() throws
InitializationException, IOException {
+ final MockResponse mockResponse = new MockResponse()
+ .setResponseCode(200)
+ .setBody(getResourceAsString("collection_listings.json"));
+ server.enqueue(mockResponse);
+
+ final Instant expectedExecutionTime =
Instant.parse("2022-08-16T10:15:30Z");
+
+ final StandardWebClientServiceProvider
standardWebClientServiceProvider =
+ new StandardWebClientServiceProvider();
+ final CustomGetShopify customGetShopify = new CustomGetShopify();
+
+ TestRunner runner = TestRunners.newTestRunner(customGetShopify);
+ runner.addControllerService("standardWebClientServiceProvider",
standardWebClientServiceProvider);
+ runner.enableControllerService(standardWebClientServiceProvider);
+
+ runner.setProperty(GetShopify.WEB_CLIENT_PROVIDER,
standardWebClientServiceProvider.getIdentifier());
+ runner.setProperty(GetShopify.ACCESS_TOKEN, "testAccessToken");
+ runner.setProperty(GetShopify.OBJECT_CATEGORY,
ResourceType.SALES_CHANNELS.getValue());
+ runner.setProperty(GetShopify.STORE_DOMAIN, "test.shopify.nifi");
+ runner.setProperty(ResourceType.SALES_CHANNELS.getValue(),
"collection_listings");
+
+ runner.run(1);
+
+ List<MockFlowFile> flowFilesForRelationship =
runner.getFlowFilesForRelationship(GetShopify.REL_SUCCESS);
+ assertEquals(1, flowFilesForRelationship.size());
+ }
+
+ static class CustomGetShopify extends GetShopify {
+
+
+ @Override
+ ShopifyRestService getShopifyRestService(WebClientServiceProvider
webClientServiceProvider, String apiVersion,
+ String baseUrl, String
accessToken, String resourceName, String limit,
+ IncrementalLoadingParameter
incrementalLoadingParameter) {
+ return new CustomShopifyRestService(webClientServiceProvider,
apiVersion, baseUrl, accessToken,
+ resourceName, limit, incrementalLoadingParameter);
+ }
+ }
+
+ static class CustomShopifyRestService extends ShopifyRestService {
+
+ public CustomShopifyRestService(WebClientServiceProvider
webClientServiceProvider, String version,
+ String baseUrl, String accessToken,
String resourceName, String limit,
+ IncrementalLoadingParameter
incrementalLoadingParameter) {
+ super(webClientServiceProvider, version, baseUrl, accessToken,
resourceName,
+ limit, incrementalLoadingParameter);
+ }
+
+ @Override
+ protected HttpUriBuilder getBaseUri() {
+ return new StandardHttpUriBuilder()
+ .scheme(baseUrl.scheme())
+ .host(baseUrl.host())
+ .port(baseUrl.port())
+ .encodedPath(baseUrl.encodedPath());
+ }
+ }
+
+ private String getResourceAsString(final String resourceName) throws
IOException {
+ return IOUtils.toString(
+
this.getClass().getClassLoader().getResourceAsStream(resourceName),
+ StandardCharsets.UTF_8
+ );
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/rest/ShopifyRestServiceTest.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/rest/ShopifyRestServiceTest.java
new file mode 100644
index 0000000000..1403f9e1e0
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/rest/ShopifyRestServiceTest.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.rest;
+
+import org.apache.nifi.web.client.api.HttpRequestBodySpec;
+import org.apache.nifi.web.client.api.HttpRequestUriSpec;
+import org.apache.nifi.web.client.api.HttpResponseEntity;
+import org.apache.nifi.web.client.api.HttpUriBuilder;
+import org.apache.nifi.web.client.api.WebClientService;
+import org.apache.nifi.web.client.provider.api.WebClientServiceProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.net.URI;
+import java.util.Locale;
+
+import static
org.apache.nifi.processors.shopify.model.IncrementalLoadingParameter.CREATED_AT;
+import static
org.apache.nifi.processors.shopify.rest.ShopifyRestService.ACCESS_TOKEN_KEY;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+@ExtendWith(MockitoExtension.class)
+class ShopifyRestServiceTest {
+
+ private static final String VERSION = "v1";
+ private static final String TEST_URL = "www.test.shopify.com";
+ private static final String TEST_ACCESS_TOKEN = "testShopifyAccessToken";
+ private static final String TEST_RESOURCE_NAME = "testResource";
+ private static final String START_TIME = "2022-09-14T16:26:32.250Z";
+ private static final String END_TIME = "2022-09-14T16:27:54.112Z";
+ private static final String LIMIT = "2";
+
+ @Mock
+ private WebClientServiceProvider webClientServiceProvider;
+ @Mock
+ private WebClientService webClientService;
+ @Mock
+ private HttpUriBuilder uriBuilder;
+
+ @BeforeEach
+ void setup() {
+
doReturn(uriBuilder).when(webClientServiceProvider).getHttpUriBuilder();
+ doReturn(uriBuilder).when(uriBuilder).scheme(anyString());
+ doReturn(uriBuilder).when(uriBuilder).host(anyString());
+ doReturn(uriBuilder).when(uriBuilder).addPathSegment(anyString());
+ doReturn(URI.create(TEST_URL)).when(uriBuilder).build();
+ }
+
+ @Test
+ void testParameterAreAddedToUri() {
+ final ShopifyRestService shopifyRestService = new ShopifyRestService(
+ webClientServiceProvider,
+ VERSION,
+ TEST_URL,
+ TEST_ACCESS_TOKEN,
+ TEST_RESOURCE_NAME,
+ LIMIT,
+ CREATED_AT
+ );
+
+ doReturn(uriBuilder).when(uriBuilder).addQueryParameter(anyString(),
anyString());
+
+ shopifyRestService.getIncrementalUri(START_TIME, END_TIME);
+
+
verify(uriBuilder).addQueryParameter(CREATED_AT.toString().toLowerCase(Locale.ROOT)
+ "_min", START_TIME);
+
verify(uriBuilder).addQueryParameter(CREATED_AT.toString().toLowerCase(Locale.ROOT)
+ "_max", END_TIME);
+ verify(uriBuilder).addQueryParameter("limit", LIMIT);
+ }
+
+ @Test
+ void testGetShopifyObjects() {
+ final ShopifyRestService shopifyRestService = new ShopifyRestService(
+ webClientServiceProvider,
+ VERSION,
+ TEST_URL,
+ TEST_ACCESS_TOKEN,
+ TEST_RESOURCE_NAME,
+ LIMIT,
+ CREATED_AT
+ );
+
+ doReturn(uriBuilder).when(uriBuilder).addQueryParameter(anyString(),
anyString());
+
+ final HttpRequestUriSpec mockHttpRequestUriSpec =
mock(HttpRequestUriSpec.class);
+ final HttpRequestBodySpec mockHttpRequestBodySpec =
mock(HttpRequestBodySpec.class);
+ final HttpResponseEntity mockHttpResponseEntity =
mock(HttpResponseEntity.class);
+
+
doReturn(webClientService).when(webClientServiceProvider).getWebClientService();
+ doReturn(mockHttpRequestUriSpec).when(webClientService).get();
+
doReturn(mockHttpRequestBodySpec).when(mockHttpRequestUriSpec).uri(any());
+
doReturn(mockHttpRequestBodySpec).when(mockHttpRequestBodySpec).header(anyString(),
anyString());
+
doReturn(mockHttpResponseEntity).when(mockHttpRequestBodySpec).retrieve();
+
+ shopifyRestService.getShopifyObjects(START_TIME, END_TIME);
+
+ verify(mockHttpRequestUriSpec).uri(URI.create(TEST_URL));
+ verify(mockHttpRequestBodySpec).header(ACCESS_TOKEN_KEY,
TEST_ACCESS_TOKEN);
+ }
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/util/TestIncrementalTimers.java
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/util/TestIncrementalTimers.java
new file mode 100644
index 0000000000..7947ac5a0b
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/java/org/apache/nifi/processors/shopify/util/TestIncrementalTimers.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.shopify.util;
+
+import org.junit.jupiter.api.Test;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAccessor;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static
org.apache.nifi.processors.shopify.util.IncrementalTimers.EXCLUSIVE_TIME_WINDOW_ADJUSTMENT;
+import static
org.apache.nifi.processors.shopify.util.IncrementalTimers.LAST_EXECUTION_TIME_KEY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+
+class TestIncrementalTimers {
+
+ private static final Long INC_DELAY_MS = 3000L;
+ private static final String TEST_TIME_STRING = "2022-08-11T12:34:23Z";
+ private static final Instant CURRENT_EXECUTION_TIME =
Instant.parse(TEST_TIME_STRING);
+
+ @Test
+ void testInitialStartTime() {
+ final String initialStartTime = "2022-08-10T12:34:23Z";
+ final IncrementalTimers timers =
IncrementalTimers.ofState(Collections.emptyMap(), initialStartTime,
INC_DELAY_MS, CURRENT_EXECUTION_TIME);
+ assertEquals(initialStartTime, timers.getStartTime());
+ }
+
+ @Test
+ void testNextStartTimeIsLastExecutionTime() {
+ final String initialStartTime = "2022-08-10T12:34:23Z";
+ final String lastExecutionTime = "2022-08-11T12:34:23Z";
+ final Map<String, String> stateMap = new HashMap<>();
+ stateMap.put(LAST_EXECUTION_TIME_KEY, lastExecutionTime);
+ final IncrementalTimers timers = IncrementalTimers.ofState(stateMap,
initialStartTime, INC_DELAY_MS, CURRENT_EXECUTION_TIME);
+ assertEquals(lastExecutionTime, timers.getStartTime());
+ }
+
+ @Test
+ void testNextEndTimeIsCurrentExecutionTimeMinusDelay() {
+ final String expectedEndTime =
CURRENT_EXECUTION_TIME.minus(INC_DELAY_MS, ChronoUnit.MILLIS).toString();
+ final IncrementalTimers timers =
IncrementalTimers.ofState(Collections.emptyMap(), null, INC_DELAY_MS,
CURRENT_EXECUTION_TIME);
+ assertEquals(expectedEndTime, timers.getEndTime());
+ }
+
+ @Test
+ void testExclusiveEndTime() {
+ final String expectedEndTime =
CURRENT_EXECUTION_TIME.minus(INC_DELAY_MS,
ChronoUnit.MILLIS).minus(EXCLUSIVE_TIME_WINDOW_ADJUSTMENT).toString();
+ final IncrementalTimers timers =
IncrementalTimers.ofState(Collections.emptyMap(), null, INC_DELAY_MS,
CURRENT_EXECUTION_TIME);
+ assertEquals(expectedEndTime, timers.getExclusiveEndTime());
+ }
+
+ @Test
+ void testEndTimeIsTruncatedToSeconds() {
+ TemporalAccessor temporalAccessor =
DateTimeFormatter.ISO_LOCAL_DATE_TIME.withZone(ZoneId.systemDefault()).parse("2022-08-11T12:34:23.728");
+ final Instant currentExecutionTime = Instant.from(temporalAccessor);
+ final String expectedEndTime =
currentExecutionTime.truncatedTo(ChronoUnit.SECONDS).toString();
+ IncrementalTimers timers =
IncrementalTimers.ofState(Collections.emptyMap(), null, 0L,
currentExecutionTime);
+ assertEquals(expectedEndTime, timers.getEndTime());
+ }
+
+}
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/collection_listings.json
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/collection_listings.json
new file mode 100644
index 0000000000..f4312e2976
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/collection_listings.json
@@ -0,0 +1,26 @@
+{
+ "collection_listings": [
+ {
+ "collection_id": 423230505179,
+ "updated_at": "2022-08-25T14:42:49+02:00",
+ "body_html": "T-shirt collection",
+ "default_product_image": null,
+ "handle": "t-shirt-collection",
+ "image": null,
+ "title": "T-SHIRT COLLECTION",
+ "sort_order": "best-selling",
+ "published_at": "2022-08-25T14:42:49+02:00"
+ },
+ {
+ "collection_id": 418532262107,
+ "updated_at": "2022-08-25T14:42:49+02:00",
+ "body_html": null,
+ "default_product_image": null,
+ "handle": "frontpage",
+ "image": null,
+ "title": "Home page",
+ "sort_order": "best-selling",
+ "published_at": "2022-08-25T14:42:49+02:00"
+ }
+ ]
+}
\ No newline at end of file
diff --git
a/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/simple_response.json
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/simple_response.json
new file mode 100644
index 0000000000..6b19b8b2b2
--- /dev/null
+++
b/nifi-nar-bundles/nifi-shopify-bundle/nifi-shopify-processors/src/test/resources/simple_response.json
@@ -0,0 +1,235 @@
+{
+ "products": [
+ {
+ "id": 7805854580955,
+ "title": "GIFT CARD PRODUCT",
+ "body_html": "GIFT CARD PRODUCT DESCRIPTION 2",
+ "vendor": "nifi-test",
+ "product_type": "Gift Cards",
+ "created_at": "2022-08-25T14:18:34+02:00",
+ "handle": "gift-card-product",
+ "updated_at": "2022-09-14T19:45:39+02:00",
+ "published_at": "2022-08-25T14:18:35+02:00",
+ "template_suffix": "",
+ "status": "active",
+ "published_scope": "web",
+ "tags": "",
+ "admin_graphql_api_id": "gid://shopify/Product/7805854580955",
+ "variants": [
+ {
+ "product_id": 7805854580955,
+ "id": 43283647889627,
+ "title": "HUF 10.00",
+ "price": "10.00",
+ "sku": "",
+ "position": 1,
+ "inventory_policy": "deny",
+ "compare_at_price": null,
+ "fulfillment_service": "gift_card",
+ "inventory_management": null,
+ "option1": "HUF 10.00",
+ "option2": null,
+ "option3": null,
+ "created_at": "2022-08-25T14:18:34+02:00",
+ "updated_at": "2022-08-25T14:18:34+02:00",
+ "taxable": false,
+ "barcode": null,
+ "grams": 0,
+ "image_id": null,
+ "weight": 0.0,
+ "weight_unit": "kg",
+ "inventory_item_id": 45379904176347,
+ "inventory_quantity": 0,
+ "old_inventory_quantity": 0,
+ "requires_shipping": false,
+ "admin_graphql_api_id": "gid://shopify/ProductVariant/43283647889627"
+ },
+ {
+ "product_id": 7805854580955,
+ "id": 43283647922395,
+ "title": "HUF 25.00",
+ "price": "25.00",
+ "sku": "",
+ "position": 2,
+ "inventory_policy": "deny",
+ "compare_at_price": null,
+ "fulfillment_service": "gift_card",
+ "inventory_management": null,
+ "option1": "HUF 25.00",
+ "option2": null,
+ "option3": null,
+ "created_at": "2022-08-25T14:18:34+02:00",
+ "updated_at": "2022-08-25T14:18:34+02:00",
+ "taxable": false,
+ "barcode": null,
+ "grams": 0,
+ "image_id": null,
+ "weight": 0.0,
+ "weight_unit": "kg",
+ "inventory_item_id": 45379904209115,
+ "inventory_quantity": 0,
+ "old_inventory_quantity": 0,
+ "requires_shipping": false,
+ "admin_graphql_api_id": "gid://shopify/ProductVariant/43283647922395"
+ },
+ {
+ "product_id": 7805854580955,
+ "id": 43283647955163,
+ "title": "HUF 50.00",
+ "price": "50.00",
+ "sku": "",
+ "position": 3,
+ "inventory_policy": "deny",
+ "compare_at_price": null,
+ "fulfillment_service": "gift_card",
+ "inventory_management": null,
+ "option1": "HUF 50.00",
+ "option2": null,
+ "option3": null,
+ "created_at": "2022-08-25T14:18:34+02:00",
+ "updated_at": "2022-08-25T14:18:34+02:00",
+ "taxable": false,
+ "barcode": null,
+ "grams": 0,
+ "image_id": null,
+ "weight": 0.0,
+ "weight_unit": "kg",
+ "inventory_item_id": 45379904241883,
+ "inventory_quantity": 0,
+ "old_inventory_quantity": 0,
+ "requires_shipping": false,
+ "admin_graphql_api_id": "gid://shopify/ProductVariant/43283647955163"
+ },
+ {
+ "product_id": 7805854580955,
+ "id": 43283647987931,
+ "title": "HUF 100.00",
+ "price": "100.00",
+ "sku": "",
+ "position": 4,
+ "inventory_policy": "deny",
+ "compare_at_price": null,
+ "fulfillment_service": "gift_card",
+ "inventory_management": null,
+ "option1": "HUF 100.00",
+ "option2": null,
+ "option3": null,
+ "created_at": "2022-08-25T14:18:34+02:00",
+ "updated_at": "2022-08-25T14:18:34+02:00",
+ "taxable": false,
+ "barcode": null,
+ "grams": 0,
+ "image_id": null,
+ "weight": 0.0,
+ "weight_unit": "kg",
+ "inventory_item_id": 45379904274651,
+ "inventory_quantity": 0,
+ "old_inventory_quantity": 0,
+ "requires_shipping": false,
+ "admin_graphql_api_id": "gid://shopify/ProductVariant/43283647987931"
+ }
+ ],
+ "options": [
+ {
+ "product_id": 7805854580955,
+ "id": 9895977025755,
+ "name": "Denominations",
+ "position": 1,
+ "values": [
+ "HUF 10.00",
+ "HUF 25.00",
+ "HUF 50.00",
+ "HUF 100.00"
+ ]
+ }
+ ],
+ "images": [
+ {
+ "product_id": 7805854580955,
+ "id": 38106415759579,
+ "position": 1,
+ "created_at": "2022-08-25T14:18:36+02:00",
+ "updated_at": "2022-08-25T14:18:36+02:00",
+ "alt": null,
+ "width": 1536,
+ "height": 2048,
+ "src":
"https://cdn.shopify.com/s/files/1/0655/2967/5995/products/IMG_1189.jpg?v=1661429916",
+ "variant_ids": [],
+ "admin_graphql_api_id": "gid://shopify/ProductImage/38106415759579"
+ }
+ ],
+ "image": {
+ "product_id": 7805854580955,
+ "id": 38106415759579,
+ "position": 1,
+ "created_at": "2022-08-25T14:18:36+02:00",
+ "updated_at": "2022-08-25T14:18:36+02:00",
+ "alt": null,
+ "width": 1536,
+ "height": 2048,
+ "src":
"https://cdn.shopify.com/s/files/1/0655/2967/5995/products/IMG_1189.jpg?v=1661429916",
+ "variant_ids": [],
+ "admin_graphql_api_id": "gid://shopify/ProductImage/38106415759579"
+ }
+ },
+ {
+ "id": 7827749896411,
+ "title": "Orange",
+ "body_html": "Delicious orange 5",
+ "vendor": "nifi-test",
+ "product_type": "",
+ "created_at": "2022-09-12T19:42:38+02:00",
+ "handle": "orange",
+ "updated_at": "2022-09-14T19:45:28+02:00",
+ "published_at": "2022-09-12T19:42:39+02:00",
+ "template_suffix": "",
+ "status": "active",
+ "published_scope": "web",
+ "tags": "",
+ "admin_graphql_api_id": "gid://shopify/Product/7827749896411",
+ "variants": [
+ {
+ "product_id": 7827749896411,
+ "id": 43366361104603,
+ "title": "Default Title",
+ "price": "300.00",
+ "sku": "",
+ "position": 1,
+ "inventory_policy": "deny",
+ "compare_at_price": null,
+ "fulfillment_service": "manual",
+ "inventory_management": "shopify",
+ "option1": "Default Title",
+ "option2": null,
+ "option3": null,
+ "created_at": "2022-09-12T19:42:38+02:00",
+ "updated_at": "2022-09-14T19:45:28+02:00",
+ "taxable": true,
+ "barcode": "",
+ "grams": 0,
+ "image_id": null,
+ "weight": 0.0,
+ "weight_unit": "kg",
+ "inventory_item_id": 45462777725147,
+ "inventory_quantity": 0,
+ "old_inventory_quantity": 0,
+ "requires_shipping": true,
+ "admin_graphql_api_id": "gid://shopify/ProductVariant/43366361104603"
+ }
+ ],
+ "options": [
+ {
+ "product_id": 7827749896411,
+ "id": 9922772697307,
+ "name": "Title",
+ "position": 1,
+ "values": [
+ "Default Title"
+ ]
+ }
+ ],
+ "images": [],
+ "image": null
+ }
+ ]
+}
\ No newline at end of file
diff --git a/nifi-nar-bundles/nifi-shopify-bundle/pom.xml
b/nifi-nar-bundles/nifi-shopify-bundle/pom.xml
new file mode 100644
index 0000000000..817a814cb2
--- /dev/null
+++ b/nifi-nar-bundles/nifi-shopify-bundle/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>nifi-nar-bundles</artifactId>
+ <groupId>org.apache.nifi</groupId>
+ <version>1.18.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>nifi-shopify-bundle</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>nifi-shopify-nar</module>
+ <module>nifi-shopify-processors</module>
+ </modules>
+</project>
diff --git a/nifi-nar-bundles/pom.xml b/nifi-nar-bundles/pom.xml
index 5828cbce7b..e12cc226ce 100755
--- a/nifi-nar-bundles/pom.xml
+++ b/nifi-nar-bundles/pom.xml
@@ -118,6 +118,7 @@
<module>nifi-workday-bundle</module>
<module>nifi-box-bundle</module>
<module>nifi-flow-registry-client-bundle</module>
+ <module>nifi-shopify-bundle</module>
</modules>
<build>