import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.http.conn.routing.RouteInfo.LayerType;
import org.eclipse.persistence.dynamic.DynamicType;
import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.cl.mdc.MdcContext;
+import org.onap.aai.schema.OxmModelLoader;
import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
-import org.onap.aai.datarouter.entity.OxmEntityDescriptor;
import org.onap.aai.datarouter.entity.SpikeEventEntity;
import org.onap.aai.datarouter.entity.SpikeEventMeta;
import org.onap.aai.datarouter.entity.SpikeEventVertex;
import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs;
-import org.onap.aai.datarouter.util.EntityOxmReferenceHelper;
-import org.onap.aai.datarouter.util.ExternalOxmModelProcessor;
-import org.onap.aai.datarouter.util.OxmModelLoader;
import org.onap.aai.datarouter.util.RouterServiceUtil;
import org.onap.aai.datarouter.util.SearchServiceAgent;
-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.EntityOxmReferenceHelper;
+import org.onap.aai.util.ExternalOxmModelProcessor;
+import org.onap.aai.util.Version;
+import org.onap.aai.util.VersionedOxmEntities;
import org.onap.aai.restclient.client.Headers;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.rest.HttpUtil;
}
protected DynamicJAXBContext readOxm(Exchange exchange, String uebPayload) {
- DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase());
+ DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion);
if (oxmJaxbContext == null) {
logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion);
logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", uebPayload);
protected String getOxmEntityType(String entityType) {
-
- String[] entityTypeArr = entityType.split("-");
- String oxmEntityType = "";
- for (String entityWord : entityTypeArr) {
- oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1);
- }
- return oxmEntityType;
+ return new OxmEntityTypeConverter().convert(entityType);
}
protected List<String> getSearchableAttibutes(DynamicJAXBContext oxmJaxbContext, String oxmEntityType,
private List<String> getOxmAttributes(DynamicJAXBContext oxmJaxbContext, String oxmEntityType,
String entityType, String fieldName) {
- DynamicType entity = (DynamicType) oxmJaxbContext.getDynamicType(oxmEntityType);
+ DynamicType entity = oxmJaxbContext.getDynamicType(oxmEntityType);
if (entity == null) {
return null;
}
meta.setSpikeEventVertex(spikeEventVertex);
- DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase());
+ DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion);
if (oxmJaxbContext == null) {
logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion);
logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch",
*/
VersionedOxmEntities oxmEntities =
- EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion));
+ EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion.toLowerCase()));
if (oxmEntities != null && !oxmEntities.getEntityTypeLookup().containsKey(entityType)) {
logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "No matching OXM Descriptor for entity-type='" + entityType + "'",
}
+ protected List<String> extractSuggestableAttr(VersionedOxmEntities oxmEntities, String entityType) {
+ // Extract suggestable attributeshandleTopographicalData
+ Map<String, OxmEntityDescriptor> rootDescriptor = oxmEntities.getSuggestableEntityDescriptors();
+
+ if (rootDescriptor == null) {
+ return Collections.emptyList();
+ }
+
+ OxmEntityDescriptor desc = rootDescriptor.get(entityType);
+
+ if (desc == null) {
+ return Collections.emptyList();
+ }
+
+ return desc.getSuggestableAttributes();
+ }
+
}