Skip to content

Bizapi Replacement

Creating bizapi replacement using projections

As we phase out the old bizapi functionality, and intend to build the integration functionality in the projections and expose through rest, we have built some support for this in Developer Studio. The structures can now be based on an entity:

structure MyStruct using MyEntity  

Inside the structure there is a new property called nestedwithcrud. This can be used to created structures from the entity that the structure is based on:

nestedwithcrud = Read, Create;  

Here we create a structure based on the entity MyEntity. The attributes used can be controlled by the 'use attributes', when overriding the entity. The 'using entity' construction can be used for other functionality as well, it is not related only to bizapi replacement. Then we have the new attribute nestedwithcrud, and now we are coming down to functionality more connected to the old bizapi's. By applying nestedwithcrud, Get and/or Create functionality will be generated, and added entity arrays and references will be treated as children in the types and functions generated. If the referred references and arrays in turn has references and arrays, these will also be added recursively. Using the example above, you will get these top level functions generated: Get_My_Struct_Rec___ and Create_My_Struct_Rec___. These will come with matching rec types as well. If there are arrays and/or references, the equivalent functions (with rec types) will be created for them as well, with the structure name as prefix, for example: Get_My_Struct_Inventory_Part_Rec___ By exposing the top functions Get_My_Struct_Rec___ and Create_My_Struct_Rec___ as actions you can call the rest service with json as input, and get and create data structures. Example:

FUNCTION My_Function___ (  
a_key_ IN VARCHAR2) RETURN My_Struct_Rec  
RETURN Get_My_Struct_Rec___(a_key_);  
END My_Function___  

Now, this can be used as an integration endpoint. Example of json body when calling create:


or get data using input values with json:


(Sometimes when you call the odata server after deploying a projection, you can get a 500 internal server error, sometimes dropping the database package and redeploying the projection can help.)

Alternative implementations when creating record

When data is being created the behavior might need to be tweaked a bit. The actual New method can be overridden (My_Struct_New in this example above). There are also functions called [Structname]_[Child]_Copy_From_Header___, which can be overridden, and are used to copy data from a header to a child, after the header has been created, but before the child is inserted. This can be used in case there is data created on insert that needs to be sent to the child, eg. order no. These functions have a new annotation in Base layer, called @Reimplementable, which means you can override them without using the keyword super inside the implementation body. The keyword super can be used if needed, but without it it will act pretty much as an overtake. It is perfectly fine to reimplement this, since the delivered functionality is just a default suggestion.

Get record as an xml structure

A function to create xml from the structure record is also generated, it is called [Structname]_Rec_To_Xml___. This can be useful in some scenarios, for example when creating outbound messages.

Call from plsql code

The code structure can also be deployed in the entity or utility database files, so outbound messages can be created directly from the plsql files, since it can be hard to access the plsvc code from there.

Tweak database column names

We have implemented a new keyword that can be used on an attribute, called alias, and it will change the displayed column name in odata. This is mainly intended to be used for integration projections.

alias = AnotherValue;  

There are a lot of details in the generated code, so a tip is to have a look at what is being generated if a better understanding is needed.