[New] Added constants for VersionQueryResult

This commit is contained in:
Robert von Burg 2019-04-02 15:26:53 +02:00
parent 74a649d2d7
commit fc1ec3b5a3
3 changed files with 15 additions and 8 deletions

View File

@ -24,7 +24,7 @@ import com.google.gson.JsonObject;
*/
public class ComponentVersion extends StrolchVersion {
private static final String COMPONENT_VERSION = "componentName";
public static final String COMPONENT_VERSION = "componentName";
private String componentName;

View File

@ -15,6 +15,8 @@
*/
package li.strolch.agent.api;
import static li.strolch.model.Tags.Json.*;
import java.util.ArrayList;
import java.util.List;
@ -84,17 +86,17 @@ public class VersionQueryResult {
public JsonObject toJson() {
JsonObject jsonObject = new JsonObject();
jsonObject.add("appVersion", this.appVersion.toJson());
jsonObject.add("agentVersion", this.agentVersion.toJson());
jsonObject.add(APP_VERSION, this.appVersion.toJson());
jsonObject.add(AGENT_VERSION, this.agentVersion.toJson());
JsonArray componentVersionsJ = new JsonArray();
this.componentVersions.forEach(c -> componentVersionsJ.add(c.toJson()));
jsonObject.add("componentVersions", componentVersionsJ);
jsonObject.add(COMPONENT_VERSIONS, componentVersionsJ);
if (this.errors != null) {
JsonArray errorsJ = new JsonArray();
this.errors.forEach(errorsJ::add);
jsonObject.add("errors", errorsJ);
jsonObject.add(ERRORS, errorsJ);
}
return jsonObject;

View File

@ -145,6 +145,11 @@ public class Tags {
public static final String EXCEPTION = "exception";
public static final String FORMAT = "format";
public static final String FLAT = "flat";
public static final String APP_VERSION = "appVersion";
public static final String AGENT_VERSION = "agentVersion";
public static final String COMPONENT_VERSIONS = "componentVersions";
public static final String ERRORS = "errors";
}
public static class Audit {