community.k2.comcommunity.k2.com/pfxaw45692/attachments/pfxaw45… · web viewto add some spice to...

22
The Composite SmartObject Prepared by Joseph Dunagan with direction from Bob Maggio Introduction There is tremendous power and speed provided to the application layer developer by the SmartObject and its building block style model. Once an enterprise’s architecture begins to take shape, Service Objects interfacing with disparate systems provide the raw materials that SmartObjects consume and provide to the developer as a one stop shop for tame application data building blocks. For instance, one of the more common Composite SmartObjects, “Employee”, in essence provides a unified view of several service objects representing existing systems that house contact, department, human relations, payroll and performance data. Deploy underlying SmartBox SmartObjects First, you’ll need some service methods that you can drag into your Composite Smartobject.

Upload: others

Post on 23-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

The Composite SmartObjectPrepared by Joseph Dunagan with direction from Bob Maggio

IntroductionThere is tremendous power and speed provided to the application layer developer by the SmartObject and its building block style model. Once an enterprise’s architecture begins to take shape, Service Objects interfacing with disparate systems provide the raw materials that SmartObjects consume and provide to the developer as a one stop shop for tame application data building blocks.

For instance, one of the more common Composite SmartObjects, “Employee”, in essence provides a unified view of several service objects representing existing systems that house contact, department, human relations, payroll and performance data.

Deploy underlying SmartBox SmartObjectsFirst, you’ll need some service methods that you can drag into your Composite Smartobject.

The Employee SmartBox SmartObject provides basic employee information and fields to tie the employee to their SAP data, their manager and their department. It will provide the service methods for some of our EmployeeDetail data.

The Department SmartBox SmartObject provides department information and a ManagerID field. We will utilize the Employee!DepartmentID field to provide some more useful Department information for our EmployeeDetail data.

Note the default service methods that are created when you add a new SmartObject to your project,

these are the SmartBox service methods are the same exact methods you will have access to from your composite SmartObject later.

SmartObjects destined to have associations must be deployed without associations first. Go ahead and deploy the Department and Employee SmartObjects now so associations can be configured.

Create AssociationsAdding associations to the Employee SmartObject will improve reporting in several ways such as allowing the report user to select “automatically present related smartobjects”.:

Click “Associations”

Click “Add”

“Next”

Select “Department”and the appropriate relationship, “Next”

Manual association type, “Next”

“Assign” Employee!DepartmentID to Department!DepartmentID

“Finish”

To add some spice to life, why not setup the Manager association too, showing that a SmartObject can be related to itself:

Click “Add”

“Next”

Select the “Employee” SmartObject (itself) and provide the appropriate relationship for the Employee/Manager. Confused? Keep in mind that the first “Employee” mentioned in the frist two options refers to object you are editting. The first “Employee” in the 2nd two options is the Employee SmartObject that you are adding, “Next”

“Manually”, “Next”

“Finish”, Don’t forget to redeploy.

Create The Composite SmartObject FileCreate a new SmartObject to be your Composite SmartObject by right-clicking in the Solution Explorer > Add > New Item > SmartObject and providing a name such as EmployeeDetails

Click “Advanced Mode” at the top of the SmartObject editor.

Provides the ability to edit the SmartObject Methods at the bottom of the editor

Load MethodLet’s edit the “Load” method to get this SmartObject going somewhere, by highlighting the “Load” line-item and clicking the newly displayed “Edit” button.

The “Load” method is defaulted to a SmartBox service that will trigger the creation of a SmartBox SQL table upon deploy. However, we will be deleting that service method and adding two of our own – using an EmployeeID to pull some basic employee information from the existing SmartBox “Employee”, while resolving the DepartmentID stored there into some useful department information from the SmartBox “Department”.

You will select Advanced on the first wizard screen, and take the defaults on the 2nd and 3rd wizard screens:

On the Service Object Methods screen, highlight and delete the default Load method listed there clearing the listing, and click “Add”:

When you click the eplipse (…) icon to select a Service Object Method, you will be exposed to a host of resources. For now, you will be navigating here in the context of the Service Object Server(s) > SmartBox Service > etc. However, you can just as easily go beyond the SmartBox services and utilize AD, Sharepoint or any other service objects that you have configured in Appit.

First, select “Service Object Server(s) > Service Object Server > SmartBox Service > Employee > Load” and click “Add”:

Then immediately click “Create All” which will automap all of your inputs and outputs and click “OK”.Alternatively, if there are any fields you know you will never use, you can selectively create the required fields and bindings.

And again, Click “Add”, navigate to the “Service Object Server(s) > Service Object Server > SmartBox Service >Departments > Load” method and click “Add”. But WAIT, don’t click “Create All” yet this time, first click “AutoMap” which will map the fields that have been created already (specifically the Input Property DepartmentID). Now, go ahead and click “Create All” and you will be greeted with a friendly option to which you answer “No” so that you can keep the bindings you just created with “AutoMap”.. Don’t click “OK” yet.

In this example, a Manager ID is kept both for the Department and the Employee, so a choice must be made - Since I’m creating an EmployeeDetail SmartObject, I will manually unbind the Department’s ManagerID as pictured here:

And you end up with something that looks like this:

Finally click “OK” and you should see something like this, before clicking “Next” and “Finish”:

This is an explicit load method, so we do not see the Service Linking screen in the wizard this time.

You will see that with no coding and just a few clicks we have made considerable progress in the development of the Composite SmartObject. We now have all of our properties and datatypes defined and our Load method is complete. Adding a GetList method will be a snap…

Get List MethodGo ahead and highlight the “Get List” method and click Edit.

The default “GetList” method is still like the other defaulted SmartBox methods. Again, we will delete that service method and add two of our own – a criteria will be supplied to return a list of basic employee information from the existing SmartBox “Employee” while resolving each DepartmentID stored there into some readable useful department information from the SmartBox “Department”.

Again, select “Advanced” on the first wizard screen and take the defaults for the 2nd and 3rd screens:

On the Service Object Methods screen, highlight and delete the default Get List method listed there clearing the listing, and click “Add”:

Click the eplipse (…) icon to select a Service Object Method. You will be navigating here in the context of the Service Object Server(s) > SmartBox Service > etc.

First, select Service Object Server(s) > Service Object Server > SmartBox Service > Employee > GetList and click ADD:

And Click “Auto Map” and “OK”:

Again, Click “Add” and again click the eplipse (…) icon to select a Service Object Method. This time, we are looking for service Object Server(s) > Service Object Server > SmartBox Service > Department > GetList and click ADD:

Click “Auto Map” and remember to “Clear” the duplicate ManagerID binding and click “OK”:

.

Upon clicking “Next”, this Get List method will request that you define a join type or a “Service Method Link”.

Click “Auto Map” which will define a cross join, and then highlight the entry and click “Edit” to further restrict the join.

In our case, we are only looking up data in the Department so we have a real Department name and description when talking about our Employee, so we will customize the Link Type to be “All values for the first object”, click “OK” and then click “Finish” in our wizard:

Note that this time we were given a Serive Method Link screen and provided a default cross-join.

Highlight and “Remove” the “Create”, “Save” and “Delete” methods:

Deploying and utilizing the new composite SmartObject will yield just what we were looking for. Here is an example dataset based on the GetList Method with no search terms passed in, noted that the transformation of DepartmentID into “Name” and “Description” (towards the right) was successful:

Final NoteThe examples in this document display how unified views of data can be easily setup and managed in Appit. Furthermore, while these examples dealt specifically with default SmartBox based SmartObjects, these techniques could just as easily be used on SmartObjects based on completely autonomous backend platforms. At which point, as single SmartObject can treat logically related data that is stored in disparate backend systems as a single unit.