use of cn.cerc.jdb.core.IHandle in project summer-mis by cn-cerc.
the class ResourceJstl method getString.
private String getString(HttpServletRequest request, JspFragment jf) throws JspException, IOException {
IHandle handle = (IHandle) request.getAttribute("myappHandle");
if (handle == null) {
log.error("handle is null");
return "handle is null";
}
String text = "";
StringWriter sw = new StringWriter();
jf.invoke(sw);
text = sw.toString();
Object temp = handle.getProperty(Application.deviceLanguage);
String lang = (temp == null || "".equals(temp)) ? Application.getLangage() : (String) temp;
if ("cn".equals(lang)) {
return text;
}
// 取其它语言的字符
ResourceBuffer rb = items.get(lang);
if (rb == null) {
rb = new ResourceBuffer(lang);
items.put(lang, rb);
}
// 取得到值,则直接返回
String result = rb.get(handle, text);
if (result != null) {
if (!"".equals(result)) {
return result;
}
}
// 取不到值,但当前是英文时,则原样返回
if ("en".equals(lang)) {
if (ServerConfig.getInstance().isDebug()) {
return lang + ":" + text;
} else {
return text;
}
}
// 如果是其它语言,则取英文的默认值
ResourceBuffer en = items.get("en");
result = en.get(handle, text);
if (result != null && !"".equals(result)) {
return result;
}
if (ServerConfig.getInstance().isDebug()) {
return lang + ":" + text;
} else {
return text;
}
}
use of cn.cerc.jdb.core.IHandle in project summer-mis by cn-cerc.
the class ExportHistoryWriter method finish.
@Override
public void finish(Object handle, Template template) {
IHandle appHandle = (IHandle) handle;
String log = String.format("系统已经为您导出: %s.xls", template.getFileName());
new HistoryRecord(log).setLevel(HistoryLevel.General).save(appHandle);
}
use of cn.cerc.jdb.core.IHandle in project summer-bean by cn-cerc.
the class BookHandleTest method test.
@Test
@Ignore
public void test() {
IHandle app = new BookHandle(handle, "144001");
assertEquals(app.getCorpNo(), "144001");
}
use of cn.cerc.jdb.core.IHandle in project summer-mis by cn-cerc.
the class AppLoginPage method checkSecurity.
@Override
public boolean checkSecurity(String token) throws IOException, ServletException {
IForm form = this.getForm();
String password = null;
String userCode = null;
try {
// TODO 需要统一 login_user login_pwd 与 userCode password 的名称
if (form.getRequest().getParameter("login_usr") != null) {
userCode = getRequest().getParameter("login_usr");
password = getRequest().getParameter("login_pwd");
return checkLogin(userCode, password);
}
log.debug(String.format("根据 token(%s) 创建 Session", token));
IHandle sess = (IHandle) form.getHandle().getProperty(null);
if (sess.init(token))
return true;
if (form.logon())
return true;
} catch (Exception e) {
this.add("loginMsg", e.getMessage());
}
this.execute();
return false;
}
use of cn.cerc.jdb.core.IHandle in project summer-mis by cn-cerc.
the class ExportService method export.
public void export() throws WriteException, IOException, AccreditException {
if (service == null || "".equals(service))
throw new RuntimeException("错误的调用:service is null");
if (exportKey == null || "".equals(exportKey))
throw new RuntimeException("错误的调用:exportKey is null");
IHandle handle = (IHandle) this.getHandle();
LocalService app = new LocalService(handle);
app.setService(service);
try (MemoryBuffer buff = new MemoryBuffer(BufferType.getExportKey, handle.getUserCode(), exportKey)) {
app.getDataIn().close();
app.getDataIn().setJSON(buff.getString("data"));
}
if (!app.exec()) {
this.export(app.getMessage());
return;
}
DataSet dataOut = app.getDataOut();
// 对分类进行处理
dataOut.first();
while (dataOut.fetch()) {
if (dataOut.getBoolean("IsType_"))
dataOut.delete();
}
this.getTemplate().setDataSet(dataOut);
super.export();
}
Aggregations