Skip to content

Commit

Permalink
Merge pull request #713 from sheiksalahudeen/develop
Browse files Browse the repository at this point in the history
Fixed issue and merged code.
  • Loading branch information
peris committed May 13, 2016
2 parents d164839 + abb6e91 commit 1d21391
Show file tree
Hide file tree
Showing 83 changed files with 1,886 additions and 556 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3595,9 +3595,6 @@
<column name="STATUS" size="40" type="VARCHAR"/>
<column name="OBJ_ID" size="36" type="VARCHAR"/>
<column name="VER_NBR" size="8" type="INTEGER"/>
<foreign-key foreignTable="OLE_NG_BAT_PRCS_JOB_T" name="OLE_NG_BAT_PRCS_ID_FK">
<reference foreign="JOB_ID" local="JOB_ID"/>
</foreign-key>
<index name="OLE_NG_BAT_JOB_I">
<index-column name="JOB_ID"/>
</index>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,5 +826,8 @@
<sql>ALTER TABLE OLE_PUR_POBA_T MODIFY UPLD_FILE_NM varchar2(120)</sql>
</changeSet>

<changeSet author="bootstrap" id="OLE_NG_BAT_JOB_DETAILS_T-dropForeignKey">
<dropForeignKeyConstraint baseTableName="OLE_NG_BAT_JOB_DETAILS_T" constraintName="OLE_NG_BAT_PRCS_ID_FK"/>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class BatchProcessTxObject {
private int numberOfFailurRecords;
private boolean exceptionCaught;
private List<BatchProcessFailureResponse> batchProcessFailureResponses;
private boolean stopped;

public String getFileExtension() {
return fileExtension;
Expand Down Expand Up @@ -142,4 +143,12 @@ public List<BatchProcessFailureResponse> getBatchProcessFailureResponses() {
public void setBatchProcessFailureResponses(List<BatchProcessFailureResponse> batchProcessFailureResponses) {
this.batchProcessFailureResponses = batchProcessFailureResponses;
}

public boolean isStopped() {
return stopped;
}

public void setStopped(boolean stopped) {
this.stopped = stopped;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
*/
public class BibImportFailureReportProcessor extends OleNGReportProcessor {

private MarcRecordUtil marcRecordUtil;

@Override
public void process(Object object, String directoryToWrite) throws Exception {
OleNGBibImportResponse oleNGBibImportResponse = (OleNGBibImportResponse) object;
List<BibFailureResponse> failureResponses = oleNGBibImportResponse.getFailureResponses();
List<Record> marcRecords = new ArrayList<>();
MarcRecordUtil marcRecordUtil = new MarcRecordUtil();
if(CollectionUtils.isNotEmpty(failureResponses)) {
Map<Integer,RecordDetails> recordsMap = oleNGBibImportResponse.getRecordsMap();
if(null != recordsMap && recordsMap.size() > 0) {
Expand All @@ -40,11 +41,22 @@ public void process(Object object, String directoryToWrite) throws Exception {
}
}
if(CollectionUtils.isNotEmpty(marcRecords)) {
String failedMarcContent = marcRecordUtil.convertMarcRecordListToRawMarcContent(marcRecords);
logMessage(directoryToWrite, "Bib-FailedMarcRecords","mrc", failedMarcContent, true);
String failedMarcContent = getMarcRecordUtil().convertMarcRecordListToRawMarcContent(marcRecords);
writeMarcContent(directoryToWrite, failedMarcContent);
}
String bibFailureMessage = new ObjectMapper().defaultPrettyPrintingWriter().writeValueAsString(failureResponses);
logMessage(directoryToWrite, "Bib-FailureMessages","txt", bibFailureMessage, false);
}
}

public void writeMarcContent(String directoryToWrite, String failedMarcContent) throws Exception {
logMessage(directoryToWrite, "Bib-FailedMarcRecords","mrc", failedMarcContent, true);
}

public MarcRecordUtil getMarcRecordUtil() {
if(null == marcRecordUtil) {
marcRecordUtil = new MarcRecordUtil();
}
return marcRecordUtil;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,68 @@
package org.kuali.ole.oleng.batch.reports.processors;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.kuali.ole.constants.OleNGConstants;
import org.kuali.ole.docstore.common.pojo.RecordDetails;
import org.kuali.ole.docstore.common.response.InvoiceFailureResponse;
import org.kuali.ole.docstore.common.response.OleNGInvoiceImportResponse;
import org.kuali.ole.docstore.common.response.OrderFailureResponse;
import org.kuali.ole.utility.MarcRecordUtil;
import org.marc4j.marc.Record;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* Created by angelind on 3/16/16.
*/
public class InvoiceImportFailureReportProcessor extends OleNGReportProcessor {

private MarcRecordUtil marcRecordUtil;

@Override
public void process(Object object, String directoryToWrite) throws Exception {
OleNGInvoiceImportResponse oleNGInvoiceImportResponse = (OleNGInvoiceImportResponse) object;
List<InvoiceFailureResponse> invoiceFailureResponses = oleNGInvoiceImportResponse.getInvoiceFailureResponses();
List<Record> marcRecords = new ArrayList<>();
if(CollectionUtils.isNotEmpty(invoiceFailureResponses)) {
String fileExtension = oleNGInvoiceImportResponse.getFileExtension();
if (StringUtils.isNotBlank(fileExtension) && fileExtension.equalsIgnoreCase(OleNGConstants.MARC)) {
Map<Integer, RecordDetails> recordsMap = oleNGInvoiceImportResponse.getRecordsMap();
if(null != recordsMap && recordsMap.size() > 0) {
for(InvoiceFailureResponse failureResponse : invoiceFailureResponses) {
Integer index = failureResponse.getIndex();
if(null != index) {
RecordDetails recordDetails = recordsMap.get(index);
if (null != recordDetails) {
Record record = recordDetails.getRecord();
if (null != record) {
marcRecords.add(record);
}
}
}
}
}
if(CollectionUtils.isNotEmpty(marcRecords)) {
String failedMarcContent = getMarcRecordUtil().convertMarcRecordListToRawMarcContent(marcRecords);
writeMarcContent(directoryToWrite, failedMarcContent);
}
}
String invoiceFailureMessage = new ObjectMapper().defaultPrettyPrintingWriter().writeValueAsString(invoiceFailureResponses);
logMessage(directoryToWrite, "Invoice-FailureMessages", "txt", invoiceFailureMessage, false);
}
}

public void writeMarcContent(String directoryToWrite, String failedMarcContent) throws Exception {
logMessage(directoryToWrite, "Invoice-FailedMarcRecords", "mrc", failedMarcContent, true);
}

public MarcRecordUtil getMarcRecordUtil() {
if(null == marcRecordUtil) {
marcRecordUtil = new MarcRecordUtil();
}
return marcRecordUtil;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
*/
public class OrderImportFailureReportProcessor extends OleNGReportProcessor {

private MarcRecordUtil marcRecordUtil;

@Override
public void process(Object object, String directoryToWrite) throws Exception {
OleNGOrderImportResponse oleNGOrderImportResponse = (OleNGOrderImportResponse) object;
List<OrderFailureResponse> orderFailureResponses = oleNGOrderImportResponse.getOrderFailureResponses();
List<Record> marcRecords = new ArrayList<>();
MarcRecordUtil marcRecordUtil = new MarcRecordUtil();
if(CollectionUtils.isNotEmpty(orderFailureResponses)) {
Map<Integer, RecordDetails> recordsMap = oleNGOrderImportResponse.getRecordsMap();
if(null != recordsMap && recordsMap.size() > 0) {
Expand All @@ -40,11 +41,22 @@ public void process(Object object, String directoryToWrite) throws Exception {
}
}
if(CollectionUtils.isNotEmpty(marcRecords)) {
String failedMarcContent = marcRecordUtil.convertMarcRecordListToRawMarcContent(marcRecords);
logMessage(directoryToWrite, "Order-FailedMarcRecords", "mrc", failedMarcContent, true);
String failedMarcContent = getMarcRecordUtil().convertMarcRecordListToRawMarcContent(marcRecords);
writeMarcContent(directoryToWrite, failedMarcContent);
}
String orderFailureMessage = new ObjectMapper().defaultPrettyPrintingWriter().writeValueAsString(orderFailureResponses);
logMessage(directoryToWrite, "Order-FailureMessages", "txt", orderFailureMessage, false);
}
}

public void writeMarcContent(String directoryToWrite, String failedMarcContent) throws Exception {
logMessage(directoryToWrite, "Order-FailedMarcRecords", "mrc", failedMarcContent, true);
}

public MarcRecordUtil getMarcRecordUtil() {
if(null == marcRecordUtil) {
marcRecordUtil = new MarcRecordUtil();
}
return marcRecordUtil;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ public interface SelectDAO {
public ItemStatusRecord fetchItemStatusByCode(String itemStatusCode);
public VendorCustomerNumber getVendorCustomerNumberByNumber(String vendorCustomerNumber);
public OLEDonor getOLEDonorByCode(String donorCode);
public OleCurrencyType getCurrencyType(String currencyType);

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringUtils;
import org.kuali.ole.OLEConstants;
import org.kuali.ole.coa.businessobject.Account;
import org.kuali.ole.coa.businessobject.*;
Expand Down Expand Up @@ -209,7 +210,7 @@ public Organization getOrganizationByChartAndOrgCode(String chartCode, String or
@Override
public VendorDetail getVendorDetailByVendorNumber(String vendorNumber){
String[] vendorDetail = vendorNumber.split("-");
if(vendorDetail.length == 2) {
if(vendorDetail.length == 2 && StringUtils.isNotBlank(vendorDetail[0]) && org.apache.commons.lang.StringUtils.isNotBlank(vendorDetail[1])) {
String vendorHeaderGeneratedIdentifier = vendorDetail[0];
String vendorDetailAssignedIdentifier = vendorDetail[1];
if (NumberUtils.isDigits(vendorHeaderGeneratedIdentifier) && NumberUtils.isDigits(vendorDetailAssignedIdentifier)) {
Expand Down Expand Up @@ -406,7 +407,7 @@ public Room getRoom(String buildingCode, String campusCode, String buildingRoomN
deliveryMap.put(OLEConstants.OLEBatchProcess.BUILDING_CODE, buildingCode);
deliveryMap.put(OLEConstants.OLEBatchProcess.CAMPUS_CODE, campusCode);
deliveryMap.put(OLEConstants.BUILDING_ROOM_NUMBER, buildingRoomNumber);
List<Room> roomList = (List) KRADServiceLocator.getBusinessObjectService().findMatching(Room.class, deliveryMap);
List<Room> roomList = (List) getBusinessObjectService().findMatching(Room.class, deliveryMap);
if (CollectionUtils.isNotEmpty(roomList)){
return roomList.get(0);
}
Expand Down Expand Up @@ -485,13 +486,24 @@ public VendorCustomerNumber getVendorCustomerNumberByNumber(String vendorCustome
public OLEDonor getOLEDonorByCode(String donorCode) {
Map<String, String> donorCodeMap = new HashMap<>();
donorCodeMap.put(OLEConstants.DONOR_CODE, donorCode);
List<OLEDonor> donorCodeList = (List) KRADServiceLocator.getBusinessObjectService().findMatching(OLEDonor.class, donorCodeMap);
List<OLEDonor> donorCodeList = (List) getBusinessObjectService().findMatching(OLEDonor.class, donorCodeMap);
if (CollectionUtils.isNotEmpty(donorCodeList)){
return donorCodeList.get(0);
}
return null;
}

@Override
public OleCurrencyType getCurrencyType(String currencyType) {
Map<String, String> donorCodeMap = new HashMap<>();
donorCodeMap.put(OLEConstants.CURRENCY_TYPE, currencyType);
List<OleCurrencyType> oleCurrencyTypes = (List) getBusinessObjectService().findMatching(OleCurrencyType.class, donorCodeMap);
if (CollectionUtils.isNotEmpty(oleCurrencyTypes)){
return oleCurrencyTypes.get(0);
}
return null;
}

public KeyValuesService getKeyValuesService() {
if(null == keyValuesService){
keyValuesService = SpringContext.getBean(KeyValuesService.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.kuali.ole.oleng.handler;

import org.kuali.ole.Exchange;
import org.kuali.ole.oleng.service.OleNGMemorizeService;
import org.kuali.ole.oleng.service.impl.OleNGMemorizeServiceImpl;
import org.kuali.ole.pojo.OleOrderRecord;

import java.util.List;
Expand All @@ -10,7 +12,20 @@
*/
public class CreateNeitherReqNorPOServiceHandler implements CreateReqAndPOBaseServiceHandler {

private OleNGMemorizeService oleNGMemorizeService;

public Integer processOrder(List<OleOrderRecord> oleOrderRecords, Exchange exchange) throws Exception {
return null;
}

public OleNGMemorizeService getOleNGMemorizeService() {
if(null == oleNGMemorizeService) {
oleNGMemorizeService = new OleNGMemorizeServiceImpl();
}
return oleNGMemorizeService;
}

public void setOleNGMemorizeService(OleNGMemorizeService oleNGMemorizeService) {
this.oleNGMemorizeService = oleNGMemorizeService;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.kuali.ole.oleng.handler;

import org.kuali.ole.Exchange;
import org.kuali.ole.oleng.service.OleNGMemorizeService;
import org.kuali.ole.pojo.OleOrderRecord;

import java.util.List;
Expand All @@ -10,4 +11,6 @@
*/
public interface CreateReqAndPOBaseServiceHandler {
public Integer processOrder(List<OleOrderRecord> oleOrderRecords, Exchange exchange) throws Exception;
public void setOleNGMemorizeService(OleNGMemorizeService oleNGMemorizeService);
public OleNGMemorizeService getOleNGMemorizeService();
}
Loading

0 comments on commit 1d21391

Please sign in to comment.