velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Tarau <adrian.ta...@intellisoftsystems.com>
Subject Re: [jira] Evaluating Strings (regular expressions / string comparison)
Date Thu, 02 Oct 2008 14:45:39 GMT

Just  be sure $customField.getValue($issue) returns a Collection and you 
can call contains() method.

acowart wrote:
> "Just populate a set ($component) with selected options and  do
> #if ($component.contains("XXX"))
>     #doSomenting
> #end "
>
> What is the syntax to populate a set from the multi-select custom field
> selected options?  I have not been able to find any JIRA documentation on
> working with multi-selects.
>
> Below is the syntax that I am using to populate $Component:
>
> #set ($customFields =
> $customFieldManager.getCustomFieldObjects($issue.project.getLong("id"),
> $issue.issueType.getString("id")))
> $foreach($customField in $customFields)
>    #if($customField.name.equals("Component"))
>        #set ($Component = $customField.getValue($issue))
>
> After running through this part of the code the value of $Component would be
> something like:
> [Dispatch, Domain Manager, Mobile]
>
> Thanks for the help.
>
>
> quote author="Adrian Tarau-3">
> Why regular expressions?
>
> Just populate a set ($component) with selected options and  do
> #if ($component.contains("XXX"))
>     #doSomenting
> #end
> acowart wrote:
>   
>> I created a multi-select list as a release note field in JIRA.
>>
>> The different options are:
>> Base
>> Dispatch
>> Domain Manager
>> Installer
>> Mobile
>>
>> I am now trying to write IF statements to find if each of the of the
>> options
>> are selected.
>>
>> So I am trying to write a regular expression to evaluate what is selected
>> in
>> the multi-select.
>>
>> Currently, I put all of the data from the multi-select custom field for an
>> issue into the a variable, $Component. This means the value of $Component
>> will be something like [Dispatch, Domain Manager, Installer]
>>
>> The code that I am trying to figure out how to write is something like:
>>
>> #if ("$Component" like "Domain Manager")
>>
>> Does anyone know a way to do this type of string comparison on a variable?
>> Or a way to use regular expressions in an if statement when validating a
>> string variable.
>>
>> Thanks.
>>
>> AC 
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
>
>   


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message