Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Tigerstripe Plugin Miscellany
< 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.