Dependency Extensibility Examples

Dependency Extensibility Use Case

The purpose of this use case is to help users understand how the Configuration files must be created to integrate their business-specific cases in the analysis.

This use case is created to cover the situation when a user creates mappings between transactions and programs.

The API_Dependency.json file specifies the APIs that return mappings between resources.
Note: Each API has a name and label. The APIs for dependencies have the attribute "type":"post_build".
{  
    "info":
   {
       "version":"5.1.0"
   },
    "extensions":  
    [
        {
          "apiKey":"a2",
          "name":"MAPPING_TRAN",
          "type":"post_build"
        }
    ]
}
The ue-config.json file specifies the type of user exit file and the path where the user exit file for a certain dependency API is located.
{
  "schemaVersion":"1.0.1",
  "documentVersion":"1.0.1",
  "ueConfig" :[
   {"name": "uejson",
    "type":"dependency-file-json",
    "location":"D:/EZSourceBuildProjects/API_JCL_PROJECTS/DOC_JCL_DEP/API Config/Resolutions/resolutionDEP.json",
    "appliesTo":["a2"]    
   }
]
}
The resolutionDEP.json file contains the mapping of resources that are returned by the "MAPPING_TRAN" API. In this specific case the mappings are as follows:
  • Transaction "TRAN1" to program "PROGRAM1"
  • Transaction "TRAN2" to program "PROGRAM2"
The following annotations are present in the resolutionDEP.json file:
  • For PROGRAM1 - annotation "annText": "ANNOTATION3" and annotation keyword "annKeyword" : "API_RESOLUTION".
  • For PROGRAM2 - annotation "annText": "ANNOTATION4" and annotation keyword "annKeyword" : "API_RESOLUTION".
The AD analysis shows the links between the mentioned resources.
{
	"schemaVersion": "1.0.0",
	"documentVersion": "1.0.0",
	"entries": [{
		"input": {
			"apiKey": "a2",
			"apiText": "MAPPING_TRAN"
		},
		"resolutions": [{
			"action": "dependency",
			"source": {
				"resourceType": "GenericTransaction",
				"value": "TRAN1"
			},
			"target": {
				"resourceType": "CobolProgram",
				"value": "PROGRAM1",
				"annText": "ANNOTATION3",
				"annKeyword" : "API_RESOLUTION"
			}
		},{
			"action": "dependency",
			"source": {
				"resourceType": "GenericTransaction",
				"value": "TRAN2"
			},
			"target": {
				"resourceType": "CobolProgram",
				"value": "PROGRAM2",
				"annText": "ANNOTATION4",
				"annKeyword" : "API_RESOLUTION"
			}
		} ]
	}]
}

JSON Schemas

Schema for Dependency API_Dependency.json

A new configuration file is introduced. The API for dependency has a new type of attribute "type": "post_build".

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "AD Extensibility dependencies definition file",
    "type": "object",
    "properties": {
        "info": {
            "type": "object",
            "properties": {
                "version": {
                    "type": "string",
                    "description": "The extension file version",
                    "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+"
                }
            },
            "required": [
                "version"
            ]
        },
        "extensions": {
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/definitions/Extension"
            }
        }
    },
    "required": [
        "info",
        "extensions"
    ],
    "definitions": {
      "Extension": 
      {
        "type": "object",
        "properties": {
          "apiKey": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "post_build"
            ],
            "description": "Extension for dependencies",
            "minLength": 1
          }
        },
        "required": [
          "apiKey",
          "name",
          "type"
        ],
        "additionalProperties": false
      }
    }
}
}

The ue-config.json schema, present in the API/Macro Call Extensibility Examples introduces a new API type "type":"dependency-file-json".

Schema for Dependency resolution.json
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "version": "1.0.0",
    "type": "object",
    "description": "The json schema for a file-json based AD dependency resolutions.",
    "properties": {
        "schemaVersion": {
            "description": "This json schema version.",
            "$ref": "#/definitions/versionDef"
        },
        "documentVersion": {
            "description": "The user exit dependency json file version.",
            "$ref": "#/definitions/versionDef"
        },
        "entries": {
            "type": "array",
            "description": "An array containing the user exit dependency content.",
            "items": {
                "type": "object",
                "description": "A user exit dependency content object.",
                "properties": {
                    "input": {
                        "type": "object",
                        "description": "An object which contains the inputs for the user exit dependency.",
                        "properties": {
                            "apiKey": {
                                "type": "string",
                                "description": "The parameter key as defined in the API config json."
                            },
                            "apiText": {
                                "type": "string",
                                "description": "The name of the API_NOT_SOURCE as defined in the API config json."
                            }
                        },
                        "required": [
                            "apiKey"
                        ],
                        "additionalProperties": false
                    },
					"resolutions": {
                        "type": "array",
                        "description": "An array which contains the user exit resolution objects.",
                        "properties": {
                        	"action": {
								"type": "string",
								"description" : "The name of the action, expect dependency.",
								"enum": [
									"dependency"
								]
							},
                        	"source": {
                        		"$ref": "#/definitions/sourceDef"
                        	},
                        	"target": {
                        		"$ref": "#/definitions/targetDef"
                        	}
                        }                     
                    }
                },
                "additionalProperties": false,
                "required": [
                    "resolutions",
                    "input"
                ]
            }
        }
    },
    "required": [
        "entries",
        "schemaVersion",
        "documentVersion"
    ],
    "definitions": {
        "versionDef": {
            "type": "string",
            "description": "A schema/document versioning pattern.",
            "pattern": "^[0-9]{1,3}\\.[0-9]{1,3}(\\.[0-9]{1,3})?$"
        },
        "sourceDef": {
	        "properties": {
	        	"resourceType": {
	                    "type": "string",
	                    "description": "A string which defines the source type of the resource from depedency relation."
	            },
	            "value": {
	                    "type": "string",
	                    "description": "A string which defines the source name of the resource from depedency relation."
	            },
	            "qualifier": {
	            	"type": "string",
	            	"description": "A string which defines the qualifier of the resource from depedency relation."
	            }
	        },
	        "required": [
                "resourceType",
                "value"
            ]
        },
        "targetDef": {
        	"properties": {
	        	"resourceType": {
	                    "type": "string",
	                    "description": "A string which defines the target type of the resource from depedency relation."
	            },
	            "value": {
	                    "type": "string",
	                    "description": "A string which defines the target name of the resource from depedency relation."
	            },
	            "annText": {
	                    "type": "string",
	                    "description": "A string which defines the key of the annotation."
	            },
	            "annKeyword": {
	                    "type": "string",
	                    "description": "A string which defines the text of the annotation."
	            }
	        }
        }
    }
}