com.jelastic.api.system.persistence.AppContext Maven / Gradle / Ivy
The newest version!
/*Server class MD5: f4796410940fbd6d88975f36b2978b91*/
package com.jelastic.api.system.persistence;
import com.jelastic.api.development.response.interfaces.ArrayItem;
import com.jelastic.api.system.po.AppContextType;
import org.json.JSONException;
import org.json.JSONObject;
/**
* @name Jelastic API Client
* @version 8.11.2
* @copyright Jelastic, Inc.
*/
public class AppContext extends ArrayItem {
public static final String CONTEXT = "context";
public static final String ARCHIVE_NAME = "archivename";
public static final String TYPE = "type";
private String context;
private String archiveName;
private AppNodes env;
private SoftNodeGroup softNodeGroup;
private AppContextType type = AppContextType.ARCHIVE;
public AppContext() {
}
public AppContext(String context, String archiveName) {
this.context = context;
this.archiveName = archiveName;
}
public AppContext(String context, String archiveName, AppContextType type) {
this.context = context;
this.archiveName = archiveName;
this.type = type;
}
public String getArchiveName() {
return archiveName;
}
public void setArchiveName(String archiveName) {
this.archiveName = archiveName;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public AppContextType getAppContextType() {
return type;
}
public void setAppContextType(AppContextType type) {
this.type = type;
}
public AppNodes getEnv() {
return env;
}
public void setEnv(AppNodes env) {
this.env = env;
}
public SoftNodeGroup getSoftNodeGroup() {
return softNodeGroup;
}
public void setSoftNodeGroup(SoftNodeGroup softNodeGroup) {
this.softNodeGroup = softNodeGroup;
}
@Override
public String toString() {
return context;
}
public AppContext getClone() {
return new AppContext(this.context, this.archiveName, this.type);
}
public JSONObject _toJSON() throws JSONException {
JSONObject contextJson = new JSONObject();
contextJson.put(CONTEXT, context);
contextJson.put(ARCHIVE_NAME, archiveName);
if (this.type != null) {
contextJson.put(TYPE, this.type.name());
}
return contextJson;
}
public AppContext _fromJSON(JSONObject json) throws JSONException {
if (json.has(CONTEXT)) {
setContext(json.getString(CONTEXT));
}
if (json.has(ARCHIVE_NAME)) {
setArchiveName(json.getString(ARCHIVE_NAME));
}
if (json.has(TYPE)) {
setAppContextType(AppContextType.valueOf(AppContextType.class, json.getString(TYPE)));
}
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy