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

How to use
WorklogJsonBean
in
com.atlassian.jira.issue.fields.rest.json.beans

Best Java code snippets using com.atlassian.jira.issue.fields.rest.json.beans.WorklogJsonBean (Showing top 17 results out of 315)

origin: com.atlassian.jira/jira-api

  public WorklogJsonBean build()
  {
    return new WorklogJsonBean(self, author, updateAuthor, comment, created, updated, visibility, isVisibilitySet, started, timeSpent, timeSpentSeconds, id);
  }
}
origin: com.atlassian.jira/jira-webhooks-plugin

  public WorklogJsonBean createBean(final Worklog worklog) {
    // Is null so author's email address will be not in the bean if email visibility is not set public in JIRA.
    ApplicationUser loggedInUser = null;

    return WorklogJsonBean.getWorklog(worklog, jiraBaseUrls, userManager, timeTrackingConfiguration, loggedInUser, emailFormatter);
  }
}
origin: com.atlassian.jira/jira-api

public static List<WorklogJsonBean> asRenderedBeans(final List<Worklog> worklogs, final JiraBaseUrls uriInfo,
     final String rendererType, final IssueRenderContext renderContext, final ApplicationUser loggedInUser, final EmailFormatter emailFormatter)
{
  List<WorklogJsonBean> result = Lists.newArrayListWithCapacity(worklogs.size());
  for (Worklog worklog : worklogs)
  {
    result.add(getRenderedWorklog(worklog, uriInfo, rendererType, renderContext, loggedInUser, emailFormatter));
  }
  return result;
}
origin: com.atlassian.jira/jira-rest-plugin

if (!errors.hasAnyErrors())
  String timeSpent = request.getTimeSpent();
  Long timeSpentSeconds = request.getTimeSpentSeconds();
  if (timeSpent != null && timeSpentSeconds != null)
  builder.startDate(request.getStarted() != null ? request.getStarted() : new Date());
  builder.comment(request.getComment());
  builder.visibility(Visibilities.fromVisibilityBean(request.getVisibility(), getProjectRoleManager()));
origin: com.atlassian.jira/jira-rest-plugin

public Response deleteWorklog(@PathParam ("issueIdOrKey") final String issueIdOrKey, @PathParam ("id") final String worklogId, @QueryParam ("adjustEstimate") String adjustEstimate, @QueryParam ("newEstimate") String newEstimate, @QueryParam ("increaseBy") String increaseBy)
  WorklogJsonBean request = new WorklogJsonBean();
  request.setId(worklogId);
  final Issue issue = issueFinder.getIssueObject(issueIdOrKey);
  return issueWorklogResource.deleteWorklog(issue, request, new IssueWorklogResource.WorklogAdjustmentRequest(adjustEstimate, newEstimate, null, increaseBy), contextUriInfo);
origin: com.atlassian.jira/jira-api

public static WorklogJsonBean getRenderedWorklog(final Worklog log, final JiraBaseUrls baseUrls,
     String rendererType, IssueRenderContext renderContext, final ApplicationUser loggedInUser, final EmailFormatter emailFormatter)
{
  final WorklogJsonBean bean = new WorklogJsonBean();
  addNonRenderableData(bean, log, baseUrls, ComponentAccessor.getUserManager(), loggedInUser, emailFormatter);
  if (StringUtils.isNotBlank(rendererType))
  {
     RendererManager rendererManager = ComponentAccessor.getComponent(RendererManager.class);
     bean.comment = rendererManager.getRenderedContent(rendererType, log.getComment(), renderContext);
  }
  else
  {
     bean.comment = log.getComment();
  }
  JiraDurationUtils jiraDurationUtils = ComponentAccessor.getComponent(JiraDurationUtils.class);
  bean.timeSpent = jiraDurationUtils.getFormattedDuration(log.getTimeSpent(), ComponentAccessor.getJiraAuthenticationContext().getLocale());
  DateTimeFormatterFactory dateTimeFormatterFactory = ComponentAccessor.getComponent(DateTimeFormatterFactory.class);
  bean.created = log.getCreated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getCreated());
  bean.updated = log.getUpdated() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getUpdated());
  bean.started = log.getStartDate() == null ? "" : dateTimeFormatterFactory.formatter().forLoggedInUser().format(log.getStartDate());
  return bean;
}
origin: com.atlassian.jira/jira-core

@Override
public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequested, final @Nullable FieldLayoutItem fieldLayoutItem)
{
  final JiraServiceContextImpl serviceContext = new JiraServiceContextImpl(authenticationContext.getUser());
  final PagedList<Worklog> worklogs =  getWorklogService().getByIssueVisibleToUser(serviceContext, issue, 20);
  if (!serviceContext.getErrorCollection().hasAnyErrors())
  {
    WorklogWithPaginationBean worklogWithPaginationBean = new WorklogWithPaginationBean();
    worklogWithPaginationBean.setMaxResults(worklogs.getPageSize());
    worklogWithPaginationBean.setTotal(worklogs.getSize());
    worklogWithPaginationBean.setStartAt(0);
    worklogWithPaginationBean.setWorklogs(WorklogJsonBean.asBeans(worklogs.getPage(0), jiraBaseUrls, ComponentAccessor.getUserManager(), ComponentAccessor.getComponent(TimeTrackingConfiguration.class), authenticationContext.getUser(), emailFormatter));
    FieldJsonRepresentation fieldJsonRepresentation = new FieldJsonRepresentation(new JsonData(worklogWithPaginationBean));
    if (renderedVersionRequested)
    {
      WorklogWithPaginationBean renderedWorklogBean = new WorklogWithPaginationBean();
      renderedWorklogBean.setMaxResults(worklogs.getPageSize());
      renderedWorklogBean.setTotal(worklogs.getSize());
      renderedWorklogBean.setStartAt(0);
      renderedWorklogBean.setWorklogs(WorklogJsonBean.asRenderedBeans(worklogs.getPage(0), jiraBaseUrls, fieldLayoutItem != null ? fieldLayoutItem.getRendererType() : null, issue.getIssueRenderContext(), authenticationContext.getUser(), emailFormatter));
      fieldJsonRepresentation.setRenderedData(new JsonData(renderedWorklogBean));
    }
    return fieldJsonRepresentation;
  }
  return null;
}
origin: com.atlassian.jira/jira-api

@Deprecated
public static List<WorklogJsonBean> asRenderedBeans(final List<Worklog> worklogs, final JiraBaseUrls uriInfo,
    final String rendererType, final IssueRenderContext renderContext)
{
  return asRenderedBeans(worklogs, uriInfo, rendererType, renderContext, ComponentAccessor.getComponent(JiraAuthenticationContext.class).getUser(), ComponentAccessor.getComponent(EmailFormatter.class));
}
origin: com.atlassian.jira/jira-rest-plugin

public Response updateWorklog(@PathParam ("issueIdOrKey") final String issueIdOrKey, @PathParam ("id") final String worklogId, @QueryParam("adjustEstimate") String adjustEstimate, @QueryParam("newEstimate") String newEstimate, WorklogJsonBean request)
  if (request.getId() != null && !request.getId().equals(worklogId))
  request.setId(worklogId);
origin: com.atlassian.jira/jira-rest-plugin

  @Override
  public Response prepareSuccessfulResponse(WorklogJsonBean result)
  {
    return Response.created(result.getSelf()).entity(result).cacheControl(never()).build();
  }
},
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-api

@Override
public WorklogJsonBean createBean(final Worklog worklog, ApplicationUser loggedInUser)
{
  URI self = URI.create(worklogSelf(worklog));
  return WorklogJsonBean.build()
      .setId(Long.toString(worklog.getId()))
      .setComment(worklog.getComment())
      .setTimeSpent(getTimeLoggedString(worklog.getTimeSpent()))
      .setTimeSpentSeconds(worklog.getTimeSpent())
      .setCreated(Dates.asTimeString(worklog.getCreated()))
      .setUpdated(Dates.asTimeString(worklog.getUpdated()))
      .setStarted(Dates.asTimeString(worklog.getStartDate()))
      .setSelf(self)
      .setAuthor(getUserBean(worklog.getAuthorKey(), loggedInUser))
      .setUpdateAuthor(getUserBean(worklog.getUpdateAuthorKey(), loggedInUser))
      .setVisibility(getVisibilityBean(worklog))
      .build();
}
origin: com.atlassian.jira/jira-rest-plugin

if (!errors.hasAnyErrors())
  String timeSpent = request.getTimeSpent();
  Long timeSpentSeconds = request.getTimeSpentSeconds();
  if (timeSpent != null && timeSpentSeconds != null)
    builder.timeSpent(timeSpent);
  Date start = request.getStarted();
  builder.comment(request.getComment() != null ? request.getComment() : existingWorklog.getComment());
  if (request.getVisibility() != null)
    builder.visibility(Visibilities.fromVisibilityBean(request.getVisibility(), getProjectRoleManager()));
  else if (request.isVisibilitySet())
origin: com.atlassian.jira/jira-rest-plugin

  @Override
  public Response prepareSuccessfulResponse(WorklogJsonBean result)
  {
    return Response.ok(result).location(result.getSelf()).cacheControl(never()).build();
  }
};
origin: com.atlassian.jira/jira-rest-plugin

private WorklogJsonBean convertToBean(final Worklog worklog)
{
  return WorklogJsonBean.getWorklog(worklog, jiraBaseUrls, userManager, timeTrackingConfiguration, authenticationContext.getUser(), emailFormatter);
}
origin: com.atlassian.jira/jira-api

@Deprecated
public static WorklogJsonBean getRenderedWorklog(final Worklog log, final JiraBaseUrls baseUrls,
    String rendererType, IssueRenderContext renderContext)
{
  return getRenderedWorklog(log, baseUrls, rendererType, renderContext, ComponentAccessor.getComponent(JiraAuthenticationContext.class).getUser(), ComponentAccessor.getComponent(EmailFormatter.class));
}
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)));
  }
}
com.atlassian.jira.issue.fields.rest.json.beansWorklogJsonBean

Most used methods

  • <init>
  • asRenderedBeans
  • getWorklog
  • addNonRenderableData
  • asBeans
  • build
  • getComment
  • getId
  • getRenderedWorklog
  • getSelf
  • getStarted
  • getTimeSpent
  • getStarted,
  • getTimeSpent,
  • getTimeSpentSeconds,
  • getUserBean,
  • getVisibility,
  • isVisibilitySet,
  • setId

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Notification (javax.management)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • 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