Tabnine Logo
WorklogService
Code IndexAdd Tabnine to your IDE (free)

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

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

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

@Override
public Worklog validateAndPerformAndAutoAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogResult worklogResult = getWorklogService().validateCreate(serviceContext, worklogInputParameters);
  return getWorklogService().createAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true);
}
origin: com.atlassian.jira/jira-rest-plugin

@Override
public Worklog validateAndPerformAndLeaveEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogResult worklogResult = getWorklogService().validateCreate(serviceContext, worklogInputParameters);
  return getWorklogService().createAndRetainRemainingEstimate(serviceContext, worklogResult, true);
}
origin: com.atlassian.jira/jira-rest-plugin

@Override
public Worklog validateAndPerformAndSetNewEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogNewEstimateResult worklogResult = getWorklogService().validateCreateWithNewEstimate(serviceContext, (WorklogNewEstimateInputParameters) worklogInputParameters);
  return getWorklogService().createWithNewRemainingEstimate(serviceContext, worklogResult, true);
}
origin: com.atlassian.jira/jira-rest-plugin

@Override
public Worklog validateAndPerformAndAutoAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogResult worklogResult = getWorklogService().validateUpdate(serviceContext, worklogInputParameters);
  return getWorklogService().updateAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true);
}
origin: com.atlassian.jira/jira-core

public void createValue(Issue issue, WorklogValue value)
{
  final WorklogResult worklogResult = value.worklogResult();
  // note that we don't expect this to be actually used but we need to pass it anyway
  final JiraServiceContext jiraServiceContext = new JiraServiceContextImpl(authenticationContext.getUser());
  // Based on how the user wants to update the remaining estimate we will call the correct do method on the service
  switch (value.adjustEstimate())
  {
    case LEAVE:
      getWorklogService().createAndRetainRemainingEstimate(jiraServiceContext, worklogResult, true);
      break;
    case NEW:
      getWorklogService().createWithNewRemainingEstimate(jiraServiceContext, (WorklogNewEstimateResult) worklogResult, true);
      break;
    case MANUAL:
      getWorklogService().createWithManuallyAdjustedEstimate(jiraServiceContext, (WorklogAdjustmentAmountResult) worklogResult, true);
      break;
    default :
      getWorklogService().createAndAutoAdjustRemainingEstimate(jiraServiceContext, worklogResult, true);
  }
}
origin: com.atlassian.jira/jira-core

@RequiresXsrfCheck
protected String doExecute() throws Exception
{
  // Based on how the user wants to update the remaining estimate we will call the correct do method on the service
  if (ADJUST_ESTIMATE_AUTO.equalsIgnoreCase(adjustEstimate))
  {
    worklogService.deleteAndAutoAdjustRemainingEstimate(getJiraServiceContext(), worklogResult, true);
  }
  else if (ADJUST_ESTIMATE_NEW.equalsIgnoreCase(adjustEstimate))
  {
    worklogService.deleteWithNewRemainingEstimate(getJiraServiceContext(), (WorklogNewEstimateResult) worklogResult, true);
  }
  else if (ADJUST_ESTIMATE_MANUAL.equalsIgnoreCase(adjustEstimate))
  {
    worklogService.deleteWithManuallyAdjustedEstimate(getJiraServiceContext(), (WorklogAdjustmentAmountResult) worklogResult, true);
  }
  else
  {
    worklogService.deleteAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true);
  }
  if (getHasErrorMessages())
  {
    return ERROR;
  }
  if (isInlineDialogMode())
  {
    return returnComplete();
  }
  return getRedirect("/browse/" + getIssue().getString("key"));
}
origin: com.atlassian.jira/jira-core

    .newEstimate(getNewEstimate())
    .buildNewEstimate();
worklogResult = worklogService.validateCreateWithNewEstimate(getJiraServiceContext(), params);
    .adjustmentAmount(getAdjustmentAmount())
    .buildAdjustmentAmount();
worklogResult = worklogService.validateCreateWithManuallyAdjustedEstimate(getJiraServiceContext(), params);
worklogResult = worklogService.validateCreate(getJiraServiceContext(), params);
origin: com.atlassian.jira/jira-core

@RequiresXsrfCheck
protected String doExecute() throws Exception
{
  // Based on how the user wants to update the remaining estimate we will call the correct do method on the service
  if (ADJUST_ESTIMATE_AUTO.equalsIgnoreCase(adjustEstimate))
  {
    worklogService.updateAndAutoAdjustRemainingEstimate(getJiraServiceContext(), worklogResult, true);
  }
  else if (ADJUST_ESTIMATE_NEW.equalsIgnoreCase(adjustEstimate))
  {
    worklogService.updateWithNewRemainingEstimate(getJiraServiceContext(), (WorklogNewEstimateResult) worklogResult, true);
  }
  else
  {
    worklogService.updateAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true);
  }
  if (getHasErrorMessages())
  {
    return ERROR;
  }
  if (isInlineDialogMode())
  {
    return returnComplete();
  }
  return getRedirect("/browse/" + getIssue().getString("key"));
}
origin: com.atlassian.jira/jira-core

@Override
public List<IssueAction> getActions(Issue issue, ApplicationUser remoteUser)
{
  JiraServiceContextImpl context = new JiraServiceContextImpl(remoteUser, new SimpleErrorCollection());
  List<Worklog> userWorklogs = worklogService.getByIssueVisibleToUser(context, issue);
  List<IssueAction> worklogs = Lists.newArrayListWithCapacity(userWorklogs.size());
  final Locale userLocale = context.getI18nBean().getLocale();
  for (Worklog userWorklog : userWorklogs)
  {
    boolean canEditWorklog = worklogService.hasPermissionToUpdate(context, userWorklog);
    boolean canDeleteWorklog = worklogService.hasPermissionToDelete(context, userWorklog);
    worklogs.add(new WorklogAction(descriptor, userWorklog, jiraDurationUtils, canEditWorklog, canDeleteWorklog, fieldLayoutManager, rendererManager, userLocale, userFormats));
  }
  // This is a bit of a hack to indicate that there are no comments to display
  if (worklogs.isEmpty())
  {
    IssueAction action = new GenericMessageAction(descriptor.getI18nBean().getText("viewissue.nowork"));
    return Lists.newArrayList(action);
  }
  Collections.sort(worklogs, IssueActionComparator.COMPARATOR);
  return worklogs;
}
origin: com.atlassian.jira/jira-rest-plugin

@Override
public Worklog validateAndPerformAndAutoAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogResult worklogResult = getWorklogService().validateDelete(serviceContext, worklogInputParameters.getWorklogId());
  boolean success = getWorklogService().deleteAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true);
  return success ? worklogResult.getWorklog() : null;
}
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

@Override
public Worklog validateAndPerformAndLeaveEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogResult worklogResult = getWorklogService().validateDelete(serviceContext, worklogInputParameters.getWorklogId());
  boolean success = getWorklogService().deleteAndRetainRemainingEstimate(serviceContext, worklogResult, true);
  return success ? worklogResult.getWorklog() : null;
}
origin: com.atlassian.jira/jira-rest-plugin

@Override
public Worklog validateAndPerformAndSetNewEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters)
{
  WorklogNewEstimateResult worklogResult = getWorklogService().validateDeleteWithNewEstimate(serviceContext, worklogInputParameters.getWorklogId(), ((WorklogNewEstimateInputParameters) worklogInputParameters).getNewEstimate());
  boolean success = getWorklogService().deleteWithNewRemainingEstimate(serviceContext, worklogResult, true);
  return success ? worklogResult.getWorklog() : null;
}
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.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 List<Worklog> getIssueWorklogsObjects(Issue issue)
{
  final JiraServiceContextImpl serviceContext = new JiraServiceContextImpl(authenticationContext.getUser());
  return worklogService.getByIssueVisibleToUser(serviceContext, issue);
}
origin: com.atlassian.jira/jira-core

worklog = worklogService.createAndAutoAdjustRemainingEstimate(getJiraServiceContext(), worklogResult, true);
worklog = worklogService.createWithNewRemainingEstimate(getJiraServiceContext(), (WorklogNewEstimateResult) worklogResult, true);
worklog = worklogService.createWithManuallyAdjustedEstimate(getJiraServiceContext(), (WorklogAdjustmentAmountResult) worklogResult, true);
worklog = worklogService.createAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true);
origin: com.atlassian.jira/jira-core

if (WorklogValue.AdjustEstimate.NEW == value.adjustEstimate())
  worklogResult = getWorklogService().validateCreateWithNewEstimate(jiraServiceContext, inputBuilder.buildNewEstimate());
  worklogResult = getWorklogService().validateCreateWithManuallyAdjustedEstimate(jiraServiceContext, inputBuilder.buildAdjustmentAmount());
  worklogResult = getWorklogService().validateCreate(jiraServiceContext, inputBuilder.build());
origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin

public void updateWorklogAndAutoAdjustRemainingEstimate(User user, RemoteWorklog remoteWorklog)
    throws RemoteException, RemotePermissionException, RemoteValidationException
{
  JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection());
  Long id = SoapUtils.toLongRequired(remoteWorklog.getId());
  String timeSpent = remoteWorklog.getTimeSpent();
  Date startDate = remoteWorklog.getStartDate();
  String comment = remoteWorklog.getComment();
  String groupLevel = remoteWorklog.getGroupLevel();
  String roleLevelId = remoteWorklog.getRoleLevelId();
  final WorklogInputParameters params = WorklogInputParametersImpl
      .timeSpent(timeSpent)
      .worklogId(id)
      .startDate(startDate)
      .comment(comment)
      .groupLevel(groupLevel)
      .roleLevelId(roleLevelId)
      .build();
  WorklogResult worklogResult = worklogService.validateUpdate(serviceContext, params);
  checkAndThrowValidationException(serviceContext.getErrorCollection());
  if (worklogResult == null)
  {
    throw new RemoteValidationException(getI18nHelper().getText("error.unexpected.condition", "WorklogService.validateUpdate"));
  }
  worklogService.updateAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true);
  checkAndThrowRemoteException(serviceContext.getErrorCollection());
}
origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin

public void deleteWorklogAndAutoAdjustRemainingEstimate(User user, String remoteWorklogId)
    throws RemoteException, RemotePermissionException, RemoteValidationException
{
  JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection());
  Long id = SoapUtils.toLongRequired(remoteWorklogId);
  WorklogResult worklogResult = worklogService.validateDelete(serviceContext, id);
  checkAndThrowValidationException(serviceContext.getErrorCollection());
  if (worklogResult == null)
  {
    throw new RemoteValidationException(getI18nHelper().getText("error.unexpected.condition", "WorklogService.validateDelete"));
  }
  worklogService.deleteAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true);
  checkAndThrowRemoteException(serviceContext.getErrorCollection());
}
com.atlassian.jira.bc.issue.worklogWorklogService

Javadoc

This is the business layer component that must be used to access all com.atlassian.jira.bc.issue.worklog.WorklogService functionality. This will perform validation before it hands off to the com.atlassian.jira.issue.worklog.WorklogManager. Operations will not be performed if validation fails.

Most used methods

  • createAndAutoAdjustRemainingEstimate
  • validateCreate
  • getById
    Used to get a worklog by its id.
  • 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
  • updateAndRetainRemainingEstimate,
  • updateWithNewRemainingEstimate,
  • validateCreateWithNewEstimate,
  • validateDelete,
  • validateDeleteWithNewEstimate,
  • validateUpdate,
  • validateUpdateWithNewEstimate,
  • createWithManuallyAdjustedEstimate,
  • deleteWithManuallyAdjustedEstimate,
  • hasPermissionToDelete

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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