2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.tca.processor;
\r
23 import org.openecomp.dcae.apod.analytics.common.service.processor.AbstractProcessorContext;
\r
24 import org.openecomp.dcae.apod.analytics.model.domain.cef.EventListener;
\r
25 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.MetricsPerEventName;
\r
26 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.TCAPolicy;
\r
29 * TCA CEF Policy Processor Context
\r
31 * @author Rajiv Singla . Creation Date: 11/7/2016.
\r
33 public class TCACEFProcessorContext extends AbstractProcessorContext {
\r
35 private static final long serialVersionUID = 1L;
\r
37 private final TCAPolicy tcaPolicy;
\r
38 private EventListener eventListener;
\r
39 private MetricsPerEventName metricsPerEventName;
\r
41 public TCACEFProcessorContext(final String message, boolean canProcessingContinue, final TCAPolicy tcaPolicy) {
\r
42 super(message, canProcessingContinue);
\r
43 this.tcaPolicy = tcaPolicy;
\r
44 // present only if cef incoming message can be parsed successfully to Event Listener Object
\r
45 this.eventListener = null;
\r
46 // present only if there are any threshold violations are detected
\r
47 this.metricsPerEventName = null;
\r
50 // Auxiliary Constructor which default canProcessingContinue Flag to true
\r
51 public TCACEFProcessorContext(final String message, final TCAPolicy tcaPolicy) {
\r
52 this(message, true, tcaPolicy);
\r
56 * Returns {@link TCAPolicy} Object
\r
58 * @return TCA Policy
\r
60 public TCAPolicy getTCAPolicy() {
\r
65 * Returns Common Event Format {@link EventListener} if present else null
\r
67 * @return CEF Event Listener
\r
69 public EventListener getCEFEventListener() {
\r
70 return eventListener;
\r
75 * Sets new {@link EventListener}
\r
77 * @param eventListener set new value for CEF event listener
\r
79 public void setCEFEventListener(final EventListener eventListener) {
\r
80 this.eventListener = eventListener;
\r
85 * Returns TCA Policy {@link MetricsPerEventName} which was has violated Threshold for the CEF Message if
\r
88 * @return Violated Threshold
\r
90 public MetricsPerEventName getMetricsPerEventName() {
\r
91 return metricsPerEventName;
\r
95 * Assign new TCA Policy {@link MetricsPerEventName} which was has violated Threshold for the CEF Message
\r
97 * @param metricsPerEventName new value for Metrics Per Functional Role with violated threshold
\r
99 public void setMetricsPerEventName(MetricsPerEventName metricsPerEventName) {
\r
100 this.metricsPerEventName = metricsPerEventName;
\r