Skip to content

Commit

Permalink
Added support for indexing product in OMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
mridulpathak committed Jan 29, 2025
1 parent 8663404 commit 664efcb
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 1 deletion.
58 changes: 58 additions & 0 deletions data/DocumentData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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.
-->
<entity-facade-xml type="seed-initial">
<dataDocuments dataDocumentId="OmsProduct" indexName="oms" documentName="Product"
primaryEntityName="org.apache.ofbiz.product.product.Product" documentTitle="ProductNameTemplate">
<fields fieldSeqId="01" fieldPath="productId"/>
<fields fieldSeqId="02" fieldPath="internalName"/>
<fields fieldSeqId="03" fieldPath="productName"/>
<fields fieldSeqId="04" fieldPath="productTypeId"/>
<fields fieldSeqId="05" fieldPath="detailImageUrl"/>
<fields fieldSeqId="06" fieldPath="primaryProductCategoryId"/>
<fields fieldSeqId="07" fieldPath="productWeight"/>
<fields fieldSeqId="08" fieldPath="shippingWeight"/>
<fields fieldSeqId="09" fieldPath="weightUomId"/>
<fields fieldSeqId="10" fieldPath="isVirtual"/>
<fields fieldSeqId="11" fieldPath="isVariant"/>

<fields fieldSeqId="12" fieldPath="categories:productCategoryId"/>
<fields fieldSeqId="13" fieldPath="categories:fromDate" fieldNameAlias="categoryFromDate"/>
<fields fieldSeqId="14" fieldPath="categories:thruDate" fieldNameAlias="categoryThruDate"/>

<fields fieldSeqId="15" fieldPath="featureAppls:productFeatureId"/>
<!--
<fields fieldSeqId="16" fieldPath="featureAppls:feature:featureType:description"/>
<fields fieldSeqId="17" fieldPath="featureAppls:feature:description"/>
-->
<fields fieldSeqId="18" fieldPath="featureAppls:fromDate" fieldNameAlias="featureFromDate"/>
<fields fieldSeqId="19" fieldPath="featureAppls:thruDate" fieldNameAlias="featureThruDate"/>

<fields fieldSeqId="20" fieldPath="identifications:goodIdentificationTypeId"/>
<fields fieldSeqId="21" fieldPath="identifications:idValue"/>
<fields fieldSeqId="22" fieldPath="identifications:fromDate" fieldNameAlias="identificationFromDate"/>
<fields fieldSeqId="23" fieldPath="identifications:thruDate" fieldNameAlias="identificationThruDate"/>

<fields fieldSeqId="24" fieldPath="keywords:keyword"/>
</dataDocuments>

<moqui.entity.feed.DataFeed dataFeedId="OmsProduct" dataFeedTypeEnumId="DTFDTP_RT_PUSH" indexOnStartEmpty="Y"
feedName="OMS Product Feed" feedReceiveServiceName="co.hotwax.oms.search.SearchServices.index#ProductSolr"
feedDeleteServiceName="org.moqui.search.SearchServices.delete#DataDocument">
<documents dataDocumentId="OmsProduct"/>
</moqui.entity.feed.DataFeed>
</entity-facade-xml>
2 changes: 1 addition & 1 deletion data/UpgradeData_V1.0.0.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-facade-xml type="seed">
<entity-facade-xml type="ext-upgrade">

<!-- EnumerationType and Enumeration data for product sync jobs -->
<moqui.basic.EnumerationType enumTypeId="PRODUCT_SYS_JOB" description="Product Jobs"/>
Expand Down
8 changes: 8 additions & 0 deletions entity/ProductExtendedEntities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ under the License.
<relationship type="many" related="org.apache.ofbiz.product.product.ProductKeyword" short-alias="keywords">
<key-map field-name="productId"/>
</relationship>
<relationship type="many" related="org.apache.ofbiz.product.category.ProductCategoryMember" short-alias="categories">
<key-map field-name="productId"/>
</relationship>
<relationship type="one" related="org.apache.ofbiz.product.category.ProductCategory" short-alias="primaryCategory">
<key-map field-name="primaryProductCategoryId"/>
</relationship>

<master>
<detail relationship="prices"/>
<detail relationship="featureAppls"/>
<detail relationship="assocs"/>
<detail relationship="identifications"/>
<detail relationship="keywords"/>
<detail relationship="categories"/>
<detail relationship="primaryCategory"/>
</master>
</extend-entity>
</entities>
16 changes: 16 additions & 0 deletions service/co/hotwax/oms/product/ProductServices.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<?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.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/service-definition-3.xsd">

Expand Down
38 changes: 38 additions & 0 deletions service/co/hotwax/oms/search/SearchServices.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/service-definition-3.xsd">
<service verb="index" noun="ProductSolr" authenticate="false">
<implements service="org.moqui.EntityServices.receive#DataFeed"/>
<actions>
<iterate list="documentList" entry="dataDocument">
<log level="info" message="Creating product index for oms productId : ${dataDocument._id}"/>
<service-call name="co.hotwax.oms.search.SearchServices.call#CreateProductIndex" in-map="[productId:dataDocument._id]"
async="true"/>
</iterate>
</actions>
</service>
<service verb="call" noun="CreateProductIndex" type="oms-rest" location="service/createProductIndex" method="post" authenticate="false">
<description>Call OMS cancelSalesOrderItems service.</description>
<in-parameters>
<parameter name="productId"/>
</in-parameters>
<out-parameters>
<parameter name="response" type="Map"/>
</out-parameters>
</service>
</services>
16 changes: 16 additions & 0 deletions service/co/hotwax/orderledger/system/FeedServices.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<?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.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://moqui.org/xsd/service-definition-3.xsd">

<service verb="consume" noun="OMSFeed" transaction-timeout="1800">
Expand Down

0 comments on commit 664efcb

Please sign in to comment.