| 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 | |
import org.kuali.rice.kns.uif.service.impl.LookupViewHelperServiceImpl; |
| 11 | |
|
| 12 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
| 13 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
| 14 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 15 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 16 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 17 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 18 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 19 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 20 | |
|
| 21 | 0 | public class TermInfoLookupViewHelperServiceImpl extends LookupViewHelperServiceImpl { |
| 22 | |
public final static String TERM_TYPE_KEY = "typeKey"; |
| 23 | |
public final static String TERM_KEY = "key"; |
| 24 | |
private transient AcademicCalendarService academicCalendarService; |
| 25 | |
|
| 26 | |
|
| 27 | |
@Override |
| 28 | |
protected List<?> getSearchResultsWithBounding(Map<String, String> fieldValues, boolean unbounded) { |
| 29 | 0 | TermInfo termInfo = null; |
| 30 | 0 | List<TermInfo> termInfoList = new ArrayList<TermInfo>(); |
| 31 | |
|
| 32 | 0 | String termKey = fieldValues.get(TERM_KEY); |
| 33 | 0 | ContextInfo context = ContextInfo.newInstance(); |
| 34 | |
try{ |
| 35 | 0 | termInfo = getAcademicCalendarService().getTerm(termKey, context); |
| 36 | 0 | termInfoList.add(termInfo); |
| 37 | 0 | return termInfoList; |
| 38 | 0 | }catch (DoesNotExistException dnee){ |
| 39 | |
|
| 40 | 0 | }catch (InvalidParameterException ipe){ |
| 41 | |
|
| 42 | 0 | }catch (MissingParameterException mpe){ |
| 43 | |
|
| 44 | 0 | }catch (OperationFailedException ofe){ |
| 45 | |
|
| 46 | 0 | }catch (PermissionDeniedException pde){ |
| 47 | |
|
| 48 | 0 | } |
| 49 | 0 | return null; |
| 50 | |
|
| 51 | |
} |
| 52 | |
|
| 53 | |
protected AcademicCalendarService getAcademicCalendarService() { |
| 54 | 0 | if(academicCalendarService == null) { |
| 55 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService")); |
| 56 | |
} |
| 57 | |
|
| 58 | 0 | return academicCalendarService; |
| 59 | |
} |
| 60 | |
|
| 61 | |
} |