Package com.atlassian.jira.rest.client.domain

Examples of com.atlassian.jira.rest.client.domain.BasicUser


  private final WorklogInputJsonGenerator generator = new WorklogInputJsonGenerator(
      JsonParseUtil.JIRA_DATE_TIME_FORMATTER.withZone(DateTimeZone.forID("+02:00"))
  );

  public WorklogInputJsonGeneratorTest() throws URISyntaxException {
    USER = new BasicUser(new URI("http://localhost:2990/jira/rest/api/2/user?username=wseliga"), "wseliga", "Wojciech Seliga");
  }
View Full Code Here



  @Override
  public Worklog parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author"));
    final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor"));
    final String comment = json.optString("comment");
    final DateTime creationDate = JsonParseUtil.parseDateTime(json, "created");
    final DateTime updateDate = JsonParseUtil.parseDateTime(json, "updated");
    final DateTime startDate = JsonParseUtil.parseDateTime(json, "started");
    // timeSpentSeconds is not required due to bug: JRADEV-8825 (fixed in 5.0, Iteration 14).
View Full Code Here

  private final ChangelogItemJsonParser changelogItemJsonParser = new ChangelogItemJsonParser();

  @Override
  public ChangelogGroup parse(JSONObject json) throws JSONException {
    final DateTime created = JsonParseUtil.parseDateTime(json, "created");
    final BasicUser author = json.has("author") ? JsonParseUtil.parseBasicUser(json.getJSONObject("author")) : null;
    final Collection<ChangelogItem> items = JsonParseUtil.parseJsonArray(json.getJSONArray("items"), changelogItemJsonParser);
    return new ChangelogGroup(author, created, items);
  }
View Full Code Here

public class ComponentJsonParser implements JsonParser<Component> {
  @Override
  public Component parse(JSONObject json) throws JSONException {
    final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json);
    final JSONObject leadJson = json.optJSONObject("lead");
    final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null;
    final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType");
    final Component.AssigneeInfo assigneeInfo;
    if (assigneeTypeStr != null) {
      final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr);
      final JSONObject assigneeJson = json.optJSONObject("assignee");
      final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null;
      final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType"));
      final JSONObject realAssigneeJson = json.optJSONObject("realAssignee");
      final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null;
      final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid");
      assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid);
    } else {
      assigneeInfo = null;
    }
View Full Code Here

import java.util.Map;

public class UserJsonParser implements JsonParser<User> {
  @Override
  public User parse(JSONObject json) throws JSONException {
    final BasicUser basicUser = JsonParseUtil.parseBasicUser(json);
    final String timezone = JsonParseUtil.getOptionalString(json, "timeZone");
    final String avatarUrl = JsonParseUtil.getOptionalString(json, "avatarUrl");
    Map<String, URI> avatarUris = Maps.newHashMap();
    if (avatarUrl != null) {
      // JIRA prior 5.0
      final URI avatarUri = JsonParseUtil.parseURI(avatarUrl);
      avatarUris.put(User.S48_48, avatarUri);
    } else {
      // JIRA 5.0+
      final JSONObject avatarUrlsJson = json.getJSONObject("avatarUrls");
      @SuppressWarnings("unchecked")
      final Iterator<String> iterator = avatarUrlsJson.keys();
      while (iterator.hasNext()) {
        final String key = iterator.next();
        avatarUris.put(key, JsonParseUtil.parseURI(avatarUrlsJson.getString(key)));
      }
    }
    // e-mail may be not set in response if e-mail visibility in jira configuration is set to hidden (in jira 4.3+)
    final String emailAddress = JsonParseUtil.getOptionalString(json, "emailAddress");
    // we expect always expanded groups, serving them is anyway cheap - that was the case for JIRA prior 5.0, now groups are not expanded...
    final ExpandableProperty<String> groups = JsonParseUtil.parseExpandableProperty(json.getJSONObject("groups"), new JsonParser<String>() {
      @Override
      public String parse(JSONObject json) throws JSONException {
        return json.getString("name");
      }
    });
    return new User(basicUser.getSelf(), basicUser.getName(), basicUser.getDisplayName(), emailAddress, groups, avatarUris, timezone);
  }
View Full Code Here

    assertNotNull(changelog);

    assertEquals(4, Iterables.size(changelog));
    final Iterator<ChangelogGroup> iterator = changelog.iterator();

    final BasicUser user1 = new BasicUser(toUri("http://localhost:2990/jira/rest/api/2/user?username=user1"), "user1", "User One");
    final BasicUser user2 = new BasicUser(toUri("http://localhost:2990/jira/rest/api/2/user?username=user2"), "user2", "User Two");

    verifyChangelog(iterator.next(),
        "2012-04-12T14:28:28.255+0200",
        user1,
        ImmutableList.of(
View Full Code Here

    final String dueDateString = getOptionalFieldStringUnisex(shouldUseNestedValueAttribute, s, DUE_DATE_FIELD.id);
    final DateTime dueDate = dueDateString == null ? null : JsonParseUtil.parseDateTimeOrDate(dueDateString);

    final BasicPriority priority = getOptionalField(shouldUseNestedValueAttribute, s, PRIORITY_FIELD.id, priorityJsonParser);
    final BasicResolution resolution = getOptionalField(shouldUseNestedValueAttribute, s, RESOLUTION_FIELD.id, resolutionJsonParser);
    final BasicUser assignee = getOptionalField(shouldUseNestedValueAttribute, s, ASSIGNEE_FIELD.id, userJsonParser);
    final BasicUser reporter = getOptionalField(shouldUseNestedValueAttribute, s, REPORTER_FIELD.id, userJsonParser);

    final String transitionsUri = getOptionalFieldStringUnisex(shouldUseNestedValueAttribute, s, TRANSITIONS_FIELD.id);
    final BasicProject project = projectJsonParser.parse(getFieldUnisex(s, PROJECT_FIELD.id));
    final Collection<IssueLink> issueLinks;
    if (isJira5x0OrNewer) {
View Full Code Here

  @Override
  public Comment parse(JSONObject json) throws JSONException {
    final URI selfUri = JsonParseUtil.getSelfUri(json);
    final Long id = JsonParseUtil.getOptionalLong(json, "id");
    final String body = json.getString("body");
    final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author"));
    final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor"));

    final Visibility visibility = visibilityJsonParser.parseVisibility(json);
    return new Comment(selfUri, body, author, updateAuthor, JsonParseUtil.parseDateTime(json.getString("created")),
        JsonParseUtil.parseDateTime(json.getString("updated")), visibility, id);
  }
View Full Code Here

 
  @Override
  public Worklog parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final URI issueUri = JsonParseUtil.parseURI(json.getString("issue"));
    final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author"));
    final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor"));
        // it turns out that somehow it can be sometimes omitted in the resource representation - JRJC-49
    final String comment = JsonParseUtil.getOptionalString(json, "comment");
    final DateTime creationDate = JsonParseUtil.parseDateTime(json, "created");
    final DateTime updateDate = JsonParseUtil.parseDateTime(json, "updated");
    final DateTime startDate = JsonParseUtil.parseDateTime(json, "started");
View Full Code Here

  private final BasicComponentJsonParser componentJsonParser = new BasicComponentJsonParser();
  private final IssueTypeJsonParser issueTypeJsonParser = new IssueTypeJsonParser();
  @Override
  public Project parse(JSONObject json) throws JSONException {
    URI self = JsonParseUtil.getSelfUri(json);
    final BasicUser lead = JsonParseUtil.parseBasicUser(json.getJSONObject("lead"));
    final String key = json.getString("key");
        final String name = JsonParseUtil.getOptionalString(json, "name");
    final String urlStr = JsonParseUtil.getOptionalString(json, "url");
    URI uri;
    try {
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.BasicUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.