├── src └── main │ ├── webapp │ ├── META-INF │ │ └── MANIFEST.MF │ ├── WEB-INF │ │ ├── iPage │ │ │ ├── footer.jsp │ │ │ ├── Comm │ │ │ │ ├── tags.jsp │ │ │ │ └── resource.jsp │ │ │ ├── header.jsp │ │ │ ├── Widget │ │ │ │ ├── Kettle │ │ │ │ │ ├── Result │ │ │ │ │ │ ├── text.jsp │ │ │ │ │ │ └── view.jsp │ │ │ │ │ └── Spoon │ │ │ │ │ │ ├── tree.jsp │ │ │ │ │ │ └── insert.jsp │ │ │ │ └── Quartz │ │ │ │ │ └── tree.jsp │ │ │ ├── topnav.jsp │ │ │ ├── subnav.jsp │ │ │ └── index.jsp │ │ └── web.xml │ └── Html │ │ ├── images │ │ ├── bg.png │ │ ├── cn.png │ │ ├── us.png │ │ ├── error.png │ │ ├── content.gif │ │ ├── favicon.ico │ │ ├── menu-bg.gif │ │ ├── shaddow.gif │ │ ├── menu-item.gif │ │ └── shaddow-hover.gif │ │ ├── css │ │ └── font │ │ │ ├── awesome.eot │ │ │ ├── awesome.otf │ │ │ ├── awesome.ttf │ │ │ └── awesome.woff │ │ ├── js │ │ ├── libs │ │ │ ├── zTree │ │ │ │ └── img │ │ │ │ │ ├── job.png │ │ │ │ │ ├── line.gif │ │ │ │ │ ├── repo.png │ │ │ │ │ ├── trans.png │ │ │ │ │ ├── zTree.gif │ │ │ │ │ ├── zTree.png │ │ │ │ │ ├── folder.png │ │ │ │ │ └── loading.gif │ │ │ └── url │ │ │ │ ├── cmg.md5.js │ │ │ │ ├── cmg.open.url.builder.paipai.js │ │ │ │ ├── cmg.open.url.builder.tianpin.js │ │ │ │ ├── cmg.open.url.builder.yihaodian.js │ │ │ │ ├── cmg.open.url.builder.jd.js │ │ │ │ ├── cmg.open.url.builder.coo8.js │ │ │ │ ├── cmg.open.url.builder.ehub.js │ │ │ │ ├── cmg.open.url.builder.dangdang.js │ │ │ │ └── cmg.open.url.builder.amazon.js │ │ ├── ui.plugin.js │ │ ├── ui.user.js │ │ └── messages │ │ │ ├── message_en_US.properties │ │ │ └── message_zh_CN.properties │ │ └── error.html │ ├── java │ └── org │ │ └── ukettle │ │ ├── basics │ │ ├── base │ │ │ ├── spring │ │ │ │ └── Controller.java │ │ │ ├── entity │ │ │ │ └── Entity.java │ │ │ ├── mapper │ │ │ │ ├── Mapper.java │ │ │ │ └── BaseMapper.java │ │ │ └── service │ │ │ │ ├── Service.java │ │ │ │ └── BaseService.java │ │ ├── page │ │ │ ├── dialect │ │ │ │ ├── DB.java │ │ │ │ ├── Dialect.java │ │ │ │ ├── db │ │ │ │ │ ├── SybaseDialect.java │ │ │ │ │ ├── DerbyDialect.java │ │ │ │ │ ├── H2Dialect.java │ │ │ │ │ ├── HSQLDialect.java │ │ │ │ │ ├── PostgreSQLDialect.java │ │ │ │ │ ├── MySQLDialect.java │ │ │ │ │ ├── SQLServerDialect.java │ │ │ │ │ └── OracleDialect.java │ │ │ │ └── Client.java │ │ │ ├── Paging.java │ │ │ ├── PageContext.java │ │ │ ├── proxy │ │ │ │ ├── PageConfiguration.java │ │ │ │ ├── PaginationMapperRegistry.java │ │ │ │ └── Pagination.java │ │ │ ├── Page.java │ │ │ ├── plugin │ │ │ │ └── PreparePaginationInterceptor.java │ │ │ └── Sorting.java │ │ └── shiro │ │ │ ├── extend │ │ │ ├── web │ │ │ │ ├── exception │ │ │ │ │ └── DefaultExceptionHandler.java │ │ │ │ └── Saved2Request.java │ │ │ ├── authc │ │ │ │ ├── UsernamePassword2Token.java │ │ │ │ └── HashedCredentials2Matcher.java │ │ │ ├── session │ │ │ │ └── DefaultSessionManager.java │ │ │ └── filter │ │ │ │ └── Authentication2Filter.java │ │ │ └── entity │ │ │ └── Shiro.java │ │ ├── www │ │ ├── https │ │ │ └── HTTPM.java │ │ ├── xstream │ │ │ └── annotations │ │ │ │ ├── XStream2Type.java │ │ │ │ └── XStream2Field.java │ │ ├── exception │ │ │ ├── CaptchaException.java │ │ │ └── uKettleException.java │ │ ├── serialize │ │ │ ├── JsonSerializer.java │ │ │ ├── ObjectSerializer.java │ │ │ ├── XmlSerializer.java │ │ │ ├── Serializer.java │ │ │ ├── FileSerializer.java │ │ │ └── Base64Serializer.java │ │ ├── toolkit │ │ │ ├── Blocking.java │ │ │ ├── spring │ │ │ │ └── SpringUtils.java │ │ │ ├── ListQueue.java │ │ │ └── Encode.java │ │ ├── locale │ │ │ └── Messages.java │ │ └── spring │ │ │ └── SpringUtils.java │ │ ├── system │ │ ├── service │ │ │ ├── RestService.java │ │ │ ├── RoleService.java │ │ │ ├── UserService.java │ │ │ ├── LocaleService.java │ │ │ ├── MenuService.java │ │ │ └── impl │ │ │ │ ├── RoleServiceImpl.java │ │ │ │ ├── RestServiceImpl.java │ │ │ │ ├── LocaleServiceImpl.java │ │ │ │ ├── UserServiceImpl.java │ │ │ │ └── MenuServiceImpl.java │ │ ├── entity │ │ │ ├── Role.java │ │ │ ├── User.java │ │ │ └── Menu.java │ │ ├── mapper │ │ │ ├── RestMapper.java │ │ │ ├── RoleMapper.java │ │ │ ├── UserMapper.java │ │ │ └── MenuMapper.java │ │ ├── spring │ │ │ ├── RoleController.java │ │ │ ├── LocaleController.java │ │ │ └── IndexController.java │ │ └── ibatis │ │ │ └── Role.Mapper.xml │ │ ├── widget │ │ ├── kettle │ │ │ ├── service │ │ │ │ ├── KettleLogsService.java │ │ │ │ ├── KettleResultService.java │ │ │ │ ├── KettleSpoonService.java │ │ │ │ ├── KettleTransService.java │ │ │ │ ├── KettleReposService.java │ │ │ │ ├── KettleJobService.java │ │ │ │ └── impl │ │ │ │ │ ├── KettleLogsServiceImpl.java │ │ │ │ │ └── KettleResultServiceImpl.java │ │ │ ├── mapper │ │ │ │ ├── KettleLogsMapper.java │ │ │ │ ├── KettleSpoonMapper.java │ │ │ │ ├── KettleResultMapper.java │ │ │ │ └── KettleReposMapper.java │ │ │ ├── entity │ │ │ │ ├── KettleLogs.java │ │ │ │ ├── KettleTree.java │ │ │ │ └── KettleRepos.java │ │ │ └── ibatis │ │ │ │ └── KettleLogs.Mapper.xml │ │ └── quartz │ │ │ ├── service │ │ │ ├── QuartzGroupService.java │ │ │ ├── JobFactoryService.java │ │ │ ├── impl │ │ │ │ └── QuartzGroupServiceImpl.java │ │ │ └── QuartzScheduleService.java │ │ │ ├── mapper │ │ │ ├── QuartzGroupMapper.java │ │ │ └── QuartzScheduleMapper.java │ │ │ ├── entity │ │ │ ├── QuartzQueue.java │ │ │ └── QuartzGroup.java │ │ │ └── ibatis │ │ │ ├── QuartzSchedule.Mapper.xml │ │ │ └── QuartzGroup.Mapper.xml │ │ ├── Version.java │ │ ├── service │ │ ├── router │ │ │ ├── mapper │ │ │ │ └── RouterMapper.java │ │ │ ├── service │ │ │ │ └── RouterService.java │ │ │ ├── spring │ │ │ │ └── RouterController.java │ │ │ └── entity │ │ │ │ └── Message.java │ │ └── execute │ │ │ ├── KettleExecService.java │ │ │ └── AgainExecService.java │ │ └── engine │ │ └── loader │ │ ├── BasicService.java │ │ └── BasicMapper.java │ └── resources │ ├── shiro-ehcache.xml │ ├── www.properties │ ├── sqlMapConfig.xml │ ├── spring-quartz.xml │ └── log4j.xml ├── README.md └── .gitignore /src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/footer.jsp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/webapp/Html/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/bg.png -------------------------------------------------------------------------------- /src/main/webapp/Html/images/cn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/cn.png -------------------------------------------------------------------------------- /src/main/webapp/Html/images/us.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/us.png -------------------------------------------------------------------------------- /src/main/webapp/Html/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/error.png -------------------------------------------------------------------------------- /src/main/webapp/Html/images/content.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/content.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/Html/images/menu-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/menu-bg.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/images/shaddow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/shaddow.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/css/font/awesome.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/css/font/awesome.eot -------------------------------------------------------------------------------- /src/main/webapp/Html/css/font/awesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/css/font/awesome.otf -------------------------------------------------------------------------------- /src/main/webapp/Html/css/font/awesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/css/font/awesome.ttf -------------------------------------------------------------------------------- /src/main/webapp/Html/css/font/awesome.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/css/font/awesome.woff -------------------------------------------------------------------------------- /src/main/webapp/Html/images/menu-item.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/menu-item.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/images/shaddow-hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/images/shaddow-hover.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/job.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/job.png -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/line.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/repo.png -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/trans.png -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/zTree.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/zTree.gif -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/zTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/zTree.png -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/folder.png -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/zTree/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aoju/kettle/HEAD/src/main/webapp/Html/js/libs/zTree/img/loading.gif -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/spring/Controller.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.spring; 2 | 3 | 4 | public class Controller { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/https/HTTPM.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.https; 2 | 3 | /** 4 | * Represents the possible HTTP request methods. 5 | * 6 | */ 7 | public enum HTTPM { 8 | GET, POST, PUT, DELETE; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/RestService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface RestService extends BaseService { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface RoleService extends BaseService { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/UserService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface UserService extends BaseService { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pentaho | China 2 | 3 | Kettle Online Business Intelligence Platform 4 | 5 | 6 | QQ Group:227385701 7 | 8 | Forum:http://www.uKettle.org 9 | 10 | Weibo:http://weibo.com/ukettle 11 | 12 | Running: update pom.xml database info -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleLogsService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface KettleLogsService extends BaseService { 6 | 7 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/service/QuartzGroupService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface QuartzGroupService extends BaseService { 6 | 7 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/Version.java: -------------------------------------------------------------------------------- 1 | package org.ukettle; 2 | 3 | public final class Version { 4 | 5 | private static final String version = "1.0.3.3"; 6 | 7 | public static String getVersion() { 8 | return version; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleResultService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface KettleResultService extends BaseService { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/entity/Role.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.entity; 2 | 3 | import org.ukettle.basics.base.entity.BaseEntity; 4 | 5 | public class Role extends BaseEntity { 6 | 7 | private static final long serialVersionUID = 5158129365652318940L; 8 | 9 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/entity/Entity.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public abstract class Entity implements Serializable { 6 | 7 | private static final long serialVersionUID = -1826225811608199693L; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/mapper/RestMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | 7 | @Repository 8 | public interface RestMapper extends BaseMapper { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | 7 | @Repository 8 | public interface RoleMapper extends BaseMapper { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | import org.ukettle.basics.base.mapper.BaseMapper; 6 | 7 | 8 | @Repository 9 | public interface UserMapper extends BaseMapper{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/router/mapper/RouterMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.router.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | 7 | @Repository 8 | public interface RouterMapper extends BaseMapper { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/mapper/KettleLogsMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | @Repository 7 | public interface KettleLogsMapper extends BaseMapper { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/mapper/KettleSpoonMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | @Repository 7 | public interface KettleSpoonMapper extends BaseMapper { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/mapper/QuartzGroupMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | import org.ukettle.basics.base.mapper.BaseMapper; 5 | 6 | @Repository 7 | public interface QuartzGroupMapper extends BaseMapper { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/mapper/Mapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.mapper; 2 | 3 | 4 | /** 5 | *

6 | * Mapper 接口 7 | *

8 | * 9 | * @author Kimi Liu 10 | * @Date Mar 12, 2014 11 | * @Time 10:16:25 12 | * @email 839536@QQ.com 13 | * @version 1.0 14 | * @since JDK 1.6 15 | */ 16 | public interface Mapper { 17 | 18 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/mapper/KettleResultMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.mapper; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | import org.ukettle.basics.base.mapper.BaseMapper; 6 | 7 | @Repository 8 | public interface KettleResultMapper extends BaseMapper { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/service/Service.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.service; 2 | 3 | 4 | /** 5 | *

6 | * Service 接口. 7 | *

8 | * 9 | * @author Kimi Liu 10 | * @Date Mar 12, 2014 11 | * @Time 10:13:56 12 | * @email 839536@QQ.com 13 | * @version 1.0 14 | * @since JDK 1.6 15 | */ 16 | public interface Service { 17 | 18 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Comm/tags.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %> -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/DB.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect; 2 | 3 | /** 4 | * @author Kimi Liu 5 | * @Date Apr 19, 2014 6 | * @Time 09:12:51 7 | * @email 839536@QQ.com 8 | * @version 1.0 9 | * @since JDK 1.6 10 | */ 11 | public enum DB { 12 | MYSQL, ORACLE, DB2, H2, HSQL, POSTGRE, SQLSERVER, SQLSERVER2005, SYBASE, 13 | // 自定义 14 | EX 15 | } 16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 |

3 |
-------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/spring/RoleController.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.spring; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.ukettle.engine.loader.BasicController; 7 | 8 | @Controller 9 | @RequestMapping(BasicController.VIEW_SYSTEM + BasicController.VIEW_ROLE) 10 | public class RoleController extends BasicController { 11 | 12 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleSpoonService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import org.ukettle.basics.base.service.BaseService; 4 | 5 | public interface KettleSpoonService extends BaseService { 6 | 7 | /** 8 | * 功能描述:执行JOB或者Trans 9 | * 10 | * @param entity 11 | * Object 参数对象 12 | * @return object 非法参数等信息 13 | */ 14 | public Object execute(T entity); 15 | 16 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/mapper/QuartzScheduleMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.mapper; 2 | 3 | import org.springframework.dao.DataAccessException; 4 | import org.springframework.stereotype.Repository; 5 | import org.ukettle.basics.base.mapper.BaseMapper; 6 | 7 | @Repository 8 | public interface QuartzScheduleMapper extends BaseMapper { 9 | 10 | public T exists(T entity) throws DataAccessException; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Widget/Kettle/Result/text.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="../../../Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/shiro-ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/mapper/KettleReposMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.mapper; 2 | 3 | import org.springframework.dao.DataAccessException; 4 | import org.springframework.stereotype.Repository; 5 | import org.ukettle.basics.base.mapper.BaseMapper; 6 | 7 | @Repository 8 | public interface KettleReposMapper extends BaseMapper { 9 | 10 | /** 11 | * 功能描述:查询对象 12 | * 13 | * @param entity 14 | * Object 查询条件 15 | * @return T 返回单个对象 16 | */ 17 | public T selectById(String id) throws DataAccessException; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/xstream/annotations/XStream2Type.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.xstream.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 功能描述:注解标签 10 | * 11 | * @author Kimi Liu 12 | * @Date May 11, 2014 13 | * @Time 10:10:09 14 | * @email 839536@QQ.com 15 | * @version 1.0 16 | * @since JDK 1.6 17 | */ 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Target({ ElementType.TYPE }) 20 | public @interface XStream2Type { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/entity/QuartzQueue.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.entity; 2 | 3 | import org.ukettle.widget.kettle.entity.KettleSpoon; 4 | 5 | 6 | public class QuartzQueue { 7 | 8 | private T entity; 9 | 10 | private long startTime; 11 | 12 | public T getEntity() { 13 | return entity; 14 | } 15 | 16 | public void setEntity(T entity) { 17 | this.entity = entity; 18 | } 19 | 20 | public long getStartTime() { 21 | return startTime; 22 | } 23 | 24 | public void setStartTime(long startTime) { 25 | this.startTime = startTime; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/xstream/annotations/XStream2Field.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.xstream.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 功能描述:注解属性 10 | * 11 | * @author Kimi Liu 12 | * @Date May 10, 2014 13 | * @Time 18:21:53 14 | * @email 839536@QQ.com 15 | * @version 1.0 16 | * @since JDK 1.6 17 | */ 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Target({ ElementType.FIELD }) 20 | public @interface XStream2Field { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/exception/CaptchaException.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.exception; 2 | 3 | import org.apache.shiro.authc.AuthenticationException; 4 | 5 | public class CaptchaException extends AuthenticationException { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | public CaptchaException() { 10 | super(); 11 | } 12 | 13 | public CaptchaException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | 17 | public CaptchaException(String message) { 18 | super(message); 19 | } 20 | 21 | public CaptchaException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/LocaleService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service; 2 | 3 | import java.util.Locale; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.springframework.context.MessageSource; 9 | 10 | public interface LocaleService { 11 | 12 | public void setMessages(MessageSource messages); 13 | 14 | public String getMessage(String key, Locale locale); 15 | 16 | public Locale resolveLocale(HttpServletRequest request); 17 | 18 | public String locale(HttpServletRequest request, 19 | HttpServletResponse response, Locale locale); 20 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | 24 |
25 |
26 |
27 | 28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/topnav.jsp: -------------------------------------------------------------------------------- 1 |
  • 2 |
  • 3 |
  • 4 |
  • 5 |
  • -------------------------------------------------------------------------------- /src/main/webapp/Html/js/ui.plugin.js: -------------------------------------------------------------------------------- 1 | var plugin = {}; 2 | 3 | plugin.locale = function(language){ 4 | $.i18n.init({ 5 | name:'message', 6 | path:ctx+'/Html/js/messages/', 7 | language: language, 8 | mode:'map', 9 | encoding: 'UTF-8', 10 | callback: function() { 11 | } 12 | }); 13 | }; 14 | plugin.isWidthChar = function(val) { 15 | var pattern = /^[a-zA-Z]([a-zA-Z0-9]|[_]){6,64}$/; 16 | return pattern.exec(val); 17 | }; 18 | plugin.language = function(val) { 19 | $.post(ctx+"/Locale?language="+val+"&url="+location.href, function(data) {}); 20 | window.location.reload(); 21 | }; 22 | $(function(){ 23 | plugin.locale(language); 24 | }); -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/ibatis/QuartzSchedule.Mapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/subnav.jsp: -------------------------------------------------------------------------------- 1 |
      2 |
    • 3 |
    • 4 |
    • 5 |
    • 6 |
    • 7 |
    -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/JsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | import com.thoughtworks.xstream.XStream; 4 | import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver; 5 | 6 | public class JsonSerializer extends ObjectSerializer { 7 | 8 | public String serialize(Object object) { 9 | XStream xstream = new XStream(new JettisonMappedXmlDriver()); 10 | xstream.processAnnotations(object.getClass()); 11 | return xstream.toXML(object); 12 | } 13 | 14 | public Object deserialize(String json) { 15 | XStream xstream = new XStream(new JettisonMappedXmlDriver()); 16 | return xstream.fromXML(json); 17 | } 18 | 19 | public String getContentType() { 20 | return TYPE_JSON_UTF8; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/ObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | /** 4 | * 功能描述:序列化、反序列化 5 | * 6 | * @author Kimi Liu 7 | * @Date Mar 09, 2014 8 | * @Time 20:33:21 9 | * @email 839536@QQ.com 10 | * @version 1.0 11 | * @since JDK 1.6 12 | */ 13 | public abstract class ObjectSerializer extends Serializer { 14 | 15 | /** 16 | * 序列化一个对象 17 | * 18 | * @param object 19 | * 对象序列化。 20 | * @return 反序列化的对象的String。 21 | */ 22 | public abstract String serialize(Object object); 23 | 24 | /** 25 | * 反序列化一个对象 26 | * 27 | * @param string 28 | * 反序列化对象的字符串表示形式。 29 | * @return an Object. 反序列化后对象Object 30 | */ 31 | public abstract Object deserialize(String string); 32 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/Paging.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.TYPE; 8 | 9 | /** 10 | *

    11 | * 分页注解,当需要对实体进行分页处理时,对其进行设置. 12 | * 只支持在类声明上进行设置 13 | *

    14 | * 15 | * @author Kimi Liu 16 | * @Date Aug 21, 2014 17 | * @Time 12:13:20 18 | * @email 839536@QQ.com 19 | * @version 1.0 20 | * @since JDK 1.6 21 | */ 22 | @Target({TYPE}) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | public @interface Paging { 25 | /** 26 | * 分页对象的属性名称, 27 | * 也就是在当参数传递对象时,需要进行设置{@link} 的属性名称 28 | * 29 | * @return 分页对象的属性名称,默认page 30 | */ 31 | String field() default "page"; 32 | 33 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/XmlSerializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | import com.thoughtworks.xstream.XStream; 4 | 5 | /** 6 | * 功能描述:序列化、反序列化 7 | * 8 | * @author Kimi Liu 9 | * @Date Mar 10, 2014 10 | * @Time 00:21:09 11 | * @email 839536@QQ.com 12 | * @version 1.0 13 | * @since JDK 1.6 14 | */ 15 | public class XmlSerializer extends ObjectSerializer { 16 | 17 | public String serialize(Object object) { 18 | XStream xstream = new XStream(); 19 | xstream.processAnnotations(object.getClass()); 20 | return xstream.toXML(object); 21 | } 22 | 23 | public Object deserialize(String string) { 24 | XStream xstream = new XStream(); 25 | return xstream.fromXML(string); 26 | } 27 | 28 | public String getContentType() { 29 | return TYPE_XML_UTF8; 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/ui.user.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $("#iUser").click(function() { 3 | var name = $.trim($("#name").val()); 4 | if (!name) { 5 | alert($.i18n.get('org.ukettle.iQuartz.Verify.User.Name')); 6 | return false; 7 | } 8 | var reg = /^(?:[a-z\d]+[_\-\+\.]?)*[a-z\d]+@(?:([a-z\d]+\-?)*[a-z\d]+\.)+([a-z]{2,})+$/i; 9 | var email = $.trim($("#email").val()); 10 | if(!reg.test(email)){ 11 | alert($.i18n.get('org.ukettle.iQuartz.Verify.User.Email')); 12 | return false; 13 | } 14 | var password = $.trim($("#password").val()); 15 | var password1 = $.trim($("#password1").val()); 16 | if (!password || !password1 || password != password1) { 17 | alert($.i18n.get('org.ukettle.iQuartz.Verify.User.Password')); 18 | return false; 19 | } 20 | $('#formId').submit(); 21 | }); 22 | }); -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/MenuService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.base.service.BaseService; 6 | 7 | 8 | public interface MenuService extends BaseService { 9 | 10 | /** 11 | * 功能描述:查询下级和下级子菜单 12 | * 13 | * @param entity 14 | * Object 查询条件 15 | * @return List 返回多个对象 16 | */ 17 | public List selectById(T entity); 18 | 19 | /** 20 | * 功能描述:查询本级和子菜单 21 | * 22 | * @param entity 23 | * Object 查询条件 24 | * @return List 返回多个对象 25 | */ 26 | public List selectByPid(T entity); 27 | 28 | /** 29 | * 功能描述:查询微信帐号菜单 30 | * 31 | * @param entity 32 | * Object 查询条件 33 | * @return List 返回多个对象 34 | */ 35 | public List selectByUid(T entity); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/Serializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | /** 4 | * 功能描述:信息序列化 5 | * 6 | * @author Kimi Liu 7 | * @Date Mar 10, 2014 8 | * @Time 00:21:09 9 | * @email 839536@QQ.com 10 | * @version 1.0 11 | * @since JDK 1.6 12 | */ 13 | public abstract class Serializer { 14 | 15 | public static String TYPE_TEXT_UTF8 = "text/plain; charset=UTF-8"; 16 | public static String TYPE_JSON_UTF8 = "application/json; charset=UTF-8"; 17 | public static String TYPE_XML_UTF8 = "text/xml; charset=UTF-8"; 18 | public static String TYPE_BINARY_UTF8 = "application/octet-stream; charset=UTF-8"; 19 | public static String TYPE_STREAM_UTF8 = "application/octet-stream; charset=UTF-8"; 20 | 21 | /** 22 | * 功能描述:获取输出类型 23 | * 24 | * @return String 输出类型 25 | */ 26 | public abstract String getContentType(); 27 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/toolkit/Blocking.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.toolkit; 2 | 3 | import org.ukettle.widget.kettle.entity.KettleSpoon; 4 | 5 | public class Blocking { 6 | 7 | /** 8 | * 控制整个kettle有多少个job执行,如果超过设置的最大值,则加入该队列。 9 | */ 10 | private static ListQueue jobQueue = new ListQueue(); 11 | 12 | public static final int DEFAULT_KETTLE_WORKER_THREAD_NUMS = 6; 13 | 14 | public static final int DEFAULT_EKETTLE_JOB_RUNNING_TIME = 4 * 60 * 1000; 15 | 16 | public static void addToWaitingQueue(KettleSpoon obj) { 17 | jobQueue.offer(obj); 18 | } 19 | 20 | public static KettleSpoon getObjectFromWaitingQueue() 21 | throws InterruptedException { 22 | return jobQueue.take(); 23 | } 24 | 25 | public static void clean() { 26 | jobQueue.clear(); 27 | } 28 | 29 | public static int jobSize() { 30 | return jobQueue.size(); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/FileSerializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.OutputStream; 8 | 9 | public class FileSerializer extends Serializer { 10 | 11 | public String getContentType() { 12 | return TYPE_STREAM_UTF8; 13 | } 14 | 15 | public void sendFile(File file, OutputStream os) throws IOException { 16 | FileInputStream is = null; 17 | BufferedInputStream buf = null; 18 | try { 19 | is = new FileInputStream(file); 20 | buf = new BufferedInputStream(is); 21 | int readBytes = 0; 22 | while ((readBytes = buf.read()) != -1) { 23 | os.write(readBytes); 24 | } 25 | os.flush(); 26 | } finally { 27 | if (is != null) { 28 | is.close(); 29 | } 30 | if (buf != null) { 31 | buf.close(); 32 | } 33 | } 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.md5.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var StringBuffer = java.lang.StringBuffer; 3 | var Integer = java.lang.Integer; 4 | 5 | 6 | function CMGMD5(){} 7 | 8 | CMGMD5.prototype.encrypt = function (strSource) { 9 | var algorithm = MessageDigest.getInstance("MD5"); 10 | 11 | // get the input as bytes 12 | var bytes = new java.lang.String(strSource).getBytes("UTF-8"); 13 | 14 | // calculate the digest 15 | algorithm.reset(); 16 | algorithm.update(bytes); 17 | var md5Digest = algorithm.digest(); 18 | 19 | // turn the digest into a hex-string representation 20 | var hexString = new StringBuffer(); 21 | 22 | for (var i = 0; i < md5Digest.length; i++){ 23 | var hex = Integer.toHexString(md5Digest[i] & 0XFF); 24 | if (hex.length() == 1){ 25 | hexString.append('0').append(""); 26 | } 27 | hexString.append(hex); 28 | } 29 | 30 | // write output value 31 | return hexString.toString(); 32 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/PageContext.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page; 2 | 3 | /** 4 | *

    5 | * 分页参数上下文. 6 | *

    7 | * 8 | * @author Kimi Liu 9 | * @Date Aug 21, 2014 10 | * @Time 10:13:40 11 | * @email 839536@QQ.com 12 | * @version 1.0 13 | * @since JDK 1.6 14 | */ 15 | public class PageContext extends Pagination { 16 | 17 | private static final long serialVersionUID = -3294902812084550562L; 18 | 19 | /** 20 | * 分页参数上下文, 21 | */ 22 | private static final ThreadLocal PAGE_CONTEXT_THREAD_LOCAL = new ThreadLocal(); 23 | 24 | /** 25 | * 取得当前的分页参数上下文 26 | * 27 | * @return 分页参数上下文 28 | */ 29 | public static PageContext getPageContext() { 30 | PageContext ci = PAGE_CONTEXT_THREAD_LOCAL.get(); 31 | if (ci == null) { 32 | ci = new PageContext(); 33 | PAGE_CONTEXT_THREAD_LOCAL.set(ci); 34 | } 35 | return ci; 36 | } 37 | 38 | /** 39 | * 清理分页参数上下文 40 | */ 41 | public static void clear() { 42 | PAGE_CONTEXT_THREAD_LOCAL.remove(); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.mapper; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.dao.DataAccessException; 6 | import org.springframework.stereotype.Repository; 7 | import org.ukettle.basics.base.mapper.BaseMapper; 8 | 9 | 10 | @Repository 11 | public interface MenuMapper extends BaseMapper { 12 | 13 | /** 14 | * 功能描述:查询下级和下级子菜单 15 | * 16 | * @param entity 17 | * Object 查询条件 18 | * @return List 返回多个对象 19 | */ 20 | public List selectById(T entity) throws DataAccessException; 21 | 22 | /** 23 | * 功能描述:查询本级和子菜单 24 | * 25 | * @param entity 26 | * Object 查询条件 27 | * @return List 返回多个对象 28 | */ 29 | public List selectByPid(T entity) throws DataAccessException; 30 | 31 | /** 32 | * 功能描述:查询微信帐号菜单 33 | * 34 | * @param entity 35 | * Object 查询条件 36 | * @return List 返回多个对象 37 | */ 38 | public List selectByUid(T entity) throws DataAccessException; 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/spring/LocaleController.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.spring; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.ukettle.engine.loader.BasicController; 10 | import org.ukettle.www.locale.Messages; 11 | 12 | @Controller 13 | @RequestMapping(value = BasicController.VIEW_LOCALE) 14 | public class LocaleController extends BasicController { 15 | 16 | /** 17 | * 如果language符合中文、英语等,那么就改变,否则使用浏览器默认的语言 18 | * 19 | * @param language 20 | * 选择的语言 21 | * @param rurl 22 | * 跳转的url 23 | * @return 跳转的url 24 | */ 25 | @RequestMapping(method = RequestMethod.POST) 26 | public void language(HttpServletRequest request, 27 | HttpServletResponse response) { 28 | Messages.locale(request, response, null); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | # intellij files 9 | .idea/ 10 | *.iml 11 | *.ipr 12 | *.iws 13 | build-idea/ 14 | 15 | # eclipse files 16 | .project 17 | .classpath 18 | .settings 19 | build-eclipse/ 20 | 21 | # netbeans files 22 | nb-configuration.xml 23 | nbactions.xml 24 | 25 | # gradle stuff 26 | .gradle/ 27 | build/ 28 | 29 | # gradle wrapper 30 | /gradle/ 31 | gradlew 32 | gradlew.bat 33 | 34 | # maven stuff (to be removed when trunk becomes 4.x) 35 | *-execution-hints.log 36 | target/ 37 | dependency-reduced-pom.xml 38 | 39 | # testing stuff 40 | **/.local* 41 | .vagrant/ 42 | /logs/ 43 | 44 | # osx stuff 45 | .DS_Store 46 | 47 | # default folders in which the create_bwc_index.py expects to find old es versions in 48 | /backwards 49 | /dev-tools/backwards 50 | 51 | # needed in case docs build is run...maybe we can configure doc build to generate files under build? 52 | html_docs 53 | 54 | # random old stuff that we should look at the necessity of... 55 | /tmp/ 56 | eclipse-build -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/router/service/RouterService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.router.service; 2 | 3 | import java.util.List; 4 | 5 | public interface RouterService { 6 | 7 | /** 8 | * 功能描述:查询对象 9 | * 10 | * @param entity 11 | * Object 查询条件 12 | * @return T 返回单个对象 13 | */ 14 | public Object select(T entity); 15 | 16 | /** 17 | * 功能描述:查询对象 18 | * 19 | * @param entity 20 | * Object 查询条件 21 | * @return List 返回多个对象 22 | */ 23 | public List selectByWhere(T entity); 24 | 25 | /** 26 | * 功能描述:查询对象 27 | * 28 | * @param entity 29 | * Object 查询条件 30 | * @return List 返回多个对象 31 | */ 32 | public void on(T entity); 33 | 34 | /** 35 | * 功能描述:请求转发 36 | * 37 | * @param entity 38 | * Object 条件 39 | */ 40 | public void forward(T entity); 41 | 42 | /** 43 | * 功能描述:验证所有信息 44 | * 45 | * @param entity 46 | * Object 条件 47 | * @return Object 返回处理结果(对象) 48 | */ 49 | public boolean isValid(T entity); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/proxy/PageConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.proxy; 2 | 3 | import org.apache.ibatis.binding.MapperRegistry; 4 | import org.apache.ibatis.session.Configuration; 5 | import org.apache.ibatis.session.SqlSession; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | *

    10 | * 自定义Mybatis的配置,扩展. 11 | *

    12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 25, 2014 15 | * @Time 10:13:40 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | @SuppressWarnings("all") 21 | @Component 22 | public class PageConfiguration extends Configuration { 23 | 24 | protected MapperRegistry mapperRegistry = new PaginationMapperRegistry(this); 25 | 26 | public void addMapper(Class type) { 27 | mapperRegistry.addMapper(type); 28 | } 29 | 30 | public T getMapper(Class type, SqlSession sqlSession) { 31 | return mapperRegistry.getMapper(type, sqlSession); 32 | } 33 | 34 | public boolean hasMapper(Class type) { 35 | return mapperRegistry.hasMapper(type); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/web/exception/DefaultExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.web.exception; 2 | 3 | import org.apache.shiro.authz.UnauthorizedException; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.ResponseStatus; 8 | import org.springframework.web.context.request.NativeWebRequest; 9 | import org.springframework.web.servlet.ModelAndView; 10 | 11 | @ControllerAdvice 12 | public class DefaultExceptionHandler { 13 | /** 14 | * 没有权限 异常
    15 | * 后续根据不同的需求定制即可 16 | */ 17 | @ExceptionHandler({ UnauthorizedException.class }) 18 | @ResponseStatus(HttpStatus.UNAUTHORIZED) 19 | public ModelAndView processUnauthenticatedException( 20 | NativeWebRequest request, UnauthorizedException e) { 21 | ModelAndView mv = new ModelAndView(); 22 | mv.addObject("exception", e); 23 | mv.setViewName("unauthorized"); 24 | return mv; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/authc/UsernamePassword2Token.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.authc; 2 | 3 | import org.apache.shiro.authc.UsernamePasswordToken; 4 | 5 | /** 6 | * extends UsernamePasswordToken 7 | */ 8 | public class UsernamePassword2Token extends UsernamePasswordToken { 9 | 10 | private static final long serialVersionUID = 1L; 11 | private String captcha; 12 | private String locale; 13 | 14 | public String getCaptcha() { 15 | return captcha; 16 | } 17 | 18 | public void setCaptcha(String captcha) { 19 | this.captcha = captcha; 20 | } 21 | 22 | public String getLocale() { 23 | return locale; 24 | } 25 | 26 | public void setLocale(String locale) { 27 | this.locale = locale; 28 | } 29 | 30 | public UsernamePassword2Token() { 31 | super(); 32 | } 33 | 34 | public UsernamePassword2Token(String username, char[] password, 35 | boolean rememberMe, String host, String locale, String captcha) { 36 | super(username, password, rememberMe, host); 37 | this.locale = locale; 38 | this.captcha = captcha; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/proxy/PaginationMapperRegistry.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.proxy; 2 | 3 | import org.apache.ibatis.binding.BindingException; 4 | import org.apache.ibatis.binding.MapperRegistry; 5 | import org.apache.ibatis.session.Configuration; 6 | import org.apache.ibatis.session.SqlSession; 7 | 8 | /** 9 | * 10 | * @author Kimi Liu 11 | * @Date Aug 22, 2014 12 | * @Time 11:31:11 13 | * @email 839536@QQ.com 14 | * @version 1.0 15 | * @since JDK 1.6 16 | */ 17 | public class PaginationMapperRegistry extends MapperRegistry { 18 | public PaginationMapperRegistry(Configuration config) { 19 | super(config); 20 | } 21 | 22 | @Override 23 | public T getMapper(Class type, SqlSession sqlSession) { 24 | if (!hasMapper(type)) { 25 | throw new BindingException("Type " + type 26 | + " is not known to the MapperRegistry."); 27 | } 28 | try { 29 | return PaginationMapperProxy.newMapperProxy(type, sqlSession); 30 | } catch (Exception e) { 31 | throw new BindingException("Error getting mapper instance. Cause: " 32 | + e, e); 33 | } 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Comm/resource.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%request.setAttribute("ctx",request.getContextPath());%><%request.getSession().getAttribute("language");%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/Dialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | 7 | 8 | /** 9 | * 类似hibernate的Dialect,但只精简出分页部分 10 | * 11 | * @author Kimi Liu 12 | * @Date Aug 18, 2014 13 | * @Time 10:09:12 14 | * @email 839536@QQ.com 15 | * @version 1.0 16 | * @since JDK 1.6 17 | */ 18 | public interface Dialect { 19 | 20 | /** 21 | * 数据库本身是否支持分页当前的分页查询方式 22 | * 如果数据库不支持的话,则不进行数据库分页 23 | * 24 | * @return true:支持当前的分页查询方式 25 | */ 26 | public boolean limit(); 27 | 28 | /** 29 | * 将sql转换为分页SQL,分别调用分页sql 30 | * 31 | * @param sql SQL语句 32 | * @param offset 开始条数 33 | * @param limit 每页显示多少纪录条数 34 | * @return 分页查询的sql 35 | */ 36 | public String getLimit(String sql, int offset, int limit); 37 | 38 | /** 39 | * 将sql转换为总记录数SQL 40 | * @param sql SQL语句 41 | * @return 总记录数的sql 42 | */ 43 | public String getCount(String sql); 44 | /** 45 | * 将sql转换为带排序的SQL 46 | * @param sql SQL语句 47 | * @return 总记录数的sql 48 | */ 49 | public String getSort(String sql, List sort); 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/entity/KettleLogs.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.entity; 2 | 3 | import org.ukettle.basics.base.entity.BaseEntity; 4 | 5 | public class KettleLogs extends BaseEntity { 6 | 7 | private static final long serialVersionUID = 2116625402456316153L; 8 | 9 | private String mid; 10 | private String logs; 11 | 12 | public void setValue(String key, String strVal) { 13 | super.setValue(key, strVal); 14 | if ("mid".equals(key)) { 15 | this.setMid(strVal); 16 | } 17 | } 18 | 19 | public String getId() { 20 | return id; 21 | } 22 | 23 | public void setId(String id) { 24 | this.id = id; 25 | } 26 | 27 | public String getMid() { 28 | return mid; 29 | } 30 | 31 | public void setMid(String mid) { 32 | this.mid = mid; 33 | } 34 | 35 | public String getLogs() { 36 | return logs; 37 | } 38 | 39 | public void setLogs(String logs) { 40 | this.logs = logs; 41 | } 42 | 43 | public String getCreator() { 44 | return creator; 45 | } 46 | 47 | public void setCreator(String creator) { 48 | this.creator = creator; 49 | } 50 | 51 | public String getCreated() { 52 | return created; 53 | } 54 | 55 | public void setCreated(String created) { 56 | this.created = created; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/service/JobFactoryService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.service; 2 | 3 | import org.quartz.spi.TriggerFiredBundle; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | import org.springframework.scheduling.quartz.SpringBeanJobFactory; 8 | 9 | /** 10 | *

    11 | * 用于对Job注入ApplicationContext等. 12 | *

    13 | * 14 | * @author Kimi Liu 15 | * @Date Jul 12, 2013 16 | * @Time 10:32:00 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class JobFactoryService extends SpringBeanJobFactory implements 21 | ApplicationContextAware { 22 | 23 | private ApplicationContext context; 24 | 25 | @Override 26 | public void setApplicationContext(ApplicationContext context) 27 | throws BeansException { 28 | this.context = context; 29 | } 30 | 31 | /** 32 | * 功能描述:创建JOB实例,并注解相关内容等 33 | * 34 | * @param bundle 35 | * TriggerFiredBundle 36 | * @return Object JOB实例 37 | */ 38 | @Override 39 | protected Object createJobInstance(TriggerFiredBundle bundle) 40 | throws Exception { 41 | Object instance = super.createJobInstance(bundle); 42 | context.getAutowireCapableBeanFactory().autowireBean(instance); 43 | return instance; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/service/BaseService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.service; 2 | 3 | import java.util.List; 4 | 5 | import org.pentaho.di.core.exception.KettleException; 6 | 7 | /** 8 | *

    9 | * BaseService 接口. 10 | *

    11 | * 12 | * @author Kimi Liu 13 | * @Date Mar 12, 2014 14 | * @Time 10:21:00 15 | * @email 839536@QQ.com 16 | * @version 1.0 17 | * @since JDK 1.6 18 | */ 19 | public interface BaseService extends Service { 20 | 21 | /** 22 | * 功能描述:添加Object 23 | * 24 | * @param entity 25 | * Object 操作对象 26 | * @return int 返回所影响的行数 27 | */ 28 | public Object insert(T entity); 29 | 30 | /** 31 | * 功能描述:更新Object 32 | * 33 | * @param entity 34 | * Object 操作对象 35 | * @return int 返回所影响的行数 36 | */ 37 | public Object update(T entity); 38 | 39 | /** 40 | * 功能描述:删除Object 41 | * 42 | * @param id 43 | * String 操作编号 44 | * @return int 返回所影响的行数 45 | */ 46 | public Object delete(String id); 47 | 48 | /** 49 | * 功能描述:查询对象 50 | * 51 | * @param entity 52 | * Object 查询条件 53 | * @return T 返回单个对象 54 | */ 55 | public Object select(T entity); 56 | 57 | /** 58 | * 功能描述:查询对象 59 | * 60 | * @param entity 61 | * Object 查询条件 62 | * @return List 返回多个对象 63 | * @throws KettleException 64 | */ 65 | public List selectByWhere(T entity); 66 | 67 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    ${message}
    13 |
    14 |
    15 |

    16 | "> 17 | 18 |

    19 |

    20 | "> 21 | 22 |

    23 |

    24 | 25 |

    26 |
    27 |
    28 | 29 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/base/mapper/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.base.mapper; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.dao.DataAccessException; 6 | 7 | 8 | /** 9 | *

    10 | * BaseMapper 接口. 11 | *

    12 | * 13 | * @author Kimi Liu 14 | * @Date Mar 12, 2014 15 | * @Time 10:27:31 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public interface BaseMapper extends Mapper { 21 | 22 | /** 23 | * 功能描述:添加Object 24 | * 25 | * @param entity 26 | * Object 操作对象 27 | * @return int 返回所影响的行数 28 | */ 29 | public int insert(T entity) throws DataAccessException; 30 | 31 | /** 32 | * 功能描述:更新Object 33 | * 34 | * @param entity 35 | * Object 操作对象 36 | * @return int 返回所影响的行数 37 | */ 38 | public int update(T entity) throws DataAccessException; 39 | 40 | /** 41 | * 功能描述:删除Object 42 | * 43 | * @param id 44 | * String 操作编号 45 | * @return int 返回所影响的行数 46 | */ 47 | public int delete(String id) throws DataAccessException; 48 | 49 | /** 50 | * 功能描述:查询对象 51 | * 52 | * @param entity 53 | * Object 查询条件 54 | * @return T 返回单个对象 55 | */ 56 | public T select(T entity) throws DataAccessException; 57 | 58 | /** 59 | * 功能描述:查询对象 60 | * 61 | * @param entity 62 | * Object 查询条件 63 | * @return List 返回多个对象 64 | */ 65 | public List selectByWhere(T entity) throws DataAccessException; 66 | 67 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/entity/KettleTree.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.entity; 2 | 3 | import org.ukettle.basics.base.entity.BaseEntity; 4 | 5 | public class KettleTree extends BaseEntity { 6 | 7 | private static final long serialVersionUID = -2436410850045045510L; 8 | 9 | private String pId; 10 | private String aId; 11 | private String dir; 12 | private String alt; 13 | private String open; 14 | private String click; 15 | private String isParent; 16 | 17 | public String getpId() { 18 | return pId; 19 | } 20 | 21 | public void setpId(String pId) { 22 | this.pId = pId; 23 | } 24 | 25 | public String getaId() { 26 | return aId; 27 | } 28 | 29 | public void setaId(String aId) { 30 | this.aId = aId; 31 | } 32 | 33 | public String getDir() { 34 | return dir; 35 | } 36 | 37 | public void setDir(String dir) { 38 | this.dir = dir; 39 | } 40 | 41 | public String getAlt() { 42 | return alt; 43 | } 44 | 45 | public void setAlt(String alt) { 46 | this.alt = alt; 47 | } 48 | 49 | public String getOpen() { 50 | return open; 51 | } 52 | 53 | public void setOpen(String open) { 54 | this.open = open; 55 | } 56 | 57 | public String getClick() { 58 | return click; 59 | } 60 | 61 | public void setClick(String click) { 62 | this.click = click; 63 | } 64 | 65 | public String getIsParent() { 66 | return isParent; 67 | } 68 | 69 | public void setIsParent(String isParent) { 70 | this.isParent = isParent; 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Widget/Quartz/tree.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="../../Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | <%@ include file="../../Comm/resource.jsp"%> 8 | 9 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
    Directory:
    Class:
    39 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/router/spring/RouterController.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.router.spring; 2 | 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.ukettle.engine.loader.BasicController; 11 | import org.ukettle.service.router.entity.Router; 12 | 13 | @Controller 14 | @RequestMapping(BasicController.VIEW_ROUTER) 15 | public class RouterController extends BasicController { 16 | 17 | private Router entity; 18 | 19 | @RequestMapping(value = ACTION_REST) 20 | public void rest(HttpServletRequest request, HttpServletResponse response) { 21 | entity = new Router(request, response); 22 | service.iRouterService.on(entity); 23 | } 24 | 25 | /** 26 | * 获取当次请求中的所有参数信息。 27 | * 28 | * @return object Object value 29 | */ 30 | protected Map getParams() { 31 | return entity.getParams(); 32 | } 33 | 34 | /** 35 | * *获取参数的中附带的URL或请求中的值。 36 | * 37 | * @param name 38 | * Parameter name 39 | * @return object Object value 40 | */ 41 | protected Object getParam(String name) { 42 | return entity.getParams().get(name); 43 | } 44 | 45 | /** 46 | * 添加信息到该请求中
    47 | * 开发人员可以将对象添加到 请求,
    48 | * 所以该次请求后续处理中可以得到到它。 49 | * 50 | * @param name 51 | * Parameter name 52 | * @param object 53 | * Object value 54 | */ 55 | protected void setAttribute(String name, Object object) { 56 | entity.getRequest().setAttribute(name, object); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/exception/uKettleException.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.exception; 2 | 3 | import java.io.PrintWriter; 4 | import java.io.StringWriter; 5 | 6 | public class uKettleException extends RuntimeException { 7 | 8 | static final long serialVersionUID = 1662900257135756746L; 9 | 10 | public uKettleException() { 11 | super(); 12 | } 13 | 14 | public uKettleException(String message) { 15 | super(message); 16 | } 17 | 18 | public uKettleException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public uKettleException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | /** 27 | * 将CheckedException转换为UncheckedException. 28 | */ 29 | public static RuntimeException unchecked(Exception e) { 30 | if (e instanceof RuntimeException) { 31 | return (RuntimeException) e; 32 | } else { 33 | return new RuntimeException(e); 34 | } 35 | } 36 | 37 | /** 38 | * 将ErrorStack转化为String. 39 | */ 40 | public static String getStackTraceAsString(Exception e) { 41 | StringWriter stringWriter = new StringWriter(); 42 | e.printStackTrace(new PrintWriter(stringWriter)); 43 | return stringWriter.toString(); 44 | } 45 | 46 | /** 47 | * 判断异常是否由某些底层的异常引起. 48 | */ 49 | public static boolean isCausedBy(Exception ex, 50 | Class... causeExceptionClasses) { 51 | Throwable cause = ex.getCause(); 52 | while (cause != null) { 53 | for (Class causeClass : causeExceptionClasses) { 54 | if (causeClass.isInstance(cause)) { 55 | return true; 56 | } 57 | } 58 | cause = cause.getCause(); 59 | } 60 | return false; 61 | } 62 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/Page.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | *

    7 | * 分页接口. 8 | *

    9 | * 10 | * @author Kimi Liu 11 | * @Date Aug 20, 2014 12 | * @Time 10:13:40 13 | * @email 839536@QQ.com 14 | * @version 1.0 15 | * @since JDK 1.6 16 | */ 17 | public interface Page extends Serializable { 18 | 19 | /** 20 | * 功能描述:获得当前页 21 | */ 22 | int getLimit(); 23 | 24 | /** 25 | * 功能描述:是否有下页 26 | */ 27 | boolean isNext(); 28 | 29 | /** 30 | * 功能描述:是否有上页 31 | */ 32 | boolean isPrevious(); 33 | 34 | /** 35 | * 功能描述:结束页 36 | */ 37 | int getEnd(); 38 | 39 | /** 40 | * 功能描述:分页大小 41 | */ 42 | int getSize(); 43 | 44 | /** 45 | * 功能描述:起始页 46 | */ 47 | int getStart(); 48 | 49 | /** 50 | * 功能描述:总也数 51 | */ 52 | int getTotal(); 53 | 54 | /** 55 | * 功能描述:总行数 56 | */ 57 | int getRows(); 58 | 59 | /** 60 | * 功能描述:设置总行数 61 | */ 62 | void setTotal(int i); 63 | 64 | /** 65 | * 功能描述:设置当前页 66 | */ 67 | void setLimit(int i); 68 | 69 | /** 70 | * 功能描述:设置下一页 71 | */ 72 | void setNext(boolean b); 73 | 74 | /** 75 | * 功能描述:设置上一页 76 | */ 77 | void setPrevious(boolean b); 78 | 79 | /** 80 | * 功能描述:设置结束行 81 | */ 82 | void setEnd(int i); 83 | 84 | /** 85 | * 功能描述:设置分页大小 86 | */ 87 | void setSize(int i); 88 | 89 | /** 90 | * 功能描述:设置起始行 91 | */ 92 | void setStart(int i); 93 | 94 | /** 95 | * 功能描述:设置总行 96 | */ 97 | void setRows(int i); 98 | 99 | /** 100 | * 功能描述:初始化分页 101 | */ 102 | void init(int rows, int size, int limit); 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/engine/loader/BasicService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.engine.loader; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.ukettle.service.router.service.RouterService; 6 | import org.ukettle.system.service.*; 7 | import org.ukettle.widget.kettle.service.*; 8 | import org.ukettle.widget.quartz.service.QuartzGroupService; 9 | import org.ukettle.widget.quartz.service.QuartzScheduleService; 10 | 11 | @Service 12 | public class BasicService { 13 | 14 | /** System Service info */ 15 | @Autowired 16 | public LocaleService iLocaleService; 17 | @Autowired 18 | public UserService iUserService; 19 | @Autowired 20 | public RoleService iRoleService; 21 | @Autowired 22 | public MenuService iMenuService; 23 | @Autowired 24 | public RestService iRestService; 25 | 26 | /** Router Service info */ 27 | @Autowired 28 | public RouterService iRouterService; 29 | 30 | /** Kettle Service info */ 31 | @Autowired 32 | public KettleLogsService iKettleLogsService; 33 | @Autowired 34 | public KettleResultService iKettleResultService; 35 | @Autowired 36 | public KettleReposService iKettleReposService; 37 | @Autowired 38 | public KettleJobService iKettleJobService; 39 | @Autowired 40 | public KettleTransService iKettleTransService; 41 | @Autowired 42 | public KettleSpoonService iKettleSpoonService; 43 | 44 | /** Quartz Service info */ 45 | @Autowired 46 | public QuartzGroupService iQuartzGroupService; 47 | @Autowired 48 | public QuartzScheduleService iQuartzScheduleService; 49 | 50 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/session/DefaultSessionManager.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.session; 2 | 3 | import java.util.Collection; 4 | import java.util.Iterator; 5 | 6 | import org.apache.shiro.cache.CacheManager; 7 | import org.apache.shiro.session.InvalidSessionException; 8 | import org.apache.shiro.session.Session; 9 | import org.apache.shiro.session.mgt.DefaultSessionKey; 10 | import org.apache.shiro.session.mgt.SessionKey; 11 | import org.apache.shiro.session.mgt.SimpleSession; 12 | import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; 13 | import org.ukettle.www.toolkit.Constant; 14 | 15 | public class DefaultSessionManager extends DefaultWebSessionManager { 16 | 17 | private CacheManager cacheManager; 18 | 19 | public CacheManager getCacheManager() { 20 | return cacheManager; 21 | } 22 | 23 | public void setCacheManager(CacheManager cacheManager) { 24 | this.cacheManager = cacheManager; 25 | } 26 | 27 | @Override 28 | public void validateSessions() { 29 | Collection activeSessions = getActiveSessions(); 30 | if (null != activeSessions && !activeSessions.isEmpty()) { 31 | for (Iterator i$ = activeSessions.iterator(); i$.hasNext();) { 32 | Session session = (Session) i$.next(); 33 | try { 34 | SessionKey key = new DefaultSessionKey(session.getId()); 35 | validate(session, key); 36 | } catch (InvalidSessionException e) { 37 | if (null != cacheManager) { 38 | SimpleSession s = (SimpleSession) session; 39 | if (null != s.getAttribute(Constant.SESSION_ID)) 40 | cacheManager.getCache(null).remove(s.getAttribute(Constant.SESSION_ID)); 41 | } 42 | } 43 | } 44 | } 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/messages/message_en_US.properties: -------------------------------------------------------------------------------- 1 | #************User Properties****************************************** 2 | org.ukettle.iQuartz.Verify.User.Name = Please check the name ! 3 | org.ukettle.iQuartz.Verify.User.Email = Please check the email ! 4 | org.ukettle.iQuartz.Verify.User.Password = Please check the password ! 5 | #************Kettle Properties**************************************** 6 | org.ukettle.iQuartz.Verify.Kettle.Repository = Repository 7 | org.ukettle.iQuartz.Verify.Kettle.Repository.Choose = Please Choose Repository ! 8 | org.ukettle.iQuartz.Verify.Kettle.Repository.Parameters.A = Please check the 9 | org.ukettle.iQuartz.Verify.Kettle.Repository.Parameters.B = Parameter value ! 10 | org.ukettle.iQuartz.Verify.Kettle.Monitor.Log = Log Info 11 | org.ukettle.iQuartz.Verify.Kettle.Monitor.Out = Monitor Info 12 | #************Pbulic Properties**************************************** 13 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Executor = Executor 14 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Executor.Choose = Please check the executor ! 15 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Group.Choose = Please Choose Group ! 16 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Title.Exist = Title already exists ! 17 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Title = Please check the title ! 18 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Parameters.A = Please check the 19 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Parameters.B = Parameter value. 20 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Search = Please choose the query conditions ! 21 | #************Pbulic Properties**************************************** 22 | org.ukettle.iQuartz.Verify.Success = Success 23 | org.ukettle.iQuartz.Verify.Error = Error -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/authc/HashedCredentials2Matcher.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.authc; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import org.apache.shiro.authc.AuthenticationInfo; 6 | import org.apache.shiro.authc.AuthenticationToken; 7 | import org.apache.shiro.authc.ExcessiveAttemptsException; 8 | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; 9 | import org.apache.shiro.cache.Cache; 10 | import org.apache.shiro.cache.CacheManager; 11 | 12 | public class HashedCredentials2Matcher extends HashedCredentialsMatcher { 13 | 14 | private Cache faultPasswordCache; 15 | 16 | public void setFaultPasswordCache( 17 | Cache faultPasswordCache) { 18 | this.faultPasswordCache = faultPasswordCache; 19 | } 20 | 21 | public HashedCredentials2Matcher(CacheManager cacheManager) { 22 | faultPasswordCache = cacheManager.getCache("faultPasswordCache"); 23 | } 24 | 25 | @Override 26 | public boolean doCredentialsMatch(AuthenticationToken token, 27 | AuthenticationInfo info) { 28 | String username = (String) token.getPrincipal(); 29 | // retry count + 1 30 | AtomicInteger retryCount = faultPasswordCache.get(username); 31 | if (null == retryCount) { 32 | retryCount = new AtomicInteger(0); 33 | faultPasswordCache.put(username, retryCount); 34 | } 35 | if (retryCount.incrementAndGet() > 5) { 36 | // if retry count > 5 throw 37 | throw new ExcessiveAttemptsException(); 38 | } 39 | 40 | boolean matches = super.doCredentialsMatch(token, info); 41 | if (matches) { 42 | // clear retry count 43 | faultPasswordCache.remove(username); 44 | } 45 | return matches; 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/main/resources/www.properties: -------------------------------------------------------------------------------- 1 | #********************************************************************** 2 | # DataBase Properties 3 | #********************************************************************** 4 | org.ukettle.jdbc.driverClass=${kettle.www.jdbc.driver} 5 | org.ukettle.jdbc.url=${kettle.www.jdbc.url} 6 | org.ukettle.jdbc.username=${kettle.www.jdbc.username} 7 | org.ukettle.jdbc.password=${kettle.www.jdbc.password} 8 | org.ukettle.jdbc.maxConnectionsPerPartition=10 9 | org.ukettle.jdbc.minConnectionsPerPartition=5 10 | org.ukettle.jdbc.partitionCount=3 11 | org.ukettle.jdbc.acquireIncrement=5 12 | org.ukettle.jdbc.statementsCacheSize=100 13 | org.ukettle.jdbc.releaseHelperThreads=3 14 | #********************************************************************** 15 | # Mail Properties 16 | #********************************************************************** 17 | org.ukettle.mail.smtp=${kettle.www.mail.smtp} 18 | org.ukettle.mail.port=${kettle.www.mail.port} 19 | org.ukettle.mail.sender=${kettle.www.mail.sender} 20 | org.ukettle.mail.username=${kettle.www.mail.username} 21 | org.ukettle.mail.password=${kettle.www.mail.password} 22 | #********************************************************************** 23 | # Kettle Properties 24 | #********************************************************************** 25 | org.ukettle.kettle.home=${kettle.core.lib} 26 | org.ukettle.kettle.plugin=${kettle.core.plugin} 27 | org.ukettle.kettle.script=${kettle.core.script} 28 | org.ukettle.kettle.loglevel=${kettle.core.loglevel} 29 | #********************************************************************** 30 | # Quartz Properties 31 | #********************************************************************** 32 | org.ukettle.quartz.exec=${kettle.www.execute} -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleTransService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import org.pentaho.di.core.exception.KettleException; 4 | 5 | /** 6 | *

    7 | * Trans执行初始化. 8 | *

    9 | * 10 | * @author Kimi Liu 11 | * @Date Mar 22, 2013 12 | * @Time 10:27:31 13 | * @email 839536@QQ.com 14 | * @version 1.0 15 | * @since JDK 1.6 16 | */ 17 | public interface KettleTransService { 18 | 19 | /** 20 | * 功能描述:执行Trans 21 | * 22 | * @param entity 23 | * Object 参数对象 24 | * @throws KettleException 25 | * 返回相关异常 26 | */ 27 | public void execute(T entity); 28 | 29 | /** 30 | * 功能描述:获得初始化Trans对象 31 | * 32 | * @param entity 33 | * Object 参数对象 34 | * @return object 返回Trans对象 35 | * @throws KettleException 36 | * 返回相关异常 37 | */ 38 | public Object getInstance(T entity) throws KettleException; 39 | 40 | /** 41 | * 功能描述:获得已创建的Trans元数据对象 42 | * 43 | * @param entity 44 | * Object 参数对象 45 | * @return object 返回Trans元数据对象 46 | * @throws KettleException 47 | * 返回相关异常 48 | */ 49 | public Object getMetaInstance(T entity) throws KettleException; 50 | 51 | /** 52 | * 功能描述:获取当前Trans自定义参数 53 | * 54 | * @param entity 55 | * Object 参数对象 56 | * @return object 返回Trans元数据对象 57 | * @throws KettleException 58 | * 返回相关异常 59 | */ 60 | public Object setParameters(T entity) throws KettleException; 61 | 62 | /** 63 | * 功能描述:获取当前Trans自定义参数 64 | * 65 | * @param entity 66 | * Object 参数对象 67 | * @return object 返回Trans参数对象 68 | * @throws KettleException 69 | * 返回相关异常 70 | */ 71 | public Object getParameters(T entity) throws KettleException; 72 | 73 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/entity/User.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.entity; 2 | 3 | import org.ukettle.basics.base.entity.BaseEntity; 4 | 5 | public class User extends BaseEntity { 6 | 7 | private static final long serialVersionUID = 5259504151652359369L; 8 | 9 | private String password; 10 | private String random; 11 | private String email; 12 | private String mobile; 13 | private String avatar; 14 | private String remark; 15 | 16 | public void setValue(String key, String value) { 17 | super.setValue(key, value); 18 | if ("password".equals(key)) { 19 | this.setPassword(value); 20 | } else if ("email".equals(key)) { 21 | this.setEmail(value); 22 | } else if ("mobile".equals(key)) { 23 | this.setMobile(value); 24 | } else if ("avatar".equals(key)) { 25 | this.setAvatar(value); 26 | } 27 | } 28 | 29 | public String getPassword() { 30 | return password; 31 | } 32 | 33 | public void setPassword(String password) { 34 | this.password = password; 35 | } 36 | 37 | public String getRandom() { 38 | return random; 39 | } 40 | 41 | public void setRandom(String random) { 42 | this.random = random; 43 | } 44 | 45 | public String getEmail() { 46 | return email; 47 | } 48 | 49 | public void setEmail(String email) { 50 | this.email = email; 51 | } 52 | 53 | public String getMobile() { 54 | return mobile; 55 | } 56 | 57 | public void setMobile(String mobile) { 58 | this.mobile = mobile; 59 | } 60 | 61 | public String getAvatar() { 62 | return avatar; 63 | } 64 | 65 | public void setAvatar(String avatar) { 66 | this.avatar = avatar; 67 | } 68 | 69 | public String getRemark() { 70 | return remark; 71 | } 72 | 73 | public void setRemark(String remark) { 74 | this.remark = remark; 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/engine/loader/BasicMapper.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.engine.loader; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Repository; 5 | import org.ukettle.service.router.mapper.RouterMapper; 6 | import org.ukettle.system.mapper.MenuMapper; 7 | import org.ukettle.system.mapper.RestMapper; 8 | import org.ukettle.system.mapper.RoleMapper; 9 | import org.ukettle.system.mapper.UserMapper; 10 | import org.ukettle.widget.kettle.mapper.KettleLogsMapper; 11 | import org.ukettle.widget.kettle.mapper.KettleReposMapper; 12 | import org.ukettle.widget.kettle.mapper.KettleResultMapper; 13 | import org.ukettle.widget.kettle.mapper.KettleSpoonMapper; 14 | import org.ukettle.widget.quartz.mapper.QuartzGroupMapper; 15 | import org.ukettle.widget.quartz.mapper.QuartzScheduleMapper; 16 | 17 | @Repository 18 | public class BasicMapper { 19 | 20 | /** System Mapper info */ 21 | @Autowired 22 | public UserMapper iUserMapper; 23 | @Autowired 24 | public RoleMapper iRoleMapper; 25 | @Autowired 26 | public MenuMapper iMenuMapper; 27 | @Autowired 28 | public RestMapper iRestMapper; 29 | 30 | /** Router Mapper info */ 31 | @Autowired 32 | public RouterMapper iRouterMapper; 33 | 34 | /** Kettle Mapper info */ 35 | @Autowired 36 | public KettleLogsMapper iKettleLogsMapper; 37 | @Autowired 38 | public KettleResultMapper iKettleResultMapper; 39 | @Autowired 40 | public KettleReposMapper iKettleReposMapper; 41 | @Autowired 42 | public KettleSpoonMapper iKettleSpoonMapper; 43 | 44 | /** Quartz Mapper info */ 45 | @Autowired 46 | public QuartzGroupMapper iQuartzGroupMapper; 47 | @Autowired 48 | public QuartzScheduleMapper iQuartzScheduleMapper; 49 | 50 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/entity/QuartzGroup.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public class QuartzGroup implements Serializable { 6 | 7 | private static final long serialVersionUID = 3366084138623252296L; 8 | 9 | private String id; 10 | private String name; 11 | private String type; 12 | private String status; 13 | private String description; 14 | private String creator; 15 | private String created; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getType() { 34 | return type; 35 | } 36 | 37 | public void setType(String type) { 38 | this.type = type; 39 | } 40 | 41 | public String getStatus() { 42 | return status; 43 | } 44 | 45 | public void setStatus(String status) { 46 | this.status = status; 47 | } 48 | 49 | public String getDescription() { 50 | return description; 51 | } 52 | 53 | public void setDescription(String description) { 54 | this.description = description; 55 | } 56 | 57 | public String getCreator() { 58 | return creator; 59 | } 60 | 61 | public void setCreator(String creator) { 62 | this.creator = creator; 63 | } 64 | 65 | public String getCreated() { 66 | return created; 67 | } 68 | 69 | public void setCreated(String created) { 70 | this.created = created; 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | return "iGroup [id=" + id + ", name=" + name + ", type=" + type 76 | + ", status=" + status + ", description=" + description 77 | + ", creator=" + creator + ", created=" + created + "]"; 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Widget/Kettle/Result/view.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="../../../Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
    ${entity.error}${entity.read}${entity.written}${entity.updated}${entity.input}${entity.output}${entity.deleted}${entity.retrieved}${entity.rejected}
    34 |
    35 |
    36 | 37 |
    38 |
    39 | 40 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | 9 | import org.ukettle.engine.loader.BasicMapper; 10 | import org.ukettle.system.entity.Role; 11 | import org.ukettle.system.service.RoleService; 12 | import org.ukettle.www.toolkit.ObjectID; 13 | 14 | 15 | @Service 16 | public class RoleServiceImpl implements RoleService { 17 | 18 | @Autowired 19 | private BasicMapper mapper; 20 | 21 | @Override 22 | public Object insert(T entity) throws DataAccessException { 23 | if (null != entity) { 24 | entity.setId(ObjectID.id()); 25 | if (((Integer) mapper.iRoleMapper.insert(entity)) > 0) { 26 | return entity.getId(); 27 | } 28 | } 29 | return null; 30 | } 31 | 32 | @Override 33 | public Object update(T entity) throws DataAccessException { 34 | if (null != entity) { 35 | if (((Integer) mapper.iRoleMapper.update(entity)) > 0) { 36 | return entity.getId(); 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | @Override 43 | public Object delete(String id) throws DataAccessException { 44 | if (null != id && !"".equals(id)) { 45 | if (((Integer) mapper.iRoleMapper.delete(id)) > 0) { 46 | return id; 47 | } 48 | } 49 | return null; 50 | } 51 | 52 | @Override 53 | public Object select(T entity) throws DataAccessException { 54 | if (null != entity) { 55 | return mapper.iRoleMapper.select(entity); 56 | } 57 | return null; 58 | } 59 | 60 | @Override 61 | public List selectByWhere(T entity) throws DataAccessException { 62 | if (null != entity) { 63 | return mapper.iRoleMapper.selectByWhere(entity); 64 | } 65 | return null; 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleReposService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import java.util.List; 4 | 5 | import org.pentaho.di.core.exception.KettleException; 6 | import org.ukettle.basics.base.service.BaseService; 7 | 8 | /** 9 | *

    10 | * 资源库相关信息. 11 | *

    12 | * 13 | * @author Kimi Liu 14 | * @Date Mar 20, 2013 15 | * @Time 10:27:31 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public interface KettleReposService extends BaseService { 21 | 22 | /** 23 | * 功能描述:重新加载资源库信息 24 | * 25 | * @param entity 26 | * Object 参数对象 27 | * @return object 返回所有已初始化资源库 28 | * @throws KettleException 29 | * 返回相关异常 30 | */ 31 | public Object loading(T entity) throws KettleException; 32 | 33 | /** 34 | * 功能描述:销毁当前资源库所有信息 35 | * 36 | * @param entity 37 | * Object 参数对象 38 | * @return object 已销毁的资源库名称 39 | * @throws KettleException 40 | * 返回相关异常 41 | */ 42 | public Object discard(T entity) throws KettleException; 43 | 44 | /** 45 | * 功能描述:查询资源库相关信息 46 | * 47 | * @param entity 48 | * Object 参数对象 49 | * @return object 所查找的资源库信息 50 | * @throws KettleException 51 | * 返回相关异常 52 | */ 53 | public Object get(T entity) throws KettleException; 54 | 55 | /** 56 | * 功能描述:获得Job或者Trans的自定义参数 57 | * 58 | * @param entity 59 | * Object 参数对象 60 | * @return object 返回Job、Trans相关参数 61 | * @throws KettleException 62 | * 返回相关异常 63 | */ 64 | public Object getParameters(T entity) throws KettleException; 65 | 66 | /** 67 | * 功能描述:读取当前资源库信息(JOB/Trans) 68 | * 69 | * @param entity 70 | * Object 参数对象 71 | * @return object 返回树形资源库 72 | * @throws KettleException 73 | * 返回相关异常 74 | */ 75 | public List getJobAndTrans(T entity) throws KettleException; 76 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/messages/message_zh_CN.properties: -------------------------------------------------------------------------------- 1 | #************User Properties****************************************** 2 | org.ukettle.iQuartz.Verify.User.Name = \u8bf7\u68c0\u67e5\u7528\u6237\u540d! 3 | org.ukettle.iQuartz.Verify.User.Email = \u8bf7\u68c0\u67e5\u90ae\u4ef6\u5730\u5740! 4 | org.ukettle.iQuartz.Verify.User.Password = \u8bf7\u68c0\u67e5\u5bc6\u7801! 5 | #************Kettle Properties**************************************** 6 | org.ukettle.iQuartz.Verify.Kettle.Repository = \u8d44 \u6e90 \u5e93 7 | org.ukettle.iQuartz.Verify.Kettle.Repository.Choose = \u8bf7\u9009\u62e9\u8d44\u6e90\u5e93! 8 | org.ukettle.iQuartz.Verify.Kettle.Repository.Parameters.A = \u8bf7\u68c0\u67e5 9 | org.ukettle.iQuartz.Verify.Kettle.Repository.Parameters.B = \u53c2\u6570\u7684\u503c! 10 | org.ukettle.iQuartz.Verify.Kettle.Monitor.Log = \u65e5\u5fd7\u4fe1\u606f 11 | org.ukettle.iQuartz.Verify.Kettle.Monitor.Out = \u76d1\u63a7\u4fe1\u606f 12 | #************Pbulic Properties**************************************** 13 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Executor = \u6267\u884c\u8005 14 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Executor.Choose = \u8bf7\u68c0\u67e5\u6267\u884c\u8005! 15 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Group.Choose = \u8bf7\u9009\u62e9\u7fa4\u7ec4! 16 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Title.Exist = \u6807\u9898\u5df2\u5b58\u5728 17 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Title = \u8bf7\u68c0\u67e5\u6807\u9898! 18 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Parameters.A = \u8bf7\u68c0\u67e5 19 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Parameters.B = \u53c2\u6570\u7684\u503c! 20 | org.ukettle.iQuartz.Verify.Quartz.Schedule.Search = \u8bf7\u9009\u62e9\u67e5\u8be2\u6761\u4ef6! 21 | #************Pbulic Properties**************************************** 22 | org.ukettle.iQuartz.Verify.Success = \u64cd\u4f5c\u6210\u529f 23 | org.ukettle.iQuartz.Verify.Error = \u64cd\u4f5c\u5931\u8d25 -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/entity/Shiro.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.entity; 2 | 3 | import org.apache.commons.lang3.builder.EqualsBuilder; 4 | import org.apache.commons.lang3.builder.HashCodeBuilder; 5 | import org.apache.shiro.SecurityUtils; 6 | import org.apache.shiro.session.Session; 7 | import org.apache.shiro.subject.Subject; 8 | import org.ukettle.basics.base.entity.BaseEntity; 9 | 10 | public class Shiro extends BaseEntity { 11 | 12 | private static final long serialVersionUID = 865277385297809342L; 13 | 14 | public String id; 15 | public String email; 16 | public String name; 17 | 18 | public Shiro(String id, String email, String name) { 19 | this.id = id; 20 | this.email = email; 21 | this.name = name; 22 | } 23 | 24 | public static final Shiro get() { 25 | return (Shiro) SecurityUtils.getSubject().getPrincipal(); 26 | } 27 | 28 | public static final Session getSession() { 29 | return SecurityUtils.getSubject().getSession(); 30 | } 31 | 32 | public static final Subject getSubject() { 33 | return SecurityUtils.getSubject(); 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | public String getEmail() { 45 | return email; 46 | } 47 | 48 | public void setEmail(String email) { 49 | this.email = email; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public void setName(String name) { 57 | this.name = name; 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return "ShiroUser [id=" + id + ", email=" + email + ", name=" + name 63 | + "]"; 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | return HashCodeBuilder.reflectionHashCode(this, "email"); 69 | } 70 | 71 | @Override 72 | public boolean equals(Object obj) { 73 | return EqualsBuilder.reflectionEquals(this, obj, "email"); 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/entity/Menu.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.entity; 2 | 3 | import org.ukettle.basics.base.entity.BaseEntity; 4 | 5 | public class Menu extends BaseEntity { 6 | 7 | private static final long serialVersionUID = -3760206081326709064L; 8 | 9 | private String uid; 10 | private String pid; 11 | private String url; 12 | private String img; 13 | private String code; 14 | private String level; 15 | private String style; 16 | 17 | public void setValue(String key, String value) { 18 | super.setValue(key, value); 19 | if ("pid".equals(key)) { 20 | this.setPid(value); 21 | } else if ("uid".equals(key)) { 22 | this.setUid(value); 23 | } else if ("url".equals(key)) { 24 | this.setUrl(value); 25 | } else if ("code".equals(key)) { 26 | this.setCode(value); 27 | } else if ("level".equals(key)) { 28 | this.setLevel(value); 29 | } else if ("style".equals(key)) { 30 | this.setStyle(value); 31 | } 32 | } 33 | 34 | public String getUid() { 35 | return uid; 36 | } 37 | 38 | public void setUid(String uid) { 39 | this.uid = uid; 40 | } 41 | 42 | public String getPid() { 43 | return pid; 44 | } 45 | 46 | public void setPid(String pid) { 47 | this.pid = pid; 48 | } 49 | 50 | public String getUrl() { 51 | return url; 52 | } 53 | 54 | public void setUrl(String url) { 55 | this.url = url; 56 | } 57 | 58 | public String getImg() { 59 | return img; 60 | } 61 | 62 | public void setImg(String img) { 63 | this.img = img; 64 | } 65 | 66 | public String getCode() { 67 | return code; 68 | } 69 | 70 | public void setCode(String code) { 71 | this.code = code; 72 | } 73 | 74 | public String getLevel() { 75 | return level; 76 | } 77 | 78 | public void setLevel(String level) { 79 | this.level = level; 80 | } 81 | 82 | public String getStyle() { 83 | return style; 84 | } 85 | 86 | public void setStyle(String style) { 87 | this.style = style; 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/impl/RestServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | import org.ukettle.engine.loader.BasicMapper; 9 | import org.ukettle.system.entity.Rest; 10 | import org.ukettle.system.service.RestService; 11 | import org.ukettle.www.toolkit.Constant; 12 | import org.ukettle.www.toolkit.ObjectID; 13 | 14 | 15 | @Service 16 | public class RestServiceImpl implements RestService { 17 | 18 | @Autowired 19 | private BasicMapper mapper; 20 | 21 | @Override 22 | public Object insert(T entity) throws DataAccessException { 23 | if (null != entity) { 24 | entity.setId(ObjectID.id()); 25 | if (mapper.iRestMapper.insert(entity) > 0) { 26 | return entity.getId(); 27 | } 28 | } 29 | return null; 30 | } 31 | 32 | @Override 33 | public Object update(T entity) throws DataAccessException { 34 | if (null != entity) { 35 | if (((Integer) mapper.iRestMapper.update(entity)) > 0) { 36 | return entity.getId(); 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | @Override 43 | public Object delete(String id) throws DataAccessException { 44 | if (null != id && !"".equals(id)) { 45 | if (((Integer) mapper.iRestMapper.delete(id)) > 0) { 46 | return id; 47 | } 48 | } 49 | return null; 50 | } 51 | 52 | @Override 53 | public Object select(T entity) throws DataAccessException { 54 | if (null != entity) { 55 | entity.setStatus(Constant.STATUS_ENABLED); 56 | return mapper.iRestMapper.select(entity); 57 | } 58 | return null; 59 | } 60 | 61 | @Override 62 | public List selectByWhere(T entity) throws DataAccessException { 63 | if (null != entity) { 64 | return mapper.iRestMapper.selectByWhere(entity); 65 | } 66 | return null; 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/KettleJobService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service; 2 | 3 | import org.pentaho.di.core.exception.KettleException; 4 | 5 | /** 6 | *

    7 | * Job执行初始化. 8 | *

    9 | * 10 | * @author Kimi Liu 11 | * @Date Mar 20, 2013 12 | * @Time 10:27:31 13 | * @email 839536@QQ.com 14 | * @version 1.0 15 | * @since JDK 1.6 16 | */ 17 | public interface KettleJobService { 18 | 19 | /** 20 | * 功能描述:执行Job(队列等待) 21 | * 22 | * @param entity 23 | * Object 参数对象 24 | * @throws KettleException 25 | * 返回相关异常 26 | */ 27 | public void execute(T entity); 28 | 29 | /** 30 | * 功能描述:执行Job(非队列,直接执行) 31 | * 32 | * @param entity 33 | * Object 参数对象 34 | * @throws KettleException 35 | * 返回相关异常 36 | */ 37 | public void executeJob(T entity); 38 | 39 | /** 40 | * 功能描述:获得初始化Job对象 41 | * 42 | * @param entity 43 | * Object 参数对象 44 | * @return object 返回Job对象 45 | * @throws KettleException 46 | * 返回相关异常 47 | */ 48 | public Object getInstance(T entity) throws KettleException; 49 | 50 | /** 51 | * 功能描述:获得已创建的Job元数据对象 52 | * 53 | * @param entity 54 | * Object 参数对象 55 | * @return object 返回Job元数据对象 56 | * @throws KettleException 57 | * 返回相关异常 58 | */ 59 | public Object getMetaInstance(T entity) throws KettleException; 60 | 61 | /** 62 | * 功能描述:获取当前Job自定义参数 63 | * 64 | * @param entity 65 | * Object 参数对象 66 | * @return object 返回Job元数据对象 67 | * @throws KettleException 68 | * 返回相关异常 69 | */ 70 | public Object setParameters(T entity) throws KettleException; 71 | 72 | /** 73 | * 功能描述:获取当前Job自定义参数 74 | * 75 | * @param entity 76 | * Object 参数对象 77 | * @return object 返回Job参数对象 78 | * @throws KettleException 79 | * 返回相关异常 80 | */ 81 | public Object getParameters(T entity) throws KettleException; 82 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/service/impl/QuartzGroupServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | import org.ukettle.widget.quartz.entity.QuartzGroup; 9 | import org.ukettle.widget.quartz.mapper.QuartzGroupMapper; 10 | import org.ukettle.widget.quartz.service.QuartzGroupService; 11 | import org.ukettle.www.toolkit.Constant; 12 | import org.ukettle.www.toolkit.ObjectID; 13 | 14 | @Service 15 | public class QuartzGroupServiceImpl implements QuartzGroupService { 16 | 17 | @Autowired 18 | private QuartzGroupMapper mapper; 19 | 20 | @Override 21 | public String insert(T entity) throws DataAccessException { 22 | if (null != entity) { 23 | entity.setId(ObjectID.id()); 24 | if (mapper.insert(entity) > 0) { 25 | return entity.getId(); 26 | } 27 | } 28 | return null; 29 | } 30 | 31 | @Override 32 | public String update(T entity) throws DataAccessException { 33 | if (null != entity) { 34 | if (mapper.update(entity) > 0) { 35 | return entity.getId(); 36 | } 37 | } 38 | return null; 39 | } 40 | 41 | @Override 42 | public String delete(String id) throws DataAccessException { 43 | if (null != id && !"".equals(id)) { 44 | if (mapper.delete(id) > 0) { 45 | return id; 46 | } 47 | } 48 | return null; 49 | } 50 | 51 | @Override 52 | public T select(T entity) throws DataAccessException { 53 | if (null != entity) { 54 | entity.setStatus(Constant.STATUS_ENABLED); 55 | return mapper.select(entity); 56 | } 57 | return null; 58 | } 59 | 60 | @Override 61 | public List selectByWhere(T entity) throws DataAccessException { 62 | if (null != entity) { 63 | entity.setStatus(Constant.STATUS_ENABLED); 64 | return mapper.selectByWhere(entity); 65 | } 66 | return null; 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/locale/Messages.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.locale; 2 | 3 | import java.util.Locale; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.springframework.context.MessageSource; 9 | import org.springframework.web.servlet.LocaleResolver; 10 | import org.springframework.web.servlet.i18n.SessionLocaleResolver; 11 | 12 | public class Messages implements LocaleResolver { 13 | 14 | private static MessageSource messages; 15 | private static Locale defaultLocale; 16 | 17 | public static void setMessages(MessageSource messages) { 18 | Messages.messages = messages; 19 | } 20 | 21 | public static String getMessage(String key, Locale locale) { 22 | return messages.getMessage(key, new Object[0], locale); 23 | } 24 | 25 | public Locale resolveLocale(HttpServletRequest request) { 26 | defaultLocale = request.getLocale(); 27 | return defaultLocale; 28 | } 29 | 30 | @Override 31 | public void setLocale(HttpServletRequest request, 32 | HttpServletResponse response, Locale locale) { 33 | locale(request, response, locale); 34 | } 35 | 36 | public static String locale(HttpServletRequest request, 37 | HttpServletResponse response, Locale locale) { 38 | defaultLocale = null; 39 | String language = request.getParameter("language"); 40 | if (null != locale) { 41 | defaultLocale = locale; 42 | } 43 | if (null != language && null == defaultLocale) { 44 | if ("zh_CN".equals(language)) { 45 | defaultLocale = new Locale("zh", "CN"); 46 | } else if ("en_US".equals(language)) { 47 | defaultLocale = new Locale("en", "US"); 48 | } else if ("ja_JP".equals(language)) { 49 | defaultLocale = new Locale("ja", "JP"); 50 | } else { 51 | defaultLocale = request.getLocale(); 52 | } 53 | } 54 | request.getSession().setAttribute( 55 | SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, 56 | defaultLocale); 57 | request.getSession().setAttribute("language", language); 58 | return language; 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/impl/LocaleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service.impl; 2 | 3 | import java.util.Locale; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.springframework.context.MessageSource; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.web.servlet.LocaleResolver; 11 | import org.springframework.web.servlet.i18n.SessionLocaleResolver; 12 | 13 | import org.ukettle.system.service.LocaleService; 14 | 15 | 16 | @Service 17 | public class LocaleServiceImpl implements LocaleResolver, LocaleService { 18 | 19 | private MessageSource messages; 20 | private Locale defaultLocale; 21 | 22 | public void setMessages(MessageSource msg) { 23 | messages = msg; 24 | } 25 | 26 | public String getMessage(String key, Locale locale) { 27 | return messages.getMessage(key, new Object[0], locale); 28 | } 29 | 30 | public Locale resolveLocale(HttpServletRequest request) { 31 | defaultLocale = request.getLocale(); 32 | return defaultLocale; 33 | } 34 | 35 | @Override 36 | public void setLocale(HttpServletRequest request, 37 | HttpServletResponse response, Locale locale) { 38 | locale(request, response, locale); 39 | } 40 | 41 | public String locale(HttpServletRequest request, 42 | HttpServletResponse response, Locale locale) { 43 | defaultLocale = null; 44 | String language = request.getParameter("language"); 45 | if (null != locale) { 46 | defaultLocale = locale; 47 | } 48 | if (null != language && null == defaultLocale) { 49 | if ("zh_CN".equals(language)) { 50 | defaultLocale = new Locale("zh", "CN"); 51 | } else if ("en_US".equals(language)) { 52 | defaultLocale = new Locale("en", "US"); 53 | } else if ("ja_JP".equals(language)) { 54 | defaultLocale = new Locale("ja", "JP"); 55 | } else { 56 | defaultLocale = request.getLocale(); 57 | } 58 | } 59 | request.getSession().setAttribute( 60 | SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, 61 | defaultLocale); 62 | request.getSession().setAttribute("language", language); 63 | return language; 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/SybaseDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * Sybase数据库分页方言实现。 还未实现 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 18, 2014 15 | * @Time 13:35:21 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class SybaseDialect implements Dialect { 21 | 22 | public boolean limit() { 23 | return false; 24 | } 25 | 26 | @Override 27 | public String getLimit(String sql, int offset, int limit) { 28 | return null; 29 | } 30 | 31 | /** 32 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 33 | * 34 | *
    35 | 	 * 如mysql
    36 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
    37 | 	 * select * from user limit :offset,:limit
    38 | 	 * 
    39 | * 40 | * @param sql 41 | * 实际SQL语句 42 | * @param offset 43 | * 分页开始纪录条数 44 | * @param offsetPlaceholder 45 | * 分页开始纪录条数-占位符号 46 | * @param limit 47 | * 分页每页显示纪录条数 48 | * @param limitPlaceholder 49 | * 分页纪录条数占位符号 50 | * @return 包含占位符的分页sql 51 | */ 52 | public String getLimit(String sql, int offset, String offsetPlaceholder, 53 | int limit, String limitPlaceholder) { 54 | throw new UnsupportedOperationException("paged queries not supported"); 55 | } 56 | 57 | @Override 58 | public String getCount(String sql) { 59 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 60 | + ") as dialect"; 61 | } 62 | 63 | @Override 64 | public String getSort(String sql, List sort) { 65 | if (sort == null || sort.isEmpty()) { 66 | return sql; 67 | } 68 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 69 | .append(") dialect order by "); 70 | for (Sorting s : sort) { 71 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 72 | .append(", "); 73 | } 74 | buffer.delete(buffer.length() - 2, buffer.length()); 75 | return buffer.toString(); 76 | } 77 | 78 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/service/QuartzScheduleService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.quartz.service; 2 | 3 | import org.quartz.SchedulerException; 4 | 5 | /** 6 | *

    7 | * Schedule 操作接口. 8 | *

    9 | * 10 | * @author Kimi Liu 11 | * @Date Mar 12, 2013 12 | * @Time 10:21:00 13 | * @version 1.0 14 | * @since JDK 1.6 15 | */ 16 | public interface QuartzScheduleService { 17 | 18 | /** 19 | * 功能描述:添加定时任务 20 | * 21 | * @param entity 22 | * Object 操作对象 23 | * @return String 任务编号 24 | */ 25 | public String insert(T entity) throws SchedulerException; 26 | 27 | /** 28 | * 功能描述:删除定时任务 29 | * 30 | * @param entity 31 | * Object 操作对象 32 | * @return String 任务编号 33 | */ 34 | public String delete(String id) throws SchedulerException; 35 | 36 | /** 37 | * 功能描述:更新定时任务 38 | * 39 | * @param entity 40 | * Object 操作对象 41 | * @return String 任务编号 42 | */ 43 | public String update(T entity) throws SchedulerException; 44 | 45 | /** 46 | * 功能描述:查询单个任务 47 | * 48 | * @param entity 49 | * Object 操作对象 50 | * @return Object 任务信息 51 | */ 52 | public Object select(T entity) throws SchedulerException; 53 | 54 | /** 55 | * 功能描述:查询多任务 56 | * 57 | * @param entity 58 | * Object 操作对象 59 | * @return Object 任务信息列表 60 | */ 61 | public Object selectByWhere(T entity) throws SchedulerException; 62 | 63 | /** 64 | * 功能描述:检查任务是否存在 65 | * 66 | * @param entity 67 | * Object 操作对象 68 | * @return String 任务编号 69 | */ 70 | public boolean exists(T entity); 71 | 72 | /** 73 | * 功能描述:执行单一任务 74 | * 75 | * @param entity 76 | * Object 操作对象 77 | * @return String 任务编号 78 | */ 79 | public String execute(String strVal) throws SchedulerException; 80 | 81 | /** 82 | * 功能描述:暂停单一任务 83 | * 84 | * @param entity 85 | * Object 操作对象 86 | * @return String 任务编号 87 | */ 88 | public String pause(String strVal) throws SchedulerException; 89 | 90 | /** 91 | * 功能描述:恢复单一任务 92 | * 93 | * @param entity 94 | * Object 操作对象 95 | * @return String 任务编号 96 | */ 97 | public String resume(String strVal) throws SchedulerException; 98 | 99 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/serialize/Base64Serializer.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.serialize; 2 | 3 | import java.io.ByteArrayInputStream; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.IOException; 6 | import java.io.ObjectInputStream; 7 | import java.io.ObjectOutputStream; 8 | 9 | import org.apache.commons.codec.binary.Base64; 10 | 11 | /** 12 | * Default base64 serializer/deserializer. 13 | * 14 | */ 15 | /** 16 | * 功能描述:注解属性 17 | * 18 | * @author Kimi Liu 19 | * @Date May 10, 2014 20 | * @Time 18:21:53 21 | * @email 839536@QQ.com 22 | * @version 1.0 23 | * @since JDK 1.6 24 | */ 25 | public class Base64Serializer extends ObjectSerializer { 26 | 27 | public String serialize(Object object) { 28 | ObjectOutputStream oos = null; 29 | ByteArrayOutputStream bos = null; 30 | try { 31 | bos = new ByteArrayOutputStream(); 32 | oos = new ObjectOutputStream(bos); 33 | oos.writeObject(object); 34 | return new String(Base64.encodeBase64(bos.toByteArray())); 35 | } catch (IOException e) { 36 | throw new IllegalArgumentException(e); 37 | } catch (Exception e) { 38 | throw new IllegalArgumentException(e); 39 | } finally { 40 | try { 41 | if (bos != null) { 42 | bos.close(); 43 | } 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | } 47 | } 48 | } 49 | 50 | public Object deserialize(String data) { 51 | if ((data == null) || (data.length() == 0)) { 52 | return null; 53 | } 54 | ObjectInputStream ois = null; 55 | ByteArrayInputStream bis = null; 56 | try { 57 | bis = new ByteArrayInputStream(Base64.decodeBase64(data.getBytes())); 58 | ois = new ObjectInputStream(bis); 59 | return ois.readObject(); 60 | } catch (ClassNotFoundException e) { 61 | throw new IllegalArgumentException(e); 62 | } catch (IOException e) { 63 | throw new IllegalArgumentException(e); 64 | } catch (Exception e) { 65 | throw new IllegalArgumentException(e); 66 | } finally { 67 | try { 68 | if (ois != null) { 69 | ois.close(); 70 | } 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | } 74 | } 75 | } 76 | 77 | public String getContentType() { 78 | return TYPE_STREAM_UTF8; 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/web/Saved2Request.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.web; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | import org.apache.shiro.web.util.SavedRequest; 6 | 7 | public class Saved2Request extends SavedRequest { 8 | 9 | private static final long serialVersionUID = 6083702936438968056L; 10 | 11 | private String scheme; 12 | private String domain; 13 | private int port; 14 | private String contextPath; 15 | private String backUrl; 16 | 17 | public Saved2Request(HttpServletRequest request, String backUrl) { 18 | super(request); 19 | this.scheme = request.getScheme(); 20 | this.domain = request.getServerName(); 21 | this.port = request.getServerPort(); 22 | this.backUrl = backUrl; 23 | this.contextPath = request.getContextPath(); 24 | } 25 | 26 | public String getScheme() { 27 | return scheme; 28 | } 29 | 30 | public String getDomain() { 31 | return domain; 32 | } 33 | 34 | public int getPort() { 35 | return port; 36 | } 37 | 38 | public String getContextPath() { 39 | return contextPath; 40 | } 41 | 42 | public String getBackUrl() { 43 | return backUrl; 44 | } 45 | 46 | public String getRequestUrl() { 47 | String requestURI = getRequestURI(); 48 | if (backUrl != null) {// 1 49 | if (backUrl.toLowerCase().startsWith("http://") 50 | || backUrl.toLowerCase().startsWith("https://")) { 51 | return backUrl; 52 | } else if (!backUrl.startsWith(contextPath)) {// 2 53 | requestURI = contextPath + backUrl; 54 | } else {// 3 55 | requestURI = backUrl; 56 | } 57 | } 58 | 59 | StringBuilder requestUrl = new StringBuilder(scheme);// 4 60 | requestUrl.append("://"); 61 | requestUrl.append(domain);// 5 62 | // 6 63 | if ("http".equalsIgnoreCase(scheme) && port != 80) { 64 | requestUrl.append(":").append(String.valueOf(port)); 65 | } else if ("https".equalsIgnoreCase(scheme) && port != 443) { 66 | requestUrl.append(":").append(String.valueOf(port)); 67 | } 68 | // 7 69 | requestUrl.append(requestURI); 70 | // 8 71 | if (backUrl == null && getQueryString() != null) { 72 | requestUrl.append("?").append(getQueryString()); 73 | } 74 | return requestUrl.toString(); 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/DerbyDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | 11 | /** 12 | * Dialect for Derby 13 | * 14 | * @author Kimi Liu 15 | * @Date Aug 19, 2014 16 | * @Time 09:18:21 17 | * @email 839536@QQ.com 18 | * @version 1.0 19 | * @since JDK 1.6 20 | */ 21 | public class DerbyDialect implements Dialect { 22 | @Override 23 | public boolean limit() { 24 | return false; 25 | } 26 | 27 | @Override 28 | public String getLimit(String sql, int offset, int limit) { 29 | return getLimit(sql,offset,Integer.toString(offset),limit,Integer.toString(limit)); 30 | } 31 | 32 | /** 33 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 34 | * 如mysql 35 | * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回 36 | * select * from user limit :offset,:limit 37 | * 38 | * @param sql 39 | * 实际SQL语句 40 | * @param offset 41 | * 分页开始纪录条数 42 | * @param offsetPlaceholder 43 | * 分页开始纪录条数-占位符号 44 | * @param limit 45 | * 分页每页显示纪录条数 46 | * @param limitPlaceholder 47 | * 分页纪录条数占位符号 48 | * @return 包含占位符的分页sql 49 | */ 50 | public String getLimit(String sql, int offset, 51 | String offsetPlaceholder, int limit, String limitPlaceholder) { 52 | throw new UnsupportedOperationException("paged queries not supported"); 53 | } 54 | 55 | @Override 56 | public String getCount(String sql) { 57 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 58 | + ") as dialect"; 59 | } 60 | 61 | @Override 62 | public String getSort(String sql, List sort) { 63 | if (sort == null || sort.isEmpty()) { 64 | return sql; 65 | } 66 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 67 | .append(") dialect order by "); 68 | for (Sorting s : sort) { 69 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 70 | .append(", "); 71 | } 72 | buffer.delete(buffer.length() - 2, buffer.length()); 73 | return buffer.toString(); 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.paipai.js: -------------------------------------------------------------------------------- 1 | var String = java.lang.String; 2 | var StringBuffer = java.lang.StringBuffer; 3 | var Integer = java.lang.Integer; 4 | var Hashtable = java.util.Hashtable; 5 | var Iteractor = java.util.Iteractor; 6 | var TreeMap = java.util.TreeMap; 7 | var Date = java.util.Date; 8 | var Mac = javax.crypto.Mac; 9 | var SecretKeySpec = javax.crypto.spec.SecretKeySpec; 10 | var Base64 = org.apache.commons.codec.binary.Base64; 11 | var URLEncoder = java.net.URLEncoder; 12 | 13 | 14 | function WangGouRESTAPI(treeMap){ 15 | this.ht = treeMap; 16 | } 17 | 18 | WangGouRESTAPI.prototype.put = function (key, value) { 19 | this.ht.put(key, value); 20 | } 21 | 22 | WangGouRESTAPI.prototype.encrypt = function (key, method,queryMethod) { 23 | var orgin = new StringBuffer(); 24 | var map = new TreeMap(); 25 | map.putAll(this.ht); 26 | 27 | var iter = map.keySet().iterator(); 28 | var i = 0; 29 | while (iter.hasNext()) { 30 | var name = String.valueOf(iter.next()); 31 | if (new String(map.get(name)).length() > 0) { 32 | if (i > 0){ 33 | orgin.append("&").append(name).append("=" + map.get(name)); 34 | } else { 35 | orgin.append(name).append("=" + map.get(name)); 36 | i = i + 1; 37 | } 38 | } 39 | } 40 | var param = queryMethod + "&" + encodeURIComponent(method, "UTF-8") + "&" + encodeURIComponent(new String(orgin)); 41 | var signingKey = new SecretKeySpec(new String(key).getBytes("UTF-8"), "HmacSHA1"); 42 | var sha256_HMAC = Mac.getInstance("HmacSHA1"); 43 | sha256_HMAC.init(signingKey); 44 | var sign = sha256_HMAC.doFinal(new String(param).getBytes("UTF-8")); 45 | var signBase64 = new Base64().encodeBase64(sign); 46 | return new String(signBase64, "UTF-8"); 47 | } 48 | 49 | WangGouRESTAPI.prototype.URLEncode = function (ru, rp) { 50 | var request_url = ru; 51 | var request_params = rp; 52 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 53 | var e = it.next(); 54 | if (new String(e.getValue()).length() > 0) { 55 | request_params.append("&").append(e.getKey()).append("=").append(encodeURIComponent(e.getValue())); 56 | } 57 | } 58 | 59 | var url = request_url + "?" + new String(request_params.toString().substring(1)); 60 | return url; 61 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/impl/KettleLogsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | import org.ukettle.basics.shiro.entity.Shiro; 9 | import org.ukettle.engine.loader.BasicMapper; 10 | import org.ukettle.widget.kettle.entity.KettleLogs; 11 | import org.ukettle.widget.kettle.service.KettleLogsService; 12 | import org.ukettle.www.toolkit.DateUtils; 13 | import org.ukettle.www.toolkit.ObjectID; 14 | 15 | @Service 16 | public class KettleLogsServiceImpl implements 17 | KettleLogsService { 18 | 19 | @Autowired 20 | private BasicMapper mapper; 21 | 22 | @Override 23 | public String insert(T entity) throws DataAccessException { 24 | if (null != entity) { 25 | String id = Shiro.get().getId(); 26 | entity.setId(ObjectID.id()); 27 | entity.setCreator(id); 28 | entity.setModifier(id); 29 | entity.setCreated(DateUtils.getTime24()); 30 | entity.setModified(DateUtils.getTime24()); 31 | if (mapper.iKettleLogsMapper.insert(entity) > 0) { 32 | return entity.getId(); 33 | } 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public String update(T entity) throws DataAccessException { 40 | if (null != entity) { 41 | entity.setModified(DateUtils.getTime24()); 42 | if (mapper.iKettleLogsMapper.update(entity) > 0) { 43 | return entity.getId(); 44 | } 45 | } 46 | return null; 47 | } 48 | 49 | @Override 50 | public String delete(String id) throws DataAccessException { 51 | if (null != id && !"".equals(id)) { 52 | if (mapper.iKettleLogsMapper.delete(id) > 0) { 53 | return id; 54 | } 55 | } 56 | return null; 57 | } 58 | 59 | @Override 60 | public Object select(T entity) throws DataAccessException { 61 | if (null != entity) { 62 | return mapper.iKettleLogsMapper.select(entity); 63 | } 64 | return null; 65 | } 66 | 67 | @Override 68 | public List selectByWhere(T entity) throws DataAccessException { 69 | if (null != entity) { 70 | return mapper.iKettleLogsMapper.selectByWhere(entity); 71 | } 72 | return null; 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/service/impl/KettleResultServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.widget.kettle.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | import org.ukettle.basics.shiro.entity.Shiro; 9 | import org.ukettle.engine.loader.BasicMapper; 10 | import org.ukettle.widget.kettle.entity.KettleResult; 11 | import org.ukettle.widget.kettle.service.KettleResultService; 12 | import org.ukettle.www.toolkit.DateUtils; 13 | import org.ukettle.www.toolkit.ObjectID; 14 | 15 | @Service 16 | public class KettleResultServiceImpl implements 17 | KettleResultService { 18 | 19 | @Autowired 20 | private BasicMapper mapper; 21 | 22 | @Override 23 | public String insert(T entity) throws DataAccessException { 24 | if (null != entity) { 25 | String id = Shiro.get().getId(); 26 | entity.setId(ObjectID.id()); 27 | entity.setCreator(id); 28 | entity.setModifier(id); 29 | entity.setCreated(DateUtils.getTime24()); 30 | entity.setModified(DateUtils.getTime24()); 31 | if (mapper.iKettleResultMapper.insert(entity) > 0) { 32 | return entity.getId(); 33 | } 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public String update(T entity) throws DataAccessException { 40 | if (null != entity) { 41 | entity.setModified(DateUtils.getTime24()); 42 | if (mapper.iKettleResultMapper.update(entity) > 0) { 43 | return entity.getId(); 44 | } 45 | } 46 | return null; 47 | } 48 | 49 | @Override 50 | public String delete(String id) throws DataAccessException { 51 | if (null != id && !"".equals(id)) { 52 | if (mapper.iKettleResultMapper.delete(id) > 0) { 53 | return id; 54 | } 55 | } 56 | return null; 57 | } 58 | 59 | @Override 60 | public Object select(T entity) throws DataAccessException { 61 | if (null != entity) { 62 | return mapper.iKettleResultMapper.select(entity); 63 | } 64 | return null; 65 | } 66 | 67 | @Override 68 | public List selectByWhere(T entity) throws DataAccessException { 69 | if (null != entity) { 70 | return mapper.iKettleResultMapper.selectByWhere(entity); 71 | } 72 | return null; 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/ibatis/Role.Mapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | insert into U_ALL_ROLE ( 8 | id 9 | , name 10 | , type 11 | , status 12 | , description 13 | ) 14 | values ( 15 | #{id}, 16 | #{name}, 17 | #{type}, 18 | #{status}, 19 | #{description} 20 | ) 21 | 22 | 23 | 24 | delete from U_ALL_ROLE where id = 25 | #{id} 26 | 27 | 28 | 29 | update U_ALL_ROLE 30 | 31 | 32 | name = #{name}, 33 | 34 | 35 | type = #{type}, 36 | 37 | 38 | status = #{status}, 39 | 40 | 41 | description = #{description} 42 | 43 | 44 | where id = #{id} 45 | 46 | 47 | 62 | 63 | 87 | 88 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/H2Dialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * A dialect compatible with the H2 database. 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 19, 2014 15 | * @Time 10:20:13 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class H2Dialect implements Dialect { 21 | 22 | public boolean limit() { 23 | return true; 24 | } 25 | 26 | /** 27 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 28 | * 如mysql 29 | * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回 30 | * select * from user limit :offset,:limit 31 | * 32 | * @param sql 33 | * 实际SQL语句 34 | * @param offset 35 | * 分页开始纪录条数 36 | * @param offsetPlaceholder 37 | * 分页开始纪录条数-占位符号 38 | * @param limit 39 | * 分页每页显示纪录条数 40 | * @param limitPlaceholder 41 | * 分页纪录条数占位符号 42 | * @return 包含占位符的分页sql 43 | */ 44 | private String getLimit(String sql, int offset, String offsetPlaceholder, 45 | int limit, String limitPlaceholder) { 46 | return sql 47 | + ((offset > 0) ? " limit " + limitPlaceholder + " offset " 48 | + offsetPlaceholder : " limit " + limitPlaceholder); 49 | } 50 | 51 | @Override 52 | public String getLimit(String sql, int offset, int limit) { 53 | return getLimit(sql, offset, Integer.toString(offset), limit, 54 | Integer.toString(limit)); 55 | } 56 | 57 | @Override 58 | public String getCount(String sql) { 59 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 60 | + ") as dialect"; 61 | } 62 | 63 | @Override 64 | public String getSort(String sql, List sort) { 65 | if (sort == null || sort.isEmpty()) { 66 | return sql; 67 | } 68 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 69 | .append(") dialect order by "); 70 | for (Sorting s : sort) { 71 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 72 | .append(", "); 73 | } 74 | buffer.delete(buffer.length() - 2, buffer.length()); 75 | return buffer.toString(); 76 | } 77 | 78 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.tianpin.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function TianpinRESTAPI(treeMap){ 13 | this.ht = treeMap; 14 | } 15 | 16 | TianpinRESTAPI.prototype.put = function (key, value) { 17 | this.ht.put(key, value); 18 | } 19 | 20 | TianpinRESTAPI.prototype.encrypt = function (app_secret) { 21 | var orgin = new StringBuffer(); 22 | //orgin.append(app_secret); 23 | 24 | var map = new TreeMap(); 25 | map.putAll(this.ht); 26 | 27 | var iter = map.keySet().iterator(); 28 | while (iter.hasNext()) { 29 | var name = String.valueOf(iter.next()); 30 | if (new String(map.get(name)).length() > 0) { 31 | orgin.append(name).append(map.get(name)); 32 | } 33 | } 34 | 35 | orgin.append(app_secret); 36 | 37 | // get the md5 digest algorithm 38 | var algorithm = MessageDigest.getInstance("MD5"); 39 | 40 | // get the input as bytes 41 | var bytes = new String(orgin).getBytes("UTF-8"); 42 | 43 | // calculate the digest 44 | algorithm.reset(); 45 | algorithm.update(bytes); 46 | var md5Digest = algorithm.digest(); 47 | 48 | // turn the digest into a hex-string representation 49 | var hexString = new StringBuffer(); 50 | 51 | for (var i = 0; i < md5Digest.length; i++){ 52 | var hex = Integer.toHexString(md5Digest[i] & 0xFF); 53 | if (hex.length() == 1){ 54 | hexString.append('0').append(""); 55 | } 56 | hexString.append(hex); 57 | } 58 | 59 | // write output value 60 | var sign = hexString.toString(); 61 | return sign; 62 | } 63 | 64 | TianpinRESTAPI.prototype.URLEncode = function (ru, rp) { 65 | var request_url = ru; 66 | var request_params = rp; 67 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 68 | var e = it.next(); 69 | if (new String(e.getValue()).length() > 0) { 70 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 71 | } 72 | } 73 | var url = request_url + "?" + request_params.toString().substring(1); 74 | 75 | return encodeURI(url); 76 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.yihaodian.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function YihaodianRESTAPI(baseURL, treeMap){ 13 | this.baseURL = baseURL; 14 | this.ht = treeMap; 15 | } 16 | 17 | YihaodianRESTAPI.prototype.put = function (key, value) { 18 | this.ht.put(key, value); 19 | } 20 | 21 | YihaodianRESTAPI.prototype.encrypt = function (app_secret) { 22 | var orgin = new StringBuffer(); 23 | orgin.append(app_secret); 24 | 25 | var map = new TreeMap(); 26 | map.putAll(this.ht); 27 | 28 | var iter = map.keySet().iterator(); 29 | while (iter.hasNext()) { 30 | var name = String.valueOf(iter.next()); 31 | if (new String(map.get(name)).length() > 0) { 32 | orgin.append(name).append(map.get(name)); 33 | } 34 | } 35 | 36 | orgin.append(app_secret); 37 | 38 | // get the md5 digest algorithm 39 | var algorithm = MessageDigest.getInstance("MD5"); 40 | 41 | // get the input as bytes 42 | var bytes = new String(orgin).getBytes("UTF-8"); 43 | 44 | // calculate the digest 45 | algorithm.reset(); 46 | algorithm.update(bytes); 47 | var md5Digest = algorithm.digest(); 48 | 49 | // turn the digest into a hex-string representation 50 | var hexString = new StringBuffer(); 51 | 52 | for (var i = 0; i < md5Digest.length; i++){ 53 | if (md5Digest[i] >= 0 && md5Digest[i] < 16) { 54 | hexString.append('0'); 55 | } 56 | hexString.append(Integer.toHexString(md5Digest[i] & 0XFF)); 57 | } 58 | 59 | // write output value 60 | var sign = hexString.toString(); 61 | return sign 62 | } 63 | 64 | YihaodianRESTAPI.prototype.URLEncode = function (rp) { 65 | var request_params = rp; 66 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 67 | var e = it.next(); 68 | if (new String(e.getValue()).length() > 0) { 69 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 70 | } 71 | } 72 | var url = this.baseURL + "?" + request_params.toString().substring(1); 73 | 74 | return new URI(url).toString(); 75 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.jd.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function JDRESTAPI(treeMap){ 13 | this.ht = treeMap; 14 | } 15 | 16 | JDRESTAPI.prototype.put = function (key, value) { 17 | this.ht.put(key, value); 18 | } 19 | 20 | JDRESTAPI.prototype.encrypt = function (app_secret) { 21 | var orgin = new StringBuffer(); 22 | orgin.append(app_secret); 23 | 24 | var map = new TreeMap(); 25 | map.putAll(this.ht); 26 | 27 | var iter = map.keySet().iterator(); 28 | while (iter.hasNext()) { 29 | var name = String.valueOf(iter.next()); 30 | if (new String(map.get(name)).length() > 0) { 31 | orgin.append(name).append(map.get(name)); 32 | } 33 | } 34 | 35 | orgin.append(app_secret); 36 | 37 | // get the md5 digest algorithm 38 | var algorithm = MessageDigest.getInstance("MD5"); 39 | 40 | // get the input as bytes 41 | var bytes = new String(orgin).getBytes("UTF-8"); 42 | 43 | // calculate the digest 44 | algorithm.reset(); 45 | algorithm.update(bytes); 46 | var md5Digest = algorithm.digest(); 47 | 48 | // turn the digest into a hex-string representation 49 | var hexString = new StringBuffer(); 50 | 51 | for (var i = 0; i < md5Digest.length; i++){ 52 | var hex = Integer.toHexString(md5Digest[i] & 0XFF); 53 | if (hex.length() == 1){ 54 | hexString.append('0').append(""); 55 | } 56 | hexString.append(hex); 57 | } 58 | 59 | // write output value 60 | var sign = hexString.toString().toUpperCase(); 61 | return sign 62 | } 63 | 64 | JDRESTAPI.prototype.URLEncode = function (ru, rp) { 65 | var request_url = ru; 66 | var request_params = rp; 67 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 68 | var e = it.next(); 69 | if (new String(e.getValue()).length() > 0) { 70 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 71 | } 72 | } 73 | var url = request_url + "?" + request_params.toString().substring(1); 74 | 75 | return new URI(url).toString(); 76 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.coo8.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function Coo8RESTAPI(treeMap){ 13 | this.ht = treeMap; 14 | } 15 | 16 | Coo8RESTAPI.prototype.put = function (key, value) { 17 | this.ht.put(key, value); 18 | } 19 | 20 | Coo8RESTAPI.prototype.encrypt = function (app_secret) { 21 | var orgin = new StringBuffer(); 22 | orgin.append(app_secret); 23 | 24 | var map = new TreeMap(); 25 | map.putAll(this.ht); 26 | 27 | var iter = map.keySet().iterator(); 28 | while (iter.hasNext()) { 29 | var name = String.valueOf(iter.next()); 30 | if (new String(map.get(name)).length() > 0) { 31 | orgin.append(name).append(map.get(name)); 32 | } 33 | } 34 | 35 | orgin.append(app_secret); 36 | 37 | // get the md5 digest algorithm 38 | var algorithm = MessageDigest.getInstance("MD5"); 39 | 40 | // get the input as bytes 41 | var bytes = new String(orgin).getBytes("UTF-8"); 42 | 43 | // calculate the digest 44 | algorithm.reset(); 45 | algorithm.update(bytes); 46 | var md5Digest = algorithm.digest(); 47 | 48 | // turn the digest into a hex-string representation 49 | var hexString = new StringBuffer(); 50 | 51 | for (var i = 0; i < md5Digest.length; i++){ 52 | var hex = Integer.toHexString(md5Digest[i] & 0XFF); 53 | if (hex.length() == 1){ 54 | hexString.append('0').append(""); 55 | } 56 | hexString.append(hex); 57 | } 58 | 59 | // write output value 60 | var sign = hexString.toString().toUpperCase(); 61 | return sign 62 | } 63 | 64 | Coo8RESTAPI.prototype.URLEncode = function (ru, rp) { 65 | var request_url = ru; 66 | var request_params = rp; 67 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 68 | var e = it.next(); 69 | if (new String(e.getValue()).length() > 0) { 70 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 71 | } 72 | } 73 | var url = request_url + "?" + request_params.toString().substring(1); 74 | 75 | return new URI(url).toString(); 76 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.ehub.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function EHubRESTAPI(treeMap){ 13 | this.ht = treeMap; 14 | } 15 | 16 | EHubRESTAPI.prototype.put = function (key, value) { 17 | this.ht.put(key, value); 18 | } 19 | 20 | EHubRESTAPI.prototype.encrypt = function (app_secret) { 21 | var orgin = new StringBuffer(); 22 | orgin.append(app_secret); 23 | 24 | var map = new TreeMap(); 25 | map.putAll(this.ht); 26 | 27 | var iter = map.keySet().iterator(); 28 | while (iter.hasNext()) { 29 | var name = String.valueOf(iter.next()); 30 | if (new String(map.get(name)).length() > 0) { 31 | orgin.append(name).append(map.get(name)); 32 | } 33 | } 34 | 35 | orgin.append(app_secret); 36 | 37 | // get the md5 digest algorithm 38 | var algorithm = MessageDigest.getInstance("MD5"); 39 | 40 | // get the input as bytes 41 | var bytes = new String(orgin).getBytes("UTF-8"); 42 | 43 | // calculate the digest 44 | algorithm.reset(); 45 | algorithm.update(bytes); 46 | var md5Digest = algorithm.digest(); 47 | 48 | // turn the digest into a hex-string representation 49 | var hexString = new StringBuffer(); 50 | 51 | for (var i = 0; i < md5Digest.length; i++){ 52 | var hex = Integer.toHexString(md5Digest[i] & 0XFF); 53 | if (hex.length() == 1){ 54 | hexString.append('0').append(""); 55 | } 56 | hexString.append(hex); 57 | } 58 | 59 | // write output value 60 | var sign = hexString.toString().toUpperCase(); 61 | return sign 62 | } 63 | 64 | EHubRESTAPI.prototype.URLEncode = function (ru, rp) { 65 | var request_url = ru; 66 | var request_params = rp; 67 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 68 | var e = it.next(); 69 | if (new String(e.getValue()).length() > 0) { 70 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 71 | } 72 | } 73 | var url = request_url + "?" + request_params.toString().substring(1); 74 | 75 | return new URI(url).toString(); 76 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/router/entity/Message.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.router.entity; 2 | 3 | 4 | import com.thoughtworks.xstream.annotations.XStreamAlias; 5 | import org.ukettle.basics.base.entity.BaseEntity; 6 | import org.ukettle.www.xstream.annotations.XStream2Field; 7 | 8 | @XStreamAlias("response") 9 | public class Message extends BaseEntity { 10 | 11 | private static final long serialVersionUID = 3668575797512981091L; 12 | 13 | @XStreamAlias("code") 14 | @XStream2Field 15 | private String code; 16 | @XStreamAlias("message") 17 | @XStream2Field 18 | private String message; 19 | 20 | public Message() { 21 | } 22 | 23 | public Message(Error code) { 24 | this.code = String.valueOf(code.getKey()); 25 | this.message = code.getMessage(); 26 | } 27 | 28 | public Message(Error code, String message) { 29 | this.code = String.valueOf(code.getKey()); 30 | this.message = message; 31 | } 32 | 33 | public String getCode() { 34 | return code; 35 | } 36 | 37 | public void setCode(String code) { 38 | this.code = code; 39 | } 40 | 41 | public String getMessage() { 42 | return message; 43 | } 44 | 45 | public void setMessage(String message) { 46 | this.message = message; 47 | } 48 | 49 | public enum Error { 50 | /** 访问权限 */ 51 | ACCESS_VALID_FAIL(100, "Authentication Failed"), 52 | ACCESS_VALID_ERROR(101, "Permission Error"), 53 | /** 系统权限 */ 54 | SYSTEM_VALID_USER(200, "Uknown User"), 55 | SYSTEM_VALID_ERROR(201,"Unknown Error"), 56 | /** API业务参数 */ 57 | API_MISSING_PARAMS(300, "Missing Parameter"), 58 | API_MISSING_ID(201,"Missing id"), 59 | API_MISSING_SIGNATURE(302, "Missing signature"), 60 | API_MISSING_TIMESTAMP(303, "Missing timestamp"), 61 | API_INVALID_TIMESTAMP(304, "Invalid timestamp"), 62 | API_VALID_FAIL(305, "Valid Fail"), 63 | /** 其他参数 */ 64 | ERROR(0, "service error"), UNKNOWN(-1, "unknown error"); 65 | final int key; 66 | final String message; 67 | 68 | private Error(int key, String message) { 69 | this.key = key; 70 | this.message = message; 71 | } 72 | 73 | public static Error getErrorCode(int key) { 74 | for (Error err : values()) { 75 | if (err.key == key) 76 | return err; 77 | } 78 | return UNKNOWN; 79 | } 80 | 81 | public int getKey() { 82 | return key; 83 | } 84 | 85 | public String getMessage() { 86 | return message; 87 | } 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/kettle/ibatis/KettleLogs.Mapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | insert into K_LOGS ( 8 | id 9 | , mid 10 | , logs 11 | , creator 12 | , created 13 | ) 14 | values ( 15 | #{id}, 16 | #{mid}, 17 | #{logs}, 18 | #{creator}, 19 | #{created} 20 | ) 21 | 22 | 23 | 24 | delete from K_LOGS where mid = #{mid} 25 | 26 | 27 | 28 | update K_LOGS 29 | 30 | 31 | logs = #{logs}, 32 | 33 | 34 | mid = #{mid}, 35 | 36 | 37 | creator = #{creator}, 38 | 39 | 40 | created = #{created} 41 | 42 | 43 | where id = #{id} 44 | 45 | 46 | 64 | 65 | 93 | 94 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/HSQLDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * Dialect for HSQLDB 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 19, 2014 15 | * @Time 10:23:45 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class HSQLDialect implements Dialect { 21 | @Override 22 | public boolean limit() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public String getLimit(String sql, int offset, int limit) { 28 | return getLimit(sql, offset, Integer.toString(offset), 29 | Integer.toString(limit)); 30 | } 31 | 32 | /** 33 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 34 | * 35 | *
    36 | 	 * 如mysql
    37 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
    38 | 	 * select * from user limit :offset,:limit
    39 | 	 * 
    40 | * 41 | * @param sql 42 | * 实际SQL语句 43 | * @param offset 44 | * 分页开始纪录条数 45 | * @param offsetPlaceholder 46 | * 分页开始纪录条数-占位符号 47 | * @param limitPlaceholder 48 | * 分页纪录条数占位符号 49 | * @return 包含占位符的分页sql 50 | */ 51 | public String getLimit(String sql, int offset, String offsetPlaceholder, 52 | String limitPlaceholder) { 53 | boolean hasOffset = offset > 0; 54 | return new StringBuffer(sql.length() + 10) 55 | .append(sql) 56 | .insert(sql.toLowerCase().indexOf("select") + 6, 57 | hasOffset ? " limit " + offsetPlaceholder + " " 58 | + limitPlaceholder : " top " + limitPlaceholder) 59 | .toString(); 60 | } 61 | 62 | @Override 63 | public String getCount(String sql) { 64 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 65 | + ") as dialect"; 66 | } 67 | 68 | @Override 69 | public String getSort(String sql, List sort) { 70 | if (sort == null || sort.isEmpty()) { 71 | return sql; 72 | } 73 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 74 | .append(") dialect order by "); 75 | for (Sorting s : sort) { 76 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 77 | .append(", "); 78 | } 79 | buffer.delete(buffer.length() - 2, buffer.length()); 80 | return buffer.toString(); 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/PostgreSQLDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * Postgre Sql的方言实现 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 17, 2014 15 | * @Time 12:01:31 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class PostgreSQLDialect implements Dialect { 21 | 22 | public boolean limit() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public String getLimit(String sql, int offset, int limit) { 28 | return getLimit(sql, offset, Integer.toString(offset), 29 | Integer.toString(limit)); 30 | } 31 | 32 | /** 33 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 34 | * 35 | *
    36 | 	 * 如mysql
    37 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
    38 | 	 * select * from user limit :offset,:limit
    39 | 	 * 
    40 | * 41 | * @param sql 42 | * 实际SQL语句 43 | * @param offset 44 | * 分页开始纪录条数 45 | * @param offsetPlaceholder 46 | * 分页开始纪录条数-占位符号 47 | * @param limitPlaceholder 48 | * 分页纪录条数占位符号 49 | * @return 包含占位符的分页sql 50 | */ 51 | public String getLimit(String sql, int offset, String offsetPlaceholder, 52 | String limitPlaceholder) { 53 | StringBuilder pageSql = new StringBuilder().append(sql); 54 | pageSql = offset <= 0 ? pageSql.append(" limit ").append( 55 | limitPlaceholder) : pageSql.append(" limit ") 56 | .append(limitPlaceholder).append(" offset ") 57 | .append(offsetPlaceholder); 58 | return pageSql.toString(); 59 | } 60 | 61 | @Override 62 | public String getCount(String sql) { 63 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 64 | + ") as dialect"; 65 | } 66 | 67 | @Override 68 | public String getSort(String sql, List sort) { 69 | if (sort == null || sort.isEmpty()) { 70 | return sql; 71 | } 72 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 73 | .append(") dialect order by "); 74 | for (Sorting s : sort) { 75 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 76 | .append(", "); 77 | } 78 | buffer.delete(buffer.length() - 2, buffer.length()); 79 | return buffer.toString(); 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/shiro/extend/filter/Authentication2Filter.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.shiro.extend.filter; 2 | 3 | import javax.servlet.ServletRequest; 4 | import javax.servlet.ServletResponse; 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | import org.apache.shiro.SecurityUtils; 8 | import org.apache.shiro.session.Session; 9 | import org.apache.shiro.subject.Subject; 10 | import org.apache.shiro.web.filter.authc.AuthenticationFilter; 11 | import org.apache.shiro.web.util.SavedRequest; 12 | import org.apache.shiro.web.util.WebUtils; 13 | 14 | import org.ukettle.basics.shiro.extend.web.Saved2Request; 15 | 16 | 17 | public class Authentication2Filter extends AuthenticationFilter { 18 | 19 | protected boolean isAccessAllowed(ServletRequest request, 20 | ServletResponse response, Object mappedValue) { 21 | Subject subject = getSubject(request, response); 22 | return subject.isAuthenticated(); 23 | } 24 | 25 | protected boolean onAccessDenied(ServletRequest request, 26 | ServletResponse response) throws Exception { 27 | String backUrl = request.getParameter("backUrl"); 28 | saveRequest(request, backUrl, 29 | getDefaultBackUrl(WebUtils.toHttp(request))); 30 | return false; 31 | } 32 | 33 | protected void saveRequest(ServletRequest request, String backUrl, 34 | String fallbackUrl) { 35 | Subject subject = SecurityUtils.getSubject(); 36 | Session session = subject.getSession(); 37 | HttpServletRequest httpRequest = WebUtils.toHttp(request); 38 | session.setAttribute("authc.fallbackUrl", fallbackUrl); 39 | SavedRequest savedRequest = new Saved2Request(httpRequest, backUrl); 40 | session.setAttribute(WebUtils.SAVED_REQUEST_KEY, savedRequest); 41 | } 42 | 43 | private String getDefaultBackUrl(HttpServletRequest request) { 44 | String scheme = request.getScheme(); 45 | String domain = request.getServerName(); 46 | int port = request.getServerPort(); 47 | String contextPath = request.getContextPath(); 48 | StringBuilder backUrl = new StringBuilder(scheme); 49 | backUrl.append("://"); 50 | backUrl.append(domain); 51 | if ("http".equalsIgnoreCase(scheme) && port != 80) { 52 | backUrl.append(":").append(String.valueOf(port)); 53 | } else if ("https".equalsIgnoreCase(scheme) && port != 443) { 54 | backUrl.append(":").append(String.valueOf(port)); 55 | } 56 | backUrl.append(contextPath); 57 | backUrl.append(getSuccessUrl()); 58 | return backUrl.toString(); 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/MySQLDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * Mysql方言的实现 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 16, 2014 15 | * @Time 11:12:31 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class MySQLDialect implements Dialect { 21 | 22 | public boolean limit() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public String getLimit(String sql, int offset, int limit) { 28 | return getLimit(sql, offset, Integer.toString(offset), 29 | Integer.toString(limit)); 30 | } 31 | 32 | /** 33 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 34 | * 35 | *
    36 | 	 * 如mysql
    37 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
    38 | 	 * select * from user limit :offset,:limit
    39 | 	 * 
    40 | * 41 | * @param sql 42 | * 实际SQL语句 43 | * @param offset 44 | * 分页开始纪录条数 45 | * @param offsetPlaceholder 46 | * 分页开始纪录条数-占位符号 47 | * @param limitPlaceholder 48 | * 分页纪录条数占位符号 49 | * @return 包含占位符的分页sql 50 | */ 51 | public String getLimit(String sql, int offset, String offsetPlaceholder, 52 | String limitPlaceholder) { 53 | StringBuilder stringBuilder = new StringBuilder(sql); 54 | stringBuilder.append(" limit "); 55 | if (offset > 0) { 56 | stringBuilder.append(offsetPlaceholder).append(",") 57 | .append(limitPlaceholder); 58 | } else { 59 | stringBuilder.append(limitPlaceholder); 60 | } 61 | return stringBuilder.toString(); 62 | } 63 | 64 | @Override 65 | public String getCount(String sql) { 66 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 67 | + ") as dialect"; 68 | } 69 | 70 | @Override 71 | public String getSort(String sql, List sort) { 72 | if (sort == null || sort.isEmpty()) { 73 | return sql; 74 | } 75 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 76 | .append(") dialect order by "); 77 | for (Sorting s : sort) { 78 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 79 | .append(", "); 80 | } 81 | buffer.delete(buffer.length() - 2, buffer.length()); 82 | return buffer.toString(); 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.dangdang.js: -------------------------------------------------------------------------------- 1 | var MessageDigest = java.security.MessageDigest; 2 | var String = java.lang.String; 3 | var StringBuffer = java.lang.StringBuffer; 4 | var Integer = java.lang.Integer; 5 | var Hashtable = java.util.Hashtable; 6 | var Iteractor = java.util.Iteractor; 7 | var DecimalFormat = java.text.DecimalFormat; 8 | var URI = org.apache.commons.httpclient.URI; 9 | var TreeMap = java.util.TreeMap; 10 | var Date = java.util.Date; 11 | 12 | function DangDangRESTAPI(baseURL, method, treeMap){ 13 | this.baseURL = baseURL; 14 | this.method = method; 15 | this.ht = treeMap; 16 | } 17 | 18 | DangDangRESTAPI.prototype.put = function (key, value) { 19 | this.ht.put(key, value); 20 | } 21 | 22 | DangDangRESTAPI.prototype.encrypt = function (app_secret) { 23 | var orgin = new StringBuffer(); 24 | 25 | var map = new TreeMap(); 26 | map.putAll(this.ht); 27 | 28 | //append value for each key 29 | var iter = map.keySet().iterator(); 30 | while (iter.hasNext()) { 31 | var name = String.valueOf(iter.next()); 32 | if (new String(map.get(name)).length() > 0) { 33 | orgin.append(map.get(name)); 34 | } 35 | } 36 | 37 | orgin.append(app_secret); 38 | 39 | // get the md5 digest algorithm 40 | var algorithm = MessageDigest.getInstance("MD5"); 41 | 42 | // get the input as bytes 43 | var bytes = new String(orgin).getBytes("UTF-8"); 44 | 45 | // calculate the digest 46 | algorithm.reset(); 47 | algorithm.update(bytes); 48 | var md5Digest = algorithm.digest(); 49 | 50 | // turn the digest into a hex-string representation 51 | var hexString = new StringBuffer(); 52 | 53 | for (var i = 0; i < md5Digest.length; i++){ 54 | var hex = Integer.toHexString(md5Digest[i] & 0XFF); 55 | if (hex.length() == 1){ 56 | hexString.append('0').append(""); 57 | } 58 | hexString.append(hex); 59 | } 60 | 61 | // write output value 62 | var sign = hexString.toString(); 63 | return sign 64 | } 65 | 66 | DangDangRESTAPI.prototype.URLEncode = function (rp) { 67 | var request_params = rp; 68 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 69 | var e = it.next(); 70 | if (new String(e.getValue()).length() > 0) { 71 | request_params.append("&").append(e.getKey()).append("=").append(e.getValue()); 72 | } 73 | } 74 | var url = this.baseURL + "/" + this.method + ".php?" + request_params.toString().substring(1); 75 | 76 | return new URI(url).toString(); 77 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/Client.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import org.ukettle.basics.page.dialect.db.DB2Dialect; 8 | import org.ukettle.basics.page.dialect.db.H2Dialect; 9 | import org.ukettle.basics.page.dialect.db.HSQLDialect; 10 | import org.ukettle.basics.page.dialect.db.MySQLDialect; 11 | import org.ukettle.basics.page.dialect.db.OracleDialect; 12 | import org.ukettle.basics.page.dialect.db.PostgreSQLDialect; 13 | import org.ukettle.basics.page.dialect.db.SQLServer2005Dialect; 14 | import org.ukettle.basics.page.dialect.db.SQLServerDialect; 15 | import org.ukettle.basics.page.dialect.db.SybaseDialect; 16 | 17 | 18 | /** 19 | * @author Kimi Liu 20 | * @Date Apr 19, 2014 21 | * @Time 10:21:33 22 | * @email 839536@QQ.com 23 | * @version 1.0 24 | * @since JDK 1.6 25 | */ 26 | public class Client implements Serializable { 27 | private static final long serialVersionUID = 8107330250767760951L; 28 | private static final Map DB_DIALECT = new HashMap(); 29 | 30 | /** 31 | * 根据数据库名称获取数据库分页查询的方言实现。 32 | * 33 | * @param db 34 | * 数据库名称 35 | * @return 数据库分页方言实现 36 | */ 37 | public static Dialect getDialect(DB db) { 38 | if (DB_DIALECT.containsKey(db)) { 39 | return DB_DIALECT.get(db); 40 | } 41 | Dialect dialect = createDialect(db); 42 | DB_DIALECT.put(db, dialect); 43 | return dialect; 44 | } 45 | 46 | /** 47 | * 插入自定义方言的实例 48 | * 49 | * @param exDialect 50 | * 方言实现 51 | */ 52 | public static void putEx(Dialect exDialect) { 53 | DB_DIALECT.put(DB.EX, exDialect); 54 | } 55 | 56 | /** 57 | * 创建数据库方言 58 | * 59 | * @param db 60 | * 数据库 61 | * @return 数据库 62 | */ 63 | private static Dialect createDialect(DB db) { 64 | switch (db) { 65 | case MYSQL: 66 | return new MySQLDialect(); 67 | case ORACLE: 68 | return new OracleDialect(); 69 | case DB2: 70 | return new DB2Dialect(); 71 | case POSTGRE: 72 | return new PostgreSQLDialect(); 73 | case SQLSERVER: 74 | return new SQLServerDialect(); 75 | case SQLSERVER2005: 76 | return new SQLServer2005Dialect(); 77 | case SYBASE: 78 | return new SybaseDialect(); 79 | case H2: 80 | return new H2Dialect(); 81 | case HSQL: 82 | return new HSQLDialect(); 83 | default: 84 | throw new UnsupportedOperationException("Empty db dialect"); 85 | } 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/SQLServerDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * MSSQLServer 数据库实现分页方言 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 17, 2014 15 | * @Time 11:09:56 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class SQLServerDialect implements Dialect { 21 | 22 | public boolean limit() { 23 | return true; 24 | } 25 | 26 | static int getAfterSelectInsertPoint(String sql) { 27 | int selectIndex = sql.toLowerCase().indexOf("select"); 28 | final int selectDistinctIndex = sql.toLowerCase().indexOf( 29 | "select distinct"); 30 | return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6); 31 | } 32 | 33 | public String getLimitString(String sql, int offset, int limit) { 34 | return getLimit(sql, offset, limit); 35 | } 36 | 37 | /** 38 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 39 | * 40 | *
    41 | 	 * 如mysql
    42 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
    43 | 	 * select * from user limit :offset,:limit
    44 | 	 * 
    45 | * 46 | * @param sql 47 | * 实际SQL语句 48 | * @param offset 49 | * 分页开始纪录条数 50 | * @param limit 51 | * 分页每页显示纪录条数 52 | * @return 包含占位符的分页sql 53 | */ 54 | public String getLimit(String sql, int offset, int limit) { 55 | if (offset > 0) { 56 | throw new UnsupportedOperationException("sql server has no offset"); 57 | } 58 | return new StringBuffer(sql.length() + 8).append(sql) 59 | .insert(getAfterSelectInsertPoint(sql), " top " + limit) 60 | .toString(); 61 | } 62 | 63 | @Override 64 | public String getCount(String sql) { 65 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 66 | + ") as dialect"; 67 | } 68 | 69 | @Override 70 | public String getSort(String sql, List sort) { 71 | if (sort == null || sort.isEmpty()) { 72 | return sql; 73 | } 74 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 75 | .append(") dialect order by "); 76 | for (Sorting s : sort) { 77 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 78 | .append(", "); 79 | } 80 | buffer.delete(buffer.length() - 2, buffer.length()); 81 | return buffer.toString(); 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /src/main/webapp/Html/js/libs/url/cmg.open.url.builder.amazon.js: -------------------------------------------------------------------------------- 1 | var String = java.lang.String; 2 | var StringBuffer = java.lang.StringBuffer; 3 | var Integer = java.lang.Integer; 4 | var Hashtable = java.util.Hashtable; 5 | var Iteractor = java.util.Iteractor; 6 | var TreeMap = java.util.TreeMap; 7 | var Date = java.util.Date; 8 | var Mac = javax.crypto.Mac; 9 | var SecretKeySpec = javax.crypto.spec.SecretKeySpec; 10 | var Base64 = org.apache.commons.codec.binary.Base64; 11 | var URLEncoder = java.net.URLEncoder; 12 | 13 | 14 | function AmazonRESTAPI(treeMap){ 15 | this.ht = treeMap; 16 | } 17 | 18 | AmazonRESTAPI.prototype.put = function (key, value) { 19 | this.ht.put(key, value); 20 | } 21 | 22 | AmazonRESTAPI.prototype.encrypt = function (url, method, version, app_secret) { 23 | var orgin = new StringBuffer(); 24 | orgin.append("POST\n"); 25 | orgin.append(url+"\n"); 26 | orgin.append("/"+method+"/"+version+"\n"); 27 | 28 | 29 | var map = new TreeMap(); 30 | map.putAll(this.ht); 31 | 32 | var iter = map.keySet().iterator(); 33 | var i = 0; 34 | while (iter.hasNext()) { 35 | var name = String.valueOf(iter.next()); 36 | if (new String(map.get(name)).length() > 0) { 37 | if (i > 0){ 38 | orgin.append("&").append(name).append("=" + URLEncoder.encode(map.get(name),"utf-8")); 39 | } else { 40 | orgin.append(name).append("=" + URLEncoder.encode(map.get(name),"utf-8")); 41 | i = i + 1; 42 | } 43 | } 44 | } 45 | //Alert(new String(orgin)); 46 | //var sign = CryptoJS.HmacSHA256("abc", "dJ9CtVeqWTKXsnqzavUf+AQTOnRqA+0EzPVWN2t1"); 47 | //Alert(new String(app_secret)); 48 | var sha256_HMAC = Mac.getInstance("HmacSHA256"); 49 | var secret_key = new SecretKeySpec(new String(app_secret).getBytes(), new String("HmacSHA256")); 50 | sha256_HMAC.init(secret_key); 51 | var sign = sha256_HMAC.doFinal(new String(orgin).getBytes()); 52 | 53 | var signBase64 = new Base64().encodeBase64(new String(sign).getBytes()); 54 | 55 | return new String(signBase64); 56 | } 57 | 58 | AmazonRESTAPI.prototype.URLEncode = function (ru, rp) { 59 | var request_url = ru; 60 | var request_params = rp; 61 | for (var it = this.ht.entrySet().iterator(); it.hasNext();) { 62 | var e = it.next(); 63 | if (new String(e.getValue()).length() > 0) { 64 | request_params.append("&").append(e.getKey()).append("=").append(URLEncoder.encode(e.getValue(),"utf-8")); 65 | } 66 | } 67 | var url = request_url + "?" + request_params.toString().substring(1); 68 | return url; 69 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | import org.ukettle.basics.shiro.entity.Shiro; 9 | import org.ukettle.engine.loader.BasicMapper; 10 | import org.ukettle.system.entity.User; 11 | import org.ukettle.system.service.UserService; 12 | import org.ukettle.www.toolkit.DateUtils; 13 | import org.ukettle.www.toolkit.Encode; 14 | import org.ukettle.www.toolkit.ObjectID; 15 | import org.ukettle.www.toolkit.Random; 16 | 17 | 18 | @Service 19 | public class UserServiceImpl implements UserService { 20 | 21 | @Autowired 22 | private BasicMapper mapper; 23 | 24 | @Override 25 | public Object insert(T entity) throws DataAccessException { 26 | if (null != entity) { 27 | entity.setId(ObjectID.id()); 28 | entrypt(entity); 29 | entity.setCreator(Shiro.get().getEmail()); 30 | entity.setCreated(DateUtils.getTime24()); 31 | if (((Integer) mapper.iUserMapper.insert(entity)) > 0) { 32 | return entity.getId(); 33 | } 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public Object update(T entity) throws DataAccessException { 40 | if (null != entity) { 41 | entrypt(entity); 42 | if (((Integer) mapper.iUserMapper.update(entity)) > 0) { 43 | return entity.getId(); 44 | } 45 | } 46 | return null; 47 | } 48 | 49 | @Override 50 | public Object delete(String id) throws DataAccessException { 51 | if (null != id && !"".equals(id)) { 52 | if (((Integer) mapper.iUserMapper.delete(id)) > 0) { 53 | return id; 54 | } 55 | } 56 | return null; 57 | } 58 | 59 | @Override 60 | public Object select(T entity) throws DataAccessException { 61 | if (null != entity) { 62 | return mapper.iUserMapper.select(entity); 63 | } 64 | return null; 65 | } 66 | 67 | @Override 68 | public List selectByWhere(T entity) throws DataAccessException { 69 | if (null != entity) { 70 | return mapper.iUserMapper.selectByWhere(entity); 71 | } 72 | return null; 73 | } 74 | 75 | private void entrypt(T entity) { 76 | byte[] random = Random.generate(Random.CODE_SIZE); 77 | entity.setRandom(Encode.encodeHex(random)); 78 | byte[] password = Random.sha1(entity.getPassword().getBytes(), random, 79 | Random.ITERATION); 80 | entity.setPassword(Encode.encodeHex(password)); 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Widget/Kettle/Spoon/tree.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="../../../Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | <%@ include file="../../../Comm/resource.jsp"%> 8 | 9 | 10 | 91 |
      92 | 93 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/proxy/Pagination.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.proxy; 2 | 3 | import org.apache.ibatis.session.RowBounds; 4 | 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | /** 9 | *

      10 | * 分页对象. 11 | *

      12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 22, 2014 15 | * @Time 10:21:21 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class Pagination { 21 | 22 | private long total; 23 | private int page; 24 | private int offset; 25 | private int limit; 26 | private int pageSize; 27 | 28 | private List datas = Collections.emptyList(); 29 | 30 | public Pagination() { 31 | this(1, 15); 32 | } 33 | 34 | public Pagination(int page) { 35 | this(page, 15); 36 | } 37 | 38 | public Pagination(int page, int limit) { 39 | setPage(page); 40 | setLimit(limit); 41 | } 42 | 43 | public Pagination(RowBounds rowBounds) { 44 | this.limit = rowBounds.getLimit(); 45 | this.offset = rowBounds.getOffset(); 46 | this.page = offset / limit + 1; 47 | } 48 | 49 | public void setPage(int page) { 50 | if (page < 0) { 51 | page = 1; 52 | } 53 | this.page = page; 54 | onInit(); 55 | } 56 | 57 | public void setLimit(int limit) { 58 | if (limit < 1) { 59 | limit = 15; 60 | } 61 | this.limit = limit; 62 | onInit(); 63 | } 64 | 65 | protected void onInit() { 66 | offset = (page - 1) * limit; 67 | } 68 | 69 | protected void onSetRowsize() { 70 | pageSize = (int) (total / limit); 71 | if (total % limit > 0) { 72 | pageSize++; 73 | } 74 | if (page > pageSize) { 75 | page = pageSize; 76 | onInit(); 77 | } 78 | } 79 | 80 | protected void onSetList() { 81 | if (datas == null || datas.isEmpty()) { 82 | total = 0; 83 | page = 1; 84 | offset = 0; 85 | } 86 | } 87 | 88 | public long getTotal() { 89 | return total; 90 | } 91 | 92 | public void setTotal(long rowSize) { 93 | this.total = rowSize; 94 | onSetRowsize(); 95 | } 96 | 97 | public int getPageSize() { 98 | return pageSize; 99 | } 100 | 101 | public List getDatas() { 102 | return datas; 103 | } 104 | 105 | public void setDatas(List datas) { 106 | this.datas = datas; 107 | onSetList(); 108 | } 109 | 110 | public int getOffset() { 111 | return offset; 112 | } 113 | 114 | public int getLimit() { 115 | return limit; 116 | } 117 | 118 | public int getPage() { 119 | return page; 120 | } 121 | 122 | } -------------------------------------------------------------------------------- /src/main/resources/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/execute/KettleExecService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.execute; 2 | 3 | import org.quartz.JobExecutionContext; 4 | import org.quartz.JobExecutionException; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.scheduling.quartz.QuartzJobBean; 7 | import org.ukettle.engine.loader.BasicService; 8 | import org.ukettle.widget.kettle.entity.KettleSpoon; 9 | import org.ukettle.www.toolkit.Constant; 10 | import org.ukettle.www.toolkit.DateUtils; 11 | 12 | /** 13 | *

      14 | * 简单的实现了Spring QuartzJobBean接口 15 | *

      16 | * 17 | * @author Kimi Liu 18 | * @Date Mar 12, 2014 19 | * @Time 10:27:31 20 | * @email 839536@QQ.com 21 | * @version 1.0 22 | * @since JDK 1.6 23 | */ 24 | public class KettleExecService extends QuartzJobBean { 25 | 26 | @Autowired 27 | private BasicService service; 28 | 29 | /** 30 | * 执行实际任务 31 | * 32 | * @see execute 33 | */ 34 | @Override 35 | protected void executeInternal(JobExecutionContext context) 36 | throws JobExecutionException { 37 | KettleSpoon entity = new KettleSpoon(); 38 | // 获取定时任务中的所有参数 39 | for (Object key : context.getJobDetail().getJobDataMap().keySet()) { 40 | String strVal = context.getJobDetail().getJobDataMap().get(key) 41 | .toString(); 42 | // 根据定时任务参数封装Kettle所需参数 43 | setValue(key.toString(), strVal, entity); 44 | } 45 | entity.setTid(context.getJobDetail().getKey().toString()); 46 | execute(entity); 47 | } 48 | 49 | /** 50 | * 执行Kettle定时任务 51 | */ 52 | private void execute(KettleSpoon entity) { 53 | if (null != entity && !"".equals(entity)) { 54 | service.iKettleSpoonService.execute((KettleSpoon) entity); 55 | } 56 | } 57 | 58 | /** 59 | * 封装Kettle定时任务等先关参数 60 | */ 61 | private void setValue(String key, String strVal, KettleSpoon entity) { 62 | if (null != strVal) { 63 | if (strVal.startsWith(Constant.STARTS_WITH_USD)) { 64 | int minute = Integer.parseInt(strVal.split("\\" 65 | + Constant.STARTS_WITH_USD)[1]); 66 | strVal = DateUtils.isAssign(null, minute); 67 | // 判断是否为复合参数以"-param:"开始 68 | } else if (strVal.startsWith(Constant.STARTS_WITH_PARAM)) { 69 | String[] array = strVal.split(Constant.SPLIT_PARAM); 70 | for (int i = 1; i < array.length; i++) { 71 | // 分割字符,获取参数、参数值 72 | String[] val = array[i].split(Constant.SPLIT_EQUAL); 73 | if (val[1].startsWith(Constant.STARTS_WITH_USD)) { 74 | // 分割字符,判断是否为自定义日期 75 | int minute = Integer.parseInt(val[1].split("\\" 76 | + Constant.STARTS_WITH_USD)[1] 77 | .replace("@@", "")); 78 | String date = DateUtils.isAssign(null, minute); 79 | if (i + 1 != array.length) { 80 | date = date + "@@"; 81 | } 82 | // 重新封装日期参数 83 | strVal = strVal.replace(val[1], date); 84 | } 85 | } 86 | } 87 | entity.setValue(key, strVal); 88 | } 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/spring/SpringUtils.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.spring; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; 5 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor; 6 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 7 | 8 | /** 9 | * 功能描述:Spring上下文信息 10 | * 11 | * @author Kimi Liu 12 | * @Date Mar 10, 2014 13 | * @Time 21:20:25 14 | * @email 839536@QQ.com 15 | * @version 1.0 16 | * @since JDK 1.6 17 | */ 18 | public final class SpringUtils implements BeanFactoryPostProcessor { 19 | 20 | // Spring应用上下文环境 21 | private static ConfigurableListableBeanFactory factory; 22 | 23 | @Override 24 | public void postProcessBeanFactory( 25 | ConfigurableListableBeanFactory beanFactory) throws BeansException { 26 | factory = beanFactory; 27 | } 28 | 29 | /** 30 | * 获取对象 31 | * 32 | * @param name 33 | * @return Object 一个以所给名字注册的bean的实例 34 | * @throws org.springframework.beans.BeansException 35 | * 36 | */ 37 | @SuppressWarnings("all") 38 | public static T getBean(String name) throws BeansException { 39 | return (T) factory.getBean(name); 40 | } 41 | 42 | /** 43 | * 获取类型为requiredType的对象 44 | * 45 | * @param clz 46 | * @return 47 | * @throws org.springframework.beans.BeansException 48 | * 49 | */ 50 | public static T getBean(Class clazz) throws BeansException { 51 | return (T) factory.getBean(clazz); 52 | } 53 | 54 | /** 55 | * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true 56 | * 57 | * @param name 58 | * @return boolean 59 | */ 60 | public static boolean containsBean(String name) { 61 | return factory.containsBean(name); 62 | } 63 | 64 | /** 65 | * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 66 | * 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) 67 | * 68 | * @param name 69 | * @return boolean 70 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 71 | * 72 | */ 73 | public static boolean isSingleton(String name) 74 | throws NoSuchBeanDefinitionException { 75 | return factory.isSingleton(name); 76 | } 77 | 78 | /** 79 | * @param name 80 | * @return Class 注册对象的类型 81 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 82 | * 83 | */ 84 | public static Class getType(String name) 85 | throws NoSuchBeanDefinitionException { 86 | return factory.getType(name); 87 | } 88 | 89 | /** 90 | * 如果给定的bean名字在bean定义中有别名,则返回这些别名 91 | * 92 | * @param name 93 | * @return 94 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 95 | * 96 | */ 97 | public static String[] getAliases(String name) 98 | throws NoSuchBeanDefinitionException { 99 | return factory.getAliases(name); 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/toolkit/spring/SpringUtils.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.toolkit.spring; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; 5 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor; 6 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 7 | 8 | /** 9 | * 功能描述:Spring上下文信息 10 | * 11 | * @author Kimi Liu 12 | * @Date Mar 10, 2014 13 | * @Time 21:20:25 14 | * @email 839536@QQ.com 15 | * @version 1.0 16 | * @since JDK 1.6 17 | */ 18 | public final class SpringUtils implements BeanFactoryPostProcessor { 19 | 20 | // Spring应用上下文环境 21 | private static ConfigurableListableBeanFactory factory; 22 | 23 | @Override 24 | public void postProcessBeanFactory( 25 | ConfigurableListableBeanFactory beanFactory) throws BeansException { 26 | factory = beanFactory; 27 | } 28 | 29 | /** 30 | * 获取对象 31 | * 32 | * @param name 33 | * @return Object 一个以所给名字注册的bean的实例 34 | * @throws org.springframework.beans.BeansException 35 | * 36 | */ 37 | @SuppressWarnings("all") 38 | public static T getBean(String name) throws BeansException { 39 | return (T) factory.getBean(name); 40 | } 41 | 42 | /** 43 | * 获取类型为requiredType的对象 44 | * 45 | * @param clz 46 | * @return 47 | * @throws org.springframework.beans.BeansException 48 | * 49 | */ 50 | public static T getBean(Class clazz) throws BeansException { 51 | return (T) factory.getBean(clazz); 52 | } 53 | 54 | /** 55 | * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true 56 | * 57 | * @param name 58 | * @return boolean 59 | */ 60 | public static boolean containsBean(String name) { 61 | return factory.containsBean(name); 62 | } 63 | 64 | /** 65 | * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 66 | * 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) 67 | * 68 | * @param name 69 | * @return boolean 70 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 71 | * 72 | */ 73 | public static boolean isSingleton(String name) 74 | throws NoSuchBeanDefinitionException { 75 | return factory.isSingleton(name); 76 | } 77 | 78 | /** 79 | * @param name 80 | * @return Class 注册对象的类型 81 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 82 | * 83 | */ 84 | public static Class getType(String name) 85 | throws NoSuchBeanDefinitionException { 86 | return factory.getType(name); 87 | } 88 | 89 | /** 90 | * 如果给定的bean名字在bean定义中有别名,则返回这些别名 91 | * 92 | * @param name 93 | * @return 94 | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException 95 | * 96 | */ 97 | public static String[] getAliases(String name) 98 | throws NoSuchBeanDefinitionException { 99 | return factory.getAliases(name); 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/iPage/Widget/Kettle/Spoon/insert.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="../../../Comm/tags.jsp"%> 2 | 3 | 4 | 5 | <spring:message code="org.ukettle.Title" /> 6 | 7 | <%@ include file="../../../Comm/resource.jsp"%> 8 | 9 | 10 | 11 |
      12 |
      13 | <%@ include file="../../../header.jsp"%> 14 |
      15 | 18 |
      19 |
      20 | 23 |
      24 |
      25 | 26 | 27 | 28 | 29 |

      30 |
      31 |
      32 |

      33 | 39 |

      40 |

      41 |
      42 |

      43 | 44 | 45 | 46 |

      47 |
      48 | " /> 49 |
      50 |
      51 | 52 |
      53 |
      54 |
      55 |
      56 |
      57 |
      58 |
      59 |
      60 | <%@ include file="../../../footer.jsp"%> 61 |
      62 |
      63 | 64 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/widget/quartz/ibatis/QuartzGroup.Mapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | insert into Q_GROUP ( 8 | id 9 | , name 10 | , type 11 | , status 12 | , description 13 | , creator 14 | , created 15 | ) 16 | values ( 17 | #{id}, 18 | #{name}, 19 | #{type}, 20 | #{status}, 21 | #{description}, 22 | #{creator}, 23 | #{created} 24 | ) 25 | 26 | 27 | 28 | delete from Q_GROUP where id = #{id} 29 | 30 | 31 | 32 | update Q_GROUP 33 | 34 | 35 | name = #{name}, 36 | 37 | 38 | type = #{type}, 39 | 40 | 41 | status = #{status}, 42 | 43 | 44 | description = #{description}, 45 | 46 | 47 | creator = #{creator}, 48 | 49 | 50 | created = #{created} 51 | 52 | 53 | where id = #{id} 54 | 55 | 56 | 73 | 74 | 110 | 111 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/system/service/impl/MenuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.stereotype.Service; 8 | 9 | import org.ukettle.basics.shiro.entity.Shiro; 10 | import org.ukettle.engine.loader.BasicMapper; 11 | import org.ukettle.system.entity.Menu; 12 | import org.ukettle.system.service.MenuService; 13 | import org.ukettle.www.toolkit.Constant; 14 | import org.ukettle.www.toolkit.DateUtils; 15 | import org.ukettle.www.toolkit.ObjectID; 16 | 17 | 18 | @Service 19 | public class MenuServiceImpl implements MenuService { 20 | 21 | @Autowired 22 | private BasicMapper mapper; 23 | 24 | @Override 25 | public Object insert(T entity) throws DataAccessException { 26 | if (null != entity) { 27 | entity.setId(ObjectID.id()); 28 | entity.setCreator(Shiro.get().getEmail()); 29 | entity.setCreated(DateUtils.getTime24()); 30 | if (((Integer) mapper.iMenuMapper.insert(entity)) > 0) { 31 | return entity.getId(); 32 | } 33 | } 34 | return null; 35 | } 36 | 37 | @Override 38 | public Object update(T entity) throws DataAccessException { 39 | if (null != entity) { 40 | if (((Integer) mapper.iMenuMapper.update(entity)) > 0) { 41 | return entity.getId(); 42 | } 43 | } 44 | return null; 45 | } 46 | 47 | @Override 48 | public Object delete(String id) throws DataAccessException { 49 | if (null != id && !"".equals(id)) { 50 | if (((Integer) mapper.iMenuMapper.delete(id)) > 0) { 51 | return id; 52 | } 53 | } 54 | return null; 55 | } 56 | 57 | @Override 58 | public Object select(T entity) throws DataAccessException { 59 | if (null != entity) { 60 | return mapper.iMenuMapper.select(entity); 61 | } 62 | return null; 63 | } 64 | 65 | @Override 66 | public List selectByWhere(T entity) throws DataAccessException { 67 | if (null != entity) { 68 | return mapper.iMenuMapper.selectByWhere(entity); 69 | } 70 | return null; 71 | } 72 | 73 | @Override 74 | public List selectById(T entity) { 75 | if (null != entity) { 76 | entity.setUid(Shiro.get().getId()); 77 | entity.setStatus(Constant.STATUS_ENABLED); 78 | return mapper.iMenuMapper.selectById(entity); 79 | } 80 | return null; 81 | } 82 | 83 | @Override 84 | public List selectByPid(T entity) { 85 | if (null != entity) { 86 | entity.setUid(Shiro.get().getId()); 87 | entity.setStatus(Constant.STATUS_ENABLED); 88 | return mapper.iMenuMapper.selectByPid(entity); 89 | } 90 | return null; 91 | } 92 | 93 | @Override 94 | public List selectByUid(T entity) { 95 | if (null != entity) { 96 | entity.setUid(Shiro.get().getId()); 97 | entity.setStatus(Constant.STATUS_ENABLED); 98 | return mapper.iMenuMapper.selectByUid(entity); 99 | } 100 | return null; 101 | } 102 | 103 | } -------------------------------------------------------------------------------- /src/main/resources/spring-quartz.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | iQuartz 27 | 28 | AUTO 29 | false 30 | 1500 31 | false 32 | org.quartz.simpl.SimpleThreadPool 33 | true 34 | 5 35 | 5 36 | 37 | org.quartz.impl.jdbcjobstore.JobStoreTX 38 | 39 | org.quartz.impl.jdbcjobstore.StdJDBCDelegate 40 | false 41 | Q_ 42 | 20 43 | 60000 44 | 45 | true 46 | 47 | 20000 48 | true 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/toolkit/ListQueue.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.toolkit; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | import java.util.concurrent.locks.Condition; 5 | import java.util.concurrent.locks.ReentrantLock; 6 | 7 | public class ListQueue { 8 | 9 | private final AtomicInteger count = new AtomicInteger(0); 10 | private transient Node head; 11 | private transient Node last; 12 | private final ReentrantLock takeLock = new ReentrantLock(); 13 | private final Condition notEmpty = this.takeLock.newCondition(); 14 | private final ReentrantLock putLock = new ReentrantLock(); 15 | 16 | private void signalNotEmpty() { 17 | ReentrantLock takeLock = this.takeLock; 18 | takeLock.lock(); 19 | try { 20 | this.notEmpty.signal(); 21 | } finally { 22 | takeLock.unlock(); 23 | } 24 | } 25 | 26 | private void insert(E x) { 27 | this.last = (this.last.next = new Node(x)); 28 | } 29 | 30 | private E extract() { 31 | Node first = this.head.next; 32 | this.head = null; 33 | this.head = first; 34 | E x = first.item; 35 | first.item = null; 36 | this.head.item = null; 37 | first = null; 38 | return x; 39 | } 40 | 41 | private void fullyLock() { 42 | this.putLock.lock(); 43 | this.takeLock.lock(); 44 | } 45 | 46 | private void fullyUnlock() { 47 | this.takeLock.unlock(); 48 | this.putLock.unlock(); 49 | } 50 | 51 | public ListQueue() { 52 | this.last = (this.head = new Node(null)); 53 | } 54 | 55 | public int size() { 56 | return this.count.get(); 57 | } 58 | 59 | public boolean offer(E o) { 60 | if (o == null) 61 | throw new NullPointerException(); 62 | 63 | int c = -1; 64 | ReentrantLock putLock = this.putLock; 65 | AtomicInteger count = this.count; 66 | putLock.lock(); 67 | try { 68 | insert(o); 69 | c = count.getAndIncrement(); 70 | } finally { 71 | putLock.unlock(); 72 | } 73 | if (c == 0) 74 | signalNotEmpty(); 75 | return c >= 0; 76 | } 77 | 78 | public E take() throws InterruptedException { 79 | int c = -1; 80 | AtomicInteger count = this.count; 81 | ReentrantLock takeLock = this.takeLock; 82 | takeLock.lockInterruptibly(); 83 | E x; 84 | try { 85 | try { 86 | while (count.get() == 0) 87 | this.notEmpty.await(); 88 | } catch (InterruptedException ie) { 89 | this.notEmpty.signal(); 90 | throw ie; 91 | } 92 | 93 | x = extract(); 94 | c = count.getAndDecrement(); 95 | if (c > 1) 96 | this.notEmpty.signal(); 97 | } finally { 98 | takeLock.unlock(); 99 | } 100 | return x; 101 | } 102 | 103 | public void clear() { 104 | fullyLock(); 105 | try { 106 | this.head.next = null; 107 | assert (this.head.item == null); 108 | this.last = this.head; 109 | } finally { 110 | fullyUnlock(); 111 | } 112 | } 113 | 114 | static class Node { 115 | volatile E item; 116 | Node next; 117 | 118 | Node(E x) { 119 | this.item = x; 120 | } 121 | } 122 | 123 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/www/toolkit/Encode.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.www.toolkit; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.net.URLDecoder; 5 | import java.net.URLEncoder; 6 | 7 | import org.apache.commons.codec.DecoderException; 8 | import org.apache.commons.codec.binary.Base64; 9 | import org.apache.commons.codec.binary.Hex; 10 | 11 | import org.ukettle.www.exception.uKettleException; 12 | 13 | /** 14 | *

      15 | * 封装各种格式的编码解码工具类. 1.Commons-Codec的 hex/base64 编码 2.自制的base62 编码 16 | * 3.Commons-Lang的xml/html escape 4.JDK提供的URLEncoder 17 | *

      18 | * 19 | * @author Kimi Liu 20 | * @Date Mar 15, 2014 21 | * @Time 10:22:21 22 | * @email 839536@QQ.com 23 | * @version 1.0 24 | * @since JDK 1.6 25 | */ 26 | public class Encode { 27 | 28 | private static String DEFAULT_URL_ENCODING = Constant.DEFAULT_ENCODING; 29 | private static final char[] BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 30 | .toCharArray(); 31 | 32 | /** 33 | * Hex编码. 34 | */ 35 | public static String encodeHex(byte[] input) { 36 | return Hex.encodeHexString(input); 37 | } 38 | 39 | /** 40 | * Hex解码. 41 | */ 42 | public static byte[] decodeHex(String input) { 43 | try { 44 | return Hex.decodeHex(input.toCharArray()); 45 | } catch (DecoderException e) { 46 | throw uKettleException.unchecked(e); 47 | } 48 | } 49 | 50 | /** 51 | * Base64编码. 52 | */ 53 | public static String encodeBase64(byte[] input) { 54 | return Base64.encodeBase64String(input); 55 | } 56 | 57 | /** 58 | * Base64编码, URL安全(将Base64中的URL非法字符'+'和'/'转为'-'和'_', 见RFC3548). 59 | */ 60 | public static String encodeUrlSafeBase64(byte[] input) { 61 | return Base64.encodeBase64URLSafeString(input); 62 | } 63 | 64 | /** 65 | * Base64解码. 66 | */ 67 | public static byte[] decodeBase64(String input) { 68 | return Base64.decodeBase64(input); 69 | } 70 | 71 | /** 72 | * Base62编码。 73 | */ 74 | public static String encodeBase62(byte[] input) { 75 | char[] chars = new char[input.length]; 76 | for (int i = 0; i < input.length; i++) { 77 | chars[i] = BASE62[((input[i] & 0xFF) % BASE62.length)]; 78 | } 79 | return new String(chars); 80 | } 81 | 82 | /** 83 | * URL 编码, Encode默认为UTF-8. 84 | */ 85 | public static String urlEncode(String url, String encoding) { 86 | try { 87 | if (null != encoding && !"".equals(encoding)) { 88 | DEFAULT_URL_ENCODING = encoding; 89 | } 90 | return URLEncoder.encode(url, DEFAULT_URL_ENCODING); 91 | } catch (UnsupportedEncodingException e) { 92 | throw uKettleException.unchecked(e); 93 | } 94 | } 95 | 96 | /** 97 | * URL 解码, Encode默认为UTF-8. 98 | */ 99 | public static String urlDecode(String url, String encoding) { 100 | try { 101 | if (null != encoding && !"".equals(encoding)) { 102 | DEFAULT_URL_ENCODING = encoding; 103 | } 104 | return URLDecoder.decode(url, DEFAULT_URL_ENCODING); 105 | } catch (UnsupportedEncodingException e) { 106 | throw uKettleException.unchecked(e); 107 | } 108 | } 109 | 110 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/service/execute/AgainExecService.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.service.execute; 2 | 3 | import java.util.Iterator; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.Map.Entry; 7 | 8 | import org.quartz.JobExecutionContext; 9 | import org.quartz.JobExecutionException; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.scheduling.quartz.QuartzJobBean; 12 | import org.ukettle.engine.loader.BasicService; 13 | import org.ukettle.widget.kettle.entity.KettleResult; 14 | import org.ukettle.widget.kettle.entity.KettleSpoon; 15 | import org.ukettle.www.toolkit.Constant; 16 | import org.ukettle.www.toolkit.DateUtils; 17 | import org.ukettle.www.toolkit.JSONUtil; 18 | 19 | /** 20 | *

      21 | * 简单的实现了Spring QuartzJobBean接口 22 | *

      23 | * 24 | * @author Kimi Liu 25 | * @Date Oct 18, 2014 26 | * @Time 10:21:03 27 | * @email 839536@QQ.com 28 | * @version 1.0 29 | * @since JDK 1.6 30 | */ 31 | public class AgainExecService extends QuartzJobBean { 32 | 33 | @Autowired 34 | private BasicService service; 35 | 36 | /** 37 | * 执行实际任务 38 | * 39 | * @see execute 40 | */ 41 | @Override 42 | protected void executeInternal(JobExecutionContext context) 43 | throws JobExecutionException { 44 | KettleResult result = new KettleResult(); 45 | for (Object key : context.getJobDetail().getJobDataMap().keySet()) { 46 | String strVal = context.getJobDetail().getJobDataMap().get(key) 47 | .toString(); 48 | // 获取定时任务中的所有参数 49 | if (strVal.startsWith(Constant.STARTS_WITH_USD)) { 50 | int minute = Integer.parseInt(strVal.split("\\" 51 | + Constant.STARTS_WITH_USD)[1]); 52 | strVal = DateUtils.isAssign(null, minute); 53 | } 54 | result.setValue(key.toString(), strVal); 55 | } 56 | @SuppressWarnings("all") 57 | List list = (List) service.iKettleResultService 58 | .selectByWhere(result); 59 | if (!list.isEmpty()) { 60 | for (KettleResult r : list) { 61 | String json = r.getParams(); 62 | if (!Constant.STATUS_ERROR.equals(r.getStatus())) { 63 | json = json.substring(1, json.length() - 1); 64 | } 65 | Map map = JSONUtil.getMapFromJson(json); 66 | final KettleSpoon entity = new KettleSpoon(); 67 | Iterator it = map.entrySet().iterator(); 68 | while (it.hasNext()) { 69 | Map.Entry ent = (Entry) it.next(); 70 | String key = (String) ent.getKey(); 71 | String val = (String) ent.getValue(); 72 | if (!Constant.STATUS_ERROR.equals(r.getStatus())) { 73 | if (key.indexOf("start_") != -1) { 74 | val = r.getStartTime(); 75 | } 76 | if (key.indexOf("end_") != -1) { 77 | val = r.getEndTime(); 78 | } 79 | if (key.indexOf("nick") != -1) { 80 | val = r.getNick(); 81 | } 82 | } 83 | if (null != val && !"".equals(val)) { 84 | entity.setValue(key, val); 85 | } 86 | } 87 | entity.setRid(r.getId()); 88 | entity.setTid(entity.getName()); 89 | entity.setQueue(false); 90 | service.iKettleSpoonService.execute(entity); 91 | } 92 | } 93 | } 94 | 95 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | uKettle 8 | 9 | 10 | org.springframework.web.context.ContextLoaderListener 11 | 12 | 13 | org.springframework.web.context.request.RequestContextListener 14 | 15 | 16 | 17 | contextConfigLocation 18 | classpath:applicationContext.xml 19 | 20 | 21 | 22 | 23 | dispatcher 24 | org.springframework.web.servlet.DispatcherServlet 25 | 26 | contextConfigLocation 27 | classpath:spring-servlet.xml 28 | 29 | 1 30 | 31 | 32 | dispatcher 33 | / 34 | 35 | 36 | 37 | 38 | characterEncodingFilter 39 | org.springframework.web.filter.CharacterEncodingFilter 40 | 41 | encoding 42 | UTF-8 43 | 44 | 45 | forceEncoding 46 | true 47 | 48 | 49 | 50 | characterEncodingFilter 51 | /* 52 | 53 | 54 | 55 | 56 | org.springframework.web.util.IntrospectorCleanupListener 57 | 58 | 59 | 60 | 61 | shiroFilter 62 | org.springframework.web.filter.DelegatingFilterProxy 63 | 64 | targetFilterLifecycle 65 | true 66 | 67 | 68 | 69 | 70 | shiroFilter 71 | /* 72 | 73 | 74 | 75 | 403 76 | /Html/error.html 77 | 78 | 79 | 404 80 | /Html/error.html 81 | 82 | 83 | 500 84 | /Html/error.html 85 | 86 | 87 | 88 | / 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/dialect/db/OracleDialect.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.dialect.db; 2 | 3 | import java.util.List; 4 | 5 | import org.ukettle.basics.page.Sorting; 6 | import org.ukettle.basics.page.dialect.Dialect; 7 | import org.ukettle.basics.page.plugin.BaseParameter; 8 | 9 | 10 | /** 11 | * Oracle的方言实现 12 | * 13 | * @author Kimi Liu 14 | * @Date Aug 21, 2014 15 | * @Time 15:23:56 16 | * @email 839536@QQ.com 17 | * @version 1.0 18 | * @since JDK 1.6 19 | */ 20 | public class OracleDialect implements Dialect { 21 | 22 | @Override 23 | public boolean limit() { 24 | return true; 25 | } 26 | 27 | @Override 28 | public String getLimit(String sql, int offset, int limit) { 29 | return getLimit(sql, offset, Integer.toString(offset), 30 | Integer.toString(limit)); 31 | } 32 | 33 | /** 34 | * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. 35 | * 36 | *
       37 | 	 * 如mysql
       38 | 	 * dialect.getLimit("select * from user", 12, ":offset",0,":limit") 将返回
       39 | 	 * select * from user limit :offset,:limit
       40 | 	 * 
      41 | * 42 | * @param sql 43 | * 实际SQL语句 44 | * @param offset 45 | * 分页开始纪录条数 46 | * @param offsetPlaceholder 47 | * 分页开始纪录条数-占位符号 48 | * @param limitPlaceholder 49 | * 分页纪录条数占位符号 50 | * @return 包含占位符的分页sql 51 | */ 52 | public String getLimit(String sql, int offset, String offsetPlaceholder, 53 | String limitPlaceholder) { 54 | sql = sql.trim(); 55 | boolean isForUpdate = false; 56 | if (sql.toLowerCase().endsWith(" for update")) { 57 | sql = sql.substring(0, sql.length() - 11); 58 | isForUpdate = true; 59 | } 60 | StringBuilder pagingSelect = new StringBuilder(sql.length() + 100); 61 | if (offset > 0) { 62 | pagingSelect 63 | .append("select * from ( select row_.*, rownum rownum_ from ( "); 64 | } else { 65 | pagingSelect.append("select * from ( "); 66 | } 67 | pagingSelect.append(sql); 68 | if (offset > 0) { 69 | String endString = offsetPlaceholder + "+" + limitPlaceholder; 70 | pagingSelect.append(" ) row_ ) where rownum_ <= ") 71 | .append(endString).append(" and rownum_ > ") 72 | .append(offsetPlaceholder); 73 | } else { 74 | pagingSelect.append(" ) where rownum <= ").append(limitPlaceholder); 75 | } 76 | 77 | if (isForUpdate) { 78 | pagingSelect.append(" for update"); 79 | } 80 | 81 | return pagingSelect.toString(); 82 | } 83 | 84 | @Override 85 | public String getCount(String sql) { 86 | return "select count(1) from (" + BaseParameter.removeOrders(sql) 87 | + ") as dialect"; 88 | } 89 | 90 | @Override 91 | public String getSort(String sql, List sort) { 92 | if (sort == null || sort.isEmpty()) { 93 | return sql; 94 | } 95 | StringBuffer buffer = new StringBuffer("select * from (").append(sql) 96 | .append(") dialect order by "); 97 | for (Sorting s : sort) { 98 | buffer.append(s.getColumn()).append(" ").append(s.getSort()) 99 | .append(", "); 100 | } 101 | buffer.delete(buffer.length() - 2, buffer.length()); 102 | return buffer.toString(); 103 | } 104 | } -------------------------------------------------------------------------------- /src/main/java/org/ukettle/basics/page/plugin/PreparePaginationInterceptor.java: -------------------------------------------------------------------------------- 1 | package org.ukettle.basics.page.plugin; 2 | 3 | import java.sql.Connection; 4 | import java.util.Properties; 5 | 6 | import org.apache.ibatis.executor.statement.BaseStatementHandler; 7 | import org.apache.ibatis.executor.statement.RoutingStatementHandler; 8 | import org.apache.ibatis.executor.statement.StatementHandler; 9 | import org.apache.ibatis.mapping.BoundSql; 10 | import org.apache.ibatis.mapping.MappedStatement; 11 | import org.apache.ibatis.plugin.Intercepts; 12 | import org.apache.ibatis.plugin.Invocation; 13 | import org.apache.ibatis.plugin.Plugin; 14 | import org.apache.ibatis.plugin.Signature; 15 | import org.ukettle.basics.page.Page; 16 | import org.ukettle.www.toolkit.Reflection; 17 | 18 | /** 19 | *

      20 | * Mybatis数据库分页插件. 拦截StatementHandler的prepare方法 21 | *

      22 | * 23 | * @author Kimi Liu 24 | * @Date Aug 26, 2014 25 | * @Time 14:12:09 26 | * @email 839536@QQ.com 27 | * @version 1.0 28 | * @since JDK 1.6 29 | */ 30 | @Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) }) 31 | public class PreparePaginationInterceptor extends BaseInterceptor { 32 | 33 | private static final long serialVersionUID = -6075937069117597841L; 34 | 35 | public PreparePaginationInterceptor() { 36 | super(); 37 | } 38 | 39 | @Override 40 | public Object intercept(Invocation ivk) throws Throwable { 41 | if (ivk.getTarget().getClass() 42 | .isAssignableFrom(RoutingStatementHandler.class)) { 43 | final RoutingStatementHandler statementHandler = (RoutingStatementHandler) ivk 44 | .getTarget(); 45 | final BaseStatementHandler delegate = (BaseStatementHandler) Reflection 46 | .getFieldValue(statementHandler, DELEGATE); 47 | final MappedStatement mappedStatement = (MappedStatement) Reflection 48 | .getFieldValue(delegate, MAPPED_STATEMENT); 49 | 50 | if (mappedStatement.getId().matches(SQL_PATTERN)) { 51 | // 拦截需要分页的SQL 52 | BoundSql boundSql = delegate.getBoundSql(); 53 | // 分页SQL