X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fdatarouter%2Fpolicy%2FEntityEventPolicy.java;h=290c47feb6c3ad0e166a568a556f5f6441cb277e;hb=1b7c1f5c9c09720defb16d11b8f22c7e4550f3e2;hp=4938bddf79249c64800d6d8417b2f6c868134378;hpb=6cb28e580a3d3e308de77b2e7b239cae3912dd7f;p=aai%2Fdata-router.git diff --git a/src/main/java/org/openecomp/datarouter/policy/EntityEventPolicy.java b/src/main/java/org/openecomp/datarouter/policy/EntityEventPolicy.java index 4938bdd..290c47f 100644 --- a/src/main/java/org/openecomp/datarouter/policy/EntityEventPolicy.java +++ b/src/main/java/org/openecomp/datarouter/policy/EntityEventPolicy.java @@ -1,16 +1,15 @@ /** * ============LICENSE_START======================================================= - * DataRouter + * org.onap.aai * ================================================================================ - * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * Copyright © 2017 Amdocs - * 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 + * 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, @@ -19,15 +18,12 @@ * limitations under the License. * ============LICENSE_END========================================================= * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ package org.openecomp.datarouter.policy; -import java.io.BufferedReader; +import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; @@ -36,14 +32,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.UUID; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; import org.apache.camel.Exchange; import org.apache.camel.Processor; -import org.eclipse.jetty.util.security.Password; import org.eclipse.persistence.dynamic.DynamicType; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; @@ -61,7 +52,6 @@ import org.openecomp.datarouter.entity.TopographicalEntity; import org.openecomp.datarouter.entity.UebEventHeader; import org.openecomp.datarouter.logging.EntityEventPolicyMsgs; import org.openecomp.datarouter.util.CrossEntityReference; -import org.openecomp.datarouter.util.DataRouterConstants; import org.openecomp.datarouter.util.EntityOxmReferenceHelper; import org.openecomp.datarouter.util.ExternalOxmModelProcessor; import org.openecomp.datarouter.util.NodeUtils; @@ -73,8 +63,6 @@ import org.openecomp.datarouter.util.Version; import org.openecomp.datarouter.util.VersionedOxmEntities; import org.openecomp.restclient.client.Headers; import org.openecomp.restclient.client.OperationResult; -import org.openecomp.restclient.client.RestClient; -import org.openecomp.restclient.enums.RestAuthenticationMode; import org.openecomp.restclient.rest.HttpUtil; import org.slf4j.MDC; @@ -83,7 +71,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.sun.jersey.core.util.MultivaluedMapImpl; public class EntityEventPolicy implements Processor { @@ -119,10 +106,7 @@ public class EntityEventPolicy implements Processor { /** Search index name for suggestive search data. */ private String aggregateGenericVnfIndex; - private String entitySearchTarget = null; - private String topographicalSearchTarget = null; - private String autoSuggestSearchTarget = null; - private String aggregationSearchVnfTarget = null; + private String autosuggestIndex; private String srcDomain; @@ -134,7 +118,7 @@ public class EntityEventPolicy implements Processor { SUCCESS, PARTIAL_SUCCESS, FAILURE; }; - public EntityEventPolicy(EntityEventPolicyConfig config) { + public EntityEventPolicy(EntityEventPolicyConfig config) throws FileNotFoundException { LoggerFactory loggerFactoryInstance = LoggerFactory.getInstance(); logger = loggerFactoryInstance.getLogger(EntityEventPolicy.class.getName()); metricsLogger = loggerFactoryInstance.getMetricsLogger(EntityEventPolicy.class.getName()); @@ -156,21 +140,6 @@ public class EntityEventPolicy implements Processor { config.getSearchEndpointDocuments(), logger); - entitySearchTarget = - EntityEventPolicy.concatSubUri(config.getSearchBaseUrl(), config.getSearchEndpoint(), - config.getSearchEntitySearchIndex(), config.getSearchEndpointDocuments()); - - topographicalSearchTarget = EntityEventPolicy.concatSubUri(config.getSearchBaseUrl(), - config.getSearchEndpoint(), config.getSearchTopographySearchIndex()); - - autoSuggestSearchTarget = - EntityEventPolicy.concatSubUri(config.getSearchBaseUrl(), config.getSearchEndpoint(), - config.getSearchEntityAutoSuggestIndex(), config.getSearchEndpointDocuments()); - - aggregationSearchVnfTarget = - EntityEventPolicy.concatSubUri(config.getSearchBaseUrl(), config.getSearchEndpoint(), - config.getSearchAggregationVnfIndex(), config.getSearchEndpointDocuments()); - this.externalOxmModelProcessors = new ArrayList(); this.externalOxmModelProcessors.add(EntityOxmReferenceHelper.getInstance()); OxmModelLoader.registerExternalOxmModelProcessors(externalOxmModelProcessors); @@ -587,7 +556,7 @@ public class EntityEventPolicy implements Processor { ae.setLink(entityLink); ae.deriveFields(uebAsJson); - handleSearchServiceOperation(ae, action, this.aggregationSearchVnfTarget); + handleSearchServiceOperation(ae, action, aggregateGenericVnfIndex); /* * It was decided to silently ignore DELETE requests for resources we don't allow to be @@ -618,8 +587,7 @@ public class EntityEventPolicy implements Processor { + e.getLocalizedMessage()); } - handleSearchServiceOperation(suggestionSearchEntity, action, - this.autoSuggestSearchTarget); + handleSearchServiceOperation(suggestionSearchEntity, action, autosuggestIndex); } } } @@ -933,7 +901,7 @@ public class EntityEventPolicy implements Processor { headers.put(Headers.IF_MATCH, etag); } else { logger.error(EntityEventPolicyMsgs.NO_ETAG_AVAILABLE_FAILURE, - entitySearchTarget + entityId, entityId); + entitySearchIndex, entityId); } ArrayList sourceObject = new ArrayList(); @@ -1095,7 +1063,7 @@ public class EntityEventPolicy implements Processor { "Cannot create unique SHA digest for topographical data."); } - this.handleSearchServiceOperation(topoEntity, action, this.topographicalSearchTarget); + this.handleSearchServiceOperation(topoEntity, action, topographicalSearchIndex); }