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

com.jelastic.api.environment.response.VcsResponse Maven / Gradle / Ivy

The newest version!
/*Server class MD5: c027ee7551269d1f827b1c57f80c92ff*/
package com.jelastic.api.environment.response;

import com.jelastic.api.Response;
import com.jelastic.api.system.persistence.VcsType;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @name Jelastic API Client
 * @version 8.11.2
 * @copyright Jelastic, Inc.
 */
public class VcsResponse extends Response {

    public static final String TYPE = "type";

    public static final String PROJECT = "project";

    public static final String CONTEXT = "context";

    public static final String BRANCH = "branch";

    public static final String URL = "url";

    public static final String INTERVAL = "interval";

    public static final String AUTOUPDATE = "autoupdate";

    public static final String AUTO_RESOLVE_CONFLICT = "autoresolveconflict";

    public static final String ATOMIC_DEPLOY = "atomicDeploy";

    public static final String LOGIN = "login";

    public static final String LOG = "log";

    public static final String HASH = "hash";

    public static final String REPO_HASH = "repoHash";

    private VcsType type;

    private String project;

    private String url;

    private String branch;

    private String login;

    private Boolean autoupdate;

    private Boolean autoResolveConflict;

    private String interval;

    private String log;

    private String hash;

    private Boolean atomicDeploy;

    private String repoHash;

    private String context;

    public VcsResponse() {
        super(OK);
    }

    public VcsResponse(int result) {
        super(result);
    }

    public VcsResponse(int result, String error) {
        super(result, error);
    }

    public VcsType getType() {
        return type;
    }

    public void setType(VcsType type) {
        this.type = type;
    }

    public String getProject() {
        return project;
    }

    public void setProject(String project) {
        this.project = project;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getBranch() {
        return branch;
    }

    public void setBranch(String branch) {
        this.branch = branch;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public Boolean getAutoupdate() {
        return autoupdate;
    }

    public void setAutoupdate(boolean autoupdate) {
        this.autoupdate = autoupdate;
    }

    public boolean isAutoResolveConflict() {
        return autoResolveConflict;
    }

    public void setAutoResolveConflict(boolean autoResolveConflict) {
        this.autoResolveConflict = autoResolveConflict;
    }

    public String getInterval() {
        return interval;
    }

    public void setInterval(String interval) {
        this.interval = interval;
    }

    public String getLog() {
        return log;
    }

    public void setLog(String log) {
        this.log = log;
    }

    public String getHash() {
        return hash;
    }

    public void setHash(String hash) {
        this.hash = hash;
    }

    public Boolean isAtomicDeploy() {
        return atomicDeploy;
    }

    public void setAtomicDeploy(Boolean atomicDeploy) {
        this.atomicDeploy = atomicDeploy;
    }

    public String getRepoHash() {
        return repoHash;
    }

    public void setRepoHash(String repoHash) {
        this.repoHash = repoHash;
    }

    @Override
    protected JSONObject _toJSON() throws JSONException {
        JSONObject json = super._toJSON();
        if (type != null) {
            json.put(TYPE, type.name());
        }
        json.put(PROJECT, project);
        json.put(CONTEXT, project);
        json.put(URL, url);
        json.put(BRANCH, branch);
        json.put(INTERVAL, interval);
        json.put(AUTOUPDATE, autoupdate);
        json.put(AUTO_RESOLVE_CONFLICT, autoResolveConflict);
        json.put(ATOMIC_DEPLOY, atomicDeploy);
        json.put(LOGIN, login);
        json.put(HASH, hash);
        json.put(LOG, log);
        json.put(REPO_HASH, repoHash);
        return json;
    }

    @Override
    protected VcsResponse _fromJSON(JSONObject json) throws JSONException {
        super._fromJSON(json);
        if (json.has(TYPE)) {
            setType(VcsType.valueOf(json.getString(TYPE)));
        }
        if (json.has(PROJECT)) {
            setProject(json.getString(PROJECT));
        }
        if (json.has(CONTEXT)) {
            setProject(json.getString(CONTEXT));
        }
        if (json.has(URL)) {
            setUrl(json.getString(URL));
        }
        if (json.has(BRANCH)) {
            setBranch(json.getString(BRANCH));
        }
        if (json.has(AUTOUPDATE)) {
            setAutoupdate(json.getBoolean(AUTOUPDATE));
        }
        if (json.has(AUTO_RESOLVE_CONFLICT)) {
            setAutoResolveConflict(json.getBoolean(AUTO_RESOLVE_CONFLICT));
        }
        if (json.has(ATOMIC_DEPLOY)) {
            setAtomicDeploy(json.getBoolean(ATOMIC_DEPLOY));
        }
        if (json.has(INTERVAL)) {
            setInterval(json.getString(INTERVAL));
        }
        if (json.has(LOG)) {
            setLog(json.getString(LOG));
        }
        if (json.has(HASH)) {
            setHash(json.getString(HASH));
        }
        if (json.has(REPO_HASH)) {
            this.repoHash = json.getString(REPO_HASH);
        }
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy