1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.student.enrollment.class2.appointment.service.impl; |
18 | |
|
19 | |
import org.apache.commons.lang.StringUtils; |
20 | |
import org.kuali.rice.core.api.criteria.PredicateFactory; |
21 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
22 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
23 | |
import org.kuali.rice.krad.uif.container.CollectionGroup; |
24 | |
import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl; |
25 | |
import org.kuali.rice.krad.uif.view.View; |
26 | |
import org.kuali.rice.krad.util.GlobalVariables; |
27 | |
import org.kuali.rice.krad.util.KRADConstants; |
28 | |
import org.kuali.student.enrollment.acal.constants.AcademicCalendarServiceConstants; |
29 | |
import org.kuali.student.enrollment.acal.dto.KeyDateInfo; |
30 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
31 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
32 | |
import org.kuali.student.enrollment.class2.appointment.dto.AppointmentWindowWrapper; |
33 | |
import org.kuali.student.enrollment.class2.appointment.form.RegistrationWindowsManagementForm; |
34 | |
import org.kuali.student.enrollment.class2.appointment.service.AppointmentViewHelperService; |
35 | |
import org.kuali.student.enrollment.class2.appointment.util.AppointmentConstants; |
36 | |
import org.kuali.student.enrollment.class2.appointment.util.AppointmentSlotRuleTypeConversion; |
37 | |
import org.kuali.student.mock.utilities.TestHelper; |
38 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
39 | |
import org.kuali.student.r2.common.dto.LocaleInfo; |
40 | |
import org.kuali.student.r2.common.exceptions.*; |
41 | |
import org.kuali.student.r2.common.util.constants.TypeServiceConstants; |
42 | |
import org.kuali.student.r2.core.appointment.constants.AppointmentServiceConstants; |
43 | |
import org.kuali.student.r2.core.appointment.dto.AppointmentWindowInfo; |
44 | |
import org.kuali.student.r2.core.appointment.service.AppointmentService; |
45 | |
import org.kuali.student.r2.core.type.dto.TypeTypeRelationInfo; |
46 | |
import org.kuali.student.r2.core.type.service.TypeService; |
47 | |
|
48 | |
import javax.xml.namespace.QName; |
49 | |
import java.text.DateFormat; |
50 | |
import java.text.SimpleDateFormat; |
51 | |
import java.util.*; |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | 0 | public class AppointmentViewHelperServiceImpl extends ViewHelperServiceImpl implements AppointmentViewHelperService { |
59 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AppointmentViewHelperServiceImpl.class); |
60 | |
|
61 | |
private transient AcademicCalendarService academicCalendarService; |
62 | |
private transient TypeService typeService; |
63 | |
private transient AppointmentService appointmentService; |
64 | |
|
65 | |
@Override |
66 | |
public void searchForTerm(String typeKey, String year, RegistrationWindowsManagementForm form) throws Exception { |
67 | |
|
68 | |
|
69 | 0 | DateFormat df = new SimpleDateFormat("yyyy"); |
70 | 0 | Date minBoundDate = df.parse(year); |
71 | 0 | Date maxBoundDate = df.parse(Integer.toString(Integer.parseInt(year)+1)); |
72 | |
|
73 | |
|
74 | 0 | QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create(); |
75 | 0 | qbcBuilder.setPredicates(PredicateFactory.and( |
76 | |
PredicateFactory.equal("atpType", typeKey), |
77 | |
PredicateFactory.greaterThanOrEqual("startDate", minBoundDate), |
78 | |
PredicateFactory.lessThan("startDate", maxBoundDate))); |
79 | |
|
80 | 0 | QueryByCriteria criteria = qbcBuilder.build(); |
81 | |
|
82 | |
|
83 | 0 | AcademicCalendarService academicCalendarService = getAcalService(); |
84 | 0 | List<TermInfo> terms = academicCalendarService.searchForTerms(criteria, null); |
85 | |
|
86 | |
|
87 | 0 | if(terms == null || terms.isEmpty()){ |
88 | 0 | GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, AppointmentConstants.APPOINTMENT_MSG_ERROR_NO_TERMS_FOUND); |
89 | 0 | return; |
90 | |
} |
91 | |
|
92 | 0 | if(terms.size()>1){ |
93 | 0 | LOG.error("Too many terms!"); |
94 | |
} |
95 | |
|
96 | 0 | TermInfo term = terms.get(0); |
97 | |
|
98 | |
|
99 | 0 | form.setTermInfo(term); |
100 | |
|
101 | |
|
102 | 0 | List<KeyDateInfo> keyDates = academicCalendarService.getKeyDatesForTerm(term.getId(), null); |
103 | 0 | if(keyDates != null){ |
104 | |
|
105 | |
|
106 | 0 | List<TypeTypeRelationInfo> milestoneTypeRelations = getTypeService().getTypeTypeRelationsByOwnerAndType("kuali.milestone.type.group.appt.regperiods","kuali.type.type.relation.type.group",new ContextInfo()); |
107 | 0 | List<String> validMilestoneTypes = new ArrayList<String>(); |
108 | 0 | for(TypeTypeRelationInfo milestoneTypeRelation:milestoneTypeRelations){ |
109 | 0 | validMilestoneTypes.add(milestoneTypeRelation.getRelatedTypeKey()); |
110 | |
} |
111 | |
|
112 | |
|
113 | 0 | List<KeyDateInfo> periodMilestones = new ArrayList<KeyDateInfo>(); |
114 | 0 | for(KeyDateInfo keyDate:keyDates){ |
115 | 0 | if(validMilestoneTypes.contains(keyDate.getTypeKey())){ |
116 | 0 | periodMilestones.add(keyDate); |
117 | |
} |
118 | |
} |
119 | 0 | form.setPeriodMilestones(periodMilestones); |
120 | |
|
121 | |
} |
122 | |
|
123 | |
|
124 | 0 | if(form.getPeriodMilestones()==null||form.getPeriodMilestones().isEmpty()){ |
125 | 0 | GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, AppointmentConstants.APPOINTMENT_MSG_ERROR_NO_REG_PERIODS_FOR_TERM); |
126 | |
} |
127 | |
|
128 | 0 | } |
129 | |
|
130 | |
public void loadTermAndPeriods(String termId, RegistrationWindowsManagementForm form) throws Exception { |
131 | 0 | ContextInfo context = TestHelper.getContext1(); |
132 | 0 | TermInfo term = getAcalService().getTerm(termId, context); |
133 | |
|
134 | 0 | if (term.getId() != null && !term.getId().isEmpty()) { |
135 | 0 | form.setTermInfo(term); |
136 | 0 | loadPeriods(termId, form); |
137 | |
} |
138 | |
|
139 | 0 | } |
140 | |
|
141 | |
public void loadPeriods(String termId, RegistrationWindowsManagementForm form) throws Exception { |
142 | 0 | ContextInfo context = TestHelper.getContext1(); |
143 | 0 | List<KeyDateInfo> periodMilestones = new ArrayList<KeyDateInfo>(); |
144 | 0 | List<KeyDateInfo> keyDateInfoList = getAcalService().getKeyDatesForTerm(termId, context); |
145 | 0 | List<TypeTypeRelationInfo> relations = getTypeService().getTypeTypeRelationsByOwnerAndType("kuali.milestone.type.group.appt.regperiods","kuali.type.type.relation.type.group",context); |
146 | 0 | for (KeyDateInfo keyDateInfo : keyDateInfoList) { |
147 | 0 | for (TypeTypeRelationInfo relationInfo : relations) { |
148 | 0 | String relatedTypeKey = relationInfo.getRelatedTypeKey(); |
149 | 0 | if (keyDateInfo.getTypeKey().equals(relatedTypeKey)) { |
150 | 0 | periodMilestones.add(keyDateInfo); |
151 | 0 | break; |
152 | |
} |
153 | 0 | } |
154 | |
} |
155 | |
|
156 | 0 | form.setPeriodMilestones(periodMilestones); |
157 | 0 | } |
158 | |
|
159 | |
public boolean validateApptWidnow(AppointmentWindowWrapper apptWindow) { |
160 | 0 | boolean isValid = true; |
161 | |
|
162 | |
|
163 | 0 | String windowTypeKey = apptWindow.getWindowTypeKey(); |
164 | 0 | if (AppointmentServiceConstants.APPOINTMENT_WINDOW_TYPE_SLOTTED_UNIFORM_KEY.equals(windowTypeKey)){ |
165 | 0 | if(apptWindow.getEndDate() == null) { |
166 | 0 | GlobalVariables.getMessageMap().putError("newCollectionLines['appointmentWindows'].endDate", |
167 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_END_DATE_REQUIRED_FOR_UNIFORM); |
168 | 0 | isValid = false; |
169 | |
} |
170 | 0 | if(apptWindow.getEndTime() == null){ |
171 | 0 | GlobalVariables.getMessageMap().putError( "newCollectionLines['appointmentWindows'].endTime", |
172 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_END_TIME_REQUIRED_FOR_UNIFORM); |
173 | 0 | isValid = false; |
174 | |
} |
175 | 0 | if (apptWindow.getEndTime().isEmpty()){ |
176 | 0 | GlobalVariables.getMessageMap().putError( "newCollectionLines['appointmentWindows'].endTimeAmPm", |
177 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_END_TIME_REQUIRED_FOR_UNIFORM); |
178 | 0 | isValid = false; |
179 | |
} |
180 | |
} |
181 | |
|
182 | 0 | String periodId = apptWindow.getPeriodKey(); |
183 | |
try { |
184 | 0 | KeyDateInfo period = getAcalService().getKeyDate(periodId,getContextInfo()); |
185 | 0 | if (period.getStartDate().after(apptWindow.getStartDate()) || period.getEndDate().before(apptWindow.getStartDate())){ |
186 | 0 | GlobalVariables.getMessageMap().putError( "newCollectionLines['appointmentWindows'].startDate", |
187 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_START_DATE_OUT_OF_RANGE); |
188 | 0 | isValid = false; |
189 | |
} |
190 | 0 | if (apptWindow.getEndDate() != null && !apptWindow.getEndDate().toString().isEmpty() ){ |
191 | 0 | if (period.getStartDate().after(apptWindow.getEndDate()) || period.getEndDate().before(apptWindow.getEndDate()) ){ |
192 | 0 | GlobalVariables.getMessageMap().putError("newCollectionLines['appointmentWindows'].endDate", |
193 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_END_DATE_OUT_OF_RANGE); |
194 | 0 | isValid = false; |
195 | |
} |
196 | |
} |
197 | 0 | }catch (Exception e){ |
198 | 0 | LOG.error("Fail to find periods for a selected term.",e); |
199 | 0 | GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, AppointmentConstants.APPOINTMENT_MSG_ERROR_NO_REG_PERIODS_FOR_TERM); |
200 | 0 | isValid = false; |
201 | 0 | } |
202 | |
|
203 | |
|
204 | 0 | if (isValid){ |
205 | |
try{ |
206 | 0 | if (apptWindow.getEndDate() != null && !apptWindow.getEndTime().isEmpty() && !apptWindow.getEndTimeAmPm().isEmpty()){ |
207 | 0 | Date startDate = _updateTime(apptWindow.getStartDate(), apptWindow.getStartTime(), apptWindow.getStartTimeAmPm()); |
208 | 0 | Date endDate = _updateTime(apptWindow.getEndDate(), apptWindow.getEndTime(), apptWindow.getEndTimeAmPm()); |
209 | 0 | if(startDate.after(endDate)){ |
210 | 0 | GlobalVariables.getMessageMap().putError( "newCollectionLines['appointmentWindows'].endDate", |
211 | |
AppointmentConstants.APPOINTMENT_MSG_ERROR_END_DATE_IS_BEFORE_START_DATE); |
212 | |
} |
213 | |
} |
214 | 0 | } catch (Exception e){ |
215 | 0 | LOG.error("Fail to find periods for a selected term.",e); |
216 | 0 | GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, AppointmentConstants.APPOINTMENT_MSG_ERROR_END_DATE_IS_BEFORE_START_DATE); |
217 | 0 | isValid = false; |
218 | 0 | } |
219 | |
} |
220 | 0 | return isValid; |
221 | |
} |
222 | |
|
223 | |
protected void processAfterAddLine(View view, CollectionGroup collectionGroup, Object model, Object addLine) { |
224 | 0 | if (addLine instanceof AppointmentWindowWrapper) { |
225 | |
|
226 | |
|
227 | 0 | RegistrationWindowsManagementForm form = (RegistrationWindowsManagementForm) model; |
228 | 0 | AppointmentWindowWrapper newCollectionLine= (AppointmentWindowWrapper)form.getNewCollectionLines().get("appointmentWindows"); |
229 | 0 | String periodId = form.getPeriodId(); |
230 | 0 | if (periodId != "all" && !periodId.isEmpty()){ |
231 | 0 | newCollectionLine.setPeriodName(form.getPeriodName()); |
232 | 0 | newCollectionLine.setPeriodKey(form.getPeriodId()); |
233 | |
} |
234 | |
} |
235 | 0 | } |
236 | |
|
237 | |
public boolean saveApptWindow(AppointmentWindowWrapper appointmentWindowWrapper) throws InvalidParameterException, DataValidationErrorException, MissingParameterException, DoesNotExistException, ReadOnlyException, PermissionDeniedException, OperationFailedException, VersionMismatchException{ |
238 | 0 | boolean isSave = true; |
239 | |
|
240 | 0 | AppointmentWindowInfo appointmentWindowInfo = appointmentWindowWrapper.getAppointmentWindowInfo(); |
241 | 0 | appointmentWindowInfo.setTypeKey(appointmentWindowWrapper.getWindowTypeKey()); |
242 | 0 | appointmentWindowInfo.setPeriodMilestoneId(appointmentWindowWrapper.getPeriodKey()); |
243 | 0 | appointmentWindowInfo.setStartDate(_updateTime(appointmentWindowWrapper.getStartDate(), appointmentWindowWrapper.getStartTime(), appointmentWindowWrapper.getStartTimeAmPm())); |
244 | 0 | appointmentWindowInfo.setEndDate(_updateTime(appointmentWindowWrapper.getEndDate(), appointmentWindowWrapper.getEndTime(), appointmentWindowWrapper.getEndTimeAmPm())); |
245 | |
|
246 | |
|
247 | 0 | if(appointmentWindowInfo.getAssignedOrderTypeKey() == null || appointmentWindowInfo.getAssignedOrderTypeKey().isEmpty()){ |
248 | 0 | appointmentWindowInfo.setAssignedOrderTypeKey("DUMMY_ID"); |
249 | |
} |
250 | |
|
251 | |
|
252 | 0 | if(appointmentWindowInfo.getTypeKey() == null || appointmentWindowInfo.getTypeKey().isEmpty()){ |
253 | 0 | appointmentWindowInfo.setTypeKey(AppointmentServiceConstants.APPOINTMENT_WINDOW_TYPE_ONE_SLOT_KEY); |
254 | |
} |
255 | |
|
256 | 0 | if(appointmentWindowInfo.getId()==null||appointmentWindowInfo.getId().isEmpty()){ |
257 | |
|
258 | 0 | appointmentWindowInfo.setStateKey(AppointmentServiceConstants.APPOINTMENT_WINDOW_STATE_DRAFT_KEY); |
259 | |
|
260 | |
|
261 | 0 | if(!AppointmentServiceConstants.APPOINTMENT_WINDOW_TYPE_ONE_SLOT_KEY.equals(appointmentWindowInfo.getTypeKey())) { |
262 | 0 | appointmentWindowInfo.setSlotRule(AppointmentSlotRuleTypeConversion.convToAppointmentSlotRuleInfo(appointmentWindowWrapper.getSlotRuleEnumType())); |
263 | |
} |
264 | |
|
265 | |
|
266 | 0 | appointmentWindowInfo = getAppointmentService().createAppointmentWindow(appointmentWindowInfo.getTypeKey(),appointmentWindowInfo,new ContextInfo()); |
267 | |
}else{ |
268 | 0 | appointmentWindowInfo = getAppointmentService().updateAppointmentWindow(appointmentWindowInfo.getId(),appointmentWindowInfo,new ContextInfo()); |
269 | |
} |
270 | |
|
271 | |
|
272 | 0 | appointmentWindowWrapper.setAppointmentWindowInfo(appointmentWindowInfo); |
273 | 0 | appointmentWindowWrapper.setId(appointmentWindowInfo.getId()); |
274 | 0 | appointmentWindowWrapper.setWindowName(appointmentWindowInfo.getName()); |
275 | |
|
276 | 0 | return isSave; |
277 | |
|
278 | |
} |
279 | |
|
280 | |
public boolean saveWindows(RegistrationWindowsManagementForm form) throws InvalidParameterException, DataValidationErrorException, MissingParameterException, DoesNotExistException, ReadOnlyException, PermissionDeniedException, OperationFailedException, VersionMismatchException { |
281 | 0 | boolean isApptWindowSaved = true; |
282 | 0 | boolean allWindowsSaved = true; |
283 | 0 | if(form.getAppointmentWindows()!=null){ |
284 | |
|
285 | 0 | for(AppointmentWindowWrapper appointmentWindowWrapper:form.getAppointmentWindows()){ |
286 | 0 | boolean isValid = validateApptWidnow(appointmentWindowWrapper); |
287 | 0 | if (isValid) { |
288 | 0 | isApptWindowSaved=saveApptWindow(appointmentWindowWrapper); |
289 | 0 | if(!isApptWindowSaved) |
290 | 0 | allWindowsSaved = isApptWindowSaved; |
291 | |
} |
292 | 0 | } |
293 | |
|
294 | 0 | if (isApptWindowSaved) |
295 | 0 | GlobalVariables.getMessageMap().putInfo( KRADConstants.GLOBAL_MESSAGES, |
296 | |
AppointmentConstants.APPOINTMENT_MSG_INFO_SAVED); |
297 | |
} |
298 | 0 | return allWindowsSaved; |
299 | |
} |
300 | |
|
301 | |
protected void processBeforeAddLine(View view, CollectionGroup collectionGroup, Object model, Object addLine) { |
302 | 0 | if (addLine instanceof AppointmentWindowWrapper){ |
303 | 0 | RegistrationWindowsManagementForm form = (RegistrationWindowsManagementForm) model; |
304 | 0 | List<KeyDateInfo> periodMilestones = form.getPeriodMilestones(); |
305 | 0 | String periodKey = ((AppointmentWindowWrapper) addLine).getPeriodKey(); |
306 | 0 | for (KeyDateInfo period : periodMilestones) { |
307 | 0 | if (periodKey.equals(period.getId())){ |
308 | 0 | if (period.getName() != null && !period.getName().isEmpty()){ |
309 | 0 | ((AppointmentWindowWrapper) addLine).setPeriodName(period.getName()); |
310 | |
} |
311 | |
else{ |
312 | 0 | ((AppointmentWindowWrapper) addLine).setPeriodName(periodKey); |
313 | |
} |
314 | 0 | break; |
315 | |
} |
316 | |
} |
317 | 0 | String windowName = ((AppointmentWindowWrapper) addLine).getAppointmentWindowInfo().getName(); |
318 | 0 | ((AppointmentWindowWrapper) addLine).setWindowName(windowName); |
319 | |
} |
320 | 0 | } |
321 | |
|
322 | |
protected boolean performAddLineValidation(View view, CollectionGroup collectionGroup, Object model, |
323 | |
Object addLine) { |
324 | 0 | boolean isValid = true; |
325 | 0 | if (addLine instanceof AppointmentWindowWrapper){ |
326 | 0 | AppointmentWindowWrapper apptWindow = (AppointmentWindowWrapper) addLine; |
327 | 0 | isValid = validateApptWidnow(apptWindow); |
328 | 0 | if(isValid) { |
329 | |
try { |
330 | |
|
331 | 0 | saveApptWindow((AppointmentWindowWrapper)addLine); |
332 | |
|
333 | 0 | GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_MESSAGES, |
334 | |
AppointmentConstants.APPOINTMENT_MSG_INFO_SAVED); |
335 | 0 | } catch (Exception e) { |
336 | 0 | LOG.error("Fail to create a window.",e); |
337 | 0 | GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, AppointmentConstants.APPOINTMENT_MSG_ERROR_WINDOW_SAVE_FAIL); |
338 | 0 | isValid = false; |
339 | 0 | } |
340 | |
} |
341 | |
|
342 | 0 | } else { |
343 | 0 | super.performAddLineValidation(view, collectionGroup, model, addLine); |
344 | |
} |
345 | 0 | return isValid; |
346 | |
} |
347 | |
|
348 | |
|
349 | |
private Date _updateTime(Date date,String time,String amPm){ |
350 | |
|
351 | 0 | if(date == null || time == null || amPm == null){ |
352 | 0 | return null; |
353 | |
} |
354 | |
|
355 | |
|
356 | |
|
357 | |
|
358 | 0 | Calendar cal = Calendar.getInstance(); |
359 | 0 | cal.setTime(date); |
360 | |
|
361 | |
|
362 | 0 | cal.set(Calendar.HOUR, Integer.parseInt(StringUtils.substringBefore(time, ":"))); |
363 | 0 | cal.set(Calendar.MINUTE, Integer.parseInt(StringUtils.substringAfter(time,":"))); |
364 | 0 | cal.set(Calendar.SECOND, 0); |
365 | 0 | cal.set(Calendar.MILLISECOND, 0); |
366 | 0 | if (StringUtils.isNotBlank(amPm)){ |
367 | 0 | if (StringUtils.equalsIgnoreCase(amPm,"am")){ |
368 | 0 | cal.set(Calendar.AM_PM,Calendar.AM); |
369 | 0 | }else if(StringUtils.equalsIgnoreCase(amPm,"pm")){ |
370 | 0 | cal.set(Calendar.AM_PM,Calendar.PM); |
371 | |
}else{ |
372 | 0 | throw new RuntimeException("Unknown AM/PM format."); |
373 | |
} |
374 | |
} |
375 | |
|
376 | 0 | return cal.getTime(); |
377 | |
} |
378 | |
|
379 | |
public AcademicCalendarService getAcalService() { |
380 | 0 | if(academicCalendarService == null) { |
381 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName(AcademicCalendarServiceConstants.NAMESPACE, AcademicCalendarServiceConstants.SERVICE_NAME_LOCAL_PART)); |
382 | |
} |
383 | 0 | return this.academicCalendarService; |
384 | |
} |
385 | |
|
386 | |
|
387 | |
public AppointmentService getAppointmentService() { |
388 | 0 | if(appointmentService == null) { |
389 | 0 | appointmentService = (AppointmentService) GlobalResourceLoader.getService(new QName(AppointmentServiceConstants.NAMESPACE, AppointmentServiceConstants.SERVICE_NAME_LOCAL_PART)); |
390 | |
} |
391 | 0 | return appointmentService; |
392 | |
} |
393 | |
|
394 | |
|
395 | |
public TypeService getTypeService() { |
396 | 0 | if(typeService == null) { |
397 | 0 | typeService = (TypeService) GlobalResourceLoader.getService(new QName(TypeServiceConstants.NAMESPACE, TypeServiceConstants.SERVICE_NAME_LOCAL_PART)); |
398 | |
} |
399 | 0 | return this.typeService; |
400 | |
} |
401 | |
|
402 | |
|
403 | |
|
404 | |
public ContextInfo getContextInfo() { |
405 | 0 | ContextInfo contextInfo = new ContextInfo(); |
406 | 0 | contextInfo.setAuthenticatedPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); |
407 | 0 | contextInfo.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); |
408 | 0 | LocaleInfo localeInfo = new LocaleInfo(); |
409 | 0 | localeInfo.setLocaleLanguage(Locale.getDefault().getLanguage()); |
410 | 0 | localeInfo.setLocaleRegion(Locale.getDefault().getCountry()); |
411 | 0 | contextInfo.setLocale(localeInfo); |
412 | 0 | return contextInfo; |
413 | |
} |
414 | |
|
415 | |
|
416 | |
} |