-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
*/
package org.onap.aai.sa.searchdbabstraction.util;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.FileInputStream;
public class DocumentSchemaUtil {
+ private DocumentSchemaUtil() { // Do not instantiate
+ }
+
private static String dynamicCustomMapping = null;
private static final String DYNAMIC_CUSTOM_TEMPALTE_FILE =
System.getProperty("CONFIG_HOME") + File.separator + "dynamic-custom-template.json";
- public static String generateDocumentMappings(String documentSchema)
- throws JsonParseException, JsonMappingException, IOException {
+ public static String generateDocumentMappings(String documentSchema) throws IOException {
// Unmarshal the json content into a document schema object.
ObjectMapper mapper = new ObjectMapper();
sb.append("\"type\": \"").append(fieldSchema.getDataType()).append("\"");
// For date type fields we may optionally supply a format specifier.
- if (fieldSchema.getDataType().equals("date")) {
- if (fieldSchema.getFormat() != null) {
- sb.append(", \"format\": \"").append(fieldSchema.getFormat()).append("\"");
- }
+ if (fieldSchema.getDataType().equals("date") && fieldSchema.getFormat() != null) {
+ sb.append(", \"format\": \"").append(fieldSchema.getFormat()).append("\"");
}
// If the index field was specified, then append it.