Commit a40c7beb by WeiCong

增加对app端请求快照的支持(和zk版一致)

parent 1e0209e3
......@@ -4,4 +4,5 @@ target/
.settings
log
e-lib
classes/
\ No newline at end of file
classes/
**/**/*.zul
\ No newline at end of file
......@@ -79,6 +79,24 @@
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
<orderEntry type="module-library">
<library name="Maven: org.zkoss:zcommon:8.0.5">
<CLASSES>
<root url="jar://$MODULE_DIR$/e-lib/zcommon-8.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: org.zkoss.zk:zk:8.0.5">
<CLASSES>
<root url="jar://$MODULE_DIR$/e-lib/zk-8.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: org.sss:eibs-container:3.5.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/src/main/webapp/WEB-INF/lib/eibs-container-3.5.0.jar!/" />
......
......@@ -35,6 +35,7 @@
<java-jwt.version>2.2.0</java-jwt.version>
<servlet-api.version>2.5</servlet-api.version>
<junit.version>4.12</junit.version>
<zk.version>8.0.5</zk.version>
</properties>
<dependencies>
......@@ -138,6 +139,22 @@
</dependency>
<dependency>
<groupId>org.zkoss</groupId>
<artifactId>zcommon</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${project.basedir}/e-lib/zcommon-8.0.5.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zk</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${project.basedir}/e-lib/zk-8.0.5.jar</systemPath>
</dependency>
<dependency>
<groupId>org.sss</groupId>
<artifactId>eibs-container</artifactId>
<version>3.5.0</version>
......
......@@ -34,6 +34,7 @@ public class NoUiRequest {
}
public NoUiRequest(HttpServletRequest request, String mappingUrl, Map<String, ?> requestData) {
this.httpRequest = request;
String tokenId = request.getHeader("token");
String userId = request.getHeader("userId");
String terminalType = request.getHeader(Constants.TERMINAL_TYPE);
......@@ -86,8 +87,8 @@ public class NoUiRequest {
}
if (this.paginationMap == null) {
this.paginationMap = new HashMap<>();
}else{
isSelByPagination=true;
} else {
isSelByPagination = true;
}
if (this.headMap == null) {
this.headMap = new HashMap<>();
......
package org.sss.presentation.noui.context;
import com.google.gson.Gson;
import log.Log;
import log.LogFactory;
import org.apache.commons.io.FileUtils;
......@@ -12,14 +11,25 @@ import org.sss.exception.ContainerException;
import org.sss.presentation.noui.api.exception.ExitTransactionException;
import org.sss.presentation.noui.api.request.NoUiRequest;
import org.sss.presentation.noui.api.response.ErrorCodes;
import org.sss.presentation.noui.common.Constants;
import org.sss.presentation.noui.util.NoUiUtils;
import org.sss.presentation.noui.util.StringUtil;
import org.sss.presentation.zk.ZkContext;
import org.sss.presentation.zk.ZkDisplayUtils;
import org.sss.presentation.zk.ZkUtils;
import org.sss.util.ClusterFileUtils;
import org.sss.util.ContainerUtils;
import org.sss.zkoss.zk.ui.http.ExecutionImpls;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.http.WebManager;
import org.zkoss.zk.ui.impl.DesktopImpl;
import org.zkoss.zk.ui.sys.ExecutionsCtrl;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
......@@ -364,7 +374,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
codetable.put(((IBaseObject) paramIAttributeValue).getUrl(), paramList);
paramIAttributeValue.setAttribute("CODEVALUES", paramList);
/*
* if (((paramIAttributeValue instanceof IBaseObject)) &&
* if (((paramIAttributeValue instanceof IBaseObject)) &&
* (!this.codeValuesList.contains(paramIAttributeValue))) { IBaseObject
* baseObject = (IBaseObject) paramIAttributeValue;
* this.codeValuesList.add(baseObject);
......@@ -378,8 +388,8 @@ public class NoUiPresentation extends AbstractNullPresentation {
// if (!tableModifyList.contains(paramIModuleList)) {
// tableModifyList.add(paramIModuleList);
// }
/*
* List<Map<String, Object>> dataList = new ArrayList<Map<String,
/*
* List<Map<String, Object>> dataList = new ArrayList<Map<String,
* Object>>(); for (int i = 0; i < paramIModuleList.size(); i++) {
* IModule module = (IModule) paramIModuleList.get(i);
* Collection<IDatafield> conns = module.getDatafields(); Map<String,
......@@ -523,18 +533,36 @@ public class NoUiPresentation extends AbstractNullPresentation {
@Override
public void saveDisplay(IPanel[] panels, String fileName, String cssUrl, String jsUrl) throws ContainerException {
saveDisplay(panels, fileName);
}
@Override
public void saveDisplay(IPanel[] panels, String fileName) throws ContainerException {
//支持bd的保存display
Execution oldExecution = ExecutionsCtrl.getCurrent();
ExecutionImpls impls=null;
try {
Map<String, ?> map = noUiRequest.getSaveDisplayMap();
String data = new Gson().toJson(map);
FileUtils.write(new File(fileName), data, Constants.ENCODING);
} catch (IOException e) {
log.error("save dispaly error", e);
File file = new File(fileName);
FileOutputStream stream = FileUtils.openOutputStream(file);
HttpServletRequest req = ((NoUiContext) ctx).getNoUiRequest().getHttpRequest();
HttpSession session = req.getSession(true);
ZkContext zkContext = new ZkContext(ctx);
ZkUtils.setZkContext(session,zkContext);
ServletContext servletContext = session.getServletContext();
Session zkSession = WebManager.getSession(session.getServletContext(), req);
zkContext.setZkSession(zkSession);
impls = new ExecutionImpls(servletContext, req, null, zkSession);
DesktopImpl desktop= new DesktopImpl(zkSession.getWebApp(), "", null, null, req);
desktop.sessionDidActivate(zkSession);
impls.setDesktop(desktop);
impls.activate();
ExecutionsCtrl.setCurrent(impls);
ZkDisplayUtils.saveDisplay(zkContext, panels, cssUrl, jsUrl, false, stream);
if (ContainerUtils.clusterUsed) {
ClusterFileUtils.clusterSendFile(file);
}
} catch (Exception e) {
log.error("save display error", e);
} finally {
impls.deactivate();
ExecutionsCtrl.setCurrent(oldExecution);
}
}
......
package org.sss.zkoss.zk.ui.http;
import org.zkoss.xel.VariableResolver;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.http.ExecutionImpl;
import org.zkoss.zk.ui.impl.AbstractWebApp;
import org.zkoss.zk.ui.sys.UiEngine;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
public class ExecutionImpls extends ExecutionImpl {
Session session;
public ExecutionImpls(ServletContext ctx, HttpServletRequest request, HttpServletResponse response, Session session) {
super(ctx, request, response, null, null);
this.session=session;
}
public Component createComponents(String uri, Component parent, Map<?, ?> arg) {
return this.createComponents0(uri, parent, null, null, arg);
}
private Component createComponents0(String uri, Component parent, Component insertBefore, VariableResolver resolver, Map<?, ?> arg) {
Component[] cs = this.getUiEngine().createComponents(this, this.getPageDefinition(uri), this.getCurrentPage(), parent, insertBefore, resolver, arg);
return cs.length > 0 ? cs[0] : null;
}
private final UiEngine getUiEngine() {
return ((AbstractWebApp)this.session.getWebApp()).getUiEngine();
}
public void activate() {
getUiEngine().activate(this);
}
public void deactivate(){
getUiEngine().deactivate(this);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<zk>
<library-property>
<name>org.zkoss.zul.include.mode</name>
<value>defer</value>
</library-property>
<session-config>
<max-desktops-per-session>2</max-desktops-per-session>
</session-config>
<system-config>
<!-- <id-generator-class>org.sss.presentation.zk.ZkIdGenerator</id-generator-class> -->
<ui-factory-class>org.sss.presentation.zk.component.ext.UiFactory</ui-factory-class>
<disable-event-thread>false</disable-event-thread>
</system-config>
<device-config>
<device-type>ajax</device-type>
<timeout-uri>/error/timeout.html</timeout-uri>
</device-config>
<!--
<library-property>
<name>org.zkoss.zk.ui.EmulateIE7</name>
<value>true</value>
</library-property>
-->
<library-property>
<name>org.zkoss.zul.theme.fontSizeM</name>
<value>12px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontSizeMS</name>
<value>11px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontSizeS</name>
<value>11px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontSizeXS</name>
<value>10px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontFamilyT</name>
<value>宋体, 宋体</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontFamilyC</name>
<value>宋体, 宋体</value>
</library-property>
<listener>
<listener-class>org.sss.presentation.zk.common.ResultDesktopInit</listener-class>
</listener>
</zk>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment