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

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


        Collection<BasicComponent> components = null;
        TimeTracking timeTracking = null;
        Collection<Field> fields = null;
        URI transitionsUri = null;
        Collection<IssueLink> issueLinks = null;
        BasicVotes votes = null;
        Collection<Worklog> worklogs = null;
        BasicWatchers watchers = null;
        Iterable<String> expandos = null;
        Collection<Subtask> subtasks = null;
        Collection<ChangelogGroup> changelog = null;
View Full Code Here


    // -- check state after example
    final Issue issue = client.getIssueClient().getIssue("TST-7", ImmutableList.copyOf(IssueRestClient.Expandos.values()), pm);

    // votes
    final BasicVotes votes = issue.getVotes();
    assertNotNull(votes);
    assertEquals(1, votes.getVotes());
    assertEquals(true, votes.hasVoted());

    // watchers
    final BasicWatchers watchers = issue.getWatchers();
    assertNotNull(watchers);
    assertEquals(1, watchers.getNumWatchers());
View Full Code Here

*/
public class BasicVotesJsonParserTest {
  @Test
  public void testParse() throws JSONException {
    final BasicVotesJsonParser parser = new BasicVotesJsonParser();
    final BasicVotes basicVotes = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/votes/valid.json"));
    assertEquals(1, basicVotes.getVotes());
    assertTrue(basicVotes.hasVoted());
    assertEquals(TestUtil.toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-1/votes"), basicVotes.getSelf());
  }
View Full Code Here

public class VotesJsonParser implements JsonObjectParser<Votes> {
  private final BasicVotesJsonParser basicVotesJsonParser = new BasicVotesJsonParser();
  private final BasicUserJsonParser basicUserJsonParser = new BasicUserJsonParser();
  @Override
  public Votes parse(JSONObject json) throws JSONException {
    final BasicVotes basicVotes = basicVotesJsonParser.parse(json);
    final Collection<BasicUser> users = JsonParseUtil.parseJsonArray(json.getJSONArray("voters"), basicUserJsonParser);
    return new Votes(basicVotes.getSelf(), basicVotes.getVotes(), basicVotes.hasVoted(), users);
  }
View Full Code Here

  @Override
  public BasicVotes parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final int voteCount = json.getInt("votes");
    final boolean hasVoted = json.getBoolean("hasVoted");
    return new BasicVotes(self, voteCount, hasVoted);
  }
View Full Code Here

    Collection<Subtask> subtasks = null;
    if (isJira5x0OrNewer) {
      subtasks = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Subtask>(subtaskJsonParser), FIELDS, SUBTASKS_FIELD.id);
    }

    final BasicVotes votes = getOptionalField(shouldUseNestedValueAttribute, s, VOTES_FIELD.id, votesJsonParser);
    final BasicStatus status = statusJsonParser.parse(getFieldUnisex(s, STATUS_FIELD.id));

    final Collection<Version> fixVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, FIX_VERSIONS_FIELD.id);
    final Collection<Version> affectedVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, AFFECTS_VERSIONS_FIELD.id);
    final Collection<BasicComponent> components = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<BasicComponent>(basicComponentJsonParser), FIELDS, COMPONENTS_FIELD.id);
View Full Code Here

public class VotesJsonParser implements JsonParser<Votes> {
  private final BasicVotesJsonParser basicVotesJsonParser = new BasicVotesJsonParser();
  private final BasicUserJsonParser basicUserJsonParser = new BasicUserJsonParser();
  @Override
  public Votes parse(JSONObject json) throws JSONException {
    final BasicVotes basicVotes = basicVotesJsonParser.parse(json);
    final Collection<BasicUser> users = JsonParseUtil.parseJsonArray(json.getJSONArray("voters"), basicUserJsonParser);
    return new Votes(basicVotes.getSelf(), basicVotes.getVotes(), basicVotes.hasVoted(), users);
  }
View Full Code Here

  @Override
  public BasicVotes parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final int voteCount = json.getInt("votes");
    final boolean hasVoted = json.getBoolean("hasVoted");
    return new BasicVotes(self, voteCount, hasVoted);
  }
View Full Code Here

    Collection<Subtask> subtasks = null;
    if (isJira5x0OrNewer) {
      subtasks = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Subtask>(subtaskJsonParser), FIELDS, SUBTASKS_FIELD.id);
    }

    final BasicVotes votes = getOptionalField(shouldUseNestedValueAttribute, s, VOTES_FIELD.id, votesJsonParser);
    final BasicStatus status = statusJsonParser.parse(getFieldUnisex(s, STATUS_FIELD.id));

    final Collection<Version> fixVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, FIX_VERSIONS_FIELD.id);
    final Collection<Version> affectedVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, AFFECTS_VERSIONS_FIELD.id);
    final Collection<BasicComponent> components = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<BasicComponent>(basicComponentJsonParser), FIELDS, COMPONENTS_FIELD.id);
View Full Code Here

    Collection<Subtask> subtasks = null;
    if (isJira5x0OrNewer) {
      subtasks = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Subtask>(subtaskJsonParser), FIELDS, SUBTASKS_FIELD.id);
    }

    final BasicVotes votes = getOptionalField(shouldUseNestedValueAttribute, s, VOTES_FIELD.id, votesJsonParser);
    final BasicStatus status = statusJsonParser.parse(getFieldUnisex(s, STATUS_FIELD.id));

    final Collection<Version> fixVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, FIX_VERSIONS_FIELD.id);
    final Collection<Version> affectedVersions = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Version>(versionJsonParser), FIELDS, AFFECTS_VERSIONS_FIELD.id);
    final Collection<BasicComponent> components = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<BasicComponent>(basicComponentJsonParser), FIELDS, COMPONENTS_FIELD.id);
View Full Code Here

TOP

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

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.