congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
WorklogService.getById
Code IndexAdd Tabnine to your IDE (free)

How to use
getById
method
in
com.atlassian.jira.bc.issue.worklog.WorklogService

Best Java code snippets using com.atlassian.jira.bc.issue.worklog.WorklogService.getById (Showing top 6 results out of 315)

origin: com.atlassian.streams/streams-jira-plugin

private Option<String> worklogComment(JiraActivityItem item)
{
  for (Long worklogId : getWorklogId(item))
  {
    Worklog worklog = worklogService.getById(new JiraServiceContextImpl(authenticationContext.getLoggedInUser()), worklogId);
    if (worklog != null)
    {
      String comment = worklog.getComment();
      if (!isBlank(comment))
      {
        return some(comment);
      }
    }
  }
  return none();
}
origin: com.atlassian.jira/jira-rest-plugin

public Response getWorklogForIssue(String worklogId, Issue issue)
{
  try
  {
    final JiraServiceContextImpl serviceContext = new JiraServiceContextImpl(authenticationContext.getUser());
    final Worklog worklog = worklogService.getById(serviceContext, Long.parseLong(worklogId));
    if (worklog != null)
    {
      if (issue.getId().equals(worklog.getIssue().getId()))
      {
        return Response.ok(WorklogJsonBean.getWorklog(worklog, jiraBaseUrls, userManager, timeTrackingConfiguration, authenticationContext.getUser(), emailFormatter)).cacheControl(never()).build();
      }
      else
      {
        final ErrorCollection errors = ErrorCollection.of(serviceContext.getErrorCollection());
        return Response.status(Response.Status.NOT_FOUND).entity(errors).cacheControl(never()).build();
      }
    }
    else
    {
      final ErrorCollection errors = ErrorCollection.of(serviceContext.getErrorCollection());
      return Response.status(Response.Status.NOT_FOUND).entity(errors).cacheControl(never()).build();
    }
  }
  catch (NumberFormatException e)
  {
    throw new NotFoundWebException(ErrorCollection.of(i18n.getText("worklog.service.error.no.worklog.for.id", worklogId)));
  }
}
origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin

public boolean hasPermissionToDeleteWorklog(User user, String worklogId)
    throws RemoteException, RemoteValidationException
{
  JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection());
  Long id = SoapUtils.toLongRequired(worklogId);
  Worklog worklog = worklogService.getById(serviceContext, id);
  // getById does not currenty return errors but it might so we do this code
  checkAndThrowValidationException(serviceContext.getErrorCollection());
  return worklog != null && worklogService.hasPermissionToDelete(serviceContext, worklog);
}
origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin

public boolean hasPermissionToUpdateWorklog(User user, String worklogId)
    throws RemoteException, RemoteValidationException
{
  JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection());
  Long id = SoapUtils.toLongRequired(worklogId);
  Worklog worklog = worklogService.getById(serviceContext, id);
  // getById does not currenty return errors but it might so we do this code
  checkAndThrowValidationException(serviceContext.getErrorCollection());
  return worklog != null && worklogService.hasPermissionToUpdate(serviceContext, worklog);
}
origin: com.atlassian.jira/jira-rest-plugin

private static Worklog getAndValidateExistingWorklog(WorklogJsonBean request, ErrorCollection errors, JiraServiceContext serviceContext)
{
  String id = request.getId();
  if (!errors.hasAnyErrors())
  {
    if (id == null)
    {
      errors.addError(IssueFieldConstants.WORKLOG, serviceContext.getI18nBean().getText("rest.worklog.error.id.missing"));
      return null;
    }
    Worklog existingWorklog = getWorklogService().getById(serviceContext, Long.parseLong(id));
    if (existingWorklog == null)
    {
      throw new NotFoundWebException(com.atlassian.jira.rest.api.util.ErrorCollection.of(serviceContext.getI18nBean().getText("worklog.service.error.no.worklog.for.id", id)));
    }
    return existingWorklog;
  }
  else
  {
    return null;
  }
}
origin: com.atlassian.jira/jira-core

public String doDefault() throws Exception
{
  // Retrieve the worklog
  worklog = worklogService.getById(getJiraServiceContext(), getWorklogId());
  if (worklog == null)
  {
    addErrorMessage(getText("logwork.error.update.invalid.id", (getWorklogId() == null) ? null : getWorklogId().toString()));
    return ERROR;
  }
  if (!worklogService.hasPermissionToUpdate(getJiraServiceContext(), worklog))
  {
    //user doesn't have permission to run this action
    return "securitybreach";
  }
  //pre-populate the fields
  final BigDecimal hoursPerDay = getHoursPerDay();
  final BigDecimal daysPerWeek = getDaysPerWeek();
  final BigDecimal secondsPerHour = BigDecimal.valueOf(DateUtils.Duration.HOUR.getSeconds());
  final long secondsPerDay = hoursPerDay.multiply(secondsPerHour).longValueExact();
  final long secondsPerWeek = daysPerWeek.multiply(hoursPerDay).multiply(secondsPerHour).longValueExact();
  setTimeLogged(DateUtils.getDurationStringSeconds(worklog.getTimeSpent(), secondsPerDay, secondsPerWeek));
  setStartDate(getFormattedStartDate(worklog.getStartDate()));
  setComment(worklog.getComment());
  setCommentLevel(CommentVisibility.getCommentLevelFromLevels(worklog.getGroupLevel(), worklog.getRoleLevelId()));
  return super.doDefault();
}
com.atlassian.jira.bc.issue.worklogWorklogServicegetById

Javadoc

Used to get a worklog by its id.

Popular methods of WorklogService

  • createAndAutoAdjustRemainingEstimate
  • validateCreate
  • createAndRetainRemainingEstimate
    Persists a new com.atlassian.jira.issue.worklog.Worklog on the given Issue. This method will make no
  • createWithNewRemainingEstimate
    Persists a new com.atlassian.jira.issue.worklog.Worklog on the given Issue. This method will adjust
  • deleteAndAutoAdjustRemainingEstimate
    Deletes the specified com.atlassian.jira.issue.worklog.Worklog. This method will auto-adjust the iss
  • deleteAndRetainRemainingEstimate
    Deletes the specified com.atlassian.jira.issue.worklog.Worklog. This method will make no adjustment
  • deleteWithNewRemainingEstimate
    Deletes the specified com.atlassian.jira.issue.worklog.Worklog. This method will adjust the issues r
  • getByIssueVisibleToUser
    Returns a PagedList over all all child worklogs of a specified issue that the provided user has perm
  • updateAndAutoAdjustRemainingEstimate
    Updates the provided com.atlassian.jira.issue.worklog.Worklog. This method will auto-adjust the issu
  • updateAndRetainRemainingEstimate
    Updates the provided com.atlassian.jira.issue.worklog.Worklog. This method will make no adjustment t
  • updateWithNewRemainingEstimate
    Updates the provided com.atlassian.jira.issue.worklog.Worklog. This method will adjust the issues re
  • validateCreateWithNewEstimate
    Determines whether worklogs are enabled in JIRA and if the user has the required permission as deter
  • updateWithNewRemainingEstimate,
  • validateCreateWithNewEstimate,
  • validateDelete,
  • validateDeleteWithNewEstimate,
  • validateUpdate,
  • validateUpdateWithNewEstimate,
  • createWithManuallyAdjustedEstimate,
  • deleteWithManuallyAdjustedEstimate,
  • hasPermissionToDelete

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now