Namespace: OpenEdge.Core.Util
Class
AnnotationWriter
Parent classes:
Inherits: Progress.Lang.Object
Implements: OpenEdge.Core.ISupportInitialize

Copyright (c) 2020 by Progress Software Corporation. All rights reserved.
File:AnnotationWriter
Purpose:Utility to read an XML XREF file and return the annotations for a given ABL program
in JSON
Author(s):pjudge
Created:2018-11-08
The JSON returned is either ancontains only a null "program" property
{ "<xref.unavailable>" : {
"meta": {
"version": "1.0.0",
"fileName":""
}
}
}
or has the structure
{
// metadata about the program
"meta":{
"version": "1.0.0" // the version of this JSON
"fileName": "" // the name of the source file that produced the annotations
"inherits": [] // an optional array of classes that this class inherits. not in procedure-based output
"implements": [] // an optional array of interface that this class implements. not in procedure-based output
}
// these are annotations that belong to the class/procedure
"program": {
"annotation-name-1": ANNOTATION-DATA
// these are annotations that match the input user map
"user" {
"group": ANNOTATION-DATA
ANNOTATION-DATA
}
// these have no parameters or cannot be overloaded. the name never has a paren
"destructor"
"procedure"
"function"
"property"
"event": {
"name": ANNOTATION-DATA
}
// these are members that can be overloaded. the name always has parens.
"constructor"
"method": {
"name(<iomode-1> <param-type-1>, <iomode-n> <param-type-n>)":
"name()":
ANNOTATION-DATA
}
}




Method Summary
Options Name Purpose
AddAnnotationToGroup (character[2], character, JsonObject, JsonObject) /* Adds an annotation and its data to a parent group @param character[2] A group and (optional) subgroup to find the parent @param character The annotation name @param JsonObject Annotation data @param JsonObject The parent document to which to add the annotations */
AddAnnotationToGroup (JsonObject, character, JsonObject) /* Adds an annotation and its data to a parent group @param JsonObject The group to which to add an annotation @param character The annotation name @param JsonObject Annotation data */
AddReferences (buffer, IStringStringMap, JsonObject) /* Adds references from a "source" element. A single piece of rcode may have many, depending on the number includes @param buffer The Source record from which to add references @param IStringStringMap Any user-defined annotation mappings @param JsonObject The obejcts to which to add the annotations */
Destroy () /* Destroy/Shutdown/Anti-Initializer */
Progress.Json.ObjectModel.JsonObject ExtractAnnotations (buffer, IStringStringMap) /* Extracts annotations for a single program @param buffer Source The current program whose annotations to extract @param IStringStringMap A map of an annotation to a user-defined group. The group is created under a "user" property. Unknown values are allowed. @return JsonObject A JSON object containing the annotations. A valid object is always returned. */
FindSourceRecord (character, buffer) /* Method to find Source record for a given program. The input buffer is positioned to a record, if found. @param character The program name @param buffer Source The buffer in which to find the record */
Progress.Json.ObjectModel.JsonObject GetAnnotations (character, IStringStringMap) /* Returns the annotations in JSON form for a given file. @param character The name of the ABL file (class/procecure/etc) for which to extract annotations @param IStringStringMap A map of an annotation to a user-defined group. The group is created under a "user" property. Unknown values are allowed. @return JsonObject A JSON object containing the annotations. A valid object is always returned. */
Progress.Json.ObjectModel.JsonObject GetAnnotations (IStringStringMap) /* Returns the annotations in JSON form for a given file. @param IStringStringMap A map of an annotation to a user-defined group. The group is created under a "user" property. Unknown values are allowed. @return JsonObject A JSON object containing the annotations. A valid object is always returned. */
Initialize () /* Initializer/Startup */
ParseXref (character) /* Reads an XML REF file into the local storage. This method can be called mulktiple times to read multiple files. @param character The name of the XML-XREF file */
ParseXref (FileInputStream) /* Reads an XML REF file into the local storage. This method can be called mulktiple times to read multiple files. @param FileInputStream The XML-XREF file to read */

Constructor Summary
Options Name Purpose
AnnotationWriter () /* Default constructor */
AnnotationWriter (character) /* Constructor. @param character The name of a XML-XREF file to read */
AnnotationWriter (FileInputStream) /* Constructor. @param FileInputStream The XML-XREF file to read */


Method Detail
Top

PROTECTED AddAnnotationToGroup (character[2], character, JsonObject, JsonObject)

/* Adds an annotation and its data to a parent group
Parameters:
pGroup CHARACTER
pAnnoName CHARACTER
pAnnoData Progress.Json.ObjectModel.JsonObject
pData Progress.Json.ObjectModel.JsonObject
Top

PROTECTED AddAnnotationToGroup (JsonObject, character, JsonObject)

/* Adds an annotation and its data to a parent group
Parameters:
pGroup Progress.Json.ObjectModel.JsonObject
pAnnoName CHARACTER
pAnnoData Progress.Json.ObjectModel.JsonObject
Top

PROTECTED AddReferences (buffer, IStringStringMap, JsonObject)

/* Adds references from a "source" element. A single piece of rcode may have many, depending
on the number includes
Parameters:
pSource buffer
pUserMap OpenEdge.Core.Collections.IStringStringMap
pData Progress.Json.ObjectModel.JsonObject
Top

PUBLIC Destroy ()

/* Destroy/Shutdown/Anti-Initializer
Top

PROTECTED Progress.Json.ObjectModel.JsonObject ExtractAnnotations (buffer, IStringStringMap)

/* Extracts annotations for a single program
Unknown values are allowed.
Parameters:
pSource buffer
pUserMap OpenEdge.Core.Collections.IStringStringMap
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object containing the annotations. A valid object is always returned.
Top

PRIVATE FindSourceRecord (character, buffer)

/* Method to find Source record for a given program. The input buffer is positioned
to a record, if found.
Parameters:
pAblProgram CHARACTER
pSource buffer
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetAnnotations (character, IStringStringMap)

/* Returns the annotations in JSON form for a given file.
Unknown values are allowed.
Parameters:
pAblProgram CHARACTER
pUserMap OpenEdge.Core.Collections.IStringStringMap
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object containing the annotations. A valid object is always returned.
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetAnnotations (IStringStringMap)

/* Returns the annotations in JSON form for a given file.
Unknown values are allowed.
Parameters:
pUserMap OpenEdge.Core.Collections.IStringStringMap
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object containing the annotations. A valid object is always returned.
Top

PUBLIC Initialize ()

/* Initializer/Startup
Top

PUBLIC ParseXref (character)

/* Reads an XML REF file into the local storage. This method can be called
mulktiple times to read multiple files.
Parameters:
pFilename CHARACTER
Top

PUBLIC ParseXref (FileInputStream)

/* Reads an XML REF file into the local storage. This method can be called
mulktiple times to read multiple files.
Parameters:
pFile Progress.IO.FileInputStream


Constructor Detail
Top

PUBLIC AnnotationWriter ()

/* Default constructor
Top

PUBLIC AnnotationWriter (character)

/* Constructor.
Parameters:
pFilename CHARACTER
Top

PUBLIC AnnotationWriter (FileInputStream)

/* Constructor.
Parameters:
pFile Progress.IO.FileInputStream


Copyright © 2020 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 12.2.0