Skip to content

Commit

Permalink
Merge pull request #844 from sheiksalahudeen/release-2.1
Browse files Browse the repository at this point in the history
Fixed issues
  • Loading branch information
sheiksalahudeen authored Jul 28, 2016
2 parents a6f8783 + 47170e0 commit 4ddb199
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
* Created by SheikS on 11/30/2015.
*/
public class ItemIndexer extends OleDsNgIndexer {

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

@Override
public void indexDocument(Object object) {
ItemRecord itemRecord = (ItemRecord) object;
Expand Down Expand Up @@ -62,7 +62,7 @@ public Map<String,SolrInputDocument> getInputDocumentForItem(ItemRecord itemReco
}

if(null != holdingSolrInputDocuemnt) {
Object bibs = holdingSolrInputDocuemnt.get(BIB_IDENTIFIER);
Object bibs = holdingSolrInputDocuemnt.getFieldValues(BIB_IDENTIFIER);
addItemDetailsToHoldings(itemSolrInputDocument, holdingSolrInputDocuemnt);

addBibInfoForHoldingsOrItems(itemSolrInputDocument, holdingSolrInputDocuemnt);
Expand Down Expand Up @@ -118,14 +118,16 @@ public SolrInputDocument buildSolrInputDocument(Object object,Map<String, SolrIn

solrInputDocument.addField(CLMS_RET_FLAG, itemRecord.getClaimsReturnedFlag());
Date claimsReturnedDateCreated = itemRecord.getClaimsReturnedFlagCreateDate();
solrInputDocument.addField(CLMS_RET_FLAG_CRE_DATE, (claimsReturnedDateCreated != null ? DOCSTORE_DATE_FORMAT.format(claimsReturnedDateCreated) : null));
solrInputDocument.addField(CLMS_RET_FLAG_CRE_DATE, convertDateToString(DOCSTORE_DATE_FORMAT, claimsReturnedDateCreated));
solrInputDocument.addField(CLMS_RET_NOTE, itemRecord.getClaimsReturnedNote());
solrInputDocument.addField(CURRENT_BORROWER, itemRecord.getCurrentBorrower());
solrInputDocument.addField(PROXY_BORROWER, itemRecord.getProxyBorrower());
solrInputDocument.addField(DUE_DATE_TIME, itemRecord.getDueDateTime());
solrInputDocument.addField(ORG_DUE_DATE_TIME, itemRecord.getOriginalDueDate());
solrInputDocument.addField(ITEM_STATUS_EFFECTIVE_DATE, itemRecord.getEffectiveDate());
solrInputDocument.addField(CHECK_OUT_DUE_DATE_TIME, itemRecord.getCheckOutDateTime());
String dueDateString = convertDateToString(DOCSTORE_DATE_FORMAT, itemRecord.getDueDateTime());
solrInputDocument.addField(DUE_DATE_TIME, dueDateString);
String originalDueDateString = convertDateToString(DOCSTORE_DATE_FORMAT, itemRecord.getOriginalDueDate());
solrInputDocument.addField(ORG_DUE_DATE_TIME, originalDueDateString);
solrInputDocument.addField(ITEM_STATUS_EFFECTIVE_DATE, convertDateToString(DOCSTORE_DATE_FORMAT, itemRecord.getEffectiveDate()));
solrInputDocument.addField(CHECK_OUT_DUE_DATE_TIME, convertDateToString(DOCSTORE_DATE_FORMAT, itemRecord.getCheckOutDateTime()));
solrInputDocument.addField(STAFF_ONLY_FLAG, itemRecord.getStaffOnlyFlag());
// solrInputDocument.addField(IS_ANALYTIC, itemRecord.isAnalytic()); // Todo : Need to verify (Ans : Need to verify with bib status) (HoldingsItemRecord - holdingsId and ItemId)
solrInputDocument.addField(ITEM_IDENTIFIER_SEARCH, itemIdentifierWithPrefix);
Expand Down Expand Up @@ -365,23 +367,22 @@ public String getAllTextValueForItem(ItemRecord itemRecord) {
String chronology = itemRecord.getChronology();
String checkinNote = itemRecord.getCheckInNote();
Date claimsReturnedDateCreated = itemRecord.getClaimsReturnedFlagCreateDate();
String claimsReturnedFlagCreateDate = (claimsReturnedDateCreated != null ? DOCSTORE_DATE_FORMAT.format(claimsReturnedDateCreated) : null);
String claimsReturnedFlagCreateDate = convertDateToString(DOCSTORE_DATE_FORMAT, claimsReturnedDateCreated);
String claimsReturnedNote = itemRecord.getClaimsReturnedNote();
//String copyNumberLabel = itemRecord.getCopyNumberLabel(); // TODO : Need to check
String currentBorrower = itemRecord.getCurrentBorrower();
String damagedItemNote = itemRecord.getDamagedItemNote();

Date dueDate = itemRecord.getDueDateTime();
String dueDateTime = (dueDate != null ? DOCSTORE_DATE_FORMAT.format(dueDate) : null);
String dueDateTime = convertDateToString(DOCSTORE_DATE_FORMAT, new Date(itemRecord.getDueDateTime().getTime()));

String fund = itemRecord.getFund();

Date itemStatusDateUpdated = itemRecord.getUpdatedDate();
String itemStatusEffectiveDate = (itemStatusDateUpdated != null ? DOCSTORE_DATE_FORMAT.format(itemStatusDateUpdated) : null);
String itemStatusEffectiveDate = convertDateToString(DOCSTORE_DATE_FORMAT, itemStatusDateUpdated);


Date missingPiecesEffectiveDate = itemRecord.getMissingPieceEffectiveDate();
String missingPieceEffectiveDate = (missingPiecesEffectiveDate != null ? DOCSTORE_DATE_FORMAT.format(missingPiecesEffectiveDate) : null);
String missingPieceEffectiveDate = convertDateToString(DOCSTORE_DATE_FORMAT, missingPiecesEffectiveDate);

String missingPieceFlagNote = itemRecord.getMissingPieceFlagNote();
String missingPiecesCount = String.valueOf(itemRecord.getMissingPiecesCount());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import org.kuali.incubator.SolrRequestReponseHandler;
import org.kuali.ole.constants.OleNGConstants;
import org.kuali.ole.docstore.common.constants.DocstoreConstants;
import org.kuali.ole.docstore.common.exception.DocstoreIndexException;
import org.kuali.ole.dsng.util.OleDsHelperUtil;

import java.text.DateFormat;
import java.util.*;

/**
Expand Down Expand Up @@ -199,26 +199,26 @@ protected void removeFieldFromSolrInputDocument(SolrInputDocument holdingsSolrIn
}

protected void addBibInfoForHoldingsOrItems(SolrInputDocument destinationSolrInputDocument, SolrInputDocument sourceSolrInputDocument) {
destinationSolrInputDocument.addField(TITLE_SEARCH, sourceSolrInputDocument.get(TITLE_SEARCH));
destinationSolrInputDocument.addField(TITLE_SORT, sourceSolrInputDocument.get(TITLE_SORT));
destinationSolrInputDocument.addField(AUTHOR_SEARCH, sourceSolrInputDocument.get(AUTHOR_SEARCH));
destinationSolrInputDocument.addField(PUBLICATIONPLACE_DISPLAY, sourceSolrInputDocument.get(PUBLICATIONPLACE_DISPLAY));
destinationSolrInputDocument.addField(PUBLISHER_SEARCH, sourceSolrInputDocument.get(PUBLISHER_SEARCH));
destinationSolrInputDocument.setField(PUBLISHER_SORT, sourceSolrInputDocument.get(PUBLISHER_SORT));
destinationSolrInputDocument.addField(ISSN_SEARCH, sourceSolrInputDocument.get(ISSN_SEARCH));
destinationSolrInputDocument.addField(ISBN_SEARCH, sourceSolrInputDocument.get(ISBN_SEARCH));
destinationSolrInputDocument.addField(FORMAT_SEARCH, sourceSolrInputDocument.get(FORMAT_SEARCH));
destinationSolrInputDocument.addField(LANGUAGE_SEARCH, sourceSolrInputDocument.get(LANGUAGE_SEARCH));
destinationSolrInputDocument.addField(PUBLICATIONDATE_SEARCH, sourceSolrInputDocument.get(PUBLICATIONDATE_SEARCH));
destinationSolrInputDocument.addField(MDF_035A, sourceSolrInputDocument.get(MDF_035A));
destinationSolrInputDocument.addField(TITLE_DISPLAY, sourceSolrInputDocument.get(TITLE_DISPLAY));
destinationSolrInputDocument.addField(AUTHOR_DISPLAY, sourceSolrInputDocument.get(AUTHOR_DISPLAY));
destinationSolrInputDocument.addField(PUBLISHER_DISPLAY, sourceSolrInputDocument.get(PUBLISHER_DISPLAY));
destinationSolrInputDocument.addField(ISSN_DISPLAY, sourceSolrInputDocument.get(ISSN_DISPLAY));
destinationSolrInputDocument.addField(ISBN_DISPLAY, sourceSolrInputDocument.get(ISBN_DISPLAY));
destinationSolrInputDocument.addField(FORMAT_DISPLAY, sourceSolrInputDocument.get(FORMAT_DISPLAY));
destinationSolrInputDocument.addField(LANGUAGE_DISPLAY, sourceSolrInputDocument.get(LANGUAGE_DISPLAY));
destinationSolrInputDocument.addField(PUBLICATIONDATE_DISPLAY, sourceSolrInputDocument.get(PUBLICATIONDATE_DISPLAY));
destinationSolrInputDocument.addField(TITLE_SEARCH, sourceSolrInputDocument.getFieldValues(TITLE_SEARCH));
destinationSolrInputDocument.addField(TITLE_SORT, sourceSolrInputDocument.getFieldValues(TITLE_SORT));
destinationSolrInputDocument.addField(AUTHOR_SEARCH, sourceSolrInputDocument.getFieldValues(AUTHOR_SEARCH));
destinationSolrInputDocument.addField(PUBLICATIONPLACE_DISPLAY, sourceSolrInputDocument.getFieldValues(PUBLICATIONPLACE_DISPLAY));
destinationSolrInputDocument.addField(PUBLISHER_SEARCH, sourceSolrInputDocument.getFieldValues(PUBLISHER_SEARCH));
destinationSolrInputDocument.setField(PUBLISHER_SORT, sourceSolrInputDocument.getFieldValues(PUBLISHER_SORT));
destinationSolrInputDocument.addField(ISSN_SEARCH, sourceSolrInputDocument.getFieldValues(ISSN_SEARCH));
destinationSolrInputDocument.addField(ISBN_SEARCH, sourceSolrInputDocument.getFieldValues(ISBN_SEARCH));
destinationSolrInputDocument.addField(FORMAT_SEARCH, sourceSolrInputDocument.getFieldValues(FORMAT_SEARCH));
destinationSolrInputDocument.addField(LANGUAGE_SEARCH, sourceSolrInputDocument.getFieldValues(LANGUAGE_SEARCH));
destinationSolrInputDocument.addField(PUBLICATIONDATE_SEARCH, sourceSolrInputDocument.getFieldValues(PUBLICATIONDATE_SEARCH));
destinationSolrInputDocument.addField(MDF_035A, sourceSolrInputDocument.getFieldValues(MDF_035A));
destinationSolrInputDocument.addField(TITLE_DISPLAY, sourceSolrInputDocument.getFieldValues(TITLE_DISPLAY));
destinationSolrInputDocument.addField(AUTHOR_DISPLAY, sourceSolrInputDocument.getFieldValues(AUTHOR_DISPLAY));
destinationSolrInputDocument.addField(PUBLISHER_DISPLAY, sourceSolrInputDocument.getFieldValues(PUBLISHER_DISPLAY));
destinationSolrInputDocument.addField(ISSN_DISPLAY, sourceSolrInputDocument.getFieldValues(ISSN_DISPLAY));
destinationSolrInputDocument.addField(ISBN_DISPLAY, sourceSolrInputDocument.getFieldValues(ISBN_DISPLAY));
destinationSolrInputDocument.addField(FORMAT_DISPLAY, sourceSolrInputDocument.getFieldValues(FORMAT_DISPLAY));
destinationSolrInputDocument.addField(LANGUAGE_DISPLAY, sourceSolrInputDocument.getFieldValues(LANGUAGE_DISPLAY));
destinationSolrInputDocument.addField(PUBLICATIONDATE_DISPLAY, sourceSolrInputDocument.getFieldValues(PUBLICATIONDATE_DISPLAY));
}

protected void addHoldingsInfoToItem(SolrInputDocument solrInputDocument, SolrInputDocument sourceInputDocument) {
Expand Down Expand Up @@ -327,4 +327,15 @@ public OleDsHelperUtil getOleDsHelperUtil() {
}
return oleDsHelperUtil;
}

public static String convertDateToString(DateFormat dateFormat, Date date) {
if (null != date) {
try {
return dateFormat.format(date);
} catch(Exception e) {
e.printStackTrace();
}
}
return null;
}
}

0 comments on commit 4ddb199

Please sign in to comment.