Jump to: navigation, search

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=
  
<h2>Collections</h2>
+
'''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'''
  
<a name="artifacts"></a><p><b>$artifact</b> (IAbstractArtifact)</p>
+
<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. See <b><a href="includedFiles.html">Including Files in the deployed Plugin</a></b> for more details.</p></blockquote>
+
<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 09: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
$artifactsCollection<IArtifact> All artifacts within this project.
$entitiesCollection<IManagedEntityArtifact> All Managed Entity artifacts within this project.
$datatypesCollection<IDatatypeArtifact> All Datatype artifacts within this project.
$eventsCollection<IEventArtifact> All Event artifacts within this project.
$enumsCollection<IEnumArtifact> All Enumeration artifacts within this project.
$exceptionsCollection<IExceptionArtifact> All Exception artifacts within this project.
$queriesCollection<IQueryArtifact> All Query artifacts within this project.
$updateProceduresCollection<IUpdateProcedureArtifact> All Update Procedure artifacts within this project.
$associationsCollection<IAssociationArtifact> All Association artifacts within this project.
$associationClassesCollection<IAssociationClassArtifact> All Association Class artifacts within this project.
$sessionsCollection<ISessionArtifact> All Session Facade artifacts within this project.
$allArtifactsCollection<IAbstractArtifact> All artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allEntitiesCollection<IManagedEntityArtifact> All Managed Entity artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allDatatypesCollection<IDatatypeArtifact> All Datatype artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allEventsCollection<IEventArtifact> All Event artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allEnumsCollection<IEnumArtifact> All Enumeration artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allExceptionsCollection<IExceptionArtifact> All Exception artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allQueriesCollection<IQueryArtifact> All Query artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allUpdateProceduresCollection<IUpdateProcedureArtifact> All Update Procedure artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allAssociationsCollection<IAssociationArtifact> All Association artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allAssociationClassesCollection<IAssociationClassArtifact> All Association Class artifacts within this project, plus those in Referenced Projects and Dependent Modules.
$allSessionsCollection<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.