Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Tigerstripe Plugin Miscellany"
(New page: {{backlink|Tigerstripe_Tutorials}} This section includes some handy reference documents that are useful when putting together plugins. =Default Velocity context contents= <h2>Collection...) |
|||
Line 5: | Line 5: | ||
=Default Velocity context contents= | =Default Velocity context contents= | ||
− | + | '''Collections''' | |
<blockquote><p>There are a number of <b>Collections</b> in the context that allows access to sets of artifacts. These <b>Collections</b> are described in the following table and would typically be accessed as follows: <i>#foreach ($artifact in $artifacts)</i></p> | <blockquote><p>There are a number of <b>Collections</b> in the context that allows access to sets of artifacts. These <b>Collections</b> are described in the following table and would typically be accessed as follows: <i>#foreach ($artifact in $artifacts)</i></p> | ||
Line 84: | Line 84: | ||
<p><b>Note</b> : The contents of the collections above may be reduced by the application of Contract facets.</p> | <p><b>Note</b> : The contents of the collections above may be reduced by the application of Contract facets.</p> | ||
+ | '''Other contents''' | ||
− | + | <p><b>$artifact</b> (IAbstractArtifact)</p> | |
<p>In an <b>Artifact Rule</b>, this is set to the current artifact. That is on each iteration of the rule over a different artifact in the <b>Tigerstripe</b> project, this will have a different value. If a specific artifact type was selected in the rule (the <i>AnyArtifact</i> option has not been selected), the actual artifact will be of that type ( eg <i>IManagedEntityArtifact</i>) and the object can be cast to the precise type for access to the specifics of that artifact type.</p> | <p>In an <b>Artifact Rule</b>, this is set to the current artifact. That is on each iteration of the rule over a different artifact in the <b>Tigerstripe</b> project, this will have a different value. If a specific artifact type was selected in the rule (the <i>AnyArtifact</i> option has not been selected), the actual artifact will be of that type ( eg <i>IManagedEntityArtifact</i>) and the object can be cast to the precise type for access to the specifics of that artifact type.</p> | ||
Line 145: | Line 146: | ||
<p><b>$pluginDir</b> (String)</p> | <p><b>$pluginDir</b> (String)</p> | ||
− | <p>The path to the root of the plugin when it is deployed. This is useful for gaining access to files that have been included with the deployed plugin | + | <p>The path to the root of the plugin when it is deployed. This is useful for gaining access to files that have been included with the deployed plugin.</p></blockquote> |
Revision as of 10:08, 2 June 2008
< To: Tigerstripe_Tutorials
This section includes some handy reference documents that are useful when putting together plugins.
Default Velocity context contents
Collections
There are a number of Collections in the context that allows access to sets of artifacts. These Collections are described in the following table and would typically be accessed as follows: #foreach ($artifact in $artifacts)
Collection Name Type Contents $artifacts Collection<IArtifact> All artifacts within this project. $entities Collection<IManagedEntityArtifact> All Managed Entity artifacts within this project. $datatypes Collection<IDatatypeArtifact> All Datatype artifacts within this project. $events Collection<IEventArtifact> All Event artifacts within this project. $enums Collection<IEnumArtifact> All Enumeration artifacts within this project. $exceptions Collection<IExceptionArtifact> All Exception artifacts within this project. $queries Collection<IQueryArtifact> All Query artifacts within this project. $updateProcedures Collection<IUpdateProcedureArtifact> All Update Procedure artifacts within this project. $associations Collection<IAssociationArtifact> All Association artifacts within this project. $associationClasses Collection<IAssociationClassArtifact> All Association Class artifacts within this project. $sessions Collection<ISessionArtifact> All Session Facade artifacts within this project. $allArtifacts Collection<IAbstractArtifact> All artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allEntities Collection<IManagedEntityArtifact> All Managed Entity artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allDatatypes Collection<IDatatypeArtifact> All Datatype artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allEvents Collection<IEventArtifact> All Event artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allEnums Collection<IEnumArtifact> All Enumeration artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allExceptions Collection<IExceptionArtifact> All Exception artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allQueries Collection<IQueryArtifact> All Query artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allUpdateProcedures Collection<IUpdateProcedureArtifact> All Update Procedure artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allAssociations Collection<IAssociationArtifact> All Association artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allAssociationClasses Collection<IAssociationClassArtifact> All Association Class artifacts within this project, plus those in Referenced Projects and Dependent Modules. $allSessions Collection<ISessionArtifact> All Session Facade artifacts within this project, plus those in Referenced Projects and Dependent Modules. Note : The contents of the collections above may be reduced by the application of Contract facets.
Other contents
$artifact (IAbstractArtifact)
In an Artifact Rule, this is set to the current artifact. That is on each iteration of the rule over a different artifact in the Tigerstripe project, this will have a different value. If a specific artifact type was selected in the rule (the AnyArtifact option has not been selected), the actual artifact will be of that type ( eg IManagedEntityArtifact) and the object can be cast to the precise type for access to the specifics of that artifact type.
$pluginConfig (IPluginConfig)
The plug-in reference gives access to the values of the plug-in Global Properties. For example, $pluginRef.Properties.getProperty(“propname”)
$tsProjectHandle (ITigerstripeModelProject)
Contains information about the Tigerstripe project such as the version, name, and Copyright notice of your project. This information is held in ProjectDetails object, for example $tsProjectHandle.getIextProjectDetails().getProperty("copyrightNotice","")
$runtime (TigerstripeRuntime)
The runtime object contains information about the Tigerstripe installation so you can check the version of Workbench. For example, $runtime.getProperty("tigerstripe.feature.version")
$sessionManager (IArtifactManagerSession)
The artifact manager session is used to gain access to artifacts in the project, or in project dependencies. For example, if you have a String that should be an FQN of another artifact, you can access that artifact using $sessionManager.getIArtifactByFullyQualifiedName($fqnString)
$util (VelocityContextUtil)
A utility class that contains a few simple String handling utilities.
stripExternalQuotes(String arg0) removes leading and trailing quotation (”) characters. unCapitalize(String arg0) Turns the first character to lower-case. capitalize(String arg0) Turns the first character to upper-case. getLastSegment(String arg0) Returns the part of the String after the last “.” character. toLowerCase(String arg0) Returns entire Strings in lower-case. toUpperCase(String arg0) Returns entire Strings in upper-case. Example use : $util.capitalize($attribute.Name)
$exp (IExpander)
A utility that can be used to simplify access to some model, plug-in, or project variables. The currentArtifact or currentModel must be set prior to use for artifact or model attributes, but the pluginRef is pre-set.
Example use : $exp.expandVar($model.TargetNamespace)
$templateName (String)
The local pathname of the template that is currently being used. For example, templates/wsdm/type.vm.
$pluginDir (String)
The path to the root of the plugin when it is deployed. This is useful for gaining access to files that have been included with the deployed plugin.