1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.student.enrollment.common.util;
16
17 import org.kuali.rice.krad.util.GlobalVariables;
18 import org.kuali.student.r2.common.dto.ContextInfo;
19 import org.kuali.student.r2.common.dto.LocaleInfo;
20
21 import java.util.Locale;
22
23
24
25
26
27
28 public class ContextBuilder {
29 public static ContextInfo loadContextInfo() {
30
31 ContextInfo contextInfo = new ContextInfo();
32 contextInfo.setAuthenticatedPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
33 contextInfo.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
34 LocaleInfo localeInfo = new LocaleInfo();
35 localeInfo.setLocaleLanguage(Locale.getDefault().getLanguage());
36 localeInfo.setLocaleRegion(Locale.getDefault().getCountry());
37 contextInfo.setLocale(localeInfo);
38
39 return contextInfo;
40 }
41 }