| 1 | |
package org.kuali.student.enrollment.class2.acal.service; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
import java.util.Map; |
| 6 | |
|
| 7 | |
import javax.xml.namespace.QName; |
| 8 | |
|
| 9 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 10 | |
|
| 11 | |
import org.kuali.rice.krad.lookup.LookupableImpl; |
| 12 | |
import org.kuali.rice.krad.web.form.LookupForm; |
| 13 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
| 14 | |
import org.kuali.student.enrollment.acal.dto.AcademicCalendarInfo; |
| 15 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 16 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 17 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 18 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 19 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 20 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 21 | |
|
| 22 | 0 | public class AcademicCalendarInfoLookupableImpl extends LookupableImpl { |
| 23 | |
public final static String CREDENTIAL_PROGRAM_TYPE_KEY = "credentialProgramTypeKey"; |
| 24 | |
public final static String ACADEMIC_CALENDAR_KEY = "key"; |
| 25 | |
private transient AcademicCalendarService academicCalendarService; |
| 26 | |
|
| 27 | |
|
| 28 | |
@Override |
| 29 | |
protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) { |
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | 0 | AcademicCalendarInfo academicCalendarInfo = null; |
| 47 | 0 | List<AcademicCalendarInfo> academicCalendarInfoList = new ArrayList<AcademicCalendarInfo>(); |
| 48 | |
|
| 49 | 0 | String academicCalendarKey = fieldValues.get(ACADEMIC_CALENDAR_KEY); |
| 50 | 0 | ContextInfo context = new ContextInfo(); |
| 51 | |
try{ |
| 52 | 0 | academicCalendarInfo = getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context); |
| 53 | 0 | academicCalendarInfoList.add(academicCalendarInfo); |
| 54 | 0 | return academicCalendarInfoList; |
| 55 | 0 | }catch (DoesNotExistException dnee){ |
| 56 | 0 | System.out.println("call getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context), and get DoesNotExistException: "+dnee.toString()); |
| 57 | 0 | }catch (InvalidParameterException ipe){ |
| 58 | 0 | System.out.println("call getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context), and get InvalidParameterException: "+ipe.toString()); |
| 59 | 0 | }catch (MissingParameterException mpe){ |
| 60 | 0 | System.out.println("call getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context), and get MissingParameterException: "+mpe.toString()); |
| 61 | 0 | }catch (OperationFailedException ofe){ |
| 62 | 0 | System.out.println("call getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context), and get OperationFailedException: "+ofe.toString()); |
| 63 | 0 | }catch (PermissionDeniedException pde){ |
| 64 | 0 | System.out.println("call getAcademicCalendarService().getAcademicCalendar(academicCalendarKey, context), and get PermissionDeniedException: "+pde.toString()); |
| 65 | 0 | } |
| 66 | 0 | return null; |
| 67 | |
|
| 68 | |
} |
| 69 | |
|
| 70 | |
protected AcademicCalendarService getAcademicCalendarService() { |
| 71 | 0 | if(academicCalendarService == null) { |
| 72 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService")); |
| 73 | |
} |
| 74 | |
|
| 75 | 0 | return academicCalendarService; |
| 76 | |
} |
| 77 | |
|
| 78 | |
|
| 79 | |
} |