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 DataDocument for creating a view of required NetSuite Fields #4

Open
wants to merge 2 commits into
base: ns-fields-view-using-data-document
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions component.xml

This file was deleted.

65 changes: 65 additions & 0 deletions data/TestResourceData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-facade-xml type="test">

<dataDocuments dataDocumentId="Order" indexName="order_header" documentName="OrderHeader" primaryEntityName="org.apache.ofbiz.order.order.OrderHeader">
<fields fieldSeqId="01" fieldPath="orderId"/>
<fields fieldSeqId="02" fieldPath="orderName"/>
<fields fieldSeqId="03" fieldPath="org.apache.ofbiz.common.enum.Enumeration:description" fieldNameAlias="salesChannelEnumId"/>
<fields fieldSeqId="04" fieldPath="org.apache.ofbiz.order.order.OrderItem:orderItemSeqId"/>
<fields fieldSeqId="05" fieldPath="org.apache.ofbiz.order.order.OrderItem:productId"/>
<fields fieldSeqId="06" fieldPath="org.apache.ofbiz.order.order.OrderItem:unitPrice"/>
<fields fieldSeqId="07" fieldPath="org.apache.ofbiz.order.order.OrderItem:quantity" fieldNameAlias="orderQuantity"/>
<fields fieldSeqId="08" fieldPath="orderDate" defaultDisplay="N"/>
<fields fieldSeqId="42" fieldPath="(&quot;${orderDate.format('dd/MM/yyyy')}&quot;)" fieldNameAlias="orderDateFormatted"/>
<fields fieldSeqId="09" fieldPath="org.apache.ofbiz.order.order.OrderItem:org.apache.ofbiz.order.order.OrderAdjustment:orderAdjustmentTypeId" fieldNameAlias="orderAdjustmentTypeId"/>
<fields fieldSeqId="10" fieldPath="org.apache.ofbiz.order.order.OrderItem:org.apache.ofbiz.order.order.OrderAdjustment:amount" fieldNameAlias="amount"/>

<fields fieldSeqId="11" fieldPath="org.apache.ofbiz.order.order.OrderAdjustment:orderAdjustmentTypeId" fieldNameAlias="orderAdjustmentTypeIdSC"/>
<fields fieldSeqId="12" fieldPath="org.apache.ofbiz.order.order.OrderAdjustment:amount" fieldNameAlias="amountSC" functionName="sum"/>

<fields fieldSeqId="13" fieldPath="org.apache.ofbiz.order.order.OrderItem:org.apache.ofbiz.product.product.Product:org.apache.ofbiz.product.product.GoodIdentification:goodIdentificationTypeId" fieldNameAlias="goodIdentificationTypeId"/>
<fields fieldSeqId="14" fieldPath="org.apache.ofbiz.order.order.OrderItem:org.apache.ofbiz.product.product.Product:org.apache.ofbiz.product.product.GoodIdentification:idValue" fieldNameAlias="idValue"/>

<fields fieldSeqId="15" fieldPath="org.apache.ofbiz.order.order.OrderRole:org.apache.ofbiz.party.party.Party:org.apache.ofbiz.party.party.PartyIdentification:partyIdentificationTypeId" fieldNameAlias="partyIdentificationTypeId"/>
<fields fieldSeqId="16" fieldPath="org.apache.ofbiz.order.order.OrderRole:org.apache.ofbiz.party.party.Party:org.apache.ofbiz.party.party.PartyIdentification:idValue" fieldNameAlias="idValue"/>

<fields fieldSeqId="17" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:contactMechPurposeTypeId" fieldNameAlias="contactMechPurposeTypeId"/>
<fields fieldSeqId="18" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:toName" fieldNameAlias="billingAddressee"/>
<fields fieldSeqId="19" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:address1" fieldNameAlias="billingAddress1"/>
<fields fieldSeqId="20" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:address2" fieldNameAlias="billingAddress2"/>
<fields fieldSeqId="21" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:city" fieldNameAlias="billingCity"/>
<fields fieldSeqId="22" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:stateProvinceGeoId" fieldNameAlias="billingState"/>
<fields fieldSeqId="23" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:postalCode" fieldNameAlias="billingPostalCode"/>
<fields fieldSeqId="24" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.PostalAddress:Country:geoCode" fieldNameAlias="billingGeoCode"/>

<fields fieldSeqId="25" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:infoString" fieldNameAlias="billingEmail"/>

<fields fieldSeqId="26" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.TelecomNumber:countryCode" fieldNameAlias="billingCountryCode"/>
<fields fieldSeqId="27" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.TelecomNumber:areaCode" fieldNameAlias="billingAreaCode"/>
<fields fieldSeqId="28" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:org.apache.ofbiz.party.contact.TelecomNumber:contactNumber" fieldNameAlias="billingContactNumber"/>

<fields fieldSeqId="29" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:toName" fieldNameAlias="shippingAddressee"/>
<fields fieldSeqId="30" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:address1" fieldNameAlias="shippingAddress1"/>
<fields fieldSeqId="31" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:address2" fieldNameAlias="shippingAddress2"/>
<fields fieldSeqId="32" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:city" fieldNameAlias="shippingCity"/>
<fields fieldSeqId="33" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:stateProvinceGeoId" fieldNameAlias="shippingStateProvinceGeoId"/>
<fields fieldSeqId="34" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:org.apache.ofbiz.party.contact.PostalAddress:postalCode" fieldNameAlias="shippingPostalCode"/>

<fields fieldSeqId="36" fieldPath="org.apache.ofbiz.order.order.OrderContactMech:org.apache.ofbiz.party.contact.ContactMech:infoString" fieldNameAlias="shippingEmail"/>

<fields fieldSeqId="37" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:TelecomNumber:countryCode" fieldNameAlias="shippingCountryCode"/>
<fields fieldSeqId="38" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:TelecomNumber:areaCode" fieldNameAlias="shippingAreaCode"/>
<fields fieldSeqId="39" fieldPath="org.apache.ofbiz.order.order.OrderItemShipGroup:TelecomNumber:contactNumber" fieldNameAlias="shippingContactNumber"/>

<!-- Not Working, Fields are being evaluated to null
<fields fieldSeqId="40" fieldPath="(&quot;${shippingCountryCode?:'A'}${shippingAreaCode?:'B'}${shippingContactNumber?:'C'}&quot;)" fieldNameAlias="shippingPhone" fieldType="text"/>-->

<!-- <fields fieldSeqId="41" fieldPath="(&quot;${billingCountryCode?:'E'}${billingAreaCode?:'P'}${billingContactNumber?:'F'}&quot;)" fieldNameAlias="billingPhone" fieldType="text"/>-->

<conditions fieldNameAlias="goodIdentificationTypeId" operator="equals" fieldValue="NETSUITE_PRODUCT_ID" conditionSeqId="01"/>
<conditions fieldNameAlias="partyIdentificationTypeId" operator="equals" fieldValue="NETSUITE_CUSTOMER_ID" conditionSeqId="02"/>
<conditions fieldNameAlias="contactMechPurposeTypeId" operator="in" fieldValue="BILLING_EMAIL,BILLING_LOCATION,SHIPPING_EMAIL,PHONE_BILLING" conditionSeqId="03"/>
<conditions fieldNameAlias="orderAdjustmentTypeId" fieldValue="EXT_PROMO_ADJUSTMENT" conditionSeqId="04"/>
<conditions fieldNameAlias="orderAdjustmentTypeIdSC" fieldValue="SHIPPING_CHARGES" conditionSeqId="05"/>
</dataDocuments>
</entity-facade-xml>
Binary file added lib/mysql-connector-j-8.0.33.jar
Binary file not shown.
25 changes: 25 additions & 0 deletions service/co/hotwax/common/CommonServices.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://moqui.org/xsd/service-definition-3.xsd">
<service verb="search" noun="OrderDataDocument" type="inline" authenticate="anonymous-all">
<out-parameters>
<parameter name="output" allow-html="any"/>
</out-parameters>
<actions>
<script><![CDATA[
List<Map> docMapList = ec.entity.getDataDocuments("Order", null, null, null)
i = 0
]]></script>
<set field="output" from="new LinkedList()"/>
<iterate list="docMapList" entry="docMap">
<script>
i++
String docString = groovy.json.JsonOutput.toJson(docMap)
String prettyDocString = groovy.json.JsonOutput.prettyPrint(docString)
output.add(docMap)
if (i==5) break;
</script>
</iterate>
</actions>
</service>
</services>