Skip to main content

Create Full BOD Wrapper for Scripting

This Python package contains some functions to create a BOD wrapper after converting JSON data to XML

you can find the code to this file

createFullBOD.py

def createRoot(root):

the root parameter should be verb+noun like SyncItemMaster. It creates the root of the BOD

createRoot('Syncemployee')

<Syncemployee xmlns="http://schema.infor.com/InforOAGIS/2">
</Syncemployee>

def createApplArea(lid,compId):

It creates the ApplicationArea structure proving the LogicalID and ComponentID

createApplArea('lid://infor.ln','erp')

    <ApplicationArea>
        <Sender>
        <LogicalID>lid://infor.ln</LogicalID>
        <ComponentID>erp</ComponentID>
        <ConfirmationCode>OnError</ConfirmationCode>
        </Sender>
        <CreationDateTime>2019-10-09T12:02:44:270Z</CreationDateTime>
        <BODID>b3c8437e-ea8c-11e9-aad9-ca7d09e7940e</BODID>
    </ApplicationArea>

def createDataArea():

it creates just the DataArea tag

    <DataArea></DataArea>

def createVerb(verb,aev,locv,aexv):

it creates the Verb structure of the BOD providing the VERB = [Sync|Process|Acknowldge|....] plus the AccountingEntity, Location and Action = [Add|Change|Replace]

createVerb('Sync','AE','000','Add')

    <Sync>
      <AccountingEntityID>AE</AccountingEntityID>
      <LocationID>000</LocationID>
      <ActionCriteria>
        <ActionExpression actionCode="Add" />
      </ActionCriteria>
    </Sync>

def renameTag(xml, oldtag,newtag):

Giving an XML, it replaces the oldtag within the XML with the newtag

renameTag(XML,'element','employee')

From here:

  <element>
    <empnum>1001</empnum>
    <fullname>John Doe                                </fullname>
    <dateofhire>2009-08-28</dateofhire>
  </element>

To here:

  <employee>
    <empnum>1001</empnum>
    <fullname>John Doe                                </fullname>
    <dateofhire>2009-08-28</dateofhire>
  </employee>

def createFullBOD(verb,noun,lid,erp,ae,loc,action,body):

  • verb = Sync
  • noun = employee
  • lid = lid://infor.ln.1
  • erp = erp
  • ae = AE
  • loc = 000
  • action = Add
  • body = see below

the body parameter should be the JSON data converted in XML if we consider as JSON this array

[
	{
		"empnum": 1001,
		"fullname": "John Doe                                ",
		"dateofhire": "2009-08-28"
	},
	{
		"empnum": 1002,
		"fullname": "Jane Doe                                ",
		"dateofhire": "2009-08-28"
	},
	{
		"empnum": 1003,
		"fullname": "Tim Bone                                ",
		"dateofhire": "2014-01-01"
	}
]

the converted XML will be like this

<root>
  <element>
    <empnum>1001</empnum>
    <fullname>John Doe                                </fullname>
    <dateofhire>2009-08-28</dateofhire>
  </element>
  <element>
    <empnum>1002</empnum>
    <fullname>Jane Doe                                </fullname>
    <dateofhire>2009-08-28</dateofhire>
  </element>
  <element>
    <empnum>1003</empnum>
    <fullname>Tim Bone                                </fullname>
    <dateofhire>2014-01-01</dateofhire>
  </element>
</root>

if the JSON data has the format as above after the convert, you can invoke the function

createFullBOD('Sync','employee','lid://infor.ln.1','erp','AE','000','Add', body)

the result will be

<Syncemployee 
  xmlns="http://schema.infor.com/InforOAGIS/2">
  <ApplicationArea>
    <Sender>
      <LogicalID>lid://infor.ln.1</LogicalID>
      <ComponentID>erp</ComponentID>
      <ConfirmationCode>OnError</ConfirmationCode>
    </Sender>
    <CreationDateTime>2019-10-09T12:28:50:088Z</CreationDateTime>
    <BODID>5902f98a-ea90-11e9-bfec-427e59ba50c3</BODID>
  </ApplicationArea>
  <DataArea>
    <Sync>
      <AccountingEntityID>AE</AccountingEntityID>
      <LocationID>000</LocationID>
      <ActionCriteria>
        <ActionExpression actionCode="Add" />
      </ActionCriteria>
    </Sync>
    <employee>
      <empnum>1001</empnum>
      <fullname>John Doe                                </fullname>
      <dateofhire>2009-08-28</dateofhire>
    </employee>
    <employee>
      <empnum>1002</empnum>
      <fullname>Jane Doe                                </fullname>
      <dateofhire>2009-08-28</dateofhire>
    </employee>
    <employee>
      <empnum>1003</empnum>
      <fullname>Tim Bone                                </fullname>
      <dateofhire>2014-01-01</dateofhire>
    </employee>
  </DataArea>
</Syncemployee>

Contact: giampaolo.spagoni@infor.com

Release files for createFullBOD 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for createFullBOD 0.0.2
File Size Uploaded
createFullBOD-0.0.2.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for createFullBOD 0.0.2
File Interpreter ABI Platform
createFullBOD-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / createFullBOD-0.0.2.tar.gz

Download URL createFullBOD-0.0.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
926a07923860b96b0dc0b1fd101acedd94a0528f309b61aaf7a1e631f496acce
BLAKE2b-256 checksum
How to use checksums
98839b9db5ac3f3b17f2e7a1f064a27f7fad939bc85389cfbbb508e369ac112f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / createFullBOD-0.0.2-py3-none-any.whl

Download URL createFullBOD-0.0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43ddb0ef42f912588024eae43f8411ffbc0fe03330987542a728404d485e26a8
BLAKE2b-256 checksum
How to use checksums
03e39d64165ef09db8998f11b50b7558207a04c0a01861c7983715d3c03eb736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page