* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* Copyright © 2017-2018 Amdocs
+ * Modifications Copyright (C) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.aai.datarouter.entity.AaiEventEntity;
import org.onap.aai.datarouter.entity.AggregationEntity;
import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
-import org.onap.aai.datarouter.entity.OxmEntityDescriptor;
import org.onap.aai.datarouter.entity.SuggestionSearchEntity;
import org.onap.aai.datarouter.entity.TopographicalEntity;
import org.onap.aai.datarouter.entity.UebEventHeader;
import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs;
-import org.onap.aai.datarouter.util.CrossEntityReference;
-import org.onap.aai.datarouter.util.EntityOxmReferenceHelper;
-import org.onap.aai.datarouter.util.ExternalOxmModelProcessor;
import org.onap.aai.datarouter.util.NodeUtils;
-import org.onap.aai.datarouter.schema.OxmModelLoader;
import org.onap.aai.datarouter.util.RouterServiceUtil;
import org.onap.aai.datarouter.util.SearchServiceAgent;
import org.onap.aai.datarouter.util.SearchSuggestionPermutation;
-import org.onap.aai.datarouter.util.Version;
-import org.onap.aai.datarouter.util.VersionedOxmEntities;
+import org.onap.aai.entity.OxmEntityDescriptor;
+import org.onap.aai.util.CrossEntityReference;
+import org.onap.aai.util.EntityOxmReferenceHelper;
+import org.onap.aai.util.ExternalOxmModelProcessor;
+import org.onap.aai.schema.OxmModelLoader;
+import org.onap.aai.setup.SchemaVersions;
+import org.onap.aai.util.Version;
+import org.onap.aai.util.VersionedOxmEntities;
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.cl.mdc.MdcContext;
this.externalOxmModelProcessors = new ArrayList<>();
this.externalOxmModelProcessors.add(EntityOxmReferenceHelper.getInstance());
OxmModelLoader.registerExternalOxmModelProcessors(externalOxmModelProcessors);
- OxmModelLoader.loadModels();
+ OxmModelLoader.loadModels(config.getSchemaVersions(), config.getSchemaLocationsBean());
oxmVersionContextMap = OxmModelLoader.getVersionContextMap();
parseLatestOxmVersion();
}
String uebPayload = exchange.getIn().getBody().toString();
- JsonNode uebAsJson =null;
+ JsonNode uebAsJson = null;
ObjectMapper mapper = new ObjectMapper();
try{
uebAsJson = mapper.readTree(uebPayload);
// Process for building AaiEventEntity object
- String[] entityTypeArr = entityType.split("-");
- String oxmEntityType = "";
- for (String entityWord : entityTypeArr) {
- oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1);
- }
+ String oxmEntityType = new OxmEntityTypeConverter().convert(entityType);
List<String> searchableAttr =
getOxmAttributes(uebPayload, oxmJaxbContext, oxmEntityType, entityType, "searchable");
JSONObject entityJsonObject = getUebEntity(uebPayload);
- JsonNode entityJsonNode = convertToJsonNode(entityJsonObject.toString());
+ JsonNode entityJsonNode =
+ convertToJsonNode(entityJsonObject !=null ? entityJsonObject.toString() : "");
String parentEntityType = entityType;
if (!sourceObject.isEmpty()) {
JsonNode node = sourceObject.get(0);
final String sourceCer = NodeUtils.extractFieldValueFromObject(node,
- "crossEntityReferenceValues");
+ "crossReferenceEntityValues");
String newCer = aaiEventEntity.getCrossReferenceEntityValues();
boolean hasNewCer = true;
if (sourceCer != null && sourceCer.length() > 0){ // already has CER
if (hasNewCer){
// Do the PUT with new CER
- ((ObjectNode)node).put("crossEntityReferenceValues", newCer);
+ ((ObjectNode)node).put("crossReferenceEntityValues", newCer);
jsonPayload = NodeUtils.convertObjectToJson(node, false);
searchAgent.putDocument(entitySearchIndex, entityId, jsonPayload, headers);
}