View Javadoc
1   package org.kuali.ole.deliver.inquiry;
2   
3   import org.kuali.ole.OLEConstants;
4   import org.kuali.ole.deliver.bo.OlePatronIngestSummaryRecord;
5   import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
6   
7   import java.util.Map;
8   
9   /**
10   * OlePatronSummaryInquirable provides URL to download the failed patron attachment and filename.
11   */
12  public class OlePatronSummaryInquirable extends KualiInquirableImpl {
13      public Object object;
14  
15      /**
16       * This method will retrieve the data object using the parameters
17       *
18       * @param parameters
19       * @return object
20       */
21      @Override
22      public Object retrieveDataObject(Map parameters) {
23          object = super.retrieveDataObject(parameters);
24          return object;
25      }
26  
27      /**
28       * This method will create the url by appending the olePatronSummaryId to call the download method in the controller
29       *
30       * @return url
31       */
32      public String getUrl() {
33          OlePatronIngestSummaryRecord olePatronIngestSummaryRecord = (OlePatronIngestSummaryRecord) object;
34          String url = OLEConstants.FAILED_PATRON_ATTACHMENT_DOWNLOAD_URL + olePatronIngestSummaryRecord.getOlePatronSummaryId();
35          return url;
36      }
37  
38      /**
39       * This will return the file name of the error xml otherwise it will return null
40       *
41       * @return fileName
42       */
43      public String getFileName() {
44          OlePatronIngestSummaryRecord olePatronIngestSummaryRecord = (OlePatronIngestSummaryRecord) object;
45          if (olePatronIngestSummaryRecord.getPatronFailedCount() != null && olePatronIngestSummaryRecord.getPatronFailedCount() > 0)
46              return olePatronIngestSummaryRecord.getOlePatronSummaryId() + OLEConstants.FAILED_PATRON_RECORD_NAME;
47          else
48              return null;
49      }
50  }