plugin
Class ValueAssigner

java.lang.Object
  extended by plugin.ValueAssigner

public class ValueAssigner
extends java.lang.Object

This class handles all the operations necessary to change the issues' value that are affected by an action made from the issue navigator, and also the methods that are used within the columnView_template file to help display in the issue navigator.


Constructor Summary
ValueAssigner()
           
 
Method Summary
 void assignValueAutomatically(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.util.Collection idsIssue)
          Assign a value automatically to myIssue: if no issue has an order assigned value, the value is set to MAX_ORDER_VALUE.
 java.util.ArrayList buildIssueAboveList(java.util.Collection issueIds, com.atlassian.jira.issue.fields.CustomFieldImpl customField, double minValue)
          Return a list of issues which have a value greater than minValue
 java.util.ArrayList buildIssueBelowList(java.util.Collection issueIds, com.atlassian.jira.issue.fields.CustomFieldImpl customField, double maxValue)
          Return a list of issues which have a value lower than maxValue
 void decreaseIssue(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.lang.String issueOrderValue, java.util.Collection idsIssue)
          Exchange the values between myIssue and the issue which have a value just below issueValue.
 void displayIssuesValue(java.util.ArrayList issues, com.atlassian.jira.issue.fields.CustomFieldImpl customField)
          Display the key and the value for each issue in the list
 void doChangeValue(java.lang.String customFieldName, java.lang.String action, java.lang.String issueKey, java.lang.String issueOrderValue, java.lang.String numberOfBoxes)
          Method called from FAIssueOrdererServlet.
 void exchangeValues(com.atlassian.jira.issue.Issue issue1, com.atlassian.jira.issue.Issue issue2, com.atlassian.jira.issue.fields.CustomFieldImpl customField)
          Exchange the values between issue1 and issue2, according to the given custom field
 com.atlassian.jira.issue.Issue findIssueAbove(java.util.ArrayList issueList, com.atlassian.jira.issue.fields.CustomFieldImpl customField, float issueValue)
          Return the issue that have the lower value greater than issueValue
 com.atlassian.jira.issue.Issue findIssueBelow(java.util.ArrayList issueList, com.atlassian.jira.issue.fields.CustomFieldImpl customField, float issueValue)
          Return the issue that have the greater value lower than issueValue
 boolean hasAValueGreaterThanZero(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.CustomField customField)
           
 void increaseIssue(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.lang.String issueOrderValue, java.util.Collection issueIds)
          Exchange the values between myIssue and the issue which have a value just above issueValue
 void insertIssue(com.atlassian.jira.issue.Issue myIssue, com.atlassian.jira.issue.Issue issueAbove, com.atlassian.jira.issue.fields.CustomFieldImpl customField)
          Insert an issue, i.e. set to it a calculated value, so as to could order it in the issue navigator.
 boolean isFirst(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.CustomField customField)
          Return true if issue has the higher value among all the issue belonging to the same project (used from the columView_template file to manage the display of the tools)
 boolean isLast(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.CustomField customField)
          Return true if issue has the lower value among all the issue belonging to the same project (used from the columView_template file to manage the display of the tools)
 void moveIssueInFirstPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.lang.String issueValue, java.util.Collection issueIds)
          Move an issue in first position, i.e. set the higher value found among all the issues that have an assigned value to myIssue.
 void moveIssueInLastPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.lang.String issueValue, java.util.Collection issueIds)
          Move an issue in last position, i.e. set the lower value found among all the issues that have an assigned value to myIssue.
 void moveIssueToPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField, com.atlassian.jira.issue.Issue myIssue, java.lang.String issueValue, java.util.Collection issueIds, java.lang.String s_nbOfBoxes)
          Move an issue up or down, depending on the sign of s_nbOfBoxes, of s_nbOfBoxes boxes.
 void setValueToIssue(com.atlassian.jira.issue.Issue issue, com.atlassian.jira.issue.fields.CustomField customField, double orderValue)
          Set the given value to the given issue for the given custom field (which is of type NumberCFType)
 void sortIssueList(java.util.ArrayList issueList, com.atlassian.jira.issue.fields.CustomFieldImpl customField)
          Sort a list of issues in ascending order, according to their assigned value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueAssigner

public ValueAssigner()
Method Detail

setValueToIssue

public void setValueToIssue(com.atlassian.jira.issue.Issue issue,
                            com.atlassian.jira.issue.fields.CustomField customField,
                            double orderValue)
                     throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Set the given value to the given issue for the given custom field (which is of type NumberCFType)

Parameters:
issue - The issue which the value will be assigned
customField - The concerned custom field
orderValue - The order value that will be assigned to the issue
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

hasAValueGreaterThanZero

public boolean hasAValueGreaterThanZero(com.atlassian.jira.issue.Issue issue,
                                        com.atlassian.jira.issue.fields.CustomField customField)
Parameters:
issue - The issue we want to check the value
customField - The corresponding custom field for the value
Returns:
true if the issue's value is greater than zero (used in the columnView_template file)

doChangeValue

public void doChangeValue(java.lang.String customFieldName,
                          java.lang.String action,
                          java.lang.String issueKey,
                          java.lang.String issueOrderValue,
                          java.lang.String numberOfBoxes)
Method called from FAIssueOrdererServlet. Handle the different changes to do over the issues regarding the parameter obtained in the request

Parameters:
customFieldName - The name of the corresponding custom field
action - The action to execute
issueKey - The issue key
issueOrderValue - The issue value
numberOfBoxes - The number of boxes to move the issue

increaseIssue

public void increaseIssue(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                          com.atlassian.jira.issue.Issue myIssue,
                          java.lang.String issueOrderValue,
                          java.util.Collection issueIds)
                   throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Exchange the values between myIssue and the issue which have a value just above issueValue

Parameters:
customField - The corresponding custom field
myIssue - The issue to modify
issueOrderValue - The issue value
issueIds - A list of ids of all the issue belonging to the same project than myIssue
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

decreaseIssue

public void decreaseIssue(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                          com.atlassian.jira.issue.Issue myIssue,
                          java.lang.String issueOrderValue,
                          java.util.Collection idsIssue)
                   throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Exchange the values between myIssue and the issue which have a value just below issueValue. If there is no issue that have a value lower, myIssue is set to 0 value.

Parameters:
customField - The corresponding custom field
myIssue - The issue to modify
issueOrderValue - The issue value
idsIssue - A list of ids of all the issue belonging to the same project than myIssue
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

assignValueAutomatically

public void assignValueAutomatically(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                     com.atlassian.jira.issue.Issue myIssue,
                                     java.util.Collection idsIssue)
                              throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Assign a value automatically to myIssue: if no issue has an order assigned value, the value is set to MAX_ORDER_VALUE. Else, the assigned value is the lower value found among all the issues that have an assigned value, divided by two.

Parameters:
customField - The corresponding custom field
myIssue - The issue that the value will be assign to.
idsIssue - A list of ids of all the issue belonging to the same project than myIssue
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

moveIssueInFirstPosition

public void moveIssueInFirstPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                     com.atlassian.jira.issue.Issue myIssue,
                                     java.lang.String issueValue,
                                     java.util.Collection issueIds)
Move an issue in first position, i.e. set the higher value found among all the issues that have an assigned value to myIssue. The order relation is preserved between the issues that had a greater value than issueValue.

Parameters:
customField - The corresponding custom field
myIssue - The issue to move in first position
issueValue - The value of myIssue
issueIds - A list of ids of all the issue belonging to the same project than myIssue

moveIssueInLastPosition

public void moveIssueInLastPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                    com.atlassian.jira.issue.Issue myIssue,
                                    java.lang.String issueValue,
                                    java.util.Collection issueIds)
Move an issue in last position, i.e. set the lower value found among all the issues that have an assigned value to myIssue. The order relation is preserved between the issues that had a lower value than issueValue.

Parameters:
customField - The corresponding custom field
myIssue - The issue to move in last position
issueValue - The value of myIssue
issueIds - A list of ids of all the issue belonging to the same project than myIssue

moveIssueToPosition

public void moveIssueToPosition(com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                com.atlassian.jira.issue.Issue myIssue,
                                java.lang.String issueValue,
                                java.util.Collection issueIds,
                                java.lang.String s_nbOfBoxes)
Move an issue up or down, depending on the sign of s_nbOfBoxes, of s_nbOfBoxes boxes.

Parameters:
customField - The corresponding custom field
myIssue - The issue to move
issueValue - The value of myIssue
issueIds - A list of ids of all the issue belonging to the same project than myIssue
s_nbOfBoxes - The number of boxes that myIssue will move.

findIssueAbove

public com.atlassian.jira.issue.Issue findIssueAbove(java.util.ArrayList issueList,
                                                     com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                                     float issueValue)
Return the issue that have the lower value greater than issueValue

Parameters:
issueList - A list of all the issues that have a greater value than issueValue (to get this list, use )
customField - The corresponding custom field
issueValue - The value of the issue to modify
Returns:
issueTmp The issue that have the lower value among all the issues that have a greater value than issueValue

findIssueBelow

public com.atlassian.jira.issue.Issue findIssueBelow(java.util.ArrayList issueList,
                                                     com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                                     float issueValue)
Return the issue that have the greater value lower than issueValue

Parameters:
issueList - A list of all the issues that have a lower value than issueValue (to get this list, use )
customField - The corresponding custom field
issueValue - The value of the issue to modify
Returns:
issueTmp The issue that have the greater value among all the issues that have a lower value than issueValue

exchangeValues

public void exchangeValues(com.atlassian.jira.issue.Issue issue1,
                           com.atlassian.jira.issue.Issue issue2,
                           com.atlassian.jira.issue.fields.CustomFieldImpl customField)
                    throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Exchange the values between issue1 and issue2, according to the given custom field

Parameters:
issue1 - The first issue to modify
issue2 - The second issue to modify
customField - The corresponding custom field
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

insertIssue

public void insertIssue(com.atlassian.jira.issue.Issue myIssue,
                        com.atlassian.jira.issue.Issue issueAbove,
                        com.atlassian.jira.issue.fields.CustomFieldImpl customField)
                 throws com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException
Insert an issue, i.e. set to it a calculated value, so as to could order it in the issue navigator.

Parameters:
myIssue - The issue that the value will be assigned to
issueAbove - The issue that have the lower value among all the issues that have an assigned value
customField - The corresponding custom field
Throws:
com.atlassian.jira.issue.fields.layout.field.FieldLayoutStorageException - Thrown if there is a problem trying to recover the FieldLayoutItem object

buildIssueAboveList

public java.util.ArrayList buildIssueAboveList(java.util.Collection issueIds,
                                               com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                               double minValue)
Return a list of issues which have a value greater than minValue

Parameters:
issueIds - A list of ids of all the issue belonging to the same project than myIssue
customField - The corresponding custom field
minValue - The minimum value that an issue must have to be selected
Returns:
issueAboveList A list of all the issues that have a an assigned value greater than minValue

buildIssueBelowList

public java.util.ArrayList buildIssueBelowList(java.util.Collection issueIds,
                                               com.atlassian.jira.issue.fields.CustomFieldImpl customField,
                                               double maxValue)
Return a list of issues which have a value lower than maxValue

Parameters:
issueIds - A list of ids of all the issue belonging to the same project than myIssue
customField - The corresponding custom field
maxValue - The maximum value that an issue must have to be selected
Returns:
issueAboveList A list of all the issues that have a an assigned value lower than minValue

sortIssueList

public void sortIssueList(java.util.ArrayList issueList,
                          com.atlassian.jira.issue.fields.CustomFieldImpl customField)
Sort a list of issues in ascending order, according to their assigned value.

Parameters:
issueList - The list of issues to be sorted
customField - The corresponding custom field

isFirst

public boolean isFirst(com.atlassian.jira.issue.Issue issue,
                       com.atlassian.jira.issue.fields.CustomField customField)
Return true if issue has the higher value among all the issue belonging to the same project (used from the columView_template file to manage the display of the tools)

Parameters:
issue - The issue to check
customField - The corresponding custom field
Returns:
true if issue has the higher assigned value

isLast

public boolean isLast(com.atlassian.jira.issue.Issue issue,
                      com.atlassian.jira.issue.fields.CustomField customField)
Return true if issue has the lower value among all the issue belonging to the same project (used from the columView_template file to manage the display of the tools)

Parameters:
issue - The issue to check
customField - The corresponding custom field
Returns:
true if issue has the lower assigned value

displayIssuesValue

public void displayIssuesValue(java.util.ArrayList issues,
                               com.atlassian.jira.issue.fields.CustomFieldImpl customField)
Display the key and the value for each issue in the list

Parameters:
issues - A list of issues
customField - The corresponding custom field for the value to display


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.