import { Settings } from './Settings' ; import { StringFunctions } from './StringFunctions' ; import { DynamicsNAV } from './DynamicsNAV' ; import * as vscode from 'vscode' ; export class NAVObject { public objectFileName : string ; public objectType : string ; public objectId : string ; public objectName : string ; public objectActions : NAVObjectAction [ ] = new Array ( ) ; public tableFields : NAVTableField [ ] = new Array ( ) ; public pageFields : NAVPageField [ ] = new Array ( ) ; public pageGroups : NAVPageGroup [ ] = new Array ( ) ; public extendedObjectName : string ; public extendedObjectId : string ; public NAVObjectText : string ; private _workSpaceSettings : Settings ; private _objectFileNamePattern : string ; private prohibitedFilenameCharsPattern : string = '<>:"/\\\\|\\?\\*' ; constructor ( navObject , workSpaceSettings , navObjectFileBaseName ) ; constructor ( navObject , workSpaceSettings , navObjectFileBaseName ? ) { this . NAVObjectText = navObject ; this . objectFileName = navObjectFileBaseName ; this . _workSpaceSettings = workSpaceSettings ; if ( this . NAVObjectText ) this . loadObjectProperties ( ) ; } setObjectProperies ( objectType , objectId , objectName ) { this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePattern ] ; this . objectType = objectType ; this . objectId = objectId ; this . objectName = objectName ; this . extendedObjectName = '' ; this . extendedObjectId = '' ; } setObjectExtensionProperies ( objectType , objectId , objectName , extendedObjectId , extendedObjectName ) { this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePatternExtensions ] ; this . objectType = objectType ; this . objectId = objectId ; this . objectName = objectName ; this . extendedObjectName = extendedObjectName ; this . extendedObjectId = extendedObjectId ; } get objectTypeShort ( ) : string { return DynamicsNAV . getBestPracticeAbbreviatedObjectType ( this . objectType ) ; } get ObjectTypeShortPascalCase ( ) : string { return DynamicsNAV . getBestPracticeObjectTypeInPascalCase ( this . objectType ) ; } get objectNameFixed ( ) : string { let objectNameFixed = this . ApplyExtensionObjectNamePattern ( this . objectName . trim ( ) . toString ( ) ) ; if ( objectNameFixed == this . objectName . trim ( ) . toString ( ) ) { objectNameFixed = this . AddPrefixAndSuffixToObjectNameFixed ( objectNameFixed ) ; } return objectNameFixed ; } get objectNameFixedForFileName ( ) : string { let objectNameFixed = this . RemovePrefixAndSuffix ( this . objectNameFixed ) ; return objectNameFixed . replace ( new RegExp ( `[${ this . prohibitedFilenameCharsPattern }]` , 'g' ) , '_' ) ; } get objectNameFixedShort ( ) : string { if ( this . objectNameFixed . length > 30 ) { return StringFunctions . removeAllButAlfaNumeric ( this . RemovePrefixAndSuffix ( this . objectName ) ) ; } else { return StringFunctions . removeAllButAlfaNumeric ( this . RemovePrefixAndSuffix ( this . objectNameFixed ) ) ; } } get extendedObjectNameFixed ( ) : string { let extendedObjectName = this . extendedObjectName . trim ( ) . toString ( ) ; return extendedObjectName ; } get extendedObjectNameFixedForFileName ( ) : string { let extendedObjectName = this . extendedObjectNameFixed ; return extendedObjectName . replace ( new RegExp ( `[${ this . prohibitedFilenameCharsPattern }]` , 'g' ) , '_' ) ; } get extendedObjectNameFixedShort ( ) : string { return StringFunctions . removeAllButAlfaNumeric ( this . extendedObjectNameFixed ) ; } get NAVObjectTextFixed ( ) : string { let NAVObjectTextFixed = this . NAVObjectText ; NAVObjectTextFixed = this . updateObjectNameInObjectText ( NAVObjectTextFixed ) ; NAVObjectTextFixed = this . AddPrefixAndSuffixToActions ( NAVObjectTextFixed ) ; NAVObjectTextFixed = this . AddPrefixAndSuffixToFields ( NAVObjectTextFixed ) ; NAVObjectTextFixed = this . AddPrefixAndSuffixToPageFields ( NAVObjectTextFixed ) ; NAVObjectTextFixed = this . AddPrefixAndSuffixToPageGroups ( NAVObjectTextFixed ) ; return NAVObjectTextFixed ; } get objectFileNameFixed ( ) : string { if ( ! this . _objectFileNamePattern ) { return this . objectFileName ; } let objectFileNameFixed = this . _objectFileNamePattern ; objectFileNameFixed = this . ApplyPatternToFileName ( objectFileNameFixed ) ; objectFileNameFixed = this . RemoveUnderscore ( objectFileNameFixed ) ; return objectFileNameFixed ; } get objectCodeunitSubType ( ) : string { if ( this . objectType . toLowerCase ( ) != 'codeunit' ) { return null ; } var reg = /(Subtype) *= *(.+);/g ; var result = reg . exec ( this . NAVObjectText ) ; if ( result !== null ) { return result [ 2 ] ; } return null ; } private loadObjectProperties ( ) { var patternObjectType = new RegExp ( '(codeunit |page |pagecustomization |pageextension |reportextension |permissionset |permissionsetextension |profile |query |report |requestpage |table |tableextension |xmlport |enum |enumextension |controladdin |interface)' , "i" ) ; var lines = this . NAVObjectText . split ( '\n' ) ; var filteredlines = lines . filter ( function ( line ) { return line . trimLeft ( ) . indexOf ( '//' ) != 0 ; } ) ; let ObjectTypeArr = filteredlines . toString ( ) . match ( patternObjectType ) ; this . _objectFileNamePattern = '' ; this . objectType = '' ; this . objectId = '' ; this . objectName = '' ; this . extendedObjectName = '' ; this . extendedObjectId = '' ; var ObjectNamePattern = '"[^"]*"' ; var ObjectNameNoQuotesPattern = '[\\w]*' ; if ( ! ObjectTypeArr ) { return null ; } if ( ObjectTypeArr ) { switch ( ObjectTypeArr [ 0 ] . trim ( ) . toLowerCase ( ) ) { case 'page' : case 'codeunit' : case 'query' : case 'report' : case 'requestpage' : case 'table' : case 'xmlport' : case 'permissionset' : case 'enum' : { var patternObject = new RegExp ( `(${ ObjectTypeArr [ 0 ] . trim ( ) . toLowerCase ( ) }) +([0-9]+) +(${ ObjectNamePattern }|${ ObjectNameNoQuotesPattern })([^"\n]*"[^"\n]*)?` , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; if ( currObject == null ) { vscode . window . showErrorMessage ( `File '${ this . objectFileName }' does not have valid object name. Maybe it got double quotes (") in the object name?` ) ; return null ; } this . objectType = currObject [ 1 ] ; this . objectId = currObject [ 2 ] ; this . objectName = currObject [ 3 ] ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePattern ] ; break ; } case 'pageextension' : case 'tableextension' : case 'reportextension' : case 'permissionsetextension' : case 'enumextension' : { var patternObject = new RegExp ( `(${ ObjectTypeArr [ 0 ] . trim ( ) . toLowerCase ( ) }) +([0-9]+) +(${ ObjectNamePattern }|${ ObjectNameNoQuotesPattern }) +extends +(${ ObjectNamePattern }|${ ObjectNameNoQuotesPattern })\\s*(\\/\\/\\s*)?([0-9]+)?` , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; if ( currObject == null ) { vscode . window . showErrorMessage ( `File '${ this . objectFileName }' does not have valid object name. Maybe it got double quotes (") in the object name?` ) ; return null ; } this . objectType = currObject [ 1 ] ; this . objectId = currObject [ 2 ] ; this . objectName = currObject [ 3 ] ; this . extendedObjectName = currObject [ 4 ] ; this . extendedObjectId = currObject [ 6 ] ? currObject [ 6 ] : '' ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePatternExtensions ] ; break ; } case 'interface' : { var patternObject = new RegExp ( '(interface)( +"?[ a-zA-Z0-9._/&-]+"?)' , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; this . objectType = currObject [ 1 ] ; this . objectId = '' ; this . objectName = currObject [ 2 ] ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePattern ] ; break ; } case 'profile' : { var patternObject = new RegExp ( '(profile)( +"?[ a-zA-Z0-9._/&-]+"?)' , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; this . objectType = currObject [ 1 ] ; this . objectId = '' ; this . objectName = currObject [ 2 ] ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePattern ] ; break ; } case 'controladdin' : { var patternObject = new RegExp ( '(controladdin)( +"?[ a-zA-Z0-9._/&-]+"?)' , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; this . objectType = currObject [ 1 ] ; this . objectId = '' ; this . objectName = currObject [ 2 ] ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePattern ] ; break ; } case 'pagecustomization' : { var patternObject = new RegExp ( `(${ ObjectTypeArr [ 0 ] . trim ( ) . toLowerCase ( ) })( +"?[ a-zA-Z0-9._/&-]+"?) +customizes( +"?[ a-zA-Z0-9._&-]+\\/?[ a-zA-Z0-9._&-]+"?) (\\/\\/+ *)?([0-9]+)?` , "i" ) ; let currObject = this . NAVObjectText . match ( patternObject ) ; this . objectType = currObject [ 1 ] ; this . objectId = '' ; this . objectName = currObject [ 2 ] ; this . extendedObjectName = currObject [ 3 ] ; this . extendedObjectId = currObject [ 5 ] ? currObject [ 5 ] : '' ; this . _objectFileNamePattern = this . _workSpaceSettings [ Settings . FileNamePatternPageCustomizations ] ; break ; } default : { vscode . window . showErrorMessage ( 'Not able to parse this file: ' + this . NAVObjectText ) ; return null ; } } this . objectType = this . objectType . trim ( ) . toString ( ) ; this . objectId = this . objectId . trim ( ) . toString ( ) ; this . objectName = this . objectName . trim ( ) . toString ( ) . replace ( /["]/g , '' ) ; this . extendedObjectName = this . extendedObjectName . trim ( ) . toString ( ) . replace ( /["]/g , '' ) ; this . extendedObjectId = this . extendedObjectId . trim ( ) . toString ( ) ; } if ( ! ( this . IsValidObjectType ( this . objectType ) ) ) { this . _objectFileNamePattern = '' ; this . objectType = '' ; this . objectId = '' ; this . objectName = '' ; this . extendedObjectName = '' ; this . extendedObjectId = '' ; return null ; } var reg = NAVObjectAction . actionRegEx ( ) ; var result ; while ( ( result = reg . exec ( this . NAVObjectText ) ) !== null ) { this . objectActions . push ( new NAVObjectAction ( result [ 1 ] , this . objectType , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ) ; } var reg = NAVTableField . fieldRegEx ( ) ; var result ; while ( ( result = reg . exec ( this . NAVObjectText ) ) !== null ) { this . tableFields . push ( new NAVTableField ( result [ 1 ] , this . objectType , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ) ; } var reg = NAVPageField . fieldRegEx ( ) ; var result ; while ( ( result = reg . exec ( this . NAVObjectText ) ) !== null ) { this . pageFields . push ( new NAVPageField ( result [ 1 ] , this . objectType , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ) ; } var reg = NAVPageGroup . fieldRegEx ( ) ; var result ; while ( ( result = reg . exec ( this . NAVObjectText ) ) !== null ) { this . pageGroups . push ( new NAVPageGroup ( result [ 1 ] , this . objectType , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ) ; } } private IsValidObjectType ( objectType ) { switch ( objectType . toLowerCase ( ) ) { case 'codeunit' : case 'page' : case 'pagecustomization' : case 'pageextension' : case 'reportextension' : case 'profile' : case 'query' : case 'report' : case 'requestpage' : case 'table' : case 'tableextension' : case 'xmlport' : case 'enum' : case 'enumextension' : case 'controladdin' : case 'interface' : case 'permissionset' : case 'permissionsetextension' : return true ; default : return false ; } } private ApplyExtensionObjectNamePattern ( objectName ) { if ( ! this . _workSpaceSettings [ Settings . ExtensionObjectNamePattern ] || ! this . objectType . toLocaleLowerCase ( ) . endsWith ( 'extension' ) ) { return objectName ; } let result = this . _workSpaceSettings [ Settings . ExtensionObjectNamePattern ] ; result = this . ApplyPatternToObjectName ( result ) ; return result ; } private ApplyPatternToObjectName ( pattern ) { let result = pattern ; result = StringFunctions . replaceAll ( result , '<Prefix>' , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] ) ; result = StringFunctions . replaceAll ( result , '<Suffix>' , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ; result = StringFunctions . replaceAll ( result , '<ObjectType>' , this . objectType ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShort>' , this . objectTypeShort ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShortPascalCase>' , this . ObjectTypeShortPascalCase ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShortUpper>' , this . objectTypeShort . toUpperCase ( ) ) ; result = StringFunctions . replaceAll ( result , '<ObjectId>' , this . objectId ) ; result = StringFunctions . replaceAll ( result , '<BaseName>' , this . extendedObjectNameFixedForFileName ) ; result = StringFunctions . replaceAll ( result , '<BaseNameShort>' , this . extendedObjectNameFixedShort ) ; result = StringFunctions . replaceAll ( result , '<BaseId>' , this . extendedObjectId ) ; return result ; } private ApplyPatternToFileName ( pattern ) { let result = pattern ; result = StringFunctions . replaceAll ( result , '<Prefix>' , this . _workSpaceSettings [ Settings . ObjectNamePrefix ] ) ; result = StringFunctions . replaceAll ( result , '<Suffix>' , this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ) ; result = StringFunctions . replaceAll ( result , '<ObjectType>' , this . objectType ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShort>' , this . objectTypeShort ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShortPascalCase>' , this . ObjectTypeShortPascalCase ) ; result = StringFunctions . replaceAll ( result , '<ObjectTypeShortUpper>' , this . objectTypeShort . toUpperCase ( ) ) ; result = StringFunctions . replaceAll ( result , '<ObjectId>' , this . objectId ) ; result = StringFunctions . replaceAll ( result , '<ObjectName>' , this . objectNameFixedForFileName ) ; result = StringFunctions . replaceAll ( result , '<ObjectNameShort>' , this . objectNameFixedShort ) ; result = StringFunctions . replaceAll ( result , '<BaseName>' , this . extendedObjectNameFixedForFileName ) ; result = StringFunctions . replaceAll ( result , '<BaseNameShort>' , this . extendedObjectNameFixedShort ) ; result = StringFunctions . replaceAll ( result , '<BaseId>' , this . extendedObjectId ) ; return result ; } private AddPrefixAndSuffixToObjectNameFixed ( objectName ) { let prefix = this . _workSpaceSettings [ Settings . ObjectNamePrefix ] ; let suffix = this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ; if ( ! prefix && ! suffix ) { return objectName ; } if ( prefix && ! objectName . startsWith ( prefix ) ) { objectName = prefix + objectName ; } if ( suffix && ! objectName . endsWith ( suffix ) ) { objectName = objectName + suffix ; } return objectName ; } private RemovePrefixAndSuffix ( objectName ) { let removePrefix = this . _workSpaceSettings [ Settings . RemovePrefixFromFilename ] ; let removeSuffix = this . _workSpaceSettings [ Settings . RemoveSuffixFromFilename ] ; if ( ! removePrefix && ! removeSuffix ) { return objectName ; } let prefix = this . _workSpaceSettings [ Settings . ObjectNamePrefix ] ; let suffix = this . _workSpaceSettings [ Settings . ObjectNameSuffix ] ; if ( ! prefix && ! suffix ) { return objectName ; } if ( prefix && removePrefix && objectName . startsWith ( prefix ) ) { objectName = objectName . substr ( prefix . length ) ; } if ( suffix && removeSuffix && objectName . endsWith ( suffix ) ) { objectName = objectName . substr ( 0 , objectName . length - suffix . length ) ; } return objectName ; } private RemoveUnderscore ( objectName ) { let removeUnderscores = this . _workSpaceSettings [ Settings . RemoveUnderscoreFromFilename ] ; if ( removeUnderscores ) { return objectName . replace ( /[_]/g , "" ) ; } else { return objectName ; } } private updateObjectNameInObjectText ( objectText ) { if ( ! this . objectName ) { return objectText ; } ; var escapedObjectName = this . escapeRegExp ( this . objectName ) ; var searchPattern = RegExp ( escapedObjectName ) ; let fixedObjectName = this . objectNameFixed . length <= 30 ? this . objectNameFixed : this . objectName ; if ( objectText . indexOf ( "\"" + this . objectName + "\"" ) >= 0 ) { return objectText . replace ( searchPattern , fixedObjectName ) ; } else { return objectText . replace ( searchPattern , "\"" + fixedObjectName + "\"" ) ; } } private escapeRegExp ( str ) { return str . replace ( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g , "\\$&" ) ; } private AddPrefixAndSuffixToActions ( objectText ) { this . objectActions . forEach ( action => { objectText = objectText . replace ( action . fullActionText , action . fullActionTextFixed ) ; } ) ; return objectText ; } private AddPrefixAndSuffixToFields ( objectText ) { this . tableFields . forEach ( field => { objectText = objectText . replace ( field . fullFieldText , field . fullFieldTextFixed ) ; } ) ; return objectText ; } private AddPrefixAndSuffixToPageFields ( objectText ) { this . pageFields . forEach ( field => { objectText = objectText . replace ( field . fullFieldText , field . fullFieldTextFixed ) ; } ) ; return objectText ; } private AddPrefixAndSuffixToPageGroups ( objectText ) { this . pageGroups . forEach ( group => { objectText = objectText . replace ( group . fullGroupText , group . fullGroupTextFixed ) ; } ) ; return objectText ; } } class NAVObjectAction { public name : string ; public fullActionText : string ; private _prefix : string ; private _suffix : string ; private _objectType : string ; public static actionRegEx ( ) { return /.*( (action\("?)([ a-zA-Z0-9._/&-]+)"?\))/g ; } get nameFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . name ; } if ( this . _objectType . toLocaleLowerCase ( ) != "pageextension" ) { return this . name ; } ; let result = this . name ; if ( this . _prefix && ! this . name . startsWith ( this . _prefix ) ) { result = this . _prefix + result ; } if ( this . _suffix && ! this . name . endsWith ( this . _suffix ) ) { result = result + this . _suffix ; } return result ; } get fullActionTextFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . fullActionText ; } ; return " action(" + StringFunctions . encloseInQuotesIfNecessary ( this . nameFixed ) + ")" ; } constructor ( fullActionText , objectType , prefix ? , suffix ? ) { this . fullActionText = fullActionText ; this . _prefix = prefix ? prefix : null ; this . _suffix = suffix ? suffix : null ; this . _objectType = objectType ; this . parseActionText ( ) ; } private parseActionText ( ) { var reg = NAVObjectAction . actionRegEx ( ) ; var result = reg . exec ( this . fullActionText ) ; if ( result !== null ) { this . name = result [ 3 ] ; } } } class NAVTableField { public name : string ; public fullFieldText : string ; public number : string ; public type : string ; private _objectType : string ; private _prefix : string ; private _suffix : string ; public static fieldRegEx ( ) { return /.*(field\((\d+); *"?([ a-zA-Z0-9._/&-]+)"?;(.*)\))/g ; } get nameFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . name ; } if ( this . _objectType . toLocaleLowerCase ( ) != "tableextension" ) { return this . name ; } ; let result = this . name ; if ( this . _prefix && ! this . name . startsWith ( this . _prefix ) ) { result = this . _prefix + result ; } if ( this . _suffix && ! this . name . endsWith ( this . _suffix ) ) { result = result + this . _suffix ; } return result ; } get fullFieldTextFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . fullFieldText ; } return "field(" + this . number + "; " + StringFunctions . encloseInQuotesIfNecessary ( this . nameFixed ) + "; " + this . type + ")" ; } constructor ( fullFieldText , objectType , prefix ? , suffix ? ) { this . fullFieldText = fullFieldText ; this . _prefix = prefix ? prefix : null ; this . _suffix = suffix ? suffix : null ; this . _objectType = objectType ; this . parseFieldText ( ) ; } private parseFieldText ( ) { var reg = NAVTableField . fieldRegEx ( ) ; var result = reg . exec ( this . fullFieldText ) ; if ( result !== null ) { this . number = result [ 2 ] . trim ( ) . toString ( ) ; this . name = result [ 3 ] . trim ( ) . toString ( ) ; this . type = result [ 4 ] . trim ( ) . toString ( ) ; } } } class NAVPageField { public name : string ; public fullFieldText : string ; public expression : string ; private _objectType : string ; private _prefix : string ; private _suffix : string ; public static fieldRegEx ( ) { return /.*(field\( *"?([ a-zA-Z0-9._/&-]+)"? *; *([" a-zA-Z0-9._/&-]+) *\))/g ; } get nameFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . name ; } if ( this . _objectType . toLocaleLowerCase ( ) != "pageextension" ) { return this . name ; } ; let result = this . name ; if ( this . _prefix && ! this . name . startsWith ( this . _prefix ) ) { result = this . _prefix + result ; } if ( this . _suffix && ! this . name . endsWith ( this . _suffix ) ) { result = result + this . _suffix ; } return result ; } get fullFieldTextFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . fullFieldText ; } return "field(" + StringFunctions . encloseInQuotesIfNecessary ( this . nameFixed ) + "; " + this . expression + ")" ; } constructor ( fullFieldText , objectType , prefix ? , suffix ? ) { this . fullFieldText = fullFieldText ; this . _prefix = prefix ? prefix : null ; this . _suffix = suffix ? suffix : null ; this . _objectType = objectType ; this . parseFieldText ( ) ; } private parseFieldText ( ) { var reg = NAVPageField . fieldRegEx ( ) ; var result = reg . exec ( this . fullFieldText ) ; if ( result !== null ) { this . name = result [ 2 ] . trim ( ) . toString ( ) ; this . expression = result [ 3 ] . trim ( ) . toString ( ) ; } } } class NAVPageGroup { public name : string ; public fullGroupText : string ; private _objectType : string ; private _prefix : string ; private _suffix : string ; public static fieldRegEx ( ) { return /.*(group\( *"?([ a-zA-Z0-9._/&-]+)"? *\))/g ; } get nameFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . name ; } if ( this . _objectType . toLocaleLowerCase ( ) != "pageextension" ) { return this . name ; } ; let result = this . name ; if ( this . _prefix && ! this . name . startsWith ( this . _prefix ) ) { result = this . _prefix + result ; } if ( this . _suffix && ! this . name . endsWith ( this . _suffix ) ) { result = result + this . _suffix ; } return result ; } get fullGroupTextFixed ( ) : string { if ( ! this . _prefix && ! this . _suffix ) { return this . fullGroupText ; } return "group(" + StringFunctions . encloseInQuotesIfNecessary ( this . nameFixed ) + ")" ; } constructor ( fullGroupText , objectType , prefix ? , suffix ? ) { this . fullGroupText = fullGroupText ; this . _prefix = prefix ? prefix : null ; this . _suffix = suffix ? suffix : null ; this . _objectType = objectType ; this . parseFieldText ( ) ; } private parseFieldText ( ) { var reg = NAVPageGroup . fieldRegEx ( ) ; var result = reg . exec ( this . fullGroupText ) ; if ( result !== null ) { this . name = result [ 2 ] . trim ( ) . toString ( ) ; } } }