summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2018-07-25 18:09:52 +0800
committerseshukm <seshu.kumar.m@huawei.com>2018-07-25 18:09:52 +0800
commit7631ccf856ab4e739bd9e9bb5ac6f7985f5a37ec (patch)
tree10b842ea23e5f406cd2814b27ef48ea20ce4bf40
parent59ad78a845d38e2e0a0ee9e3cd5de3d2d9917152 (diff)
fix code issues in heat-model
Issue-ID: SO-729 Change-Id: If717d9f9c30cfc924d78cf9b06e3bdd7550fe96b Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
-rw-r--r--heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java38
-rw-r--r--heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java204
-rw-r--r--heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java4
3 files changed, 123 insertions, 123 deletions
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<String, Object> getFiles() {
- return this.files;
+ return this.files;
}
public void setFiles(Map<String, Object> 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<Output> outputs;
-
- public List<Output> 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> T getOutputValue (String key, Class<T> type)
- {
- try {
- String s = mapper.writeValueAsString(_findOutputValue(key));
- return mapper.readValue(s, type);
- }
- catch (IOException e) {
- return null;
- }
- }
-
- @JsonProperty("parameters")
- private Map<String,Object> parameters = new HashMap<>();
-
- public void setParameters (Map<String,Object> params)
- {
- // Need to "fix" comma-delimited-list parameters for pre-Juno Heat
- // (see https://bugs.launchpad.net/heat/+bug/1367393)
- parameters = params;
-
- for (Entry<String,Object> param : parameters.entrySet())
- {
- // CDL params are returned as a string with format:
- // "[u'<value1>',u'<value2>',...]"
- String value = param.getValue().toString();
- if (value.startsWith("[") && value.endsWith("]"))
- {
- param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1"));
- }
- }
- }
-
- public Map<String,Object> 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<Output> outputs;
+
+ public List<Output> 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> T getOutputValue (String key, Class<T> type)
+ {
+ try {
+ String s = mapper.writeValueAsString(_findOutputValue(key));
+ return mapper.readValue(s, type);
+ }
+ catch (IOException e) {
+ return null;
+ }
+ }
+
+ @JsonProperty("parameters")
+ private Map<String,Object> parameters = new HashMap<>();
+
+ public void setParameters (Map<String,Object> params)
+ {
+ // Need to "fix" comma-delimited-list parameters for pre-Juno Heat
+ // (see https://bugs.launchpad.net/heat/+bug/1367393)
+ parameters = params;
+
+ for (Entry<String,Object> param : parameters.entrySet())
+ {
+ // CDL params are returned as a string with format:
+ // "[u'<value1>',u'<value2>',...]"
+ String value = param.getValue().toString();
+ if (value.startsWith("[") && value.endsWith("]"))
+ {
+ param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1"));
+ }
+ }
+ }
+
+ public Map<String,Object> 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<String, Object> files) {
- this.files = files;
+ this.files = files;
}
public Map<String, Object> getFiles() {
- return this.files;
+ return this.files;
}
/**