2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.appc.listener.CL.model;
24 import com.fasterxml.jackson.annotation.JsonIgnore;
25 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
28 import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
31 * This class reperesnts a message coming in from DCAE.
34 @JsonSerialize(include = Inclusion.NON_NULL)
35 @JsonIgnoreProperties(ignoreUnknown = true)
36 public class IncomingMessage extends CommonMessage {
38 private static final long serialVersionUID = 1L;
41 * The action being requested. Its presence signals that it is an incoming message and it is not present on outgoing
44 @JsonProperty("request")
45 private String request;
48 * The url for the server used for auth. http://<compute>:<port>/<tenentId>/server/<serverID>
50 @JsonProperty("VServerSelfLink")
54 * The tenant Id in OpenStack that the server belongs to
56 @JsonProperty("TenantID")
57 private String TenantId;
65 @JsonProperty("Identity")
66 private String identityUrl;
68 public String getRequest() {
73 public Action getAction() {
74 return Action.toAction(request);
77 public String getUrl() {
81 public String getTenantId() {
85 public String getVmId() {
89 public String getIdentityUrl() {
93 public void setUrl(String Url) {
97 public void setTenantId(String TenantId) {
98 this.TenantId = TenantId;
101 public void setVmId(String VmId) {
105 public void setRequest(String request) {
106 this.request = request;
109 public void setIdentityUrl(String identityUrl) {
110 this.identityUrl = identityUrl;
114 public String toString() {
115 String time = getRequestTime() != null ? getRequestTime() : "N/A";
116 // String req = request != null ? request : "N/A";
117 return String.format("[%s - %s]", time, getId());
120 public String toOutgoing(Status status) {
121 return toOutgoing(status, getMessage());
124 public String toOutgoing(Status status, String msg) {
125 OutgoingMessage out = new OutgoingMessage(this);
126 out.setResponse(status);
128 return out.toResponse().toString();
132 * Determines if this message should be parsed parsed. Will eventually check that the message is well formed, has
133 * all required fields, and had not exceeded any timing restrictions.
135 * @return True if the message should be parsed. False otherwise
137 public boolean isValid() {