public JSONObject object() {
return json;
}
public ImportContext context() throws IOException {
ImportContext context = null;
if (json.has("import")) {
context = new ImportContext();
json = json.getJSONObject("import");
if (json.has("id")) {
context.setId(json.getLong("id"));
}
if (json.has("state")) {
context.setState(State.valueOf(json.getString("state")));
}
if (json.has("user")) {
context.setUser(json.getString("user"));
}
if (json.has("archive")) {
context.setArchive(json.getBoolean("archive"));
}
if (json.has("targetWorkspace")) {
context.setTargetWorkspace(
fromJSON(json.getJSONObject("targetWorkspace"), WorkspaceInfo.class));
}
if (json.has("targetStore")) {
context.setTargetStore(
fromJSON(json.getJSONObject("targetStore"), StoreInfo.class));
}
if (json.has("data")) {
context.setData(data(json.getJSONObject("data")));
}
}
return context;
}