Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added complete support for shopify bulk import mutation and bulk query. #24

Merged
merged 12 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 290 additions & 11 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ tasks.withType(GroovyCompile) { options.compilerArgs << "-proc:none" }

dependencies {
implementation project(':framework')

// https://mvnrepository.com/artifact/org.json/json
implementation 'org.json:json:20230618'
implementation 'org.apache.commons:commons-text:1.10.0'
}

// by default the Java plugin runs test on build, change to not do that (only run test if explicit task)
Expand Down
72 changes: 71 additions & 1 deletion data/ShopifyServiceJobData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ under the License.

<entity-facade-xml type="ext">

<!-- ServiceJob data to purge old SystemMessage records -->
<moqui.service.job.ServiceJob jobName="purge_OldSystemMessages" description="Purge Old System Messages"
serviceName="co.hotwax.impl.SystemMessageServices.purge#OldSystemMessages" cronExpression="0 0 * * *" paused="Y">
<parameters parameterName="purgeDays" parameterValue=""/><!-- defaults to 30 days -->
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for polling OMS Fulfilled Items Feed -->
<moqui.service.job.ServiceJob jobName="poll_SystemMessageSftp_OMSFulfillmentFeed" description="Poll OMS Fulfilled Items Feed"
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_OMSFulfillmentFeed" description="Poll OMS Fulfilled Items Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="OMSFulfillmentFeed"/>
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
Expand All @@ -35,4 +41,68 @@ under the License.
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
<parameters parameterName="lastRunTime" parameterValue=""/>
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for polling Product Tags Feed -->
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_ProductTagsFeed" description="Poll Product Tags Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="ProductTagsFeed"/>
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
<parameters parameterName="consumeSmrId" parameterValue=""/>
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for polling Product Variants Feed -->
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_ProductVariantsFeed" description="Poll Product Variants Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="ProductVariantsFeed"/>
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
<parameters parameterName="consumeSmrId" parameterValue=""/>
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for sending next bulk mutation system message in queue for shopify bulk import -->
<moqui.service.job.ServiceJob jobName="send_ProducedBulkOperationSystemMessage_ShopifyBulkImport" description="Send next bulk mutation system message in queue for shopify bulk import"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#ProducedBulkOperationSystemMessage" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="parentSystemMessageTypeId" parameterValue="ShopifyBulkImport"/>
<parameters parameterName="retryLimit" parameterValue=""/><!-- Defaults to 3 -->
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for sending next bulk query system message in queue-->
<moqui.service.job.ServiceJob jobName="send_ProducedBulkOperationSystemMessage_ShopifyBulkQuery" description="Send next bulk query system message in queue"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#ProducedBulkOperationSystemMessage" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="parentSystemMessageTypeId" parameterValue="ShopifyBulkQuery"/>
<parameters parameterName="retryLimit" parameterValue=""/><!-- Defaults to 3 -->
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for polling current bulk operation mutation result -->
<moqui.service.job.ServiceJob jobName="poll_BulkOperationResult_ShopifyBulkImport" description="Poll current bulk operation mutation result"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.poll#BulkOperationResult" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="parentSystemMessageTypeId" parameterValue="ShopifyBulkImport"/>
<parameters parameterName="consumeSmrId" parameterValue=""/><!-- For sending the result file to SFTP server -->
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for polling current bulk operation query result -->
<moqui.service.job.ServiceJob jobName="poll_BulkOperationResult_ShopifyBulkQuery" description="Poll current bulk operation query result"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.poll#BulkOperationResult" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="parentSystemMessageTypeId" parameterValue="ShopifyBulkQuery"/>
<parameters parameterName="consumeSmrId" parameterValue=""/><!-- For sending the result file to SFTP server -->
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for queuing bulk variants metafield query -->
<moqui.service.job.ServiceJob jobName="queue_BulkQuerySystemMessage_BulkVariantsMetafieldQuery" description="Queue bulk variants metafield query"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.queue#BulkQuerySystemMessage" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="BulkVariantsMetafieldQuery"/>
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
<parameters parameterName="filterQuery" parameterValue=""/>
<parameters parameterName="fromDate" parameterValue=""/>
<parameters parameterName="thruDate" parameterValue=""/>
</moqui.service.job.ServiceJob>

<!-- ServiceJob data for queuing bulk order metafields query -->
<moqui.service.job.ServiceJob jobName="queue_BulkQuerySystemMessage_BulkOrderMetafieldsQuery" description="Queue bulk order metafields query"
serviceName="co.hotwax.shopify.system.ShopifySystemMessageServices.queue#BulkQuerySystemMessage" cronExpression="0 0/15 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="BulkOrderMetafieldsQuery"/>
<parameters parameterName="systemMessageRemoteId" parameterValue=""/>
<parameters parameterName="filterQuery" parameterValue=""/>
<parameters parameterName="fromDate" parameterValue=""/>
<parameters parameterName="thruDate" parameterValue=""/>
</moqui.service.job.ServiceJob>
</entity-facade-xml>
103 changes: 102 additions & 1 deletion data/ShopifySetupSeedData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,117 @@ under the License.
<moqui.basic.Enumeration description="Shopify Shop Read Only Access" enumId="SHOP_READ_ACCESS" enumTypeId="ShopifyShopAccessScope"/>
<moqui.basic.Enumeration description="Shopify Shop Read and Write Access" enumId="SHOP_READ_WRITE_ACCESS" enumTypeId="ShopifyShopAccessScope"/>

<!-- EnumerationType for Shopify system message type enum and relationship -->
<moqui.basic.EnumerationType description="Shopify System Message Type Enum" enumTypeId="ShopifyMessageTypeEnum"/>
<!-- Enumerations for defining relation between two system message types for the purpose of creating consecutive system messages -->
<moqui.basic.Enumeration description="Send Bulk Update Product Tags Result" enumId="SendBulkUpdateProductTagsResult" enumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Bulk Update Product Tags" enumId="BulkUpdateProductTags" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="SendBulkUpdateProductTagsResult" relatedEnumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Product Tags Feed" enumId="ProductTagsFeed" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="BulkUpdateProductTags" relatedEnumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Send Bulk Update Product Variants Result" enumId="SendBulkUpdateProductVariantsResult" enumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Bulk Update Product Variants" enumId="BulkUpdateProductVariants" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="SendBulkUpdateProductVariantsResult" relatedEnumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Product Variants Feed" enumId="ProductVariantsFeed" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="BulkUpdateProductVariants" relatedEnumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Send Bulk Variants Metafield Query Result" enumId="SendBulkVariantsMetafieldQueryResult" enumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Bulk Variants Metafield Query" enumId="BulkVariantsMetafieldQuery" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="SendBulkVariantsMetafieldQueryResult" relatedEnumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Send Bulk Order Metafields Query Result" enumId="SendBulkOrderMetafieldsQueryResult" enumTypeId="ShopifyMessageTypeEnum"/>
<moqui.basic.Enumeration description="Bulk Order Metafields Query" enumId="BulkOrderMetafieldsQuery" enumTypeId="ShopifyMessageTypeEnum" relatedEnumId="SendBulkOrderMetafieldsQueryResult" relatedEnumTypeId="ShopifyMessageTypeEnum"/>

<!-- Parent SystemMessageType record for incoming and outgoing local feed file system message types -->
<moqui.service.message.SystemMessageType systemMessageTypeId="LocalFeedFile" description="Local Feed File"/>

<!-- SystemMessageType record for creating Shopify Fulfillment -->
<moqui.service.message.SystemMessageType systemMessageTypeId="CreateShopifyFulfillment" description="Create Shopify Fulfillment System Message"
sendServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#ShopifyFulfillmentSystemMessage"/>

<!-- SystemMessageType record for importing OMS Fulfillment Feed -->
<moqui.service.message.SystemMessageType systemMessageTypeId="OMSFulfillmentFeed"
description="Create OMS Fulfillment Feed System Message"/>
description="Create OMS Fulfillment Feed System Message"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#FulfillmentFeed"
receivePath="" receiveResponseEnumId="MsgRrMove" receiveMovePath=""/>

<!-- SystemMessageType record for sending Shopify Fulfillment Ack Feed (sendPath = sftp directory) -->
<moqui.service.message.SystemMessageType systemMessageTypeId="SendShopifyFulfillmentAck" description="Send Shopify Fulfillment Ack Feed"
parentTypeId="LocalFeedFile"
sendServiceName="co.hotwax.ofbiz.SystemMessageServices.send#SystemMessageFileSftp"
sendPath=""/>

<!-- SystemMessageType record for importing Product Tags Feed -->
<moqui.service.message.SystemMessageType systemMessageTypeId="ProductTagsFeed"
description="Create Product Tags Feed System Message"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#GraphQLBulkImportFeed"
receivePath="" receiveResponseEnumId="MsgRrMove" receiveMovePath=""/>

<!-- Parent SystemMessageType for all the shopify bulk import mutation system message types -->
<moqui.service.message.SystemMessageType systemMessageTypeId="ShopifyBulkImport" description="Parent SystemMessageType for Shopify Bulk Imports"/>

<!-- Parent SystemMessageType for all the shopify bulk query system message types -->
<moqui.service.message.SystemMessageType systemMessageTypeId="ShopifyBulkQuery" description="Parent SystemMessageType for Shopify Bulk Query"/>

<!-- SystemMessageType record for updating product tags in Shopify -->
<moqui.service.message.SystemMessageType systemMessageTypeId="BulkUpdateProductTags" description="Create Update Product Tags System Message"
parentTypeId="ShopifyBulkImport"
sendServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#BulkMutationSystemMessage"
sendPath="component://shopify-connector/template/graphQL/BulkUpdateProductTags.ftl"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#BulkOperationResult"
receivePath="${contentRoot}/shopify/ProductTagsFeed/result/BulkOperationResult-${systemMessageId}-${remoteMessageId}-${nowDate}.jsonl"/>

<!-- SystemMessageType record for sending bulk update product tags result to SFTP -->
<moqui.service.message.SystemMessageType systemMessageTypeId="SendBulkUpdateProductTagsResult"
description="Send Bulk Update Product Tags Result"
parentTypeId="LocalFeedFile"
sendServiceName="co.hotwax.ofbiz.SystemMessageServices.send#SystemMessageFileSftp"
sendPath=""/>

<!-- SystemMessageType record for importing Product Variants Feed -->
<moqui.service.message.SystemMessageType systemMessageTypeId="ProductVariantsFeed"
description="Create Product Variants Feed System Message"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#GraphQLBulkImportFeed"
receivePath="" receiveResponseEnumId="MsgRrMove" receiveMovePath=""/>

<!-- SystemMessageType record for updating product variants in Shopify -->
<moqui.service.message.SystemMessageType systemMessageTypeId="BulkUpdateProductVariants" description="Create Update Product Variants System Message"
parentTypeId="ShopifyBulkImport"
sendServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#BulkMutationSystemMessage"
sendPath="component://shopify-connector/template/graphQL/BulkUpdateProductVariants.ftl"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#BulkOperationResult"
receivePath="${contentRoot}/shopify/ProductVariantsFeed/result/BulkOperationResult-${systemMessageId}-${remoteMessageId}-${nowDate}.jsonl"/>

<!-- SystemMessageType record for sending bulk update product variants result to SFTP -->
<moqui.service.message.SystemMessageType systemMessageTypeId="SendBulkUpdateProductVariantsResult"
description="Send Bulk Update Product Variants Result"
parentTypeId="LocalFeedFile"
sendServiceName="co.hotwax.ofbiz.SystemMessageServices.send#SystemMessageFileSftp"
sendPath=""/>

<!-- SystemMessageType record for bulk variant metafield query to Shopify -->
<moqui.service.message.SystemMessageType systemMessageTypeId="BulkVariantsMetafieldQuery" description="Bulk Variants Metafield Query System Message"
parentTypeId="ShopifyBulkQuery"
sendServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#BulkQuerySystemMessage"
sendPath="component://shopify-connector/template/graphQL/BulkVariantsMetafieldQuery.ftl"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#BulkOperationResult"
receivePath="${contentRoot}/shopify/BulkVariantsMetafieldFeed/BulkOperationResult-${systemMessageId}-${remoteMessageId}-${nowDate}.jsonl"/>

<!-- SystemMessageType record for sending bulk variants metafield query result to SFTP -->
<moqui.service.message.SystemMessageType systemMessageTypeId="SendBulkVariantsMetafieldQueryResult"
description="Send Bulk Variants Metafield Query Result"
parentTypeId="LocalFeedFile"
sendServiceName="co.hotwax.ofbiz.SystemMessageServices.send#SystemMessageFileSftp"
sendPath=""/>

<!-- SystemMessageType record for bulk order metafields query to Shopify -->
<moqui.service.message.SystemMessageType systemMessageTypeId="BulkOrderMetafieldsQuery" description="Bulk Order Metafields Query System Message"
parentTypeId="ShopifyBulkQuery"
sendServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.send#BulkQuerySystemMessage"
sendPath="component://shopify-connector/template/graphQL/BulkOrderMetafieldsQuery.ftl"
consumeServiceName="co.hotwax.shopify.system.ShopifySystemMessageServices.consume#BulkOperationResult"
receivePath="${contentRoot}/shopify/BulkOrderMetafieldsFeed/BulkOperationResult-${systemMessageId}-${remoteMessageId}-${nowDate}.jsonl"/>

<!-- SystemMessageType record for sending bulk order metafields query result to SFTP -->
<moqui.service.message.SystemMessageType systemMessageTypeId="SendBulkOrderMetafieldsQueryResult"
description="Send Bulk Order Metafields Query Result"
parentTypeId="LocalFeedFile"
sendServiceName="co.hotwax.ofbiz.SystemMessageServices.send#SystemMessageFileSftp"
sendPath=""/>

Expand Down
Loading