Error in my script.

Michely Balbino January 16, 2013

Could you help me to verify if there is any error in my script?

"import java.util.Arrays;

import java.util.Collection;

import java.util.Map;

import webwork.dispatcher.ActionResult;

import com.atlassian.core.ofbiz.CoreFactory;

import com.atlassian.core.util.map.EasyMap;

import com.atlassian.jira.action.ActionNames;

import org.ofbiz.core.entity.GenericValue;

import com.atlassian.core.ofbiz.CoreFactory;

import com.atlassian.core.util.map.EasyMap;

import com.atlassian.jira.ComponentManager;

import com.atlassian.jira.project.ProjectManager;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.issue.MutableIssue;

import com.atlassian.jira.util.ImportUtils;

import com.atlassian.jira.issue.index.IssueIndexManager;

import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem;

import com.atlassian.jira.issue.*;

import com.atlassian.jira.issue.util.*;

import com.atlassian.jira.config.SubTaskManager;

import com.atlassian.jira.security.JiraAuthenticationContext;

import com.atlassian.jira.security.roles.*;

import com.atlassian.jira.issue.fields.layout.field.*;

import com.atlassian.jira.issue.fields.*;

import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;

import com.opensymphony.workflow.InvalidInputException;

import org.apache.log4j.Category;

import com.opensymphony.user.Group;

import com.atlassian.crowd.embedded.api.Group;

import com.atlassian.jira.component.ComponentAccessor;

def log = null

try{

log = Category.getInstance("log.acotel.groovy");

}catch(Throwable e){

System.out.println("ERRO ao obter a instancia do log4j")

e.printStackTrace();

return

}

def celular = "customfield_10102"

def permiteComentario = "customfield_10230"

ComponentManager componentManager = ComponentManager.getInstance();

IssueManager issueManager = componentManager.getIssueManager()

SubTaskManager subTaskManager = componentManager.getSubTaskManager();

//JiraAuthenticationContext authenticationContext = componentManager.getJiraAuthenticationContext();

// Adicionado em 20130104 ;

JiraAuthenticationContext authenticationContext = ComponentAccessor.getJiraAuthenticationContext();

// ---

IssueFactory issueFactory = componentManager.getIssueFactory();

ProjectManager projectManager = componentManager.getProjectManager();

CustomFieldManager cfManager = componentManager.getCustomFieldManager()

FieldLayoutManager fieldLayoutManager = componentManager.getFieldLayoutManager()

CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()

CustomField customFieldTarget = customFieldManager.getCustomFieldObject( celular )

CustomField customFieldComentarioTarget = customFieldManager.getCustomFieldObject( permiteComentario )

log.debug("Tarefa pai = " + issue.getKey() + " criada por " + issue.getReporter() )

if( issue.getCustomFieldValue(customFieldTarget) != null && issue.getCustomFieldValue(customFieldTarget).equals("Sim") ){

MutableIssue subTask = issueFactory.getIssue();

MutableIssue mIssue = issue

subTask.setParentObject( issue )

subTask.setReporter( issue.getReporter() )

//Seta o Projeto da Tarefa para para sub-tarefa

subTask.setProject(projectManager.getProject(issue.getProjectObject().getId()))

//Seta o tipo da tarefa como Sub-Task

subTask.setIssueTypeId( "5" )

//Seta o Titulo da tarefa

subTask.setSummary( "Definir Celular" )

//Seta a descrição da tarefa

subTask.setDescription( "Definir Celular" )

//Seta como Reporte o mesmo da tarefa pai

subTask.setReporter( issue.getReporter())

//Persiste a tarefa com as alterações

GenericValue subTaskSalva = issueManager.createIssue( issue.getReporter(), subTask )

subTaskManager.createSubTaskIssueLink(subTask.getParent(), subTaskSalva, authenticationContext.getUser())

// Seta novo valor no Custom Field Permite Comentario

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();

List("ACOTEL_users") ), changeHolder)

//Persiste a tarefa com as altera<C3>õe

subTask.store()

log.info("Sub Task Criada com Chave = " + subTask.getKey() + " da tarefa pai " + issue.getKey())

}else{

log.warn("Celular não preenchido sem necessidade de criar sub-tarefa 'Definir Celular' ")

"

I'm testing the version of Jira 5.2.4. But this error occurring when opening called. When trying to open reports the error in Jira: "Only Manager has permission to create this type of call." However, I belong to the Group Manager and checked now CROWD. But the log reports the following error: "/ secure / QuickCreateIssue.jspa [groovy.canned.utils.ConditionUtils] javax.script.ScriptException: groovy.lang.MissingMethodException: groovy.lang.MissingMethodException: No signature of method: com.atlassian . jira.crowd.embedded.ofbiz Possible solutions: getClass () "

Could you help me?

1 answer

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2013

I think the (huge) script you posted is unrelated to your problem. There must be more to that error message as well.

Basically you need to replace osuser with calls to crowd: https://developer.atlassian.com/display/JIRADEV/How+to+migrate+a+plugin+from+JIRA+4.x+to+JIRA+5.0

And change user.getFullName to user.getDisplayName

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events