com.atlassian.greenhopper.web.rapid.issue.fields
Class FieldHelper

java.lang.Object
  extended by com.atlassian.greenhopper.web.rapid.issue.fields.FieldHelper

@Service
public class FieldHelper
extends java.lang.Object

Contains methods which are useful for the Field classes in rendering and updating their values.

Author:
mtokar

Constructor Summary
FieldHelper()
           
 
Method Summary
 HtmlFieldEntry createDateFieldViewEntry(I18n2 i18n, com.atlassian.crowd.embedded.api.User user, java.sql.Timestamp date, java.lang.String id, java.lang.String labelKey)
          Factory method for creating FieldEntry's for date fields.
 java.lang.String getRenderedText(com.atlassian.jira.issue.Issue issue, java.lang.String fieldId, java.lang.String value)
          Renders a text using the field layout defined for the given field/issue.
static
<T> java.lang.String
renderListField(java.util.Collection<T> values, com.google.common.base.Function<T,java.lang.String> toStringFunction)
          Transforms a list of values into a comma-separated string representation
 ServiceOutcome<java.lang.Void> updateField(com.atlassian.crowd.embedded.api.User user, com.atlassian.jira.issue.Issue issue, SimpleEditableField editableField, java.lang.String newValue)
          Updates the value of a SimpleEditableField for the specified Issue using the IssueUpdateService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldHelper

public FieldHelper()
Method Detail

renderListField

public static <T> java.lang.String renderListField(java.util.Collection<T> values,
                                                   com.google.common.base.Function<T,java.lang.String> toStringFunction)
Transforms a list of values into a comma-separated string representation

Type Parameters:
T - a property of an issue e.g. Version, ProjectComponent
Parameters:
values - the value objects
toStringFunction - the function which converts the value object to its String representation
Returns:
the comma-separated string; null if there were no values

getRenderedText

public java.lang.String getRenderedText(com.atlassian.jira.issue.Issue issue,
                                        java.lang.String fieldId,
                                        java.lang.String value)
Renders a text using the field layout defined for the given field/issue.

Parameters:
issue - the issue containing this field
fieldId - the ID of the field to render
value - the value to render
Returns:
the rendered text, html encoded?

updateField

@NotNull
public ServiceOutcome<java.lang.Void> updateField(com.atlassian.crowd.embedded.api.User user,
                                                          com.atlassian.jira.issue.Issue issue,
                                                          SimpleEditableField editableField,
                                                          java.lang.String newValue)
Updates the value of a SimpleEditableField for the specified Issue using the IssueUpdateService.

Parameters:
user - the user performing the update
issue - the issue to be updated
editableField - the field we are updating
newValue - the new value for that field
Returns:
the outcome - may contain errors if update failed.

createDateFieldViewEntry

public HtmlFieldEntry createDateFieldViewEntry(I18n2 i18n,
                                               com.atlassian.crowd.embedded.api.User user,
                                               java.sql.Timestamp date,
                                               java.lang.String id,
                                               java.lang.String labelKey)
Factory method for creating FieldEntry's for date fields.



Copyright © 2007-2012 Atlassian. All Rights Reserved.