From 7631ccf856ab4e739bd9e9bb5ac6f7985f5a37ec Mon Sep 17 00:00:00 2001 From: seshukm Date: Wed, 25 Jul 2018 18:09:52 +0800 Subject: fix code issues in heat-model Issue-ID: SO-729 Change-Id: If717d9f9c30cfc924d78cf9b06e3bdd7550fe96b Signed-off-by: seshukm --- .../woorea/openstack/heat/model/Explanation.java | 38 ++-- .../com/woorea/openstack/heat/model/Stack.java | 204 ++++++++++----------- .../openstack/heat/model/UpdateStackParam.java | 4 +- 3 files changed, 123 insertions(+), 123 deletions(-) (limited to 'heat-model') diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java index 18455e0..ed2395b 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java @@ -47,47 +47,47 @@ public class Explanation { private String type; public String getMessage() { - return message; + return message; } public String getTraceback() { - return traceback; + return traceback; } public String getType() { - return type; + return type; } } private Error error; public String getExplanation() { - return explanation; + return explanation; } public int getCode() { - return code; + return code; } public String getTitle() { - return title; + return title; } public Error getError() { - return error; + return error; } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Explanation [ " + - "code='" + code + - "', title='" + title + - "', explanation='" + explanation + - "', Error [type='" + error.type + - "', message='" + error.message + "' ] ]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Explanation [ " + + "code='" + code + + "', title='" + title + + "', explanation='" + explanation + + "', Error [type='" + error.type + + "', message='" + error.message + "' ] ]"; + } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java index 724f6de..a07764b 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java @@ -65,7 +65,7 @@ public class Stack { // ObjectMapper instance to parse Json stack outputs @JsonIgnore - private static ObjectMapper mapper = new ObjectMapper(); + private static ObjectMapper mapper = new ObjectMapper(); public Date getUpdatedTime() { return updatedTime; @@ -133,10 +133,10 @@ public class Stack { } public Map getFiles() { - return this.files; + return this.files; } public void setFiles(Map files) { - this.files = files; + this.files = files; } @@ -157,103 +157,103 @@ public class Stack { '}'; } - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Output { - @JsonProperty("output_value") - private Object outputValue; - - private String description; - - @JsonProperty("output_key") - private String outputKey; - - public Object getOutputValue() { - return outputValue; - } - - public String getDescription() { - return description; - } - - public String getOutputKey() { - return outputKey; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Output [key=" + outputKey + ", value=" - + outputValue + "]"; - } - } - - private List outputs; - - public List getOutputs() { - return outputs; - } - - private Object _findOutputValue (String key) { - for (Output o : outputs) { - if (o.getOutputKey().equals(key)) { - return o.getOutputValue(); - } - } - return null; - } - - /* - * Return a stack output as a String. - * Generally speaking, most outputs will be Strings. - */ - public String getOutputValue (String key) - { - Object value = _findOutputValue(key); - if (value != null) - return value.toString(); - else - return null; - } - - /* - * Return a stack output as a Json-mapped Object of the provided type. - * This is useful for json-object stack outputs. - */ - public T getOutputValue (String key, Class type) - { - try { - String s = mapper.writeValueAsString(_findOutputValue(key)); - return mapper.readValue(s, type); - } - catch (IOException e) { - return null; - } - } - - @JsonProperty("parameters") - private Map parameters = new HashMap<>(); - - public void setParameters (Map params) - { - // Need to "fix" comma-delimited-list parameters for pre-Juno Heat - // (see https://bugs.launchpad.net/heat/+bug/1367393) - parameters = params; - - for (Entry param : parameters.entrySet()) - { - // CDL params are returned as a string with format: - // "[u'',u'',...]" - String value = param.getValue().toString(); - if (value.startsWith("[") && value.endsWith("]")) - { - param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1")); - } - } - } - - public Map getParameters() { - return parameters; - } + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Output { + @JsonProperty("output_value") + private Object outputValue; + + private String description; + + @JsonProperty("output_key") + private String outputKey; + + public Object getOutputValue() { + return outputValue; + } + + public String getDescription() { + return description; + } + + public String getOutputKey() { + return outputKey; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Output [key=" + outputKey + ", value=" + + outputValue + "]"; + } + } + + private List outputs; + + public List getOutputs() { + return outputs; + } + + private Object _findOutputValue (String key) { + for (Output o : outputs) { + if (o.getOutputKey().equals(key)) { + return o.getOutputValue(); + } + } + return null; + } + + /* + * Return a stack output as a String. + * Generally speaking, most outputs will be Strings. + */ + public String getOutputValue (String key) + { + Object value = _findOutputValue(key); + if (value != null) + return value.toString(); + else + return null; + } + + /* + * Return a stack output as a Json-mapped Object of the provided type. + * This is useful for json-object stack outputs. + */ + public T getOutputValue (String key, Class type) + { + try { + String s = mapper.writeValueAsString(_findOutputValue(key)); + return mapper.readValue(s, type); + } + catch (IOException e) { + return null; + } + } + + @JsonProperty("parameters") + private Map parameters = new HashMap<>(); + + public void setParameters (Map params) + { + // Need to "fix" comma-delimited-list parameters for pre-Juno Heat + // (see https://bugs.launchpad.net/heat/+bug/1367393) + parameters = params; + + for (Entry param : parameters.entrySet()) + { + // CDL params are returned as a string with format: + // "[u'',u'',...]" + String value = param.getValue().toString(); + if (value.startsWith("[") && value.endsWith("]")) + { + param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1")); + } + } + } + + public Map getParameters() { + return parameters; + } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java index 69041dd..5274d16 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java @@ -112,10 +112,10 @@ public class UpdateStackParam { } public void setFiles(Map files) { - this.files = files; + this.files = files; } public Map getFiles() { - return this.files; + return this.files; } /** -- cgit 1.2.3-korg