/* * Copyright (C) 2014 Cisco Systems, Inc. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Authors : Thomas Bachman */ package org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages; import java.util.List; import org.opendaylight.groupbasedpolicy.jsonrpc.RpcMessage; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize @JsonDeserialize public class StateReportRequest extends RpcMessage { public static final String STATE_MESSAGE = "report_state"; static public class Params { private Uri object; private List observable; public Uri getObject() { return object; } public void setObject(Uri object) { this.object = object; } public List getObservable() { return observable; } public void setObservable(List observable) { this.observable = observable; } } private JsonNode id; private String method; private List params; @JsonIgnore private String name; @Override public JsonNode getId() { return id; } @Override public void setId(JsonNode id) { this.id = id; } @Override public String getMethod() { return method; } @Override public void setMethod(String method) { this.method = method; } public List getParams() { return this.params; } public void setParams(List params) { this.params = params; } @Override public String getName() { return this.name; } @Override public void setName(String name) { this.name = name; } public StateReportRequest(String name) { this.name = name; } public StateReportRequest() { this.name = STATE_MESSAGE; this.method = STATE_MESSAGE; } /** * Minimal check on validity of message * @return true if message has passed validity check */ @JsonIgnore @Override public boolean valid() { if (params == null) return false; if (params.get(0) == null) return false; return true; } }