If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Execute Data Object

The Execute Data Object process flow is a generic way to execute a stored procedure through the business logic framework in services.  Rather than force users to create a process flow for every stored procedure they want to execute, we created a generic one that should meet the majority of needs.  It does require naming your input parameters according to our naming conventions.  But if you can do that, it should save you a chunk of work.

The process flow has the following input properties:

Input PropertyType

Description

DataObjectNamestringThe name of the database object to execute
RequestobjectA POCO representing the client input
AuthenticatedAttributesobjectThe current authenticated attributes object for the caller.

This process flow will look at the input parameters declared on the database object referenced by 'DataObjectName'.  If the parameter name is in the format @ObjectName_ParameterName the process component will assume 'objectName' is an object that exists in the input properties, and attempt to look up a value 'parameterName' on that object.  There are three types of objects the component understands for ObjectName:

  • If the object is a primitive type its value is used for the DBO parameter.  
  • If the object is an instance of IInputContext then the component will ask the context object for the value of ParameterName and use that for the DBO parameter
  • If the object is a POCO and a public instance property exists on the object with the same name as 'ParameterName', the property will be retrieved used for the DBO parameter

Examples

Let's assume we have the following endpoint defined

{
  "endpoints": {
    "ExamplesGetSingleProduct": {
      "route": {
        "httpMethod": "GET",
        "segments": {
          "examples": {
            "isLiteral": true,
            "type": "string"
          },
          "products": {
            "isLiteral": true,
            "type": "string"
          },
          "productId": {
            "isLiteral": false,
            "type": "long"
          }
        }
      },
      "businessLogic": {
        "allProductsRetrieval": {
          "executionType": "processFlow",
          "processFlowProperties": {
            "processFlowName": "Execute Data Object",
            "processFlowParameters": {
              "DataObjectName": "spGeteBusiness6_0ProductCatalog",
              "authenticatedAttributes": "@AuthenticatedAttributes"
            }
          }
        }
      }
	  //remaining metadata omitted
    }
  }
}

We want spGeteBusiness6_0ProductCatalog to return product information for the requested product id and with pricing information appropriate for the current user.  If we define our database object like this:

CREATE PROCEDURE spGeteBusiness6_0ProductCatalog
(      
  @Request_ProductId INT,
  @AuthenticatedAttributes_AuthenticatedPrincipalRecordId INT
)
--stored procedure body ommitted 

The system will automatically map those parameters for you.  @Request_ProductId will have the product ID from the URL, and @ AuthenticatedAttributes_AuthenticatedPrincipalRecordId will be the logged in person ID, or the anonymous person if the user is not authenticated.  

Copyright © 2014-2019 Aptify - Confidential and Proprietary