public JSONObject getJSONRepresentation() throws JSONException { JSONObject obj = new JSONObject(); for (Property prop:Property.values()) { if (propertyValueMap.containsKey(prop)) { String val = propertyValueMap.get(prop); if (val != null && !val.equals("")) { obj.put(prop.name(), val); } } } if (hasServiceProperties()) { obj.put(Property.hasServiceProperties.name(), true); } else { obj.put(Property.hasServiceProperties.name(), false); } return obj; }
@Override public String getDescription() { JSONObject propertiesJson = new JSONObject(properties); String desc = ""; String sep = ""; if (propertiesJson.has(Property.hasServiceProperties.name()) && propertiesJson.getBoolean(Property.hasServiceProperties.name())) { desc = "Service"; sep = ", "; } if (propertiesJson.has(Property.graphLabel.name()) && !propertiesJson.getString(Property.graphLabel.name()).isEmpty()) { desc = desc + sep + "Model Name: " + propertiesJson.getString(Property.graphLabel.name()); sep = ", "; } if (propertiesJson.has("hasPrefix") && propertiesJson.getBoolean("hasPrefix")) { desc = desc + sep + "Prefix: " + propertiesJson.getString(Property.prefix.name()); sep = ", "; } if (propertiesJson.has("hasBaseURI") && propertiesJson.getBoolean("hasBaseURI")) { desc = desc + sep + "Base URI: " + propertiesJson.getString(Property.baseURI.name()); sep = ", "; } if (propertiesJson.has("hasGithubURL") && propertiesJson.getBoolean("hasGithubURL")) { desc = desc + sep + "Github URL: " + propertiesJson.getString(Property.GithubURL.name()); sep = ", "; } return desc; }
String graphLabel = propertiesJson.getString(Property.graphLabel.name()); if (!graphLabel.trim().isEmpty()) { props.setPropertyValue(Property.graphLabel, graphLabel); if (propertiesJson.getBoolean(Property.hasServiceProperties.name())) { props.setHasServiceProperties(true); propertiesJson.getString(Property.serviceUrl.name())); propertiesJson.getString(Property.serviceRequestMethod.name())); if (propertiesJson.getString(Property.serviceRequestMethod.name()) .equals(HttpMethods.POST.name())) { props.setPropertyValue(Property.serviceDataPostMethod, propertiesJson.getString(Property.serviceDataPostMethod.name())); if (propertiesJson.has(Property.GithubURL.name()) && !propertiesJson.getString(Property.GithubURL.name()).isEmpty()) props.setPropertyValue(Property.GithubURL, propertiesJson.getString(Property.GithubURL.name())); propertiesJson.getString(Property.prefix.name())); propertiesJson.getString(Property.baseURI.name()));