-/*\r
- * ===============================LICENSE_START======================================\r
- * dcae-analytics\r
- * ================================================================================\r
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============================LICENSE_END===========================================\r
- */\r
-\r
-package org.openecomp.dcae.apod.analytics.tca.processor;\r
-\r
-import org.openecomp.dcae.apod.analytics.model.domain.cef.Domain;\r
-import org.openecomp.dcae.apod.analytics.model.domain.cef.EventListener;\r
-\r
-/**\r
- * <p>\r
- * TCA Processor which acts like a filter to filter out messages which does not belong to TCA Policy Domain\r
- * <br>\r
- * Pre Conditions: CEF Event Listener must be present\r
- * </p>\r
- *\r
- * @author Rajiv Singla . Creation Date: 11/7/2016.\r
- */\r
-public class TCACEFPolicyDomainFilter extends AbstractTCAECEFPolicyProcessor {\r
-\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- @Override\r
- public String getProcessorDescription() {\r
- return "Filters out CEF Messages which does not match TCAPolicy Domain";\r
- }\r
-\r
- @Override\r
- public TCACEFProcessorContext processMessage(TCACEFProcessorContext processorContext) {\r
-\r
- // Safe to get event Listener here without null check as pre processor will validate if\r
- // event listener is indeed present\r
- final EventListener eventListener = processorContext.getCEFEventListener();\r
-\r
- Domain cefMessageDomain;\r
-\r
- // Extract CEF domain as it is must be present as per CEF Schema\r
- if (eventListener.getEvent() != null &&\r
- eventListener.getEvent().getCommonEventHeader() != null &&\r
- eventListener.getEvent().getCommonEventHeader().getDomain() != null) {\r
- cefMessageDomain = eventListener.getEvent().getCommonEventHeader().getDomain();\r
-\r
- } else {\r
- final String terminatingMessage = "Invalid CEF Message.Common Event Header Domain not present.";\r
- setTerminatingProcessingMessage(terminatingMessage, processorContext);\r
- return processorContext;\r
- }\r
-\r
- // Get Policy Domain. TCA Policy Validation must ensure that Domain is indeed present\r
- // no null check will be required here\r
- final String policyDomain = processorContext.getTCAPolicy().getDomain();\r
-\r
- // If Policy domain matches CEF message domain then continue processing\r
- if (cefMessageDomain.toString().equalsIgnoreCase(policyDomain)) {\r
- final String finishMessage = String.format("Policy Domain and CEF Message Domain match successful." +\r
- " Message Domain: %s, Policy Domain: %s", cefMessageDomain, policyDomain);\r
- setFinishedProcessingMessage(finishMessage, processorContext);\r
- } else {\r
- // If policy domain does not match with CEF message terminate processing chain\r
- final String terminatingMessage = String.format("Policy Domain and CEF Message Domain match unsuccessful." +\r
- " Message Domain: %s, Policy Domain: %s", cefMessageDomain, policyDomain);\r
- setTerminatingProcessingMessage(terminatingMessage, processorContext);\r
- }\r
-\r
- return processorContext;\r
- }\r
-}\r
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.onap.dcae.apod.analytics.tca.processor;
+
+import org.onap.dcae.apod.analytics.model.domain.cef.Domain;
+import org.onap.dcae.apod.analytics.model.domain.cef.EventListener;
+
+/**
+ * <p>
+ * TCA Processor which acts like a filter to filter out messages which does not belong to TCA Policy Domain
+ * <br>
+ * Pre Conditions: CEF Event Listener must be present
+ * </p>
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public class TCACEFPolicyDomainFilter extends AbstractTCAECEFPolicyProcessor {
+
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getProcessorDescription() {
+ return "Filters out CEF Messages which does not match TCAPolicy Domain";
+ }
+
+ @Override
+ public TCACEFProcessorContext processMessage(TCACEFProcessorContext processorContext) {
+
+ // Safe to get event Listener here without null check as pre processor will validate if
+ // event listener is indeed present
+ final EventListener eventListener = processorContext.getCEFEventListener();
+
+ Domain cefMessageDomain;
+
+ // Extract CEF domain as it is must be present as per CEF Schema
+ if (eventListener.getEvent() != null &&
+ eventListener.getEvent().getCommonEventHeader() != null &&
+ eventListener.getEvent().getCommonEventHeader().getDomain() != null) {
+ cefMessageDomain = eventListener.getEvent().getCommonEventHeader().getDomain();
+
+ } else {
+ final String terminatingMessage = "Invalid CEF Message.Common Event Header Domain not present.";
+ setTerminatingProcessingMessage(terminatingMessage, processorContext);
+ return processorContext;
+ }
+
+ // Get Policy Domain. TCA Policy Validation must ensure that Domain is indeed present
+ // no null check will be required here
+ final String policyDomain = processorContext.getTCAPolicy().getDomain();
+
+ // If Policy domain matches CEF message domain then continue processing
+ if (cefMessageDomain.toString().equalsIgnoreCase(policyDomain)) {
+ final String finishMessage = String.format("Policy Domain and CEF Message Domain match successful." +
+ " Message Domain: %s, Policy Domain: %s", cefMessageDomain, policyDomain);
+ setFinishedProcessingMessage(finishMessage, processorContext);
+ } else {
+ // If policy domain does not match with CEF message terminate processing chain
+ final String terminatingMessage = String.format("Policy Domain and CEF Message Domain match unsuccessful." +
+ " Message Domain: %s, Policy Domain: %s", cefMessageDomain, policyDomain);
+ setTerminatingProcessingMessage(terminatingMessage, processorContext);
+ }
+
+ return processorContext;
+ }
+}