All Downloads are FREE. Search and download functionalities are using the official Maven repository.

backlog4j.api.FindIssue Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package backlog4j.api;

import backlog4j.BacklogClient;
import backlog4j.BacklogException;
import backlog4j.Issue;
import backlog4j.impl.IssueImpl;
import backlog4j.util.XmlRpcUtil;

import java.util.List;

/**
 * @author eguchi
 */
public class FindIssue extends AbstractFindIssueRequest,FindIssue> {


    private final BacklogClient client;

    public FindIssue(BacklogClient client) {
        this.client = client;
    }

    @Override
    protected FindIssue getThis() {
        return this;
    }

    public String getSort() {
        return (String) map.get(SORT);
    }

    public FindIssue setSort(String sort) {
        map.put(SORT, sort);

        return this;
    }


    public Boolean getOrder() {
        return (Boolean) map.get(ORDER);
    }

    public FindIssue setOrder(boolean order) {
        map.put(ORDER, order);

        return this;
    }

    public Integer getOffset() {
        return (Integer) map.get(OFFSET);
    }

    public FindIssue setOffset(int offset) {
        map.put(OFFSET, offset);

        return this;
    }

    public Integer getLimit() {
        return (Integer) map.get(LIMIT);
    }

    public FindIssue setLimit(int limit) {
        if (limit > MAX_LIMIT || limit < 0) {
            throw new IllegalArgumentException();
        }
        map.put(LIMIT, limit);

        return this;
    }

    private void checkParameters() {
        if (getProjectId() == null) {
            throw new BacklogException("projectId is required");
        }
    }

    public List execute() {
        checkParameters();
        Object res = client.execute(BACKLOG_FIND_ISSUE, map);

        return XmlRpcUtil.toList(IssueImpl.class, res);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy