componentaction.java

来自「OBPM是一个开源」· Java 代码 · 共 84 行

JAVA
84
字号
package cn.myapps.core.dynaform.component.action;

import java.util.Collection;
import java.util.Iterator;

import cn.myapps.core.deploy.application.ejb.ApplicationProcess;
import cn.myapps.core.deploy.application.ejb.ApplicationVO;
import cn.myapps.core.dynaform.component.ejb.Component;
import cn.myapps.core.dynaform.form.action.FormAction;
import cn.myapps.core.dynaform.form.ejb.FormField;
import cn.myapps.util.ProcessFactory;
import cn.myapps.util.text.TemplateContext;

public class ComponentAction extends FormAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1395964549692071142L;

	private Collection fieldList;

	public ComponentAction() throws ClassNotFoundException {
		super(new Component());
	}

	public String doSelectList() throws Exception {
		return super.doList();
	}

	public String doFieldList() throws Exception {
		String id = (String) getParams().getParameter("id");

		Component comp = (Component) proxy.doView(id);
		if (comp != null) {
			fieldList = comp.getFields();

			for (Iterator iter = fieldList.iterator(); iter.hasNext();) {
				FormField field = (FormField) iter.next();
				TemplateContext context = TemplateContext
						.parse(field.getName());
				field.setName(context.toText());
			}
		} else {
			addFieldError("",
					"Could not find the component,please make sure it has already existed!");
		}

		return SUCCESS;
	}

	public String get_applicationid() {
		Component content = (Component) getContent();

		if (content.getApplication() != null) {
			return content.getApplication().getId();
		} else {
			return null;
		}
	}

	public void set_applicationid(String _applicationid) throws Exception {
		Component content = (Component) getContent();

		if (_applicationid != null) {
			ApplicationProcess ap = (ApplicationProcess) ProcessFactory
					.createProcess(ApplicationProcess.class);

			ApplicationVO app = (ApplicationVO) ap.doView(_applicationid);
			content.setApplication(app);
		} else {
			content.setApplication(null);
		}
	}

	public Collection getFieldList() {
		return fieldList;
	}

	public void setFieldList(Collection fieldList) {
		this.fieldList = fieldList;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?