Commit deb2901c authored by harshit aggarwal's avatar harshit aggarwal Committed by Kishore Battula
Browse files

Using SLF4J Logger in core

parent d8b3d75f
...@@ -101,8 +101,8 @@ spec: ...@@ -101,8 +101,8 @@ spec:
- name: default_tenant - name: default_tenant
value: {{ .Values.default_tenant }} value: {{ .Values.default_tenant }}
- name: max_concurrent_calls - name: max_concurrent_calls
value: "8" value: "32"
- name: executor_n_threads - name: executor_n_threads
value: "8" value: "32"
- name: max_lock_renew_duration_seconds - name: max_lock_renew_duration_seconds
value: "600" value: "600"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springfox-version>2.7.0</springfox-version> <springfox-version>2.7.0</springfox-version>
<osdu.oscorecommon-version>0.3.18</osdu.oscorecommon-version> <osdu.oscorecommon-version>0.3.24</osdu.oscorecommon-version>
</properties> </properties>
<licenses> <licenses>
......
package org.opengroup.osdu.wks; package org.opengroup.osdu.wks;
import java.util.logging.Level;
import org.opengroup.osdu.wks.config.ThreadScopeBeanFactoryPostProcessor; import org.opengroup.osdu.wks.config.ThreadScopeBeanFactoryPostProcessor;
import org.opengroup.osdu.wks.provider.interfaces.SubscriptionManager; import org.opengroup.osdu.wks.provider.interfaces.SubscriptionManager;
import org.opengroup.osdu.wks.service.SchemaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
...@@ -12,15 +13,13 @@ import org.springframework.context.annotation.Bean; ...@@ -12,15 +13,13 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import lombok.extern.java.Log;
@Log
@SpringBootApplication @SpringBootApplication
@ComponentScan(value = { @ComponentScan(value = {
"org.opengroup.osdu" "org.opengroup.osdu"
}) })
public class WksServiceApplication { public class WksServiceApplication {
private final static Logger LOGGER = LoggerFactory.getLogger(SchemaService.class);
public static void main(String[] args) { public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(WksServiceApplication.class, args); ApplicationContext context = SpringApplication.run(WksServiceApplication.class, args);
try { try {
...@@ -29,8 +28,7 @@ public class WksServiceApplication { ...@@ -29,8 +28,7 @@ public class WksServiceApplication {
} }
catch (Exception e) catch (Exception e)
{ {
log.severe(e.getMessage()); LOGGER.error(e.getMessage(), e);
log.log(Level.FINE, e.getMessage(), e);
} }
} }
......
...@@ -12,11 +12,11 @@ public class Constants { ...@@ -12,11 +12,11 @@ public class Constants {
public static final String APP_KEY = "AppKey"; public static final String APP_KEY = "AppKey";
public static final String WKS_KIND = "wks"; public static final String WKS_KIND = "wks";
public static final String WKE_KIND = "wke"; public static final String WKE_KIND = "wke";
public static final String NO_MAPPING_FOR_KIND = "Mapping not found for %s"; public static final String NO_MAPPING_FOR_KIND = "Mapping not found for {}";
public static final String NO_MAPPING_FOR_ANY_RECORD = "Mapping not found for any record"; public static final String NO_MAPPING_FOR_ANY_RECORD = "Mapping not found for any record";
public static final String ERROR_WHILE_GETTING_RAW_RECORD = "Error retrieving raw record."; public static final String ERROR_WHILE_GETTING_RAW_RECORD = "Error retrieving raw record.";
public static final String TRANFORMATION_SUCCESSFUL = "Transformed successfully raw record id: %s, wks record id: %s and wks schema kind: %s"; public static final String TRANFORMATION_SUCCESSFUL = "Transformed successfully raw record id: {}, wks record id: {} and wks schema kind: {}";
public static final String TRANFORMATION_ALREADY_DONE = "Transformation already done for %d out of %d records"; public static final String TRANFORMATION_ALREADY_DONE = "Transformation already done for {} out of {} records";
public static final String RAW_RECORD_NOT_PRESENT = "Raw record not present"; public static final String RAW_RECORD_NOT_PRESENT = "Raw record not present";
public static final String MAPPING_NOT_PRESENT = "Mapping not present"; public static final String MAPPING_NOT_PRESENT = "Mapping not present";
public static final String COLON_SEPARATOR = ":"; public static final String COLON_SEPARATOR = ":";
...@@ -27,11 +27,11 @@ public class Constants { ...@@ -27,11 +27,11 @@ public class Constants {
public static final String MISSING_RAW_RECORD_DETAILS = "Missing raw records details"; public static final String MISSING_RAW_RECORD_DETAILS = "Missing raw records details";
public static final String DATA_PARTITION_ID_NEEDED = "Data Partition Id is needed"; public static final String DATA_PARTITION_ID_NEEDED = "Data Partition Id is needed";
public static final String CORRELATION_ID_NEEDED = "Correlation Id is needed"; public static final String CORRELATION_ID_NEEDED = "Correlation Id is needed";
public static final String TRANFORMATION_FAILED = "Transformation failed for raw record id: %s, reason: %s"; public static final String TRANFORMATION_FAILED = "Transformation failed for raw record id: {}, reason: {}";
public static final String TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND = "Transformation failed for raw record id: %s with mapping of wks kind: %s, reason: %s"; public static final String TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND = "Transformation failed for raw record id: {} with mapping of wks kind: {}, reason: {}";
public static final String COULD_NOT_TRANSFORM = "Could not transform"; public static final String COULD_NOT_TRANSFORM = "Could not transform";
public static final String TRANFORMATION_PROCESS_COMPLETED = "Transformation process completed"; public static final String TRANFORMATION_PROCESS_COMPLETED = "Transformation process completed";
public static final String NOT_CREATE_OR_UPDATE_OPERATION = "%d out of %d records do not have create or update operation code"; public static final String NOT_CREATE_OR_UPDATE_OPERATION = "{} out of {} records do not have create or update operation code";
private Constants() { private Constants() {
} }
......
...@@ -17,6 +17,8 @@ import org.opengroup.osdu.wks.model.SchemaInfoResponse; ...@@ -17,6 +17,8 @@ import org.opengroup.osdu.wks.model.SchemaInfoResponse;
import org.opengroup.osdu.wks.provider.interfaces.UserCredential; import org.opengroup.osdu.wks.provider.interfaces.UserCredential;
import org.opengroup.osdu.wks.util.KindUtil; import org.opengroup.osdu.wks.util.KindUtil;
import org.opengroup.osdu.wks.util.RestClient; import org.opengroup.osdu.wks.util.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -28,6 +30,7 @@ import java.util.List; ...@@ -28,6 +30,7 @@ import java.util.List;
@Component @Component
public class SchemaService implements ISchemaService{ public class SchemaService implements ISchemaService{
private final static Logger LOGGER = LoggerFactory.getLogger(SchemaService.class);
private static final String SCHEMA_SERVICE_ERROR_MESSAGE = "Schema service status code %s and message %s"; private static final String SCHEMA_SERVICE_ERROR_MESSAGE = "Schema service status code %s and message %s";
@Autowired @Autowired
...@@ -94,6 +97,7 @@ public class SchemaService implements ISchemaService{ ...@@ -94,6 +97,7 @@ public class SchemaService implements ISchemaService{
return kinds; return kinds;
} }
catch (JsonProcessingException exception) { catch (JsonProcessingException exception) {
LOGGER.warn(exception.getMessage(), exception);
throw new ApplicationException(exception.getMessage(), exception.getCause()); throw new ApplicationException(exception.getMessage(), exception.getCause());
} }
} }
...@@ -113,6 +117,7 @@ public class SchemaService implements ISchemaService{ ...@@ -113,6 +117,7 @@ public class SchemaService implements ISchemaService{
return uriBuilder.build().toString(); return uriBuilder.build().toString();
} }
catch (URISyntaxException exception) { catch (URISyntaxException exception) {
LOGGER.warn(exception.getMessage(), exception);
throw new ApplicationException(exception.getMessage(), exception.getCause()); throw new ApplicationException(exception.getMessage(), exception.getCause());
} }
......
...@@ -13,16 +13,16 @@ import org.opengroup.osdu.wks.model.RequestParameters; ...@@ -13,16 +13,16 @@ import org.opengroup.osdu.wks.model.RequestParameters;
import org.opengroup.osdu.wks.model.RestResponse; import org.opengroup.osdu.wks.model.RestResponse;
import org.opengroup.osdu.wks.provider.interfaces.UserCredential; import org.opengroup.osdu.wks.provider.interfaces.UserCredential;
import org.opengroup.osdu.wks.util.RestClient; import org.opengroup.osdu.wks.util.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import lombok.extern.java.Log;
@Log
@Service @Service
public class StorageServiceImpl implements StorageService { public class StorageServiceImpl implements StorageService {
private final static Logger LOGGER = LoggerFactory.getLogger(StorageServiceImpl.class);
@Autowired @Autowired
private RestClient restClient; private RestClient restClient;
...@@ -96,13 +96,14 @@ private String getAuthKey(TenantInfo tenantInfo) { ...@@ -96,13 +96,14 @@ private String getAuthKey(TenantInfo tenantInfo) {
try { try {
return userCrendential.getIdToken(tenantInfo); return userCrendential.getIdToken(tenantInfo);
} catch(ApplicationException e) { } catch(ApplicationException e) {
LOGGER.warn(e.getErrorMsg(), e);
throw new AuthorizationException(e); throw new AuthorizationException(e);
} }
} }
private void verifyResponseStatus(RestResponse response) throws ApplicationException { private void verifyResponseStatus(RestResponse response) throws ApplicationException {
if (response.getStatus() != HttpStatus.SC_CREATED) { if (response.getStatus() != HttpStatus.SC_CREATED) {
log.warning(response.getException()); LOGGER.warn(response.getException());
throw new ApplicationException(response.getException()); throw new ApplicationException(response.getException());
} }
} }
......
...@@ -6,8 +6,6 @@ import java.util.HashMap; ...@@ -6,8 +6,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.logging.Level;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -24,18 +22,19 @@ import org.opengroup.osdu.wks.model.TransformationResult; ...@@ -24,18 +22,19 @@ import org.opengroup.osdu.wks.model.TransformationResult;
import org.opengroup.osdu.wks.provider.interfaces.StatusStoreService; import org.opengroup.osdu.wks.provider.interfaces.StatusStoreService;
import org.opengroup.osdu.wks.util.KindUtil; import org.opengroup.osdu.wks.util.KindUtil;
import org.opengroup.osdu.wks.util.WksTransformator; import org.opengroup.osdu.wks.util.WksTransformator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.datatree.Tree; import io.datatree.Tree;
import lombok.extern.java.Log;
@Log
@Service("wKSService") @Service("wKSService")
public class WKSServiceImpl implements WKSService { public class WKSServiceImpl implements WKSService {
private final static Logger LOGGER = LoggerFactory.getLogger(WKSServiceImpl.class);
private static final int SOURCE_INDEX = 1; private static final int SOURCE_INDEX = 1;
private static final String UPDATE = "update"; private static final String UPDATE = "update";
private static final String CREATE = "create"; private static final String CREATE = "create";
...@@ -83,6 +82,8 @@ public class WKSServiceImpl implements WKSService { ...@@ -83,6 +82,8 @@ public class WKSServiceImpl implements WKSService {
if(rawRecordsDetailsForTransformation.length > 0) { if(rawRecordsDetailsForTransformation.length > 0) {
Map<String, List<MappingsModel>> mappingsMap = retrieveMappingsMap(rawRecordsDetailsForTransformation); Map<String, List<MappingsModel>> mappingsMap = retrieveMappingsMap(rawRecordsDetailsForTransformation);
// Updating mappings with latest minor and patch versions
updateMappingsWithLatestMinorAndPatchVersions(mappingsMap);
transformRecords(rawRecordsDetailsForTransformation, mappingsMap, dataPartitionId, correlationId); transformRecords(rawRecordsDetailsForTransformation, mappingsMap, dataPartitionId, correlationId);
} }
} finally { } finally {
...@@ -106,13 +107,12 @@ public class WKSServiceImpl implements WKSService { ...@@ -106,13 +107,12 @@ public class WKSServiceImpl implements WKSService {
} }
if (invalidOpCodeCount > 0) { if (invalidOpCodeCount > 0) {
log.log(Level.INFO, String.format(Constants.NOT_CREATE_OR_UPDATE_OPERATION, invalidOpCodeCount, LOGGER.info(Constants.NOT_CREATE_OR_UPDATE_OPERATION, invalidOpCodeCount,
rawRecordsDetails.length)); rawRecordsDetails.length);
} }
if (invalidSourceCount > 0) { if (invalidSourceCount > 0) {
log.log(Level.INFO, LOGGER.info(Constants.TRANFORMATION_ALREADY_DONE, invalidSourceCount, rawRecordsDetails.length);
String.format(Constants.TRANFORMATION_ALREADY_DONE, invalidSourceCount, rawRecordsDetails.length));
} }
return rawRecordsDetailsList.toArray(new RawRecordDetails[0]); return rawRecordsDetailsList.toArray(new RawRecordDetails[0]);
...@@ -126,11 +126,10 @@ public class WKSServiceImpl implements WKSService { ...@@ -126,11 +126,10 @@ public class WKSServiceImpl implements WKSService {
for (RawRecordDetails rawRecord : rawRecordsDetails) { for (RawRecordDetails rawRecord : rawRecordsDetails) {
try { try {
List<MappingsModel> mappingsList = retrieveMappings(mappingsMap, rawRecord); List<MappingsModel> mappingsList = retrieveMappings(mappingsMap, rawRecord);
List<MappingsModel> mappingsWithLatestMinorAndPatchVersions = updateMappingsWithLatestMinorAndPatchVersions(mappingsList);
Tree rawRecordTree = retrieveRawRecordTree(rawRecord); Tree rawRecordTree = retrieveRawRecordTree(rawRecord);
for (MappingsModel mappings: mappingsWithLatestMinorAndPatchVersions) { for (MappingsModel mappings: mappingsList) {
try { try {
TransformRequest transformRequest = new TransformRequest(rawRecordTree, mappings); TransformRequest transformRequest = new TransformRequest(rawRecordTree, mappings);
...@@ -144,19 +143,17 @@ public class WKSServiceImpl implements WKSService { ...@@ -144,19 +143,17 @@ public class WKSServiceImpl implements WKSService {
} }
wksRecordTreeList.add(wksRecordTree); wksRecordTreeList.add(wksRecordTree);
log.log(Level.INFO, String.format(Constants.TRANFORMATION_SUCCESSFUL, rawRecord.getId(), LOGGER.info(Constants.TRANFORMATION_SUCCESSFUL, rawRecord.getId(),
wksRecordTree.get(ID).asString(), wksRecordTree.get(KIND))); wksRecordTree.get(ID).asString(), wksRecordTree.get(KIND));
} }
catch (ApplicationException e) { catch (ApplicationException e) {
log.log(Level.WARNING, LOGGER.warn(Constants.TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND, rawRecord.getId(), mappings.getTargetSchemaKind(), e.getErrorMsg(), e);
String.format(Constants.TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND, rawRecord.getId(), mappings.getTargetSchemaKind(), e.getErrorMsg()));
} }
} }
} catch (ApplicationException e) { } catch (ApplicationException e) {
log.log(Level.WARNING, LOGGER.warn(Constants.TRANFORMATION_FAILED, rawRecord.getId(), e.getErrorMsg(), e);
String.format(Constants.TRANFORMATION_FAILED, rawRecord.getId(), e.getErrorMsg()));
} }
} }
...@@ -166,17 +163,21 @@ public class WKSServiceImpl implements WKSService { ...@@ -166,17 +163,21 @@ public class WKSServiceImpl implements WKSService {
statusStoreService.createOrUpdateStoreEntry(relationshipStatusList); statusStoreService.createOrUpdateStoreEntry(relationshipStatusList);
} }
} }
log.log(Level.INFO, Constants.TRANFORMATION_PROCESS_COMPLETED); LOGGER.info(Constants.TRANFORMATION_PROCESS_COMPLETED);
} }
private List<MappingsModel> updateMappingsWithLatestMinorAndPatchVersions(List<MappingsModel> mappingsList) throws ApplicationException { private void updateMappingsWithLatestMinorAndPatchVersions(Map<String, List<MappingsModel>> mappingsMap) throws ApplicationException {
for (MappingsModel mappingsModel : mappingsList) {
List<String> schemaKindsWithLatestMinorAndPatchVersions = schemaService.getSchemas(mappingsModel.getTargetSchemaKind()); for (Map.Entry<String, List<MappingsModel>> entry : mappingsMap.entrySet()) {
mappingsModel.setTargetSchemaKind(schemaKindsWithLatestMinorAndPatchVersions.get(0)); List<MappingsModel> mappingsModelList = new ArrayList<>();
for (MappingsModel mappingsModel : entry.getValue()) {
List<String> schemaKindsWithLatestMinorAndPatchVersions = schemaService.getSchemas(mappingsModel.getTargetSchemaKind());
mappingsModel.setTargetSchemaKind(schemaKindsWithLatestMinorAndPatchVersions.get(0));
mappingsModelList.add(mappingsModel);
}
entry.setValue(mappingsModelList);
} }
log.log(Level.INFO, "Schemas for WKS fetched with latest minor and patch versions"); LOGGER.info("Schemas for WKS fetched with latest minor and patch versions");
return mappingsList;
} }
private void initializeMessageContext(String dataPartitionId, String correlationId) { private void initializeMessageContext(String dataPartitionId, String correlationId) {
...@@ -188,7 +189,7 @@ public class WKSServiceImpl implements WKSService { ...@@ -188,7 +189,7 @@ public class WKSServiceImpl implements WKSService {
throws ApplicationException { throws ApplicationException {
List<MappingsModel> mappings = mappingsMap.get(rawRecord.getKind()); List<MappingsModel> mappings = mappingsMap.get(rawRecord.getKind());
if (isEmptyMappings(mappings)) { if (isEmptyMappings(mappings)) {
log.warning(String.format(Constants.NO_MAPPING_FOR_KIND, rawRecord.getKind())); LOGGER.warn(Constants.NO_MAPPING_FOR_KIND, rawRecord.getKind());
throw new ApplicationException(String.format(Constants.NO_MAPPING_FOR_KIND, rawRecord.getKind())); throw new ApplicationException(String.format(Constants.NO_MAPPING_FOR_KIND, rawRecord.getKind()));
} }
return mappings; return mappings;
...@@ -196,7 +197,7 @@ public class WKSServiceImpl implements WKSService { ...@@ -196,7 +197,7 @@ public class WKSServiceImpl implements WKSService {
private void validateTransformRecord(Tree wksRecordTree) throws ApplicationException { private void validateTransformRecord(Tree wksRecordTree) throws ApplicationException {
if (wksRecordTree == null || wksRecordTree.isEmpty()) { if (wksRecordTree == null || wksRecordTree.isEmpty()) {
log.warning(Constants.COULD_NOT_TRANSFORM); LOGGER.warn(Constants.COULD_NOT_TRANSFORM);
throw new ApplicationException(Constants.COULD_NOT_TRANSFORM); throw new ApplicationException(Constants.COULD_NOT_TRANSFORM);
} }
} }
...@@ -205,7 +206,7 @@ public class WKSServiceImpl implements WKSService { ...@@ -205,7 +206,7 @@ public class WKSServiceImpl implements WKSService {
throws ApplicationException { throws ApplicationException {
String message = this.storageService.putRecords(convertTreeListToJsonStrArr(wksRecordTreeList), String message = this.storageService.putRecords(convertTreeListToJsonStrArr(wksRecordTreeList),
dataPartitionId, correlationId); dataPartitionId, correlationId);
log.info(message); LOGGER.info(message);
} }
private Tree retrieveRawRecordTree(RawRecordDetails rawRecord) private Tree retrieveRawRecordTree(RawRecordDetails rawRecord)
...@@ -213,14 +214,14 @@ public class WKSServiceImpl implements WKSService { ...@@ -213,14 +214,14 @@ public class WKSServiceImpl implements WKSService {
Optional<String> optionalRawRecord = storageService.getRecord(rawRecord.getId()); Optional<String> optionalRawRecord = storageService.getRecord(rawRecord.getId());
if (!optionalRawRecord.isPresent()) { if (!optionalRawRecord.isPresent()) {
log.severe(Constants.RAW_RECORD_NOT_PRESENT); LOGGER.warn(Constants.RAW_RECORD_NOT_PRESENT);
throw new BadRequestException(Constants.RAW_RECORD_NOT_PRESENT); throw new BadRequestException(Constants.RAW_RECORD_NOT_PRESENT);
} }
String rawRecordJsonStr = optionalRawRecord.get(); String rawRecordJsonStr = optionalRawRecord.get();
Tree rawRecordTree = convertJsonStringToTree(rawRecordJsonStr); Tree rawRecordTree = convertJsonStringToTree(rawRecordJsonStr);
if (rawRecordTree.isEmpty()) { if (rawRecordTree.isEmpty()) {
log.severe(Constants.RAW_RECORD_NOT_PRESENT); LOGGER.warn(Constants.RAW_RECORD_NOT_PRESENT);
throw new ApplicationException(Constants.RAW_RECORD_NOT_PRESENT); throw new ApplicationException(Constants.RAW_RECORD_NOT_PRESENT);
} }
return rawRecordTree; return rawRecordTree;
...@@ -249,15 +250,15 @@ public class WKSServiceImpl implements WKSService { ...@@ -249,15 +250,15 @@ public class WKSServiceImpl implements WKSService {
|| StringUtils.isBlank(rawRecordsDetails[0].getId()) || StringUtils.isBlank(rawRecordsDetails[0].getId())
|| StringUtils.isBlank(rawRecordsDetails[0].getKind()) || StringUtils.isBlank(rawRecordsDetails[0].getKind())
|| StringUtils.isBlank(rawRecordsDetails[0].getOp())) { || StringUtils.isBlank(rawRecordsDetails[0].getOp())) {
log.warning(Constants.MISSING_RAW_RECORD_DETAILS); LOGGER.warn(Constants.MISSING_RAW_RECORD_DETAILS);
throw new BadRequestException(Constants.MISSING_RAW_RECORD_DETAILS); throw new BadRequestException(Constants.MISSING_RAW_RECORD_DETAILS);
} }
if (StringUtils.isBlank(dataPartitionId)) { if (StringUtils.isBlank(dataPartitionId)) {
log.warning(Constants.DATA_PARTITION_ID_NEEDED); LOGGER.warn(Constants.DATA_PARTITION_ID_NEEDED);
throw new BadRequestException(Constants.DATA_PARTITION_ID_NEEDED); throw new BadRequestException(Constants.DATA_PARTITION_ID_NEEDED);
} }
if (StringUtils.isBlank(correlationId)) { if (StringUtils.isBlank(correlationId)) {
log.warning(Constants.CORRELATION_ID_NEEDED); LOGGER.warn(Constants.CORRELATION_ID_NEEDED);
throw new BadRequestException(Constants.CORRELATION_ID_NEEDED); throw new BadRequestException(Constants.CORRELATION_ID_NEEDED);
} }
} }
...@@ -280,7 +281,7 @@ public class WKSServiceImpl implements WKSService { ...@@ -280,7 +281,7 @@ public class WKSServiceImpl implements WKSService {
try { try {
map = mapper.readValue(jsonStr, Map.class); map = mapper.readValue(jsonStr, Map.class);
} catch (IOException e) { } catch (IOException e) {
log.warning("Could not convert json string to map"); LOGGER.warn("Could not convert json string to map", e);
} }
} }
return new Tree(map); return new Tree(map);
......
...@@ -8,11 +8,12 @@ import org.apache.commons.lang3.StringUtils; ...@@ -8,11 +8,12 @@ import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.datatree.Tree; import io.datatree.Tree;
import lombok.extern.java.Log; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Log
public class JsonTreeUtil { public class JsonTreeUtil {
private final static Logger LOGGER = LoggerFactory.getLogger(JsonTreeUtil.class);
private JsonTreeUtil(){ private JsonTreeUtil(){
throw new IllegalStateException("JsonTreeUtil should not be instantiated"); throw new IllegalStateException("JsonTreeUtil should not be instantiated");
} }
...@@ -25,7 +26,7 @@ public class JsonTreeUtil { ...@@ -25,7 +26,7 @@ public class JsonTreeUtil {
try { try {
map = mapper.readValue(jsonStr, Map.class); map = mapper.readValue(jsonStr, Map.class);
} catch (IOException e) { } catch (IOException e) {
log.warning("Could not convert json string to map"); LOGGER.warn("Could not convert json string to map", e);
} }
} }
return new Tree(map); return new Tree(map);
......
...@@ -8,9 +8,7 @@ import java.util.List; ...@@ -8,9 +8,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.logging.Level;