org.tigris.scarab.util
Class IssueIdParser

java.lang.Object
  extended byorg.tigris.scarab.util.IssueIdParser

public class IssueIdParser
extends java.lang.Object

This class contains logic for finding issue ids in generic text.

Version:
$Id: IssueIdParser.java 7604 2003-04-09 22:55:31Z jmcnally $
Author:
John McNally

Constructor Summary
IssueIdParser()
           
 
Method Summary
static java.lang.String getIssueIdFromToken(Module module, java.lang.String token)
          Assumption is the token will contain at most one issue id.
static java.util.Map getIssueIds(Module module, java.lang.String text)
          A Map of ids where the keys are the tokens such as "issue#35" and the value is the unique id, "PACS35".
static java.util.List getIssueIdTokens(Module module, java.lang.String text)
          Parses text for any valid issue ids and returns matches.
static java.util.List tokenizeText(Module module, java.lang.String text)
          Parses text for any valid issue ids.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IssueIdParser

public IssueIdParser()
Method Detail

getIssueIdTokens

public static java.util.List getIssueIdTokens(Module module,
                                              java.lang.String text)
                                       throws org.apache.torque.TorqueException
Parses text for any valid issue ids and returns matches. The regular expression to determine ids is given by the module

Throws:
org.apache.torque.TorqueException

tokenizeText

public static java.util.List tokenizeText(Module module,
                                          java.lang.String text)
                                   throws org.apache.torque.TorqueException
Parses text for any valid issue ids. The text is broken up into tokens at potential id boundaries. if a token corresponds to a valid issue id, a List is returned with [0] as the token and [1] is the id. if a token does not contain an id the text is added as a String.

Throws:
org.apache.torque.TorqueException

getIssueIdFromToken

public static java.lang.String getIssueIdFromToken(Module module,
                                                   java.lang.String token)
Assumption is the token will contain at most one issue id. A number is a potential valid id within the given module. A syntactically correct id will be checked against the db to make sure a valid issue exists. if the token does not result in a valid issue, null is returned. Otherwise the id will be returned including the module code.

Parameters:
module - a Module value
token - a String value
Returns:
a String value

getIssueIds

public static java.util.Map getIssueIds(Module module,
                                        java.lang.String text)
                                 throws org.apache.torque.TorqueException
A Map of ids where the keys are the tokens such as "issue#35" and the value is the unique id, "PACS35".

Throws:
org.apache.torque.TorqueException


Copyright © 2000-2004 Tigris.org. All Rights Reserved.