Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I have a groovy script where new updates of the methods is not corresponding

pablo_marcos September 9, 2020

Hi,

I did updates in java library and now the script displays errors in the lines 50/53/54

# def results = searchService.search(query, user, PagerFilter.getUnlimitedFilter())

# for (def issue : results.getIssue()){
calculoHorasLinealesQ1(issueManager.getIssueObject(issue.key));

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
pablo_marcos September 9, 2020

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
// FUNCTION: CÁLCULO DE LAS HORAS LINEALES /////////////////////////////////
def calculoHorasLinealesQ1(Issue issue){
def cfManager = ComponentAccessor.getCustomFieldManager();
def horas= cfManager.getCustomFieldObject(16135); //'Horas lineales 2020-Q1'
def estimacionesFieldIds=[
'Estimación Loyalty 2020-Q1':16125,
'Estimación MCR 2020-Q1':16126,
'Estimación Campañas 2020-Q1':17409,
'Estimación iBlue 2020-Q1':16133,
'Estimación Salesforce 2020-Q1':16129,
'Estimación Voz 2020-Q1':16132,
'Estimación APP 2020-Q1':16117,
'Estimación Assistant 2020-Q1':16118,
'Estimación Booking Engine 2020-Q1':16119,
'Estimación Channel Manager 2020-Q1':16121,
'Estimación Melia.com 2020-Q1':16127,
'Estimación Extranet & Switch 2020-Q1':16123,
'Estimación RMS 2020-Q1':16128,
'Estimación Sirius 2020-Q1':16131,
'Estimación Servicios y Pasarela & Message Broker 2020-Q1':16130,
'Estimación Customer Intelligence & ETL 2020-Q1':16122,
'Estimación Focus 2020-Q1':16124
];
if(horas != null && estimacionesFieldIds != null){
double hl = 0;
for (def id: estimacionesFieldIds.values()){
def estimacion = cfManager.getCustomFieldObject(id)?.getValue(issue);
if(estimacion != null) hl += (double) estimacion;
}
def changeHolder = new DefaultIssueChangeHolder()
log.warn(issue.key + "|" + hl);
horas.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(horas), hl),changeHolder); // Actualizar el campo de horas lineales con el valor de 'hl'
}
}
////////////////////////////////////////////////////////////////////////////
// JQL QUERY ///////////////////////////////////////////////////////////////
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def SearchService = ComponentAccessor.getComponent(SearchService)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
// edit this query to suit
def query = jqlQueryParser.parseQuery("issuetype = Épica AND category = 'BUSINESS DEVELOPMENT TECHNOLOGIES'")
def results = searchService.search(query, user, PagerFilter.getUnlimitedFilter())
/////////////////////////////////////////////////////////////////////////////
// ACCIONES SOBRE LAS ÉPICAS BDT ////////////////////////////////////////////
for (def issue : results.getIssue()){
calculoHorasLinealesQ1(issueManager.getIssueObject(issue.key));
}
////////////////////////////////////////////////////////////////////////////

TAGS
AUG Leaders

Atlassian Community Events