use of com.genexus.ModelContext in project JavaClasses by genexuslabs.
the class UserInformation method getLocalUtil.
public LocalUtil getLocalUtil() {
String androidLanguage = com.artech.base.services.AndroidContext.ApplicationContext.getLanguageName();
if (localUtil != null && androidLanguage != null) {
String androidLanguageCode = Application.getClientPreferences().getProperty("language|" + androidLanguage, "code", (String) null);
if (androidLanguageCode != null && !localUtil._language.equals(androidLanguageCode)) {
// re create localUtil, language has changed.
System.out.println("change LocalUtil language: " + androidLanguage + "");
ModelContext tempContext = ModelContext.getModelContext();
if (tempContext != null) {
int res = ((HttpContext) tempContext.getHttpContext()).setLanguage(androidLanguage);
this.setLocalUtil(tempContext.getHttpContext().getLanguageProperty("decimal_point").charAt(0), tempContext.getHttpContext().getLanguageProperty("date_fmt"), tempContext.getHttpContext().getLanguageProperty("time_fmt"), tempContext.getClientPreferences().getYEAR_LIMIT(), tempContext.getHttpContext().getLanguageProperty("code"));
}
}
}
return localUtil;
}
use of com.genexus.ModelContext in project JavaClasses by genexuslabs.
the class Reorganization method execute.
public void execute() {
context = new ModelContext(getClass());
new reorg(getHandle()).execute();
}
use of com.genexus.ModelContext in project JavaClasses by genexuslabs.
the class GXOAuthUserInfo method doExecute.
protected void doExecute(HttpContext context) throws Exception {
new WebApplicationStartup().init(Application.gxCfg, context);
context.setStream();
try {
ModelContext modelContext = new ModelContext(Application.gxCfg);
modelContext.setHttpContext(context);
ModelContext.getModelContext().setHttpContext(context);
String[] user = new String[] { "" };
boolean[] flag = new boolean[] { false };
GXSecurityProvider.getInstance().oauthgetuser(-2, modelContext, user, flag);
if (!flag[0]) {
} else {
context.getResponse().setContentType("application/json");
context.getResponse().setStatus(200);
context.writeText(user[0]);
context.getResponse().flushBuffer();
return;
}
} catch (Throwable e) {
context.sendResponseStatus(500, e.getMessage());
}
}
use of com.genexus.ModelContext in project JavaClasses by genexuslabs.
the class GXutil method now.
@SuppressWarnings("deprecation")
@Override
public Date now(boolean useClientTimeZone, boolean millisecond) {
ModelContext context = ModelContext.getModelContext();
Calendar cal = getCalendar();
synchronized (cal) {
cal.setTime(new Date());
if (!millisecond)
cal.set(Calendar.MILLISECOND, 0);
if (Application.getClientPreferences().useTimezoneFix() && useClientTimeZone)
return context.toContextTz(cal.getTime());
return cal.getTime();
}
}
use of com.genexus.ModelContext in project JavaClasses by genexuslabs.
the class GXOAuthLogout method doExecute.
protected void doExecute(HttpContext context) throws Exception {
new WebApplicationStartup().init(Application.gxCfg, context);
context.setStream();
try {
ModelContext modelContext = new ModelContext(Application.gxCfg);
modelContext.setHttpContext(context);
ModelContext.getModelContext().setHttpContext(context);
GXSecurityProvider.getInstance().oauthlogout(-2, modelContext);
context.getResponse().setContentType("application/json");
context.getResponse().setStatus(200);
context.writeText("{}");
context.getResponse().flushBuffer();
return;
} catch (Throwable e) {
context.sendResponseStatus(500, e.getMessage());
}
}
Aggregations