package org.flhy.webapp.trans;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Toolkit;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.flhy.ext.App;
import org.flhy.ext.PluginFactory;
import org.flhy.ext.TransDebugExecutor;
import org.flhy.ext.TransExecutor;
import org.flhy.ext.base.GraphCodec;
import org.flhy.ext.core.ConditionCodec;
import org.flhy.ext.core.PropsUI;
import org.flhy.ext.core.database.DatabaseCodec;
import org.flhy.ext.trans.TransExecutionConfigurationCodec;
import org.flhy.ext.trans.step.StepEncoder;
import org.flhy.ext.utils.JSONArray;
import org.flhy.ext.utils.JSONObject;
import org.flhy.ext.utils.JsonUtils;
import org.flhy.ext.utils.StringEscapeHelper;
import org.flhy.ext.utils.SvgImageUrl;
import org.flhy.webapp.utils.GetSQLProgress;
import org.flhy.webapp.utils.SearchFieldsProgress;
import org.flhy.webapp.utils.TransPreviewProgress;
import org.pentaho.di.base.AbstractMeta;
import org.pentaho.di.core.CheckResultInterface;
import org.pentaho.di.core.CheckResultSourceInterface;
import org.pentaho.di.core.Condition;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.RowMetaAndData;
import org.pentaho.di.core.SQLStatement;
import org.pentaho.di.core.database.Database;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.logging.DefaultLogLevel;
import org.pentaho.di.core.logging.LoggingObjectInterface;
import org.pentaho.di.core.logging.LoggingObjectType;
import org.pentaho.di.core.logging.SimpleLoggingObject;
import org.pentaho.di.core.plugins.PluginInterface;
import org.pentaho.di.core.plugins.PluginRegistry;
import org.pentaho.di.core.plugins.StepPluginType;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMeta;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.xml.XMLHandler;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.repository.RepositorySecurityProvider;
import org.pentaho.di.trans.TransExecutionConfiguration;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.TransPreviewFactory;
import org.pentaho.di.trans.debug.StepDebugMeta;
import org.pentaho.di.trans.debug.TransDebugMeta;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.w3c.dom.Element;
import com.mxgraph.util.mxUtils;
@Controller
@RequestMapping(value="/trans")
public class TransGraphController {
@ResponseBody
@RequestMapping(method=RequestMethod.POST, value="/engineXml")
protected void engineXml(HttpServletRequest request, HttpServletResponse response, @RequestParam String graphXml) throws Exception {
GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.TRANS_CODEC);
AbstractMeta transMeta = codec.decode(graphXml);
String xml = XMLHandler.getXMLHeader() + transMeta.getXML();
response.setContentType("text/html; charset=utf-8");
response.getWriter().write(xml);
}
@ResponseBody
@RequestMapping(method=RequestMethod.POST, value="/database")
protected void database(@RequestParam String graphXml, String name) throws Exception {
GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.TRANS_CODEC);
TransMeta transMeta = (TransMeta) codec.decode(graphXml);
DatabaseMeta databaseMeta = transMeta.findDatabase(name);
if(databaseMeta == null)
databaseMeta = new DatabaseMeta();
JSONObject jsonObject = DatabaseCodec.encode(databaseMeta);
JsonUtils.response(jsonObject);
}
@ResponseBody
@RequestMapping(method=RequestMethod.POST, value="/save")
protected void save(HttpServletRequest request, HttpServletResponse response, @RequestParam String graphXml) throws Exception {
GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.TRANS_CODEC);
AbstractMeta transMeta = codec.decode(StringEscapeHelper.decode(graphXml));
Repository repository = App.getInstance().getRepository();
ObjectId existingId = repository.getTransformationID( transMeta.getName(), transMeta.getRepositoryDirectory() );
if(transMeta.getCreatedDate() == null)
transMeta.setCreatedDate(new Date());
if(transMeta.getObjectId() == null)
transMeta.setObjectId(existingId);
transMeta.setModifiedDate(new Date());
boolean versioningEnabled = true;
boolean versionCommentsEnabled = true;
String fullPath = transMeta.getRepositoryDirectory() + "/" + transMeta.getName() + transMeta.getRepositoryElementType().getExtension();
RepositorySecurityProvider repositorySecurityProvider = repository.getSecurityProvider() != null ? repository.getSecurityProvider() : null;
if ( repositorySecurityProvider != null ) {
versioningEnabled = repositorySecurityProvider.isVersioningEnabled( fullPath );
versionCommentsEnabled = repositorySecurityProvider.allowsVersionComments( fullPath );
}
String versionComment = null;
if (!versioningEnabled || !versionCommentsEnabled) {
versionComment = "";
} else {
versionComment = "no comment";
}
repository.save( transMeta, versionComment, null);
JsonUtils.success("转换保存成功!");
}
/**
* 校验这个转换
*
* @param graphXml
* @param show_successful_results
* @throws Exception
*/
@ResponseBody
@RequestMapping(method=RequestMethod.POST, value="/check")
protected void check(@RequestParam String graphXml, @RequestParam boolean show_successful_results) throws Exception {
GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.TRANS_CODEC);
TransMeta transMeta = (TransMeta) codec.decode(graphXml);
ArrayList<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
transMeta.checkSteps(remarks, false, null, transMeta, App.getInstance().getRepository(), App.getInstance().getMetaStore() );
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < remarks.size(); i++) {
CheckResultInterface cr = remarks.get(i);
if (show_successful_results || cr.getType() != CheckResultInterface.TYPE_RESULT_OK) {
JSONObject jsonObject = new JSONObject();
CheckResultSourceInterface sourceMeta = cr.getSourceInfo();
if (sourceMeta != null) {
jsonObject.put("name", sourceMeta.getName());
} else {
jsonObject.put("name", "<global>");
}
jsonObject.put("type", cr.getType());
jsonObject.put("typeDesc", cr.getTypeDesc());
jsonObject.put("text", cr.getText());
jsonArray.add(jsonObject);
}
}
JsonUtils.response(jsonArray);
}
@ResponseBody
@RequestMapping(method=RequestMethod.POST, value="/initPreview")
protected void initPreview(@RequestParam String graphXml, @RequestParam String selectedCells) throws Exception {
JSONArray cells = JSONArray.fromObject(URLDecoder.decode(selectedCells, "utf-8"));
HashSet hs = new HashSet();
hs.addAll(cells);
GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.TRANS_CODEC);
TransMeta transMeta = (TransMeta) codec.decode(graphXml);
transMeta.setRepository(App.getInstance().getRepository());
transMeta.setMetaStore(App.getInstance().getMetaStore());
TransExecutionConfiguration executionConfiguration = App.getInstance().getTransPreviewExecutionConfiguration();
executionConfiguration.setRepository(App.getInstance().getRepository());
executionConfiguration.setSafeModeEnabled(true);
TransDebugMeta transDebugMeta = transPreviewMetaMap.get(
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
项目概述:KettleWeb数据集成平台是一款基于Java与Web技术的开源数据集成工具。此平台源码基于Kettle原生版本6.1.0.1开发,扩展了Web端操作功能,便于用户进行数据集成工作。 技术栈:项目主要采用Java语言进行开发,同时整合了JavaScript、CSS等前端技术。 文件组成:总计2439个文件,其中包括: - 数据库相关文件:1066个(.db) - 图像文件:754个(.gif) - JavaScript脚本文件:159个(.js) - Java源代码文件:140个(.java) - 样式表文件:118个(.css) - PNG图像文件:105个(.png) - Photoshop设计文件:22个(.psd) - Kettle转换配置文件:12个(.ktr) - XML配置文件:11个(.xml) - 属性配置文件:10个(.properties) 简而言之,KettleWeb不仅保留了Kettle的核心功能,还通过Web界面为用户提供了便捷的数据集成体验,适合需要进行大量数据处理和分析的用户及团队使用。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java与Web技术的KettleWeb数据集成平台源码 (2000个子文件)
ext-all.css 136KB
ext-all-notheme.css 98KB
xtheme-access.css 40KB
xtheme-blue.css 38KB
xtheme-gray.css 38KB
yourtheme.css 37KB
form.css 11KB
grid.css 11KB
button.css 8KB
panel.css 8KB
tabs.css 7KB
grid.css 6KB
grid.css 6KB
grid.css 6KB
panel-reset.css 6KB
codemirror.css 6KB
core.css 5KB
toolbar.css 5KB
layout.css 5KB
date-picker.css 5KB
tree.css 4KB
menu.css 4KB
tree.css 4KB
form.css 4KB
window.css 3KB
tree.css 3KB
tree.css 3KB
common.css 3KB
button.css 3KB
ext-patch.css 3KB
toolbar.css 3KB
tabs.css 3KB
date-picker.css 3KB
editor.css 3KB
tabs.css 3KB
resizable.css 3KB
date-picker.css 3KB
date-picker.css 3KB
form.css 3KB
tabs.css 3KB
public.css 3KB
toolbar.css 3KB
toolbar.css 3KB
qtips.css 3KB
form.css 2KB
button.css 2KB
button.css 2KB
panel.css 2KB
panel.css 2KB
slider.css 2KB
panel.css 2KB
window.css 2KB
menu.css 2KB
window.css 2KB
window.css 2KB
core.css 2KB
resizable.css 2KB
resizable.css 2KB
core.css 2KB
resizable.css 2KB
menu.css 2KB
list-view.css 2KB
core.css 1KB
box.css 1KB
box.css 1KB
box.css 1KB
box.css 1KB
menu.css 1KB
Spinner.css 1KB
layout.css 1KB
layout.css 1KB
layout.css 1KB
pivotgrid.css 1KB
qtips.css 1KB
qtips.css 1KB
qtips.css 1KB
dialog.css 1KB
borders.css 1KB
dd.css 1006B
treegrid.css 940B
debug.css 917B
combo.css 895B
combo.css 889B
list-view.css 878B
combo.css 877B
dialog.css 811B
dialog.css 807B
dialog.css 800B
combo.css 787B
pivotgrid.css 781B
pivotgrid.css 780B
list-view.css 776B
progress.css 775B
list-view.css 772B
progress.css 759B
dd.css 639B
dd.css 638B
dd.css 638B
slider.css 635B
slider.css 632B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- twj4290531532024-05-03终于找到了超赞的宝藏资源,果断冲冲冲,支持!
沐知全栈开发
- 粉丝: 5810
- 资源: 5218
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功