Skip to content

Commit

Permalink
OLE-9209 : Requesting is failing intermittently
Browse files Browse the repository at this point in the history
  • Loading branch information
NSSuresh11 committed Jun 9, 2017
1 parent ee0836f commit 076b59a
Showing 1 changed file with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package org.kuali.ole.ncip.servlet;

import org.apache.log4j.Logger;
import org.kuali.ole.OLEConstants;
import org.kuali.ole.converter.OLECheckInItemConverter;
import org.kuali.ole.converter.OLELookupUserConverter;
import org.kuali.ole.converter.OLERenewItemConverter;
import org.kuali.ole.deliver.bo.OleDeliverRequestBo;
import org.kuali.ole.ncip.bo.OLECirculationErrorMessage;
import org.kuali.ole.ncip.bo.OLENCIPConstants;
import org.kuali.ole.ncip.bo.OLENCIPErrorResponse;
import org.kuali.ole.ncip.converter.*;
import org.kuali.ole.ncip.service.OLECirculationService;
import org.kuali.ole.ncip.service.impl.*;
import org.kuali.rice.krad.service.BusinessObjectService;
import org.kuali.rice.krad.service.KRADServiceLocator;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
Expand All @@ -32,7 +28,6 @@
*/
public class OLECirculationServlet extends HttpServlet {
final Logger LOG = Logger.getLogger(OLECirculationServlet.class);
private BusinessObjectService businessObjectService;


public void doPost(HttpServletRequest request, HttpServletResponse response)
Expand Down Expand Up @@ -304,26 +299,6 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
}else{
responseString=getCirculationErrorMessage(service,OLENCIPConstants.INVALID_FORMAT,"504",null,outputFormat);
}
Map<String, String> requestMap = new HashMap<String, String>();
try {
Thread.sleep(3000);
requestMap.put(OLEConstants.OleDeliverRequest.ITEM_ID, parameterMap.get(OLENCIPConstants.ITEM_BARCODE)[0]);
List<OleDeliverRequestBo> requestList = (List<OleDeliverRequestBo>) getBusinessObjectService().findMatchingOrderBy(OleDeliverRequestBo.class, requestMap, OLEConstants.OleDeliverRequest.REQUEST_TYPE_ID, true);
for (int i = 0; i < requestList.size(); i++) {
for (int j = i + 1; j < requestList.size(); j++) {
if (requestList.get(i).getBorrowerQueuePosition().equals(requestList.get(j).getBorrowerQueuePosition()) && requestList.get(i).getRequestTypeId().equals(requestList.get(j).getRequestTypeId())) {
requestList.get(j).setBorrowerQueuePosition(requestList.get(j).getBorrowerQueuePosition() + 1);
responseString = responseString.replaceAll(responseString.substring(responseString.indexOf("<queuePosition>") +15,responseString.indexOf("</queuePosition>")),requestList.get(j).getBorrowerQueuePosition().toString());
getBusinessObjectService().save(requestList.get(j));
break;

}
}
}
}
catch(Exception e) {
LOG.info("Request Failed" + e);
}
}
else{
responseString=OLENCIPConstants.NULL_SERVICE;
Expand Down Expand Up @@ -351,13 +326,6 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
out.write(responseString);
}

private BusinessObjectService getBusinessObjectService() {
if (null == businessObjectService) {
businessObjectService = KRADServiceLocator.getBusinessObjectService();
}
return businessObjectService;
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
OLECirculationService oleCirculationService=new OLECirculationServiceImpl();
Expand Down

0 comments on commit 076b59a

Please sign in to comment.