Skip to main content

create full structure of BOD dinamically

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

createFullBOD-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

createFullBOD-0.0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file createFullBOD-0.0.2.tar.gz.

File metadata

  • Download URL: createFullBOD-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for createFullBOD-0.0.2.tar.gz
Algorithm Hash digest
SHA256 926a07923860b96b0dc0b1fd101acedd94a0528f309b61aaf7a1e631f496acce
MD5 2935dc3a23b167547701ecd3771ca879
BLAKE2b-256 98839b9db5ac3f3b17f2e7a1f064a27f7fad939bc85389cfbbb508e369ac112f

See more details on using hashes here.

File details

Details for the file createFullBOD-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: createFullBOD-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for createFullBOD-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43ddb0ef42f912588024eae43f8411ffbc0fe03330987542a728404d485e26a8
MD5 2a15e35b6decbb66dbdb33871c692d14
BLAKE2b-256 03e39d64165ef09db8998f11b50b7558207a04c0a01861c7983715d3c03eb736

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page