/* * The Kuali Financial System, a comprehensive financial management system for higher education. * * Copyright 2005-2014 The Kuali Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.kfs.module.ar.web.struts; import java.util.ArrayList; import java.util.Collection; import org.kuali.kfs.module.ar.document.ContractsGrantsInvoiceDocument; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.rice.core.api.datetime.DateTimeService; import org.kuali.rice.kns.lookup.LookupResultsService; import org.kuali.rice.kns.web.struts.action.KualiAction; import org.kuali.rice.krad.bo.PersistableBusinessObject; /** * Base methods to support report summary actions */ public class ContractsGrantsBillingSummaryActionBase extends KualiAction { private static volatile DateTimeService dateTimeService; private static volatile LookupResultsService lookupResultsService; /** * Gets the invoice documents from sequence number. * @param lookupResultsSequenceNumber The sequence number of search result. * @param personId The principal id of the person who searched. * @return Returns the list of invoice documents. */ protected Collection<ContractsGrantsInvoiceDocument> getCGInvoiceDocumentsFromLookupResultsSequenceNumber(String lookupResultsSequenceNumber, String personId) { Collection<ContractsGrantsInvoiceDocument> invoiceDocuments = new ArrayList<ContractsGrantsInvoiceDocument>(); try { for (PersistableBusinessObject obj : getLookupResultsService().retrieveSelectedResultBOs(lookupResultsSequenceNumber, ContractsGrantsInvoiceDocument.class, personId)) { invoiceDocuments.add((ContractsGrantsInvoiceDocument) obj); } } catch (Exception e) { // retrieveSelectedResultBOs throws Exception, hence the Pokemon handler throw new RuntimeException(e); } return invoiceDocuments; } public static DateTimeService getDateTimeService() { if (dateTimeService == null) { dateTimeService = SpringContext.getBean(DateTimeService.class); } return dateTimeService; } public static LookupResultsService getLookupResultsService() { if (lookupResultsService == null) { lookupResultsService = SpringContext.getBean(LookupResultsService.class); } return lookupResultsService; } }