Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;
import org.everit.jira.reporting.service.attribute.WorklogAttributeService;
import java.util.Arrays;
import java.util.List;


@WithPlugin("org.everit.jira.timetracker.plugin")

@PluginModule
WorklogAttributeService worklogAttributeService;

// list worklog attributes (only enabled attributes will be returned)
List<String> worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);

// add worklog attributes
worklogAttributeService.updateWorklogAttributes(Arrays.asList("billable", "not-billable"));
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);

// delete worklog attribute
worklogAttributeService.deleteWorklogAttribute("billable");
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);

// delete worklog attribute
worklogAttributeService.deleteWorklogAttribute("not-billable");
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);

...