Lehel44 commented on code in PR #6301:
URL: https://github.com/apache/nifi/pull/6301#discussion_r947270902


##########
nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/java/org/apache/nifi/processors/hubspot/GetHubSpot.java:
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.hubspot;
+
+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.behavior.TriggerWhenEmpty;
+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.AllowableValue;
+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.util.StandardValidators;
+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.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@PrimaryNodeOnly
+@TriggerSerially
+@TriggerWhenEmpty
+@InputRequirement(Requirement.INPUT_FORBIDDEN)
+@Tags({"hubspot"})
+@CapabilityDescription("Retrieves JSON data from a private HubSpot 
application."
+        + " Supports incremental retrieval: Users can set the \"limit\" 
property which serves as the upper limit of the retrieved objects."
+        + " When this property is set the processor will retrieve new records. 
This processor is intended to be run on the Primary Node only.")
+@Stateful(scopes = Scope.CLUSTER, description = "When the 'Limit' attribute is 
set, the paging cursor is saved after executing a request."
+        + " Only the objects after the paging cursor will be retrieved. The 
maximum number of retrieved objects is the 'Limit' attribute."
+        + " State is stored across the cluster so that this Processor can be 
run on Primary Node only and if a new Primary Node is selected,"
+        + " the new node can pick up where the previous node left off, without 
duplicating the data.")
+public class GetHubSpot extends AbstractProcessor {
+
+    // OBJECTS
+
+    static final AllowableValue COMPANIES = new AllowableValue(
+            "/crm/v3/objects/companies",
+            "Companies",
+            "In HubSpot, the companies object is a standard CRM object. 
Individual company records can be used to store information about businesses" +
+                    " and organizations within company properties."
+    );
+    static final AllowableValue CONTACTS = new AllowableValue(
+            "/crm/v3/objects/contacts",
+            "Contacts",
+            "In HubSpot, contacts store information about individuals. From 
marketing automation to smart content, the lead-specific data found in" +
+                    " contact records helps users leverage much of HubSpot's 
functionality."
+    );
+    static final AllowableValue DEALS = new AllowableValue(
+            "/crm/v3/objects/deals",
+            "In HubSpot, a deal represents an ongoing transaction that a sales 
team is pursuing with a contact or company. It’s tracked through" +
+                    " pipeline stages until won or lost."
+    );
+    static final AllowableValue FEEDBACK_SUBMISSIONS = new AllowableValue(
+            "/crm/v3/objects/feedback_submissions",
+            "In HubSpot, feedback submissions are an object which stores 
information submitted to a feedback survey. This includes Net Promoter Score 
(NPS)," +
+                    " Customer Satisfaction (CSAT), Customer Effort Score 
(CES) and Custom Surveys."
+    );
+    static final AllowableValue LINE_ITEMS = new AllowableValue(
+            "/crm/v3/objects/line_items",
+            "Line Items",
+            "In HubSpot, line items can be thought of as a subset of products. 
When a product is attached to a deal, it becomes a line item. Line items can" +
+                    " be created that are unique to an individual quote, but 
they will not be added to the product library."
+    );
+    static final AllowableValue PRODUCTS = new AllowableValue(
+            "/crm/v3/objects/products",
+            "Products",
+            "In HubSpot, products represent the goods or services to be sold. 
Building a product library allows the user to quickly add products to deals," +
+                    " generate quotes, and report on product performance."
+    );
+    static final AllowableValue TICKETS = new AllowableValue(
+            "/crm/v3/objects/tickets",
+            "Tickets",
+            "In HubSpot, a ticket represents a customer request for help or 
support."
+    );
+    static final AllowableValue QUOTES = new AllowableValue(
+            "/crm/v3/objects/quotes",
+            "Quotes",
+            "In HubSpot, quotes are used to share pricing information with 
potential buyers."
+    );
+
+    // ENGAGEMENTS
+
+    private static final AllowableValue CALLS = new AllowableValue(
+            "/crm/v3/objects/calls",
+            "Calls",
+            "Get calls on CRM records and on the calls index page."
+    );
+    private static final AllowableValue EMAILS = new AllowableValue(
+            "/crm/v3/objects/emails",
+            "Emails",
+            "Get emails on CRM records."
+    );
+    private static final AllowableValue MEETINGS = new AllowableValue(
+            "/crm/v3/objects/meetings",
+            "Meetings",
+            "Get meetings on CRM records."
+    );
+    private static final AllowableValue NOTES = new AllowableValue(
+            "/crm/v3/objects/notes",
+            "Notes",
+            "Get notes on CRM records."
+    );
+    private static final AllowableValue TASKS = new AllowableValue(
+            "/crm/v3/objects/tasks",
+            "Tasks",
+            "Get tasks on CRM records."
+    );
+
+    // OTHER
+
+    private static final AllowableValue OWNERS = new AllowableValue(
+            "/crm/v3/owners/",
+            "Owners",
+            "HubSpot uses owners to assign specific users to contacts, 
companies, deals, tickets, or engagements. Any HubSpot user with access to 
contacts" +
+                    " can be assigned as an owner, and multiple owners can be 
assigned to an object by creating a custom property for this purpose."
+    );

Review Comment:
   I usually extract them if there are conditions on the allowable values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to