net.sourceforge.groboutils.pmti.v1.defimpl
Class AbstractEditableIssue

java.lang.Object
  extended bynet.sourceforge.groboutils.pmti.v1.defimpl.AbstractEditableIssue
All Implemented Interfaces:
IEditableIssue, IIssue

public abstract class AbstractEditableIssue
extends java.lang.Object
implements IEditableIssue

Allows for editing of an issue. The only parts that can't be edited are the ID and type, since those uniquely identify the issue at hand. Editing an issue has several constraints that should be known by the user:

Since:
July 12, 2002
Version:
$Date: 2003/02/10 22:51:57 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
AbstractEditableIssue(IIssue base)
           
 
Method Summary
protected  void assertStateCanBeNext(IIssueState state)
           
abstract  void commit()
          Commits all changes from the issue to the tracker.
protected abstract  IEditableAttributeSet createEditableAttributeSet(IAttributeSet as)
          Creates an editable set of attributes based on the immutable attribute set.
protected abstract  IIssueState createImmutableIssueState(IEditableIssueState eis)
          Create a non-editable version of eis.
protected abstract  IEditableIssueState[] createNextEditableIssueStates(IIssueState is)
          Creates a set of editable issue states that can be set as 'next' for is.
 IAttributeSet getAttributes()
          Returns a list of all attributes associated with this issue.
 IEditableAttributeSet getEditableAttributes()
          This is a synonymn for getAttributes(), but this explicitly sets the returned value as an editable set, without the need for an extra cast.
 java.lang.String getID()
          Returns the unique ID associated with this issue.
 IEditableIssueState[] getNextStates()
          Returns the list of all states that this issue can move to next.
 java.lang.String getShortDescription()
          Retrieves the short description of the issue.
 IIssueState getState()
          Queries the "state" of the issue.
 java.lang.String getType()
          Returns the type of issue.
 boolean hasShortDescriptionChanged()
           
 boolean hasStateChanged()
           
abstract  IIssue reload()
          Returns a new issue instance, containing the most up-to-date tracker information for this issue.
 void setShortDescription(java.lang.String desc)
           
 void setState(IIssueState state)
          Sets the current state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEditableIssue

public AbstractEditableIssue(IIssue base)
Method Detail

getID

public java.lang.String getID()
Description copied from interface: IIssue
Returns the unique ID associated with this issue.

Specified by:
getID in interface IIssue
Returns:
the problem tracker's assigned ID for this issue, which can never be null.

getType

public java.lang.String getType()
Description copied from interface: IIssue
Returns the type of issue. For the SourceForge.net site, this may be "bug", "feature request", and so forth. Some trackers may only have one type of issue, so this field may not be as useful. For those trackers that have different attribute data sets for different types, this may aid programs in decoding the attributes and states.

NOTE: this field may be deprecated in the future in favor of specific IAttributeSet types.

Specified by:
getType in interface IIssue
Returns:
the issue's type, which may be null.
See Also:
IIssue.getAttributes()

getShortDescription

public java.lang.String getShortDescription()
Description copied from interface: IIssue
Retrieves the short description of the issue. This can also be referred to as the issue title or summary. It should be a human-readable short description, describing a general overview of the issue.

Specified by:
getShortDescription in interface IIssue
Returns:
the issue's short description, which may be null.

getState

public IIssueState getState()
Description copied from interface: IIssue
Queries the "state" of the issue. In a very general way, this refers to various progress states an issue can be in, such as "new", "assigned", "investigating", "resolved", "verified", "closed", and so on. Additional data may be associated with this state, such as who's working on the issue, the resolution of the issue, who verified the resolution, and so on. If the tracker does not support a state, then null may be returned.

Some trackers may have different state categories for different issue types.

Specified by:
getState in interface IIssue
Returns:
the issue's state, which may be null.

getAttributes

public IAttributeSet getAttributes()
Description copied from interface: IIssue
Returns a list of all attributes associated with this issue. All issues of a particular type should have the same set of issues.

Specified by:
getAttributes in interface IIssue
Returns:
the set of tracker-specific and issue type-specific attributes and values associated with this issue. Can never return null.

reload

public abstract IIssue reload()
                       throws ProblemManagerException
Description copied from interface: IIssue
Returns a new issue instance, containing the most up-to-date tracker information for this issue. Since the IIssue instances are immutable, this will not change the invoked issue. If the current instance is of type IEditableIssue, then an IEditableIssue will be returned, but will contain none of the non-committed changes performed on the owning issue.

In theory, issues should never be removed. However, some systems allow them to be deleted (say, if there was an accidental creation). In this case, an IssueRemovedException will be thrown.

Specified by:
reload in interface IIssue
Returns:
an IIssue with the
Throws:
ProblemManagerException - if there was an underlying tracker error.

setShortDescription

public void setShortDescription(java.lang.String desc)
Specified by:
setShortDescription in interface IEditableIssue

hasShortDescriptionChanged

public boolean hasShortDescriptionChanged()
Specified by:
hasShortDescriptionChanged in interface IEditableIssue
Returns:
true if setShortDescription( String ) was called with a different description string than the original issue, otherwise false.

getNextStates

public IEditableIssueState[] getNextStates()
Returns the list of all states that this issue can move to next. This is part of the workflow logic of the underlying PMT. The returned states may be safely edited without any affect; the only effect will be when the state is explicitly set. This will always return, in index 0, a copy of the current state as editable.

Specified by:
getNextStates in interface IEditableIssue

setState

public void setState(IIssueState state)
              throws ProblemManagerException
Sets the current state. Since there is no getEditableState() method, use this method if any information in the current state needs to be updated. You can retrieve the current state as an editable state using getNextStates()[0], but note that any changes to that editable version will not affect the tracker's state unless that editable instance is explicitly set in this method.

Specified by:
setState in interface IEditableIssue
Throws:
ProblemManagerException - if the input state is not a valid next state.

hasStateChanged

public boolean hasStateChanged()
Specified by:
hasStateChanged in interface IEditableIssue
Returns:
true if the setState( IIssueState ) method has been invoked and did not throw an exception, otherwise false. Note that even if the set state is an unchanged version of the current issue's state, this will still return true.

getEditableAttributes

public IEditableAttributeSet getEditableAttributes()
This is a synonymn for getAttributes(), but this explicitly sets the returned value as an editable set, without the need for an extra cast. The returned attribute set may be safely edited, and changes there will affect the issue that returned them.

Specified by:
getEditableAttributes in interface IEditableIssue

commit

public abstract void commit()
                     throws ProblemManagerException
Commits all changes from the issue to the tracker.

In theory, issues should never be removed. However, some systems allow them to be deleted (say, if there was an accidental creation). In this case, an IssueRemovedException will be thrown.

Specified by:
commit in interface IEditableIssue
Throws:
ProblemManagerException - if there was an underlying tracker error.

createNextEditableIssueStates

protected abstract IEditableIssueState[] createNextEditableIssueStates(IIssueState is)
Creates a set of editable issue states that can be set as 'next' for is. Note that it is required that the input is must be returned in index 0 of the returned array.


createEditableAttributeSet

protected abstract IEditableAttributeSet createEditableAttributeSet(IAttributeSet as)
Creates an editable set of attributes based on the immutable attribute set. The new set of attributes should accurately reflect the input attribute set's values.


createImmutableIssueState

protected abstract IIssueState createImmutableIssueState(IEditableIssueState eis)
Create a non-editable version of eis.


assertStateCanBeNext

protected void assertStateCanBeNext(IIssueState state)
                             throws ProblemManagerException
Throws:
ProblemManagerException


Copyright © 2001-2003 by The GroboUtils Project