}
- if (list.size() == 0) {
+ if (list.isEmpty()) {
Thread.sleep(pollingInternalInt);
}
LOGGER.debug("number of messages to be converted :{}", list.size());
- if (list.size() != 0) {
+ if (!list.isEmpty()) {
String val = ((LinkedList<String>) list).removeFirst();
List<String> messages = new ArrayList<>();
String vesEvent = processReceivedJson(val);
- if (!(vesEvent.isEmpty() || vesEvent.equals(null) || vesEvent.equals(""))) {
+ if (vesEvent!=null && (!(vesEvent.isEmpty() || vesEvent.equals("")))) {
messages.add(vesEvent);
publisher.publish(messages);
LOGGER.info("Message successfully published to DMaaP Topic");
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Hex;
pstmt11.executeUpdate();
LOGGER.info("CREATE TABLE IF NOT EXISTS executed successfully....");
- if ((bytesArray.length > 0) && (!bytesArray.toString().equals(""))) {
+ if ((bytesArray.length > 0) && (!Arrays.toString(bytesArray).equals(""))) {
LOGGER.debug("2Connection object:" + con.toString());
try (PreparedStatement pstmt = con.prepareStatement("INSERT INTO "
+ MappingFileTableName
*/
public class MapperConfigUtils {
- private final Logger LOGGER = LoggerFactory.getLogger(MapperConfigUtils.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MapperConfigUtils.class);
private static Set<Entry> entries = new TreeSet<>((o1, o2) -> o1.getPriority().compareTo(o2.getPriority()));
private enum JoinOperator {
readMapperConfigFile(mappingFile);
checkIncomingJsonForMatchingDomain(incomingJsonString);
} catch (MapperConfigException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.error("Exception in mapperConfigFile reading:{}",e);
}
}
throw new MapperConfigException("Unable to read config file for reason...\n " + exception.getMessage(),
exception);
}
- System.out.println("Read config file content into :" + config);
+ LOGGER.debug("Read config file content into :{}",config);
if (null != config) {
entries.addAll(config.getEntries());
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().equals(evaluation.getValue());
+ break;
case DOUBLE:
if (null != actualObj.get(field))
return actualObj.get(field).asDouble() == Double
.valueOf(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case STARTSWITH:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().startsWith(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case ENDSWITH:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().endsWith(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case CONTAINS:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().contains(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
default:
return false;
}
LOGGER.debug("EnterPrise ID recieved:{}",enterpriseid);
- if ((mappingfile != null) && (mappingfile.length > 0) && (!mappingfile.equals(""))) {
+ if ((mappingfile != null) && (mappingfile.length > 0)) {
for (MultipartFile aFile : mappingfile) {
if(aFile.isEmpty()) {
continue;
LOGGER.error("IOException occured:{}",e.getCause());
return "failed";
} catch (SQLException e) {
- // TODO Auto-generated catch block
LOGGER.error("SQLException occured:{}",e.getCause());
return "failed";
}