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

backlog4j.admin.api.UpdateProject Maven / Gradle / Ivy

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

import backlog4j.BacklogAdminClient;
import backlog4j.BacklogException;
import backlog4j.admin.impl.ProjectEx;

import java.util.HashMap;
import java.util.Map;

/**
 * @author eguchi
 */
public class UpdateProject implements BacklogAdminCommand {

    private final BacklogAdminClient client;
    protected final Map map = new HashMap();

    public UpdateProject(BacklogAdminClient client) {
        this.client = client;
    }

    public UpdateProject setId(Integer id) {
        map.put(ID, id);

        return this;
    }

    public Integer getId() {
        return (Integer) map.get(ID);
    }

    public UpdateProject setName(String name) {
        map.put(NAME, name);

        return this;
    }

    public String getName() {
        return (String) map.get(NAME);
    }

    public UpdateProject setKey(String key) {
        map.put(KEY, key);

        return this;
    }

    public String getKey() {
        return (String) map.get(KEY);
    }

    public UpdateProject setUseChart(String key) {
        map.put(USE_CHART, key);

        return this;
    }

    public Boolean getUseChart() {
        return (Boolean) map.get(USE_CHART);
    }

    public UpdateProject setArchived(Boolean archived) {
        map.put(ARCHIVED, archived);

        return this;
    }

    public Boolean getArchived() {
        return (Boolean) map.get(ARCHIVED);
    }

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

    @Override
    public ProjectEx execute() {

        checkParameters();
        Object res = client.execute(BACKLOG_ADMIN_UPDATE_PROJECT, map);

        return new ProjectEx((Map) res);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy