Skip to content

Commit

Permalink
Merge pull request #1005 from NSSuresh11/OLE-9141
Browse files Browse the repository at this point in the history
OLE-9141 : Added LOG.info statements
  • Loading branch information
sheiksalahudeen authored Mar 17, 2017
2 parents cf4f26e + ea534f1 commit 8fc2bca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.log4j.Logger;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
Expand Down Expand Up @@ -46,6 +47,8 @@ public class BatchUtil extends OleNgUtil {
private MarcRecordUtil marcRecordUtil;
public static Map<String, BatchJobDetails> BATCH_JOB_EXECUTION_DETAILS_MAP = new HashMap<>();
private MarcXMLConverter marcXMLConverter;
private static final Logger LOG = Logger
.getLogger(BatchUtil.class);

public OleDsNgRestClient getOleDsNgRestClient() {
if(null == oleDsNgRestClient) {
Expand Down Expand Up @@ -463,6 +466,7 @@ public String getStatusContent(String status, String totalTimeTaken) {
}

public BatchJobDetails createBatchJobDetailsEntry(BatchProcessJob batchProcessJob, String fileName) {
LOG.info("Inside createBatchJobDetailsEntry");
BatchJobDetails batchJobDetails = new BatchJobDetails();
batchJobDetails.setJobId(batchProcessJob.getJobId());
batchJobDetails.setJobName(batchProcessJob.getJobName());
Expand Down Expand Up @@ -503,7 +507,7 @@ public String getSolrDate(String dateStr, boolean isFrom) throws ParseException
return solrDtFormat.format(cal.getTime());
}
} catch (ParseException e) {
//LOG.error("Error while parsing user entered date::" + dateStr, e);
LOG.error("Error while parsing user entered date::" + dateStr, e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class BatchBibFileProcessor extends BatchFileProcessor {
@Override
public OleNgBatchResponse processRecords(Map<Integer, RecordDetails> recordsMap, BatchProcessTxObject batchProcessTxObject,
BatchProcessProfile batchProcessProfile) throws JSONException {
LOG.info("Inside processRecords() in BatchBibFileProcessor >>>");
BatchJobDetails batchJobDetails = batchProcessTxObject.getBatchJobDetails();
String reportDirectoryName = batchProcessTxObject.getReportDirectoryName();
JSONArray jsonArray = new JSONArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,28 @@ public abstract class BatchFileProcessor extends BatchUtil {

public JSONObject processBatch(File inputFileDirectoryPath, String fileType, String profileId, String reportDirectoryName,
BatchJobDetails batchJobDetails) throws Exception {
LOG.info("Inside Batch processBatch() in BatchFileProcessor >>>");
JSONObject response = new JSONObject();

BatchProcessProfile batchProcessProfile = new BatchProcessProfile();
String responseData = "";
try {
BATCH_JOB_EXECUTION_DETAILS_MAP.put(batchJobDetails.getJobId() + "_" + batchJobDetails.getJobDetailId(), batchJobDetails);
batchProcessProfile = fetchBatchProcessProfile(profileId);
LOG.info("batchProcessProfile >>>>" + batchProcessProfile);
BatchProcessTxObject batchProcessTxObject = new BatchProcessTxObject();
batchProcessTxObject.setBatchProcessProfile(batchProcessProfile);
batchProcessTxObject.setBatchFileProcessor(this);
batchProcessTxObject.setBatchJobDetails(batchJobDetails);
LOG.info("batchJobDetails >>>>" + batchJobDetails);
batchProcessTxObject.setFileExtension(fileType);
batchProcessTxObject.setReportDirectoryName(reportDirectoryName);
batchProcessTxObject.getOleStopWatch().start();
batchProcessTxObject.setIncomingFileDirectoryPath(inputFileDirectoryPath.getAbsolutePath());
LOG.info("ProfileID >>>>>>" + batchJobDetails.getProfileId());
LOG.info("ProfileName >>>>>>" +batchJobDetails.getProfileName());
LOG.info("FileName >>>>>>>" + batchJobDetails.getFileName());


if (fileType.equalsIgnoreCase(OleNGConstants.MARC)) {
OleCamelContext oleCamelContext = OleCamelContext.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
Expand Down Expand Up @@ -69,6 +70,9 @@ public class BatchRestController extends OleNgControllerBase {
@Autowired
private DescribeDAO describeDAO;

private static final Logger LOG = Logger
.getLogger(BatchRestController.class);

public DescribeDAO getDescribeDAO() {
return describeDAO;
}
Expand Down Expand Up @@ -109,6 +113,10 @@ public String UploadFile(@RequestParam("file") MultipartFile file, @RequestParam

private JSONObject processBatch(File uploadDirectory, String batchType, String profileId, String fileExtension, BatchJobDetails batchJobDetails) throws Exception {
BatchFileProcessor batchProcessor = getBatchProcessor(batchType);
LOG.info("batchJobDetails in processBatch() method >>>>" + batchJobDetails);
LOG.info("ProfileID >>>>>>" + batchJobDetails.getProfileId());
LOG.info("ProfileName >>>>>>" +batchJobDetails.getProfileName());
LOG.info("FileName >>>>>>>" + batchJobDetails.getFileName());

long jobDetailsId = batchJobDetails.getJobDetailId();
String reportDirectory = (jobDetailsId != 0) ? String.valueOf(jobDetailsId) : OleNGConstants.QUICK_LAUNCH + OleNGConstants.DATE_FORMAT.format(new Date());
Expand Down Expand Up @@ -177,7 +185,9 @@ public String createBatchJobDetailsEntry(@RequestBody String requestBody) {
public String quickLaunchJob(@RequestParam("jobId") String jobId, @RequestParam("numOfRecordsInFile") String numOfRecordsInFile, @RequestParam("extension") String extension, @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
BatchJobDetails batchJobDetails = null;
try {
LOG.info("Starting QuickLauch Job");
BatchProcessJob matchedBatchJob = getBatchUtil().getBatchProcessJobById(Long.valueOf(jobId));
LOG.info("matchedBatchJob job Id>>>" + matchedBatchJob.getJobId());
matchedBatchJob.setNumOfRecordsInFile(Integer.parseInt(numOfRecordsInFile));
matchedBatchJob.setOutputFileFormat(extension);
String originalFilename = null;
Expand Down

0 comments on commit 8fc2bca

Please sign in to comment.