📄 xmlmodelhandler.java
字号:
/**
* Copyright 2005 Jdon.com
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jdon.model.handler;
import com.jdon.model.*;
import javax.servlet.http.*;
import com.jdon.controller.events.*;
import com.jdon.controller.model.Model;
import com.jdon.controller.WebAppUtil;
import com.jdon.bussinessproxy.meta.MethodMetaArgs;
import com.jdon.util.Debug;
import com.jdon.controller.ContainerClient;
/**
* auto gernerate the XmlModelHandler code from jdonframework.xml
*
* <p>Copyright: Jdon.com Copyright (c) 2003</p>
* @author banq
* @version JdonFramework 2005 v1.0
*/
public class XmlModelHandler extends ModelHandler {
private final static String module = XmlModelHandler.class.getName();
private MethodMetaArgsFactory maFactory = new MethodMetaArgsFactory();
private ContainerClient containerClient = new ContainerClient();
public ModelForm initForm(HttpServletRequest request) throws java.lang.
Exception {
return null;
}
public Model findModelByKey(String keyValue, HttpServletRequest request) throws
java.lang.Exception {
Debug.logVerbose(" findModel By Key:" + keyValue, module);
HandlerMetaDef hm = this.modelMapping.getHandlerMetaDef();
String ejbName = hm.getServiceRef();
MethodMetaArgs methodMetaArgs = maFactory.createfindMethod(hm, keyValue);
Debug.logVerbose(" create MethodMetaArgs for ejbName:" + ejbName, module);
Object result = containerClient.visitEJBService(ejbName,
methodMetaArgs,
request);
Debug.logVerbose(" result type:" + result.getClass().getName(), module);
return (Model) result;
}
public void serviceAction(EventModel em, HttpServletRequest request) throws
java.lang.Exception {
try {
HandlerMetaDef hm = this.modelMapping.getHandlerMetaDef();
String ejbName = hm.getServiceRef();
MethodMetaArgs methodMetaArgs = null;
switch (em.getActionType()) {
case Event.CREATE:
methodMetaArgs = maFactory.createCreateMethod(hm, em);
break;
case Event.EDIT:
methodMetaArgs = maFactory.createUpdateMethod(hm, em);
break;
case Event.DELETE:
methodMetaArgs = maFactory.createDeleteMethod(hm, em);
break;
}
containerClient.visitEJBService(ejbName, methodMetaArgs, request);
} catch (Exception ex) {
Debug.logError(" serviceAction Error: " + ex, module);
throw new Exception(" serviceAction Error:" + ex);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -