Command line syntax
String getDGVariable(String variableName)
returns the specified DG variable of String type
Parameter: name of the variable
Returns: value of the variable or an empty string, if the variable is not defined in the given place
RwiElement getDGRwiElement(String variableName)
returns the specified DG variable of RwiElement type
Parameter: name of the variable
Returns: value of the variable or null, if the variable is not provided in the given place
RwiElement getDGRwiProperty(String variableName)
returns RwiProperty type DG variable with the specified name
Parameter: name of the variable
Returns: value of the variable or null, if this variable is not in place
String getDGOption(String optionName)
returns the specified DG option.
Parameter: name of the option
Returns: value of the option or empty string, if such option is not defined
Features:
The option can be specified for an object of Report Generator (descendant of the class ..gendoc.docgenerator.Generic.GnrReportGenerator, for example: class ..gendoc.docgenerator.txt.TXTReportGenerator) using the method: addReportOption (String optionName, String optionValue)
Default values for some options can be defined in the template file. This definition persists even though TemplateDesigner subsequently modifies the template. However, method addReportOption overwrites the options values.
Example:
default values for the options inclSubpackages", "inclDoc", "DTLAdapter"
DEFAULT_OPTIONS={inclSubpackages='yes';inclDoc='yes';DTLAdapter='com.togethersoft.modules.doorslink.DTLAdapter'}
String invokeForName(String className, String methodName)
String invokeForName(String className, String methodName, String param1)
String invokeForName(String className, String methodName, String param1, String param2)
invokes specified method of the user-provided class.
Parameters:
className
fully-qualified name of the user-provided class. This class should not be absrtact.
DG creates an instance of className class and calls the method methodName with this instance. Note that this instance object is created for each entry of invokeForNamecall within each particular expression of template where this function is used.
However, the object is created only during the first call from such an entry, and will be used for the next calls, unless parameter className is changed.
methodName
name of the method in the class to be executed. The method should have the following signature:
String methodName (..gendoc.api.GenDocContext)
Parameter is an instance of ..gendoc.api.GenDocContext. Class ..gendoc.api.GenDocContext provides the following methods:
RwiReference getRwiReference
returns RwiReference, if the current DG iteration element is an RWI-reference within a diagram. Otherwise the method returns null.
gRwiElement etRwiElement
always returns the RwiElement. If the current DG iteration element is an RWI-reference then returned element is rwiReference.getElement(). Otherwise, returned element is the current DG iteration RWI-element.
String getParameter1()
returns the value of the first optional parameter passed to invokeForName function, or null, if the parameter is ommitted.
String getParameter2()
returns the value of the second optional parameter passed to invokeForName function, or null, if the parameter is ommitted.
The method methodName should return String value it calculates.
Returns:
Returns value calculated by the user-provided method methodName.
RwiDiagram getContainingDiagram()
returns the RWI-diagram containing the primary reference to the current element. Possible call in an expression is
rwiElement-> getContainingDiagram()Returns: RWI-diagram containing the primary reference to the current element
boolean isImported()
Checks if the current element in the diagram is presented by a shortcut.
Returns: true, if the element is a shortcut; false, if the element is not a shortcut
String getSubproperty(RwiProperty rwiProperty, String subpropertyName)
The fuction returns the value of subproperty subpropertyName contained in the RWI-property rwiProperty. See description of curPropertyInstance DG variable for an example of using this function. Possible call is:
rwiProperty->getSubproperty(subpropertyName)Parameters:
rwiProperty the element property
subpropertyName the name of its subproperty
Returns: value of the specified subproperty
String hasSubproperty(RwiProperty rwiProperty, String subpropertyName)
Checks if the RWI-property rwiProperty contains the subproperty subpropertyName.
Possible call is: rwiProperty->hasSubproperty(subpropertyName)
Parameters:
rwiProperty the element property
subpropertyName the name of subproperty to be checked
Returns: true, if the property has the specified subproperty; false otherwise
RwiElement findElement(String uniqueName)
passes the call to the RwiModel.findElement() method which finds an element by its unique name.
Parameter: string with the unique name of an RWI-element that needs to be found
Returns: an element found by its unique name
String getPropertyExt(String propertyName)
This function gets any element property available in DG for the metatype to which this element belongs. It includes the properties provided by RWI and the properties calculated only by DG (names of such properties start with %. See file MetaModel.mm).
Possible call is: rwiElement->getPropertyExt(propertyName.In this case, the RWI-element whose property should be obtained, is specified before arrow.
Parameter: name of the required property
Returns: value of the property or empty string if the element has no such property
See also: getProperty()
|
Utility functions provided by DG |
String substring(String str, int beginIndex)
String substring(String str, int beginIndex, int endIndex)Returns a new string that is a substring of the string str. Parameters are the same as in the standard Java String.substring() methods.
int length(String str)
Returns the length of string str.
String str(Numeric N)
Converts numeric value to string.
Numeric val(String str)
Converts numeric value represented as String into Numeric format. If conversion is impossible, returns 0.
|
The following functions, commonly provided in Together formula queries, are also very useful in DG expressions. |
String getProperty(String rwiPropertyName)
Returns the value of the specified RWI property the current element has.
Possible call is rwiElement->getProperty(rwiPropertyName.In this case, the RWI-element, whose property should be obtained, is specified before arrow.
Parameter: name of the required property
Returns: value of the property or empty string if the element has no such property
See also: getPropertyExt()
boolean hasProperty(String rwiPropertyName)
Checks if the current element has the specified property.
Possible call is: rwiElement->hasProperty(rwiPropertyName)
In this case, the RWI-element, whose property should be checked, is specified before arrow.
Parameter: name of the property being checked
Returns: true , if the element has such property; false, otherwise
boolean hasPropertyValue (String rwiPropertyName, String value)
Checks if the current element has the property with the specified value.
Possible call is: rwiElement->hasPropertyValue (rwiPropertyName, value)
In this case, the RWI-element, whose property should be checked, is specified before arrow.
Parameter:
rwiPropertyName name of the property being checked
value required property value
Returns: true , if the element has specified property with the required value; false, otherwise
type if(boolean condition, type value1, type value2)
If the parameter condition is true, the function returns value1. If the condition is false, the function returns value2.
The type can be any data type allowed in queries.
RwiNode getContainingNode()
returns the RwiNode element that contains the current element. Can be called for RWI member or node current element.
Possible call is: rwiElement->getContainingNode()
Example:
the following expression calculates visibility modifier for the class/interface member:
if (hasProperty("$private"), "private",
if (hasProperty("$protected"), "protected",
if (hasProperty("$public") && !getContainingNode()-> hasProperty("$interface"),
"public", "")))In this case, the public modifier is printed only when the containing node is not an interface, since all interface members are public implicitly.
You can launch the documentation generation system from the command line using the following syntax. Note that this does not presently run fully in console mode... the Generate Documentation dialog will appear to set required options.
Usage:
TgStarter -script:com.togethersoft.modules.gendoc.GenerateDocumentation PrjName
Where:
|
Win 32 |
TgStarter = %TgHome%/bin/Together.bat or |
|
Other OS |
TgStarter = %TgHome%/bin/Together.sh
|
|
PrjName = fully qualified project name, e.g. %TgHome%/samples/java/CashSales/CashSales.tpr |
|