com.atlassian.jira.external
Class ExternalUtils

java.lang.Object
  extended by com.atlassian.jira.external.ExternalUtils

public class ExternalUtils
extends Object


Field Summary
static String CF_PREFIX
           
static String GENERIC_CONTENT_TYPE
           
static String TYPE_SEPERATOR
           
 
Constructor Summary
ExternalUtils(ProjectManager projectManager, PermissionSchemeManager permissionSchemeManager, IssueManager issueManager, JiraAuthenticationContext authenticationContext, VersionManager versionManager, ProjectComponentManager componentManager, CustomFieldManager customFieldManager, OptionsManager optionsManager, org.ofbiz.core.entity.GenericDelegator genericDelegator, ActionDispatcher actionDispatcher, ConstantsManager constantsManager, WorkflowManager workflowManager, IssueTypeScreenSchemeManager issueTypeScreenSchemeManager, FieldScreenManager fieldScreenManager, PermissionManager permissionManager, IssueFactory issueFactory, AttachmentManager attachmentManager, IssueLinkTypeManager issueLinkTypeManager, IssueLinkManager issueLinkManager, FieldManager fieldManager, ApplicationProperties applicationProperties, IssueTypeSchemeManager issueTypeSchemeManager, CommentManager commentManager, UserUtil userUtil)
           
 
Method Summary
 void addComments(org.ofbiz.core.entity.GenericValue issue, ExternalComment externalComment, boolean dispatchEvent)
          Adds an external comment to an issue and portentially dispatches and event about this.
 void addComments(org.ofbiz.core.entity.GenericValue issue, ExternalComment externalComment, boolean dispatchEvent, boolean tweakIssueUpdateDate)
          Adds an external comment to an issue and portentially dispatches and event about this and also updates the issue updated date.
 String addConstant(String constantName, String constantType)
          Deprecated. Use PriorityManager, IssueTypeManager, ResolutionManager instead. Since v5.0.
protected  String addConstant(String constantName, String constantType, Map<String,String> extraParams)
           
 void addOptions(CustomField customFieldObject, ExternalCustomFieldValue customFieldValue, org.ofbiz.core.entity.GenericValue issueGV)
           
 void associateCustomFieldWithScreen(CustomField customField, FieldScreen screen)
           
 void associateProjectCategory(org.ofbiz.core.entity.GenericValue project, org.ofbiz.core.entity.GenericValue projectCategory)
          Deprecated. since v4.4. Use associateProjectCategory(com.atlassian.jira.project.Project, com.atlassian.jira.project.ProjectCategory) instead.
 void associateProjectCategory(Project project, ProjectCategory category)
          Associates a project with a projectCategory.
 void attachFile(ExternalAttachment externalAttachment, org.ofbiz.core.entity.GenericValue issueGv)
          Deprecated. Use AttachmentManager.createAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue) instead. Since v5.0.
 boolean canActivateNumberOfUsers(int numberOfUsers)
           
protected  void checkStatus(Issue issue, String status)
           
 org.ofbiz.core.entity.GenericValue createComponent(ExternalProject externalProject, ExternalComponent externalComponent)
           
 CustomField createCustomField(ExternalCustomFieldValue customFieldValue)
           
 org.ofbiz.core.entity.GenericValue createIssue(Issue issue, String status, String resolution)
           
protected  org.ofbiz.core.entity.GenericValue createIssue(Map fields)
           
 org.ofbiz.core.entity.GenericValue createProject(ExternalProject externalProject)
          Deprecated. since v4.4. Use createProjectObject(com.atlassian.jira.external.beans.ExternalProject) instead.
 org.ofbiz.core.entity.GenericValue createProjectCategory(String projectCategoryName)
          Deprecated. Use createProjectCategoryObject(String) instead. Since v4.4
 ProjectCategory createProjectCategoryObject(String projectCategoryName)
           
 Project createProjectObject(ExternalProject externalProject)
          Create a project in JIRA from the given ExternalProject.
 com.atlassian.crowd.embedded.api.User createUser(ExternalUser externalUser)
           
 Version createVersion(ExternalProject externalProject, ExternalVersion externalVersion)
           
 String extractCustomFieldId(String customfieldId)
           
 String extractCustomFieldType(String customfieldId)
           
 org.ofbiz.core.entity.GenericValue getComponent(ExternalProject externalProject, ExternalComponent externalComponent)
           
 org.ofbiz.core.entity.GenericValue getConstant(String constantName, String constantType)
          Deprecated. Use ConstantsManager.getConstantObject(String, String), or ConstantsManager.getIssueConstantByName(String, String) instead. Since v5.0.
 CustomField getCustomField(ExternalCustomFieldValue customFieldValue)
           
 CustomField getCustomField(String customfieldId)
           
 com.atlassian.crowd.embedded.api.User getJiraUser(ExternalUser externalUser)
           
 org.ofbiz.core.entity.GenericValue getProject(ExternalProject externalProject)
          Deprecated. Use getProjectObject(com.atlassian.jira.external.beans.ExternalProject) instead. Since v4.4.
 org.ofbiz.core.entity.GenericValue getProjectCategory(String projectCategoryName)
          Deprecated. Use getProjectCategoryObject(String) instead. Since v4.4.
 ProjectCategory getProjectCategoryObject(String projectCategoryName)
          Tries to find a Project Category with the given name.
 Project getProjectObject(ExternalProject externalProject)
          Tries to find an existing Project based on the values in the given ExternalProject.
static String getTextDataFromMimeMessage(String s)
           
 Version getVersion(ExternalProject externalProject, ExternalVersion externalVersion)
           
 MutableIssue newIssueInstance()
           
 void setCurrentWorkflowStep(org.ofbiz.core.entity.GenericValue issue, String status, String resolution)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERIC_CONTENT_TYPE

public static final String GENERIC_CONTENT_TYPE
See Also:
Constant Field Values

TYPE_SEPERATOR

public static final String TYPE_SEPERATOR
See Also:
Constant Field Values

CF_PREFIX

public static final String CF_PREFIX
See Also:
Constant Field Values
Constructor Detail

ExternalUtils

public ExternalUtils(ProjectManager projectManager,
                     PermissionSchemeManager permissionSchemeManager,
                     IssueManager issueManager,
                     JiraAuthenticationContext authenticationContext,
                     VersionManager versionManager,
                     ProjectComponentManager componentManager,
                     CustomFieldManager customFieldManager,
                     OptionsManager optionsManager,
                     org.ofbiz.core.entity.GenericDelegator genericDelegator,
                     ActionDispatcher actionDispatcher,
                     ConstantsManager constantsManager,
                     WorkflowManager workflowManager,
                     IssueTypeScreenSchemeManager issueTypeScreenSchemeManager,
                     FieldScreenManager fieldScreenManager,
                     PermissionManager permissionManager,
                     IssueFactory issueFactory,
                     AttachmentManager attachmentManager,
                     IssueLinkTypeManager issueLinkTypeManager,
                     IssueLinkManager issueLinkManager,
                     FieldManager fieldManager,
                     ApplicationProperties applicationProperties,
                     IssueTypeSchemeManager issueTypeSchemeManager,
                     CommentManager commentManager,
                     UserUtil userUtil)
Method Detail

getProject

public org.ofbiz.core.entity.GenericValue getProject(ExternalProject externalProject)
Deprecated. Use getProjectObject(com.atlassian.jira.external.beans.ExternalProject) instead. Since v4.4.

Tries to find an existing Project based on the values in the given ExternalProject.

Parameters:
externalProject - the ExternalProject.
Returns:
the project or null if none exist

getProjectObject

public Project getProjectObject(ExternalProject externalProject)
Tries to find an existing Project based on the values in the given ExternalProject.

Parameters:
externalProject - the ExternalProject.
Returns:
the project or null if none exist

createProject

public org.ofbiz.core.entity.GenericValue createProject(ExternalProject externalProject)
                                                 throws ExternalException
Deprecated. since v4.4. Use createProjectObject(com.atlassian.jira.external.beans.ExternalProject) instead.

Create a project in JIRA from the given ExternalProject.

Parameters:
externalProject - the ExternalProject definition
Returns:
The newly created Project
Throws:
ExternalException - if anything goes wrong

createProjectObject

public Project createProjectObject(ExternalProject externalProject)
                            throws ExternalException
Create a project in JIRA from the given ExternalProject.

Parameters:
externalProject - the ExternalProject definition
Returns:
The newly created Project
Throws:
ExternalException - if anything goes wrong

createVersion

public Version createVersion(ExternalProject externalProject,
                             ExternalVersion externalVersion)

getVersion

public Version getVersion(ExternalProject externalProject,
                          ExternalVersion externalVersion)

createComponent

public org.ofbiz.core.entity.GenericValue createComponent(ExternalProject externalProject,
                                                          ExternalComponent externalComponent)

getComponent

public org.ofbiz.core.entity.GenericValue getComponent(ExternalProject externalProject,
                                                       ExternalComponent externalComponent)

createUser

public com.atlassian.crowd.embedded.api.User createUser(ExternalUser externalUser)

canActivateNumberOfUsers

public boolean canActivateNumberOfUsers(int numberOfUsers)

getJiraUser

public com.atlassian.crowd.embedded.api.User getJiraUser(ExternalUser externalUser)

createIssue

public org.ofbiz.core.entity.GenericValue createIssue(Issue issue,
                                                      String status,
                                                      String resolution)
                                               throws ExternalException
Throws:
ExternalException

checkStatus

protected void checkStatus(Issue issue,
                           String status)
                    throws WorkflowException,
                           ExternalException
Throws:
WorkflowException
ExternalException

createIssue

protected org.ofbiz.core.entity.GenericValue createIssue(Map fields)
                                                  throws CreateException
Throws:
CreateException

setCurrentWorkflowStep

public void setCurrentWorkflowStep(org.ofbiz.core.entity.GenericValue issue,
                                   String status,
                                   String resolution)
                            throws org.ofbiz.core.entity.GenericEntityException,
                                   WorkflowException
Throws:
org.ofbiz.core.entity.GenericEntityException
WorkflowException

getCustomField

public CustomField getCustomField(ExternalCustomFieldValue customFieldValue)

getCustomField

public CustomField getCustomField(String customfieldId)

addOptions

public void addOptions(CustomField customFieldObject,
                       ExternalCustomFieldValue customFieldValue,
                       org.ofbiz.core.entity.GenericValue issueGV)

createCustomField

public CustomField createCustomField(ExternalCustomFieldValue customFieldValue)

extractCustomFieldType

public String extractCustomFieldType(String customfieldId)

extractCustomFieldId

public String extractCustomFieldId(String customfieldId)

associateCustomFieldWithScreen

public void associateCustomFieldWithScreen(CustomField customField,
                                           FieldScreen screen)

addComments

public void addComments(org.ofbiz.core.entity.GenericValue issue,
                        ExternalComment externalComment,
                        boolean dispatchEvent)
                 throws ExternalException
Adds an external comment to an issue and portentially dispatches and event about this. The issue updated date will be set to now via this method.

Parameters:
issue - the issue GV
externalComment - the external Comment to add
dispatchEvent - whether to dispatch an issue updated event
Throws:
ExternalException - if something bad happens

addComments

public void addComments(org.ofbiz.core.entity.GenericValue issue,
                        ExternalComment externalComment,
                        boolean dispatchEvent,
                        boolean tweakIssueUpdateDate)
                 throws ExternalException
Adds an external comment to an issue and portentially dispatches and event about this and also updates the issue updated date. When doing a CSV import one might not want the event dispatched nor the issue updated date changed.

Parameters:
issue - the issue GV
externalComment - the external Comment to add
dispatchEvent - whether to dispatch an issue updated event
tweakIssueUpdateDate - whether to tweak the issue updated date or not
Throws:
ExternalException - if something bad happens

attachFile

public void attachFile(ExternalAttachment externalAttachment,
                       org.ofbiz.core.entity.GenericValue issueGv)
                throws ExternalException
Deprecated. Use AttachmentManager.createAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue) instead. Since v5.0.

Attaches a file to the given Issue.

Parameters:
externalAttachment - the Attachment
issueGv - the Issue
Throws:
ExternalException

getConstant

public org.ofbiz.core.entity.GenericValue getConstant(String constantName,
                                                      String constantType)
Deprecated. Use ConstantsManager.getConstantObject(String, String), or ConstantsManager.getIssueConstantByName(String, String) instead. Since v5.0.


addConstant

public String addConstant(String constantName,
                          String constantType)
                   throws ExternalException
Deprecated. Use PriorityManager, IssueTypeManager, ResolutionManager instead. Since v5.0.

Throws:
ExternalException

addConstant

protected String addConstant(String constantName,
                             String constantType,
                             Map<String,String> extraParams)
                      throws ExternalException
Throws:
ExternalException

newIssueInstance

public MutableIssue newIssueInstance()

getTextDataFromMimeMessage

public static String getTextDataFromMimeMessage(String s)

getProjectCategory

public org.ofbiz.core.entity.GenericValue getProjectCategory(String projectCategoryName)
Deprecated. Use getProjectCategoryObject(String) instead. Since v4.4.

Tries to find a Project Category with the given name.

Parameters:
projectCategoryName -
Returns:
a Project Category with the given name or null.

getProjectCategoryObject

public ProjectCategory getProjectCategoryObject(String projectCategoryName)
Tries to find a Project Category with the given name.

Parameters:
projectCategoryName -
Returns:
a Project Category with the given name or null.

createProjectCategory

public org.ofbiz.core.entity.GenericValue createProjectCategory(String projectCategoryName)
                                                         throws ExternalException
Deprecated. Use createProjectCategoryObject(String) instead. Since v4.4

Creates a projectCategory with the given name.

Parameters:
projectCategoryName - The name.
Returns:
The newly create ProjectCategory
Throws:
ExternalException

createProjectCategoryObject

public ProjectCategory createProjectCategoryObject(String projectCategoryName)
                                            throws ExternalException
Throws:
ExternalException

associateProjectCategory

public void associateProjectCategory(org.ofbiz.core.entity.GenericValue project,
                                     org.ofbiz.core.entity.GenericValue projectCategory)
Deprecated. since v4.4. Use associateProjectCategory(com.atlassian.jira.project.Project, com.atlassian.jira.project.ProjectCategory) instead.

Associates a project with a projectCategory.

Parameters:
project - The Project
projectCategory - The category.

associateProjectCategory

public void associateProjectCategory(Project project,
                                     ProjectCategory category)
Associates a project with a projectCategory.

Parameters:
project - The Project
category - The category.


Copyright © 2002-2012 Atlassian. All Rights Reserved.