⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expobject.java

📁 OBPM是一个开源
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package cn.myapps.core.expimp.exp.ejb;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.collections.map.LinkedMap;

import cn.myapps.base.action.ParamsTable;
import cn.myapps.base.dao.ValueObject;
import cn.myapps.base.ejb.BaseProcess;
import cn.myapps.constans.Environment;
import cn.myapps.core.deploy.application.ejb.ApplicationProcess;
import cn.myapps.core.deploy.module.ejb.ModuleProcess;
import cn.myapps.core.dynaform.component.ejb.ComponentProcess;
import cn.myapps.core.dynaform.dts.excelimport.config.ejb.IMPMappingConfigProcess;
import cn.myapps.core.dynaform.dts.exp.mappingconfig.ejb.MappingConfigProcess;
import cn.myapps.core.dynaform.form.ejb.FormProcess;
import cn.myapps.core.dynaform.view.ejb.ViewProcess;
import cn.myapps.core.image.repository.ejb.ImageRepositoryProcess;
import cn.myapps.core.macro.repository.ejb.RepositoryProcess;
import cn.myapps.core.page.ejb.PageProcess;
import cn.myapps.core.report.reportconfig.ejb.ReportConfigProcess;
import cn.myapps.core.resource.ejb.ResourceProcess;
import cn.myapps.core.style.repository.ejb.StyleRepositoryProcess;
import cn.myapps.core.workflow.storage.definition.ejb.BillDefiProcess;
import cn.myapps.util.ProcessFactory;

public class ExpObject {

	private boolean expAll = false; // 导出全部

	private boolean expDatas = false; // 导出数据

	private String[] appSelects = new String[0]; // 所选择的application

	private String[] moduleSelects = new String[0]; // 所选择的module

	private String[] resSelects = new String[0]; // 所选择的resource

	private String[] formSelects = new String[0]; // 所选择的form

	private String[] compSelects = new String[0]; // 所选择的component

	private String[] pageSelects = new String[0]; // 所选择的page

	private String[] viewSelects = new String[0]; // 所选择的view

	private String[] flowSelects = new String[0]; // 所选择的workflow

	private String[] stylibSelects = new String[0]; // 所选择的stylelib

	private String[] imglibSelects = new String[0]; // 所选择的imglib

	private String[] mcolibSelects = new String[0]; // 所选择的macrolib

	private String[] mappcfgSelects = new String[0]; // 所选择的mappingConfig

	private String[] repcfgSelects = new String[0]; // 所选择的reportConfig

	private String[] excelMappcfgSelects = new String[0]; // 所选择的excelMappcfg

	private boolean formRetView = false; // 是否导出form相关的views *

	private boolean formRetAct = false; // 是否导出form相关的activitys

	private boolean formRetDoc = false; // 是否导出form相关的documents

	private boolean formRetStyle = false; // 是否导出from相关的StyleRepository *

	private boolean flowRetAct = false; // 是否导出billdefi相关的activitys

	private boolean viewRetAct = false; // 是否导出view相关的activitys

	private boolean viewRetStyle = false; // 是否导出view相关的StyleRepository *

	private boolean viewRetColumn = false; // 是否导出view相关的column

	private boolean viewRetSform = false; // 是否导出view相关的searchForm

	private boolean repcfgRetTableCol = false; // 是否导出reportconfig相关的tablecolumn

	private boolean repcfgRetMappcfg = false; // 是否导出reportconfig相关的mappingconfig

	private boolean repcfgRetQuery = false; // 是否导出reportconfig相关的query

	private boolean repcfgRetForm = false; // 是否导出reportconfig相关的searchForm

	public Map getAllSQLs(String application) throws Exception {
		if (isExpAll()) {
			setSelects(application);
		}

		Map temp = new LinkedHashMap();

		HashSet ignoreids = new HashSet(1000);

		ExpApplication expApp = new ExpApplication(isExpAll());
		Map appSQLs = expApp.exportSQLS(appSelects, ignoreids);

		ExpModule expModule = new ExpModule(isExpAll());
		Map moduleSQLs = expModule.exportSQLS(moduleSelects, ignoreids);

		ExpResource expRes = new ExpResource(isExpAll());
		Map resSQLs = expRes.exportSQLS(resSelects, ignoreids);

		// 设置form关联
		ExpForm expForm = new ExpForm(isExpAll());
		expForm.setFormRetAct(this.isFormRetAct());
		expForm.setFormRetDoc(this.isFormRetDoc());
		expForm.setFormRetStyle(this.isFormRetStyle());
		expForm.setFormRetView(this.isFormRetView());
		Map formSQLs = expForm.exportSQLS(formSelects, ignoreids);

		// 设置component关联
		ExpComponent expComp = new ExpComponent(isExpAll());
		Map compSQLs = expComp.exportSQLS(compSelects, ignoreids);

		// 设置page关联
		ExpPage expPage = new ExpPage(isExpAll());
		Map pageSQLs = expPage.exportSQLS(pageSelects, ignoreids);

		// 设置view关联
		ExpView expView = new ExpView(isExpAll());
		expView.setViewRetAct(this.isViewRetAct());
		expView.setViewRetStyle(this.isViewRetStyle());
		expView.setViewRetColumn(this.isViewRetColumn());
		expView.setViewRetSform(this.isViewRetSform());
		Map viewSQLs = expView.exportSQLS(viewSelects, ignoreids);

		// 设置flow关联
		ExpBillDefi expFlow = new ExpBillDefi(isExpAll());
		expFlow.setFlowRetAct(this.isFlowRetAct());
		Map flowSQLs = expFlow.exportSQLS(flowSelects, ignoreids);

		// 设置stylelib
		ExpStyleRepository expStylelib = new ExpStyleRepository(isExpAll());
		Map styleSQLs = expStylelib.exportSQLS(stylibSelects, ignoreids);

		// 设置imagelib
		ExpImageRepository expImglib = new ExpImageRepository(isExpAll());
		Map imgLibSQLs = expImglib.exportSQLS(imglibSelects, ignoreids);

		// 设置mracolib
		ExpRepository expMacrolib = new ExpRepository(isExpAll());
		Map mcoLibSQLs = expMacrolib.exportSQLS(mcolibSelects, ignoreids);

		// 设置mappingconfig关联
		ExpMappingConfig expMappcfg = new ExpMappingConfig(isExpAll());
		expMappcfg.setRepcfgRetMappcfg(this.isRepcfgRetMappcfg());
		Map mappcfgSQLs = expMappcfg.exportSQLS(mappcfgSelects, ignoreids);

		// 设置reportconfig关联
		ExpReportConfig expRepcfg = new ExpReportConfig(isExpAll());
		expRepcfg.setRepcfgRetMappcfg(this.isRepcfgRetMappcfg());
		expRepcfg.setRepcfgRetQuery(this.isRepcfgRetQuery());
		expRepcfg.setRepcfgRetTableCol(this.isRepcfgRetTableCol());
		expRepcfg.setRepcfgRetForm(this.isRepcfgRetForm());
		Map repcfgSQLs = expRepcfg.exportSQLS(repcfgSelects, ignoreids);

		// 设置impmappingconfig
		ExpIMPMappingConfig expExcelMappcfg = new ExpIMPMappingConfig(
				isExpAll());
		Map excelMappcfgSQLs = expExcelMappcfg.exportSQLS(excelMappcfgSelects,
				ignoreids);

		// 设置document
		Map docSQLs = new LinkedMap();
		if (isFormRetDoc()) {
			docSQLs = new ExpDocument(isExpAll()).exportDocSQLS(formSelects,
					ignoreids);
		}

		temp.putAll(appSQLs);
		temp.putAll(moduleSQLs);
		temp.putAll(resSQLs);
		temp.putAll(formSQLs);
		temp.putAll(compSQLs);
		temp.putAll(pageSQLs);
		temp.putAll(viewSQLs);
		temp.putAll(flowSQLs);
		temp.putAll(styleSQLs);
		temp.putAll(imgLibSQLs);
		temp.putAll(mcoLibSQLs);
		temp.putAll(mappcfgSQLs);
		temp.putAll(repcfgSQLs);
		temp.putAll(excelMappcfgSQLs);
		temp.putAll(docSQLs);

		return temp;
	}

	/**
	 * @throws Exception
	 */
	public void setSelects(String application) throws Exception {
		// 设置application selects
		ApplicationProcess ap = (ApplicationProcess) ProcessFactory
				.createProcess(ApplicationProcess.class);
		setAppSelects(getSelects(ap, null, application));

		// 设置module selects
		ModuleProcess mp = (ModuleProcess) ProcessFactory
				.createProcess(ModuleProcess.class);
		setModuleSelects(getSelects(mp, null, application));

		// 设置resource selects
		ResourceProcess rp = (ResourceProcess) ProcessFactory
				.createProcess(ResourceProcess.class);
		setResSelects(getSelects(rp, null, application));

		// 设置form selects
		FormProcess fp = (FormProcess) ProcessFactory
				.createProcess(FormProcess.class);
		setFormSelects(getSelects(fp, null, application));

		// 设置component selects
		ComponentProcess cp = (ComponentProcess) ProcessFactory
				.createProcess(ComponentProcess.class);
		setCompSelects(getSelects(cp, null, application));

		// 设置page selects
		PageProcess pp = (PageProcess) ProcessFactory
				.createProcess(PageProcess.class);
		setPageSelects(getSelects(pp, null, application));

		// 设置view selects
		ViewProcess vp = (ViewProcess) ProcessFactory
				.createProcess(ViewProcess.class);
		setViewSelects(getSelects(vp, null, application));

		// 设置workflow selects
		BillDefiProcess bp = (BillDefiProcess) ProcessFactory
				.createProcess(BillDefiProcess.class);
		setFlowSelects(getSelects(bp, null, application));

		// 设置stylelib selects
		StyleRepositoryProcess srp = (StyleRepositoryProcess) ProcessFactory
				.createProcess(StyleRepositoryProcess.class);
		setStylibSelects(getSelects(srp, null, application));

		// 设置imglib selects
		ImageRepositoryProcess irp = (ImageRepositoryProcess) ProcessFactory
				.createProcess(ImageRepositoryProcess.class);
		setImglibSelects(getSelects(irp, null, application));

		// 设置mcolib selects
		RepositoryProcess rtp = (RepositoryProcess) ProcessFactory
				.createProcess(RepositoryProcess.class);
		setMcolibSelects(getSelects(rtp, null, application));

		// 设置mappcfg selects
		MappingConfigProcess mcp = (MappingConfigProcess) ProcessFactory
				.createProcess(MappingConfigProcess.class);
		setMappcfgSelects(getSelects(mcp, null, application));

		// 设置repcfg selects
		ReportConfigProcess rcp = (ReportConfigProcess) ProcessFactory
				.createProcess(ReportConfigProcess.class);
		setRepcfgSelects(getSelects(rcp, null, application));

		setRelation(isExpAll()); // 设置关联

		// 设置repcfg selects
		IMPMappingConfigProcess imcp = (IMPMappingConfigProcess) ProcessFactory
				.createProcess(IMPMappingConfigProcess.class);
		setRepcfgSelects(getSelects(imcp, null, application));

		setRelation(isExpAll()); // 设置关联
	}

	private String[] getSelects(BaseProcess proxy, ParamsTable params,
			String application) throws Exception {
		Collection colls = proxy.doSimpleQuery(params, application);

		// module和resource根据级联关系排序
		if (proxy instanceof ModuleProcess) {
			colls = ((ModuleProcess) proxy)
					.deepSearchModule(colls, null, "", 0);
		} else if (proxy instanceof ResourceProcess) {
			colls = ((ResourceProcess) proxy).deepSearchResouece(colls, null,
					"", 0);
		}

		String[] selects = new String[colls.size()];
		int count = 0;
		for (Iterator iter = colls.iterator(); iter.hasNext();) {

⌨️ 快捷键说明

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