Commit ec36a1a5 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

using slf4j templating

parent afa50210
Pipeline #21861 passed with stages
in 28 minutes and 45 seconds
......@@ -12,11 +12,11 @@ public class Constants {
public static final String APP_KEY = "AppKey";
public static final String WKS_KIND = "wks";
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 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_ALREADY_DONE = "Transformation already done for %d out of %d records";
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 {} out of {} records";
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 COLON_SEPARATOR = ":";
......@@ -27,11 +27,11 @@ public class Constants {
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 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 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 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: {} with mapping of wks kind: {}, reason: {}";
public static final String COULD_NOT_TRANSFORM = "Could not transform";
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() {
}
......
......@@ -107,12 +107,12 @@ public class WKSServiceImpl implements WKSService {
}
if (invalidOpCodeCount > 0) {
LOGGER.info(String.format(Constants.NOT_CREATE_OR_UPDATE_OPERATION, invalidOpCodeCount,
rawRecordsDetails.length));
LOGGER.info(Constants.NOT_CREATE_OR_UPDATE_OPERATION, invalidOpCodeCount,
rawRecordsDetails.length);
}
if (invalidSourceCount > 0) {
LOGGER.info(String.format(Constants.TRANFORMATION_ALREADY_DONE, invalidSourceCount, rawRecordsDetails.length));
LOGGER.info(Constants.TRANFORMATION_ALREADY_DONE, invalidSourceCount, rawRecordsDetails.length);
}
return rawRecordsDetailsList.toArray(new RawRecordDetails[0]);
......@@ -143,17 +143,17 @@ public class WKSServiceImpl implements WKSService {
}
wksRecordTreeList.add(wksRecordTree);
LOGGER.info(String.format(Constants.TRANFORMATION_SUCCESSFUL, rawRecord.getId(),
wksRecordTree.get(ID).asString(), wksRecordTree.get(KIND)));
LOGGER.info(Constants.TRANFORMATION_SUCCESSFUL, rawRecord.getId(),
wksRecordTree.get(ID).asString(), wksRecordTree.get(KIND));
}
catch (ApplicationException e) {
LOGGER.warn(String.format(Constants.TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND, rawRecord.getId(), mappings.getTargetSchemaKind(), e.getErrorMsg()), e);
LOGGER.warn(Constants.TRANSFORMATION_FAILED_FOR_GIVEN_WKS_KIND, rawRecord.getId(), mappings.getTargetSchemaKind(), e.getErrorMsg(), e);
}
}
} catch (ApplicationException e) {
LOGGER.warn(String.format(Constants.TRANFORMATION_FAILED, rawRecord.getId(), e.getErrorMsg()), e);
LOGGER.warn(Constants.TRANFORMATION_FAILED, rawRecord.getId(), e.getErrorMsg(), e);
}
}
......@@ -189,7 +189,7 @@ public class WKSServiceImpl implements WKSService {
throws ApplicationException {
List<MappingsModel> mappings = mappingsMap.get(rawRecord.getKind());
if (isEmptyMappings(mappings)) {
LOGGER.warn(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()));
}
return mappings;
......
......@@ -164,10 +164,10 @@ public class RelationshipBlockHandler {
// 2. Choose records having same universe as that of the mapping file
// 3. Choose the one with highest major version
LOGGER.info(String.format("Total %s Records found having %s in ancestry block", wksInfos.size(), rawId));
LOGGER.info("Total {} Records found having {} in ancestry block", wksInfos.size(), rawId);
List<WksInfo> wksGeneratedByWKSService = getWKSRecordsCreatedByWKSService(rawId, wksInfos, rawKind);
LOGGER.info(String.format("Total %s Records created by WKS service", wksGeneratedByWKSService.size()));
LOGGER.info("Total {} Records created by WKS service", wksGeneratedByWKSService.size());
if(wksGeneratedByWKSService.isEmpty()) {
return rawId;
}
......@@ -175,7 +175,7 @@ public class RelationshipBlockHandler {
String targetSchemaAuthority = targetSchemaKindValue.split(Constants.COLON_SEPARATOR)[0];
List<WksInfo> wksFromGivenAuthority = getWKSRecordsFromGivenAuthority(targetSchemaAuthority, wksGeneratedByWKSService);
LOGGER.info(String.format("Total %s Records have same authority as that of target schema", wksGeneratedByWKSService.size()));
LOGGER.info("Total {} Records have same authority as that of target schema", wksGeneratedByWKSService.size());
if(wksFromGivenAuthority.isEmpty()) {
return rawId;
......@@ -187,7 +187,7 @@ public class RelationshipBlockHandler {
List<WksInfo> wksSortedOnMajorVersion = wksFromGivenAuthority.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
LOGGER.info(String.format("Unique WKS Record with id: %s found for relationship with Record %s", wksSortedOnMajorVersion.get(0).getId(), rawId));
LOGGER.info("Unique WKS Record with id: {} found for relationship with Record {}", wksSortedOnMajorVersion.get(0).getId(), rawId);
return wksSortedOnMajorVersion.get(0).getId();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment