* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.appc.listener.demo.model;
import java.io.Serializable;
-import java.util.Collection;
import org.json.JSONObject;
import org.onap.appc.listener.util.Mapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+
/**
* This class holds attributes that are common to DMaaP messages both coming in from DCAE and being sent out by APPC
*
*/
-@JsonSerialize(include = Inclusion.NON_NULL)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+
@JsonIgnoreProperties(ignoreUnknown = true)
public class CommonMessage implements Serializable {
/*
public void setGenericVnfId(String genericVnfId) {
this.genericVnfId = genericVnfId;
}
-
- @JsonProperty("pg-streams")
- private pgStreams pgStreams;
+
+ @JsonProperty("streams")
+ private Streams streams;
/**
* @return the TenantID
*/
- public String getPgStreams() {
- String r = "{\\\"pg-streams\\\": {\\\"pg-stream\\\":[";
- boolean first = true;
- for(pgStream p : this.pgStreams.streams){
- String n = "{\\\"id\\\":\\\""+p.getId()+"\\\", \\\"is-enabled\\\":\\\""+p.getIsEnabled()+"\\\"}";
- if(!first){
- r = r.concat(",");
- }
- first = false;
- r = r.concat(n);
- }
- r= r.concat("]}}");
+ public String getStreams() {
+ String r = "{\\\"streams\\\": {\\\"active-streams\\\": " + streams.getActiveStreams() +
+ "}}";
return r;
}
* @param TenantID
* the TenantID to set
*/
- public void setPgStreams(pgStreams pgStreams) {
- this.pgStreams = pgStreams;
+ public void setStreams(Streams streams) {
+ this.streams = streams;
}
};
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class pgStreams {
- @JsonProperty("pg-stream")
- private Collection<pgStream> streams;
-
- public Collection<pgStream> getStreams() {
- return streams;
- }
-
- public void setStreams(Collection<pgStream> streams) {
- this.streams = streams;
- }
-
+ public static class Streams {
+
+ @JsonProperty("active-streams")
+ private int activeStreams;
+
+ public int getActiveStreams() {
+ return this.activeStreams;
+ }
+ public void setActiveStreams(int activeStreams) {
+ this.activeStreams = activeStreams;
+ }
+
};
- @JsonIgnoreProperties(ignoreUnknown = true)
- public static class pgStream{
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getIsEnabled() {
- return isEnabled;
- }
- public void setIsEnabled(String isEnabled) {
- this.isEnabled = isEnabled;
- }
- @JsonProperty("id")
- private String id;
- @JsonProperty("is-enabled")
- private String isEnabled;
- };
-
}