Skip to content

Commit

Permalink
Merge pull request #911 from sheiksalahudeen/release-2.1
Browse files Browse the repository at this point in the history
OLE-8959 : Fixed issue with getting the bib information while doing order import.
  • Loading branch information
sheiksalahudeen authored Oct 26, 2016
2 parents e1138a3 + 81aad85 commit 70653b5
Showing 1 changed file with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.kuali.incubator.SolrRequestReponseHandler;
import org.kuali.ole.Exchange;
import org.kuali.ole.OLEConstants;
import org.kuali.ole.constants.OleNGConstants;
import org.kuali.ole.docstore.common.constants.DocstoreConstants;
import org.kuali.ole.docstore.common.document.Bib;
import org.kuali.ole.docstore.common.pojo.RecordDetails;
import org.kuali.ole.docstore.common.util.BusinessObjectServiceHelperUtil;
import org.kuali.ole.docstore.engine.service.storage.rdbms.pojo.BibInfoRecord;
import org.kuali.ole.module.purap.PurapConstants;
import org.kuali.ole.oleng.batch.profile.model.BatchProcessProfile;
import org.kuali.ole.oleng.handler.CreateReqAndPOBaseServiceHandler;
Expand All @@ -28,7 +27,7 @@
/**
* Created by SheikS on 3/10/2016.
*/
public class OleNGPOHelperUtil {
public class OleNGPOHelperUtil extends BusinessObjectServiceHelperUtil {
private static final Logger LOG = Logger.getLogger(OleNGPOHelperUtil.class);
private static OrderImportService oleOrderImportService;
private SolrRequestReponseHandler solrRequestReponseHandler;
Expand Down Expand Up @@ -127,28 +126,17 @@ private void addPOIdToMap(Integer purapId, List<OleOrderRecord> oleOrderRecords,


private Bib getBibDetails(String bibId) {
String query = "id:" + bibId;
SolrDocumentList solrDocumentList = getSolrRequestReponseHandler().getSolrDocumentList(query);
if (solrDocumentList.size() > 0) {
BibInfoRecord bySinglePrimaryKey = getBusinessObjectService().findBySinglePrimaryKey(BibInfoRecord.class, bibId);
if(null != bySinglePrimaryKey) {
Bib bib = new Bib();
SolrDocument solrDocument = solrDocumentList.get(0);

List<String> authors = (List<String>) solrDocument.getFieldValue(DocstoreConstants.TITLE_DISPLAY);
String author = (CollectionUtils.isNotEmpty(authors)) ? authors.get(0) : "";

List<String> titles = (List<String>) solrDocument.getFieldValue(DocstoreConstants.TITLE_DISPLAY);
String title = (CollectionUtils.isNotEmpty(titles)) ? titles.get(0) : "";

List<String> isbns = (List<String>) solrDocument.getFieldValue(DocstoreConstants.ISBN_DISPLAY);
String isbn = (CollectionUtils.isNotEmpty(isbns)) ? isbns.get(0) : "";

List<String> publishers = (List<String>) solrDocument.getFieldValue(DocstoreConstants.PUBLISHER_DISPLAY);
String publisher = (CollectionUtils.isNotEmpty(publishers)) ? publishers.get(0) : "";

bib.setTitle(title);
bib.setAuthor(author);
bib.setPublisher(publisher);
bib.setIsbn(isbn);
String author = bySinglePrimaryKey.getAuthor();
String title = bySinglePrimaryKey.getTitle();
String publisher = bySinglePrimaryKey.getPublisher();
String isbn = bySinglePrimaryKey.getIsxn();
bib.setTitle(StringUtils.isNotBlank(title)? title : "");
bib.setAuthor(StringUtils.isNotBlank(author) ? author : "");
bib.setPublisher(StringUtils.isNotBlank(publisher)? publisher : "");
bib.setIsbn(StringUtils.isNotBlank(isbn)? isbn : "");
return bib;
}
return null;
Expand Down

0 comments on commit 70653b5

Please sign in to comment.