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

Tempo 8.0.0.2 update broken script

Server Admin June 8, 2016

Hi,

Since upgrading to tempo version 8.0.0.2 the bellow script fails:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.tempoplugin.worklog.attribute.WorklogAttributeService

@WithPlugin("is.origo.jira.tempo-plugin")

@PluginModule
WorklogAttributeService worklogAttributeService

def worklogManager = ComponentAccessor.getWorklogManager()
def worklogs = worklogManager.getByIssue(issue)

worklogs.findAll { worklog ->
    worklogAttributeService.getWorklogAttributes(worklog.id).containsKey("_ChargeableWork_")
}
.sum { Worklog worklog ->
    worklog.timeSpent
} as Long

// if no ChargeableWork worklogs just return null

Specifically I get an error with this line:

import com.tempoplugin.worklog.attribute.WorklogAttributeService

Unable to resolve class. Any help you can offer would be great.

Thanks,
Rich

1 answer

1 vote
Sigrún Arna Sigurðardóttir
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.
June 8, 2016

Hi Rich,

There were made some changes to the Java API.

Instead of: com.tempoplugin.worklog.attribute.WorklogAttributeService

We are now using: com.tempoplugin.core.workattribute.api.WorkAttributeService

I hope this helps.


Best regards,
Sigrún
Tempo 

Server Admin June 8, 2016

Thanks for the reply,

 

I've modified the scrip, but now it errors out on this line:

WorkAttributeService.getworkattribute(worklog.id).containsKey("_ChargeableWork_")

*Error - Cannot find matching method

Have I made a syntax error here?

Sigrún Arna Sigurðardóttir
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.
June 8, 2016

These are the functions we're using with the latest release of Tempo Timesheets:

ServiceOutcome<WorkAttribute> createWorkAttribute(WorkAttribute workAttribute);

    ServiceOutcome<WorkAttribute> updateWorkAttribute(WorkAttribute workAttribute);

    ServiceOutcome<Boolean> deleteWorkAttribute(int id);

    ServiceOutcome<Collection<WorkAttribute>> getWorkAttributes();

    ServiceOutcome<WorkAttribute> getWorkAttributeById(int id);

    ServiceOutcome<WorkAttribute> getWorkAttributeByKey(String key);

    ServiceOutcome<Collection<WorkAttribute>> getWorkAttributesByType(WorkAttributeType.Type type);

    ServiceOutcome<Collection<WorkAttributeType>> getWorkAttributeTypes();

I hope this helps you fix this error.

 

Best regards,
Sigrún
Tempo 

Michael_Lansdown July 19, 2016

Hello,

 

I have the same problem. Did you use getWorkAttributeById() to resolve the error?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events