com.atlassian.jira.jql.util
Class JqlDurationSupportImpl

java.lang.Object
  extended by com.atlassian.jira.jql.util.JqlDurationSupportImpl
All Implemented Interfaces:
IndexValueConverter, JqlDurationSupport

@InjectableComponent
public class JqlDurationSupportImpl
extends Object
implements JqlDurationSupport

The default implementation of JqlDurationSupport

Since:
v4.0

Constructor Summary
JqlDurationSupportImpl()
           
 
Method Summary
 Long convertToDuration(Long durationInMinutes)
          Convenience method.
 Long convertToDuration(String durationString)
          Converts the formatted duration string into its duration in seconds.
protected  String convertToIndexValue(Long durationInMinutes)
          Convenience method.
 String convertToIndexValue(QueryLiteral rawValue)
           
protected  String convertToIndexValue(String durationString)
          Converts the specified duration into the format used by the index.
 boolean validate(String durationString, boolean allowNegatives)
          Check to see if the passed string is a valid duration according to JQL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JqlDurationSupportImpl

public JqlDurationSupportImpl()
Method Detail

validate

public boolean validate(String durationString,
                        boolean allowNegatives)
Description copied from interface: JqlDurationSupport
Check to see if the passed string is a valid duration according to JQL.

Specified by:
validate in interface JqlDurationSupport
Parameters:
durationString - the string to check; cannot be null.
allowNegatives - use true if a negative duration is allowed to be specified
Returns:
true if the date is valid; false otherwise.

convertToIndexValue

public String convertToIndexValue(QueryLiteral rawValue)
Specified by:
convertToIndexValue in interface IndexValueConverter
Parameters:
rawValue - the query literal to convert
Returns:
the string of the index representation, null if the conversion fails

convertToDuration

public Long convertToDuration(Long durationInMinutes)
Convenience method. See convertToDuration(String). Converts the duration in minutes into its duration in seconds.

Parameters:
durationInMinutes - the duration
Returns:
the duration in seconds; null if there was a problem

convertToDuration

public Long convertToDuration(String durationString)
Converts the formatted duration string into its duration in seconds.

Parameters:
durationString - the formatted duration string
Returns:
the duration in seconds; null if there was a problem

convertToIndexValue

protected String convertToIndexValue(Long durationInMinutes)
Convenience method. See convertToIndexValue(String). Converts the specified duration into the format used by the index.

Parameters:
durationInMinutes - the duration
Returns:
the index representation of the duration value in seconds

convertToIndexValue

protected String convertToIndexValue(String durationString)
Converts the specified duration into the format used by the index.

Parameters:
durationString - the formatted duration string
Returns:
the index representation of the duration value in seconds


Copyright © 2002-2009 Atlassian. All Rights Reserved.