001package org.kuali.ole.deliver.util.printSlip;
002
003import com.itextpdf.text.Chunk;
004import com.itextpdf.text.Paragraph;
005import com.itextpdf.text.pdf.PdfPTable;
006import org.kuali.ole.deliver.bo.OleDeliverRequestBo;
007import org.kuali.ole.deliver.util.OleRegularPrintSlipUtil;
008import org.kuali.ole.deliver.util.RegularPdfFormatUtil;
009
010/**
011 * Created by chenchulakshmig on 9/3/15.
012 */
013public class OnHoldRegularPrintSlipUtil extends OleRegularPrintSlipUtil {
014
015    @Override
016    public RegularPdfFormatUtil getPdfFormatUtil() {
017        return new RegularPdfFormatUtil();
018    }
019
020    @Override
021    protected void populateHeader(Paragraph paraGraph) {
022        paraGraph.add(new Chunk("Hold Slip", getPdfFormatUtil().getBoldFont()));
023    }
024
025    @Override
026    protected void populateBody(PdfPTable pdfTable) {
027        OleDeliverRequestBo oleDeliverRequestBo = getOleItemRecordForCirc().getOleDeliverRequestBo();
028        String patronName = oleDeliverRequestBo != null ? oleDeliverRequestBo.getOlePatron().getPatronName() : null;
029        Object expirationDate = oleDeliverRequestBo != null ? oleDeliverRequestBo.getHoldExpirationDate() : null;
030        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInJustified("Patron Name"));
031        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInLeft(":"));
032        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInJustified(patronName));
033
034        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInJustified("Expiration Date"));
035        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInLeft(":"));
036        pdfTable.addCell(getPdfFormatUtil().getPdfPCellInJustified(expirationDate != null ? getDateFormat().format(expirationDate).toString() : null));
037    }
038
039}