byd扫描漏洞。
@@ -103,6 +103,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryDictItemsByCode")
|
@GetMapping("/sys/api/queryDictItemsByCode")
|
||||||
List<DictModel> queryDictItemsByCode(@RequestParam("code") String code);
|
List<DictModel> queryDictItemsByCode(@RequestParam("code") String code);
|
||||||
|
|
||||||
@@ -111,6 +112,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryEnableDictItemsByCode")
|
@GetMapping("/sys/api/queryEnableDictItemsByCode")
|
||||||
public List<DictModel> queryEnableDictItemsByCode(@RequestParam("code") String code);
|
public List<DictModel> queryEnableDictItemsByCode(@RequestParam("code") String code);
|
||||||
|
|
||||||
@@ -132,6 +134,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryTableDictItemsByCode")
|
@GetMapping("/sys/api/queryTableDictItemsByCode")
|
||||||
List<DictModel> queryTableDictItemsByCode(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code);
|
List<DictModel> queryTableDictItemsByCode(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code);
|
||||||
|
|
||||||
@@ -314,6 +317,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param username
|
* @param username
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryUserRoles")
|
@GetMapping("/sys/api/queryUserRoles")
|
||||||
Set<String> queryUserRoles(@RequestParam("username") String username);
|
Set<String> queryUserRoles(@RequestParam("username") String username);
|
||||||
|
|
||||||
@@ -322,6 +326,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param username
|
* @param username
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryUserAuths")
|
@GetMapping("/sys/api/queryUserAuths")
|
||||||
Set<String> queryUserAuths(@RequestParam("username") String username);
|
Set<String> queryUserAuths(@RequestParam("username") String username);
|
||||||
|
|
||||||
@@ -331,6 +336,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param dbSourceId
|
* @param dbSourceId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/getDynamicDbSourceById")
|
@GetMapping("/sys/api/getDynamicDbSourceById")
|
||||||
DynamicDataSourceModel getDynamicDbSourceById(@RequestParam("dbSourceId") String dbSourceId);
|
DynamicDataSourceModel getDynamicDbSourceById(@RequestParam("dbSourceId") String dbSourceId);
|
||||||
|
|
||||||
@@ -340,6 +346,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param dbSourceCode
|
* @param dbSourceCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/getDynamicDbSourceByCode")
|
@GetMapping("/sys/api/getDynamicDbSourceByCode")
|
||||||
DynamicDataSourceModel getDynamicDbSourceByCode(@RequestParam("dbSourceCode") String dbSourceCode);
|
DynamicDataSourceModel getDynamicDbSourceByCode(@RequestParam("dbSourceCode") String dbSourceCode);
|
||||||
|
|
||||||
@@ -347,6 +354,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* 39根据用户账号查询用户信息 CommonAPI中定义
|
* 39根据用户账号查询用户信息 CommonAPI中定义
|
||||||
* @param username
|
* @param username
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/getUserByName")
|
@GetMapping("/sys/api/getUserByName")
|
||||||
LoginUser getUserByName(@RequestParam("username") String username);
|
LoginUser getUserByName(@RequestParam("username") String username);
|
||||||
|
|
||||||
@@ -358,6 +366,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param key
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/translateDictFromTable")
|
@GetMapping("/sys/api/translateDictFromTable")
|
||||||
String translateDictFromTable(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key);
|
String translateDictFromTable(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key);
|
||||||
|
|
||||||
@@ -367,6 +376,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param key
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/translateDict")
|
@GetMapping("/sys/api/translateDict")
|
||||||
String translateDict(@RequestParam("code") String code, @RequestParam("key") String key);
|
String translateDict(@RequestParam("code") String code, @RequestParam("key") String key);
|
||||||
|
|
||||||
@@ -374,6 +384,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* 42查询数据权限
|
* 42查询数据权限
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/queryPermissionDataRule")
|
@GetMapping("/sys/api/queryPermissionDataRule")
|
||||||
List<SysPermissionDataRuleModel> queryPermissionDataRule(@RequestParam("component") String component, @RequestParam("requestPath") String requestPath, @RequestParam("username") String username);
|
List<SysPermissionDataRuleModel> queryPermissionDataRule(@RequestParam("component") String component, @RequestParam("requestPath") String requestPath, @RequestParam("username") String username);
|
||||||
|
|
||||||
@@ -382,6 +393,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param username
|
* @param username
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@GetMapping("/sys/api/getCacheUser")
|
@GetMapping("/sys/api/getCacheUser")
|
||||||
SysUserCacheInfo getCacheUser(@RequestParam("username") String username);
|
SysUserCacheInfo getCacheUser(@RequestParam("username") String username);
|
||||||
|
|
||||||
@@ -525,7 +537,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
* @param keys 多个用逗号分割
|
* @param keys 多个用逗号分割
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
@GetMapping("/sys/api/translateDictFromTableByKeys")
|
@GetMapping("/sys/api/translateDictFromTableByKeys")
|
||||||
List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys);
|
List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys);
|
||||||
|
|
||||||
|
|||||||
@@ -315,24 +315,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
*/
|
*/
|
||||||
List<String> loadCategoryDictItem(String ids);
|
List<String> loadCategoryDictItem(String ids);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code加载字典text
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param keys 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<String> loadDictItem(String dictCode, String keys);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code查询字典项
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param dictCode 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> getDictItems(String dictCode);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据多个字典code查询多个字典项
|
* 根据多个字典code查询多个字典项
|
||||||
* @param dictCodeList
|
* @param dictCodeList
|
||||||
@@ -340,15 +322,5 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
*/
|
*/
|
||||||
Map<String, List<DictModel>> getManyDictItems(List<String> dictCodeList);
|
Map<String, List<DictModel>> getManyDictItems(List<String> dictCodeList);
|
||||||
|
|
||||||
/**
|
|
||||||
* 【JSearchSelectTag下拉搜索组件专用接口】
|
|
||||||
* 大数据量的字典表 走异步加载 即前端输入内容过滤数据
|
|
||||||
*
|
|
||||||
* @param dictCode 字典code格式:table,text,code
|
|
||||||
* @param keyword 过滤关键字
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> loadDictItemByKeyword(String dictCode, String keyword, Integer pageSize);
|
|
||||||
|
|
||||||
String translateByDictMap(Map<String, String> dictMap, String keys);
|
String translateByDictMap(Map<String, String> dictMap, String keys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,16 +110,6 @@ public interface CommonAPI {
|
|||||||
*/
|
*/
|
||||||
Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys);
|
Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys);
|
||||||
|
|
||||||
/**
|
|
||||||
* 15 字典表的 翻译,可批量
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keys 多个用逗号分割
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 14获取全部字典
|
* 14获取全部字典
|
||||||
* @author lqt
|
* @author lqt
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.jero.common.constant.enums;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中英文切换标识
|
|
||||||
* @description
|
|
||||||
* @date 2022/1/21 15:22
|
|
||||||
* @auth zhn
|
|
||||||
*/
|
|
||||||
public enum IsMustEnum {
|
|
||||||
YES("是","1"),
|
|
||||||
NO("否","0");
|
|
||||||
|
|
||||||
|
|
||||||
String name;
|
|
||||||
String value;
|
|
||||||
|
|
||||||
private IsMustEnum(String name, String value) {
|
|
||||||
this.name = name;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.jero.common.constant.enums;
|
|
||||||
|
|
||||||
public enum MessageType2Enum {
|
|
||||||
|
|
||||||
|
|
||||||
SUBSCRIPTION_NOTIFICATION("Subscription Notification","订阅通知"),
|
|
||||||
SHARE_FORWARD("Share Forward","转发推送"),
|
|
||||||
REGULATION_EARLY_WARNING("Regulation Early Warning","法规预警"),
|
|
||||||
REGULATION_LIST_CONFIRMATION("Regulation List Confirmation","法规清单确认"),
|
|
||||||
REGULATION_TASK_CONFIRMATION("Regulation Task Confirmation","法规任务确认"),
|
|
||||||
DESIGN_COMPLIANCE_CONFIRMATION("Design Compliance Confirmation","设计符合性确认"),
|
|
||||||
PRE_HOMO_CONFIRMATION("Pre-Homo Confirmation","Pre-Homo确认"),
|
|
||||||
VALIDATION_COMPLIANCE_CONFIRMATION("Validation Compliance Confirmation","验证符合性确认"),
|
|
||||||
REGULATION_OPINION_COLLECTION("Regulation Opinion Collection","法规意见收集"),
|
|
||||||
REGULATION_TECHNICAL_ASSESSMENT("Regulation Technical Assessment","法规技术评估"),
|
|
||||||
HOMO_PARAMETER_COLLECTION("Homo Parameter Collection","认证参数收集"),
|
|
||||||
CERTIFICATION_LIST_CONFIRMATION("Certification List Confirmation","认证清单确认");
|
|
||||||
|
|
||||||
String en;
|
|
||||||
String cn;
|
|
||||||
|
|
||||||
MessageType2Enum(String en, String cn) {
|
|
||||||
this.en = en;
|
|
||||||
this.cn = cn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEn() {
|
|
||||||
return en;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEn(String en) {
|
|
||||||
this.en = en;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCn() {
|
|
||||||
return cn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCn(String cn) {
|
|
||||||
this.cn = cn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.jero.common.constant.enums;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description
|
|
||||||
* @date 2022/1/21 15:22
|
|
||||||
* @auth zhn
|
|
||||||
*/
|
|
||||||
public enum MessageTypeEnum {
|
|
||||||
READ("Subscription Notification","订阅通知","1"),
|
|
||||||
WARN("Regulation Early Warning","法规预警","2"),
|
|
||||||
PUSH("Share / Forward","转发推送","3"),
|
|
||||||
HOMO_TASK("Homo Parameter Task","","4"),
|
|
||||||
TASK("Regulation Compliance Task","", "5"),
|
|
||||||
//REGULATION_LIST_CONFIRMATION_TASK("Regulation List Confirmation Task", "6"), // 清单确认任务
|
|
||||||
//REGULATION_LIST_CONFIRMATION_NOTIFICATION("Regulation List Confirmation Notification", "7"), // 清单确认通知
|
|
||||||
//REGULATION_TASK_CONFIRMATION_TASK("Regulation Task Confirmation", "8"), // 任务确认任务
|
|
||||||
//REGULATION_TASK_CONFIRMATION_NOTIFICATION("Regulation Task Confirmation Notification", "15"), // 任务确认通知
|
|
||||||
//DESIGN_COMPLIANCE_TASK("Design Compliance Task", "9"), // 设计符合性任务
|
|
||||||
//PRE_HOMO_TASK("Pre-Homo Task", "10"), // Pre-Homo任务
|
|
||||||
//VALIDATION_TASK("Validation Compliance Task", "11"), // 验证符合性任务
|
|
||||||
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
|
|
||||||
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
|
|
||||||
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
|
|
||||||
SYSTEMATIC_NOTIFICATION("Systematic Notification","系统通知", "15"), // 系统通知
|
|
||||||
LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认
|
|
||||||
TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认
|
|
||||||
COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认
|
|
||||||
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments","", "20"), // 法规意见收集
|
|
||||||
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "","21"), // 法规技术评估
|
|
||||||
;
|
|
||||||
|
|
||||||
String name;
|
|
||||||
String nameCn;
|
|
||||||
String value;
|
|
||||||
|
|
||||||
private MessageTypeEnum(String name,String nameCn, String value) {
|
|
||||||
this.name = name;
|
|
||||||
this.nameCn = nameCn;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNameCn() {
|
|
||||||
return nameCn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNameCn(String nameCn) {
|
|
||||||
this.nameCn = nameCn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.jero.common.constant.enums;
|
|
||||||
|
|
||||||
public enum MsgColorEnum {
|
|
||||||
|
|
||||||
GREEN("其他","green"),
|
|
||||||
RED("任务被拒绝","red"),
|
|
||||||
YELLOW("任务逾期","yellow");
|
|
||||||
|
|
||||||
String label;
|
|
||||||
String value;
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
MsgColorEnum(String label, String value) {
|
|
||||||
this.label = label;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
package com.jero.common.util.dynamic.db;
|
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import com.jero.common.exception.JeroBootException;
|
|
||||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
|
||||||
import com.jero.common.util.ReflectHelper;
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spring JDBC 实时数据库访问
|
|
||||||
*
|
|
||||||
* @author chenguobin
|
|
||||||
* @version 1.0
|
|
||||||
* @date 2014-09-05
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class DynamicDBUtil {
|
|
||||||
|
|
||||||
private DynamicDBUtil(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数据源【最底层方法,不要随便调用】
|
|
||||||
*
|
|
||||||
* @param dbSource
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) {
|
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
|
||||||
|
|
||||||
String driverClassName = dbSource.getDbDriver();
|
|
||||||
String url = dbSource.getDbUrl();
|
|
||||||
String dbUser = dbSource.getDbUsername();
|
|
||||||
String dbPassword = dbSource.getDbPassword();
|
|
||||||
dataSource.setDriverClassName(driverClassName);
|
|
||||||
dataSource.setUrl(url);
|
|
||||||
dataSource.setTestWhileIdle(true);
|
|
||||||
dataSource.setTestOnBorrow(false);
|
|
||||||
dataSource.setTestOnReturn(false);
|
|
||||||
dataSource.setBreakAfterAcquireFailure(true);
|
|
||||||
dataSource.setConnectionErrorRetryAttempts(0);
|
|
||||||
dataSource.setUsername(dbUser);
|
|
||||||
dataSource.setMaxWait(30000);
|
|
||||||
dataSource.setPassword(dbPassword);
|
|
||||||
|
|
||||||
log.info("******************************************");
|
|
||||||
log.info("* *");
|
|
||||||
log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*");
|
|
||||||
log.info("* *");
|
|
||||||
log.info("******************************************");
|
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过 dbKey ,获取数据源
|
|
||||||
*
|
|
||||||
* @param dbKey
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static DruidDataSource getDbSourceByDbKey(final String dbKey) {
|
|
||||||
//获取多数据源配置
|
|
||||||
DynamicDataSourceModel dbSource = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
|
|
||||||
//先判断缓存中是否存在数据库链接
|
|
||||||
DruidDataSource cacheDbSource = DataSourceCachePool.getCacheBasicDataSource(dbKey);
|
|
||||||
if (cacheDbSource != null && !cacheDbSource.isClosed()) {
|
|
||||||
log.debug("--------getDbSourceBydbKey------------------从缓存中获取DB连接-------------------");
|
|
||||||
return cacheDbSource;
|
|
||||||
} else {
|
|
||||||
DruidDataSource dataSource = getJdbcDataSource(dbSource);
|
|
||||||
if(dataSource.isEnable()){
|
|
||||||
DataSourceCachePool.putCacheBasicDataSource(dbKey, dataSource);
|
|
||||||
}else{
|
|
||||||
throw new JeroBootException("动态数据源连接失败,dbKey:"+dbKey);
|
|
||||||
}
|
|
||||||
log.info("--------getDbSourceBydbKey------------------创建DB数据库连接-------------------");
|
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭数据库连接池
|
|
||||||
*
|
|
||||||
* @param dbKey
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static void closeDbKey(final String dbKey) {
|
|
||||||
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
|
|
||||||
try {
|
|
||||||
if (dataSource != null && !dataSource.isClosed()) {
|
|
||||||
dataSource.getConnection().commit();
|
|
||||||
dataSource.getConnection().close();
|
|
||||||
dataSource.close();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static JdbcTemplate getJdbcTemplate(String dbKey) {
|
|
||||||
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
|
|
||||||
return new JdbcTemplate(dataSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes the SQL statement in this <code>PreparedStatement</code> object,
|
|
||||||
* which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
|
||||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
|
||||||
* such as a DDL statement.
|
|
||||||
*/
|
|
||||||
public static int update(final String dbKey, String sql, Object... param) {
|
|
||||||
int effectCount;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
if (ArrayUtils.isEmpty(param)) {
|
|
||||||
effectCount = jdbcTemplate.update(sql);
|
|
||||||
} else {
|
|
||||||
effectCount = jdbcTemplate.update(sql, param);
|
|
||||||
}
|
|
||||||
return effectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的Update
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int updateByHash(final String dbKey, String sql, Map<String, Object> data) {
|
|
||||||
int effectCount;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
//根据模板获取sql
|
|
||||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
|
||||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
|
||||||
effectCount = namedParameterJdbcTemplate.update(sql, data);
|
|
||||||
return effectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object findOne(final String dbKey, String sql, Object... param) {
|
|
||||||
List<Map<String, Object>> list;
|
|
||||||
list = findList(dbKey, sql, param);
|
|
||||||
if (oConvertUtils.listIsEmpty(list)) {
|
|
||||||
log.error("Except one, but not find actually");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (list.size() > 1) {
|
|
||||||
log.error("Except one, but more than one actually");
|
|
||||||
}
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的查询 返回HashMap
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Object findOneByHash(final String dbKey, String sql, Map<String, Object> data) {
|
|
||||||
List<Map<String, Object>> list;
|
|
||||||
list = findListByHash(dbKey, sql, data);
|
|
||||||
if (oConvertUtils.listIsEmpty(list)) {
|
|
||||||
log.error("Except one, but not find actually");
|
|
||||||
}
|
|
||||||
if (list.size() > 1) {
|
|
||||||
log.error("Except one, but more than one actually");
|
|
||||||
}
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 直接sql查询 根据clazz返回单个实例
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句
|
|
||||||
* @param clazz 返回实例的Class
|
|
||||||
* @param param
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
|
||||||
Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
|
|
||||||
return ReflectHelper.setAll(clazz, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的查询 返回单个实例
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param clazz 返回实例的Class
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
|
||||||
Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
|
|
||||||
return ReflectHelper.setAll(clazz, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Map<String, Object>> findList(final String dbKey, String sql, Object... param) {
|
|
||||||
List<Map<String, Object>> list;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
|
|
||||||
if (ArrayUtils.isEmpty(param)) {
|
|
||||||
list = jdbcTemplate.queryForList(sql);
|
|
||||||
} else {
|
|
||||||
list = jdbcTemplate.queryForList(sql, param);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的查询
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<Map<String, Object>> findListByHash(final String dbKey, String sql, Map<String, Object> data) {
|
|
||||||
List<Map<String, Object>> list;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
//根据模板获取sql
|
|
||||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
|
||||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
|
||||||
list = namedParameterJdbcTemplate.queryForList(sql, data);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//此方法只能返回单列,不能返回实体类
|
|
||||||
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
|
||||||
List<T> list;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
|
|
||||||
if (ArrayUtils.isEmpty(param)) {
|
|
||||||
list = jdbcTemplate.queryForList(sql, clazz);
|
|
||||||
} else {
|
|
||||||
list = jdbcTemplate.queryForList(sql, clazz, param);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的查询 返回单列数据list
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param clazz 类型Long、String等
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T> List<T> findListByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
|
||||||
List<T> list;
|
|
||||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
|
||||||
//根据模板获取sql
|
|
||||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
|
||||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
|
||||||
list = namedParameterJdbcTemplate.queryForList(sql, data, clazz);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 直接sql查询 返回实体类列表
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持 minidao 语法逻辑
|
|
||||||
* @param clazz 返回实体类列表的class
|
|
||||||
* @param param sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
|
||||||
List<Map<String, Object>> queryList = findList(dbKey, sql, param);
|
|
||||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支持miniDao语法操作的查询 返回实体类列表
|
|
||||||
*
|
|
||||||
* @param dbKey 数据源标识
|
|
||||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
|
||||||
* @param clazz 返回实体类列表的class
|
|
||||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
|
||||||
List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
|
|
||||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgform.controller;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformButton;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformButtonService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController("onlCgformButtonController")
|
|
||||||
@RequestMapping({"/online/cgform/button"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgformButtonController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformButtonService onlCgformButtonService;
|
|
||||||
|
|
||||||
private static final String OP_SUCCESS = "操作成功!";
|
|
||||||
private static final String EN_IS_NULL = "未找到对应实体";
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping({"/list/{code}"})
|
|
||||||
public Result<IPage<OnlCgformButton>> list(OnlCgformButton var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4, @PathVariable("code") String var5) {
|
|
||||||
Result<IPage<OnlCgformButton>> var6 = new Result<>();
|
|
||||||
var1.setCgformHeadId(var5);
|
|
||||||
QueryWrapper<OnlCgformButton> var7 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgformButton> var8 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgformButton> var9 = this.onlCgformButtonService.page(var8, var7);
|
|
||||||
var6.setSuccess(true);
|
|
||||||
var6.setResult(var9);
|
|
||||||
return var6;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<Object> add(@RequestBody OnlCgformButton cgformButton) {
|
|
||||||
try {
|
|
||||||
this.onlCgformButtonService.save(cgformButton);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/aitest"})
|
|
||||||
public Result<Object> aitest(@RequestBody JSONArray jsonArray) {
|
|
||||||
try {
|
|
||||||
for(int i = 0; i < jsonArray.size(); ++i) {
|
|
||||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
||||||
OnlCgformButton cgformButton = JSON.parseObject(jsonObject.toJSONString(), OnlCgformButton.class);
|
|
||||||
this.onlCgformButtonService.saveButton(cgformButton);
|
|
||||||
}
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<Object> edit(@RequestBody OnlCgformButton cgformButton) {
|
|
||||||
OnlCgformButton existCgformButton = this.onlCgformButtonService.getById(cgformButton.getId());
|
|
||||||
if (existCgformButton == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean flag = this.onlCgformButtonService.updateById(cgformButton);
|
|
||||||
if (flag) {
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
|
||||||
String id = map.get("id");
|
|
||||||
if(StringUtils.isEmpty(id)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
OnlCgformButton cgformButton = this.onlCgformButtonService.getById(id);
|
|
||||||
if (cgformButton == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean flag = this.onlCgformButtonService.removeById(id);
|
|
||||||
if (flag) {
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
|
||||||
String ids = map.get("ids");
|
|
||||||
if (ids != null && !"".equals(ids.trim())) {
|
|
||||||
this.onlCgformButtonService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
} else {
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgformButton> queryById(@RequestParam(name = "id",required = true) String id) {
|
|
||||||
OnlCgformButton cgformButton = this.onlCgformButtonService.getById(id);
|
|
||||||
if (cgformButton == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
return Result.OK(cgformButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
package com.jero.generater.modules.online.cgform.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
|
||||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformHead;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformFieldService;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformHeadService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController("onlCgformFieldController")
|
|
||||||
@RequestMapping({"/online/cgform/field"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgformFieldController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformHeadService onlCgformHeadService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformFieldService onlCgformFieldService;
|
|
||||||
|
|
||||||
private static final String EN_IS_NULL = "未找到对应实体";
|
|
||||||
|
|
||||||
@GetMapping({"/listByHeadCode"})
|
|
||||||
public Result<List<OnlCgformField>> a(@RequestParam("headCode") String var1) {
|
|
||||||
LambdaQueryWrapper<OnlCgformHead> var2 = new LambdaQueryWrapper<>();
|
|
||||||
var2.eq(OnlCgformHead::getTableName, var1);
|
|
||||||
OnlCgformHead var3 = this.onlCgformHeadService.getOne(var2);
|
|
||||||
return var3 == null ? Result.error("不存在的code") : this.b(var3.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/listByHeadId"})
|
|
||||||
public Result<List<OnlCgformField>> b(@RequestParam("headId") String var1) {
|
|
||||||
QueryWrapper<OnlCgformField> var2 = new QueryWrapper<>();
|
|
||||||
var2.eq("cgform_head_id", var1);
|
|
||||||
var2.orderByAsc("order_num");
|
|
||||||
List<OnlCgformField> var3 = this.onlCgformFieldService.list(var2);
|
|
||||||
return Result.OK(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgformField>> a(OnlCgformField var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
Result<IPage<OnlCgformField>> var5 = new Result<>();
|
|
||||||
QueryWrapper<OnlCgformField> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgformField> var7 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgformField> var8 = this.onlCgformFieldService.page(var7, var6);
|
|
||||||
var5.setSuccess(true);
|
|
||||||
var5.setResult(var8);
|
|
||||||
return var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<Object> add(@RequestBody OnlCgformField var1) {
|
|
||||||
try {
|
|
||||||
this.onlCgformFieldService.save(var1);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<Object> edit(@RequestBody OnlCgformField var1) {
|
|
||||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1.getId());
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean var4 = this.onlCgformFieldService.updateById(var1);
|
|
||||||
if (var4) {
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
|
||||||
String var1 = map.get("id");
|
|
||||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean var4 = this.onlCgformFieldService.removeById(var1);
|
|
||||||
if (var4) {
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
if (var1 != null && !"".equals(var1.trim())) {
|
|
||||||
this.onlCgformFieldService.removeByIds(Arrays.asList(var1.split(",")));
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
} else {
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<Object> queryById(@RequestParam(name = "id",required = true) String var1) {
|
|
||||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
return Result.OK(var3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,607 +0,0 @@
|
|||||||
package com.jero.generater.modules.online.cgform.controller;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.codegenerate.database.DbReadTableUtil;
|
|
||||||
import com.jero.codegenerate.properties.CodeConfigProperties;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.constant.enums.CgformEnum;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.common.system.util.JwtUtil;
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import com.jero.generater.modules.online.cgform.entity.*;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformEnhanceService;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformFieldService;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformHeadService;
|
|
||||||
import com.jero.generater.modules.online.cgform.util.CgformUtil;
|
|
||||||
import com.jero.generater.modules.online.config.exception.DBException;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.core.io.ResourceLoader;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RestController("onlCgformHeadController")
|
|
||||||
@RequestMapping({"/online/cgform/head"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgformHeadController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformHeadService onlCgformHeadService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformFieldService onlCgformFieldService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformEnhanceService onlCgformEnhanceService;
|
|
||||||
|
|
||||||
private List<String> b = null;
|
|
||||||
@Autowired
|
|
||||||
ResourceLoader resourceLoader;
|
|
||||||
|
|
||||||
private String c;
|
|
||||||
|
|
||||||
private static final String OP_SUCCESS = "操作成功!";
|
|
||||||
private static final String EN_IS_NULL = "未找到对应实体";
|
|
||||||
private static final String SAVE_ERROR = "保存失败!";
|
|
||||||
private static final String DEL_ERROR = "删除失败!";
|
|
||||||
private static final String PARAM_ERROR = "参数不识别!";
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgformHead>> a(OnlCgformHead var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
Result<IPage<OnlCgformHead>> var5 = new Result<>();
|
|
||||||
QueryWrapper<OnlCgformHead> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgformHead> var7 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgformHead> var8 = this.onlCgformHeadService.page(var7, var6);
|
|
||||||
if (var1.getCopyType() != null && var1.getCopyType() == 0) {
|
|
||||||
this.onlCgformHeadService.initCopyState(var8.getRecords());
|
|
||||||
}
|
|
||||||
|
|
||||||
var5.setSuccess(true);
|
|
||||||
var5.setResult(var8);
|
|
||||||
return var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<Object> add(@RequestBody OnlCgformHead var1) {
|
|
||||||
try {
|
|
||||||
this.onlCgformHeadService.save(var1);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<Object> edit(@RequestBody OnlCgformHead var1) {
|
|
||||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1.getId());
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean var4 = this.onlCgformHeadService.updateById(var1);
|
|
||||||
if (var4) {
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
|
||||||
String id = map.get("id");
|
|
||||||
if (id == null || "".equals(id.trim())) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.onlCgformHeadService.deleteRecordAndTable(id);
|
|
||||||
} catch (DBException | SQLException e) {
|
|
||||||
return Result.error("删除失败" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/removeRecord"})
|
|
||||||
public Result<T> removeRecord(@RequestBody Map<String, String> map) {
|
|
||||||
String id = map.get("id");
|
|
||||||
if (id == null || "".equals(id.trim())) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.onlCgformHeadService.deleteRecord(id);
|
|
||||||
} catch (DBException | SQLException e) {
|
|
||||||
return Result.error("移除失败" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK("移除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
String var2 = map.get("flag");
|
|
||||||
if (var2 == null || "".equals(var2.trim())) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
if (var1 != null && !"".equals(var1.trim())) {
|
|
||||||
this.onlCgformHeadService.deleteBatch(var1, var2);
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
} else {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgformHead> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
||||||
OnlCgformHead cgformHead = this.onlCgformHeadService.getById(id);
|
|
||||||
if (cgformHead == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
return Result.OK(cgformHead);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryByTableNames"})
|
|
||||||
public Result<List<OnlCgformHead>> queryByTableNames(@RequestParam(name = "tableNames", required = true) String var1) {
|
|
||||||
LambdaQueryWrapper<OnlCgformHead> var2 = new LambdaQueryWrapper<>();
|
|
||||||
String[] var3 = var1.split(",");
|
|
||||||
var2.in(OnlCgformHead::getTableName, Arrays.asList(var3));
|
|
||||||
List<OnlCgformHead> var4 = this.onlCgformHeadService.list(var2);
|
|
||||||
return var4 == null ? Result.error(EN_IS_NULL) : Result.OK(var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/addEnhanceJs/{code}"})
|
|
||||||
public Result<T> addEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
|
||||||
try {
|
|
||||||
var2.setCgformHeadId(var1);
|
|
||||||
this.onlCgformHeadService.saveEnhance(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/enhanceJs/{code}"})
|
|
||||||
public Result<OnlCgformEnhanceJs> getEnhanceJs(@PathVariable("code") String var1, HttpServletRequest var2) {
|
|
||||||
try {
|
|
||||||
String var3 = var2.getParameter("type");
|
|
||||||
OnlCgformEnhanceJs var4 = this.onlCgformHeadService.queryEnhance(var1, var3);
|
|
||||||
return var4 == null ? Result.error("查询为空") : Result.OK(var4);
|
|
||||||
} catch (Exception var5) {
|
|
||||||
log.error(var5.getMessage(), var5);
|
|
||||||
return Result.error("查询失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/enhanceJs/{code}"})
|
|
||||||
public Result<T> editEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
|
||||||
try {
|
|
||||||
var2.setCgformHeadId(var1);
|
|
||||||
this.onlCgformHeadService.editEnhance(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/enhanceButton/{formId}"})
|
|
||||||
public Result<List<OnlCgformButton>> getEnhanceButton(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
|
||||||
try {
|
|
||||||
List<OnlCgformButton> var3 = this.onlCgformHeadService.queryButtonList(var1);
|
|
||||||
return var3 != null && !var3.isEmpty() ? Result.OK(var3) : Result.error("查询为空");
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error("查询失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/enhanceSql/{formId}"})
|
|
||||||
public Result<List<OnlCgformEnhanceSql>> getEnhanceSql(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
|
||||||
List<OnlCgformEnhanceSql> var3 = this.onlCgformEnhanceService.queryEnhanceSqlList(var1);
|
|
||||||
return Result.OK(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresRoles({"admin"})
|
|
||||||
@PostMapping({"/addEnhanceSql/{formId}"})
|
|
||||||
public Result<T> addEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
|
||||||
try {
|
|
||||||
var2.setCgformHeadId(var1);
|
|
||||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
|
||||||
this.onlCgformEnhanceService.saveEnhanceSql(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} else {
|
|
||||||
return Result.error("保存失败,该按钮已存在增强配置!");
|
|
||||||
}
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresRoles({"admin"})
|
|
||||||
@PostMapping({"/enhanceSql/{formId}"})
|
|
||||||
public Result<T> editEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
|
||||||
try {
|
|
||||||
var2.setCgformHeadId(var1);
|
|
||||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
|
||||||
this.onlCgformEnhanceService.updateEnhanceSql(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} else {
|
|
||||||
return Result.error("保存失败,该按钮已存在增强配置!");
|
|
||||||
}
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/enhanceSql"})
|
|
||||||
public Result<T> deletenhanceSql(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("id");
|
|
||||||
if (StringUtils.isBlank(var1)) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.onlCgformEnhanceService.deleteEnhanceSql(var1);
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
} catch (Exception var3) {
|
|
||||||
log.error(var3.getMessage(), var3);
|
|
||||||
return Result.error(DEL_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deletebatchEnhanceSql"})
|
|
||||||
public Result<T> deletebatchEnhanceSql(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
if (StringUtils.isBlank(var1)) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
List<String> var2 = Arrays.asList(var1.split(","));
|
|
||||||
this.onlCgformEnhanceService.deleteBatchEnhanceSql(var2);
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
} catch (Exception var3) {
|
|
||||||
log.error(var3.getMessage(), var3);
|
|
||||||
return Result.error(DEL_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/enhanceJava/{formId}"})
|
|
||||||
public Result<List<OnlCgformEnhanceJava>> getEnhanceJava(@PathVariable("formId") String formId, OnlCgformEnhanceJava var2) {
|
|
||||||
List<OnlCgformEnhanceJava> var3 = this.onlCgformEnhanceService.queryEnhanceJavaList(formId);
|
|
||||||
return Result.OK(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/addEnhanceJava/{formId}"})
|
|
||||||
public Result<T> addEnhanceJava(@PathVariable("formId") String formId, @RequestBody OnlCgformEnhanceJava var2) {
|
|
||||||
try {
|
|
||||||
if (!CgformUtil.a(var2)) {
|
|
||||||
return Result.error("类实例化失败,请检查!");
|
|
||||||
} else {
|
|
||||||
var2.setCgformHeadId(formId);
|
|
||||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
|
||||||
this.onlCgformEnhanceService.saveEnhanceJava(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} else {
|
|
||||||
return Result.error("保存失败,配置重复了!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/enhanceJava/{formId}"})
|
|
||||||
public Result<T> c(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceJava var2) {
|
|
||||||
try {
|
|
||||||
if (!CgformUtil.a(var2)) {
|
|
||||||
return Result.error("类实例化失败,请检查!");
|
|
||||||
} else {
|
|
||||||
var2.setCgformHeadId(var1);
|
|
||||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
|
||||||
this.onlCgformEnhanceService.updateEnhanceJava(var2);
|
|
||||||
return Result.OK(OP_SUCCESS);
|
|
||||||
} else {
|
|
||||||
return Result.error("保存失败,配置重复了!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.error(var4.getMessage(), var4);
|
|
||||||
return Result.error(SAVE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/enhanceJava"})
|
|
||||||
public Result<T> g(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("id");
|
|
||||||
if (StringUtils.isBlank(var1)) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.onlCgformEnhanceService.deleteEnhanceJava(var1);
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
} catch (Exception var3) {
|
|
||||||
log.error(var3.getMessage(), var3);
|
|
||||||
return Result.error(DEL_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatchEnhanceJava"})
|
|
||||||
public Result<T> h(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
if (StringUtils.isBlank(var1)) {
|
|
||||||
return Result.error(PARAM_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
List<String> var2 = Arrays.asList(var1.split(","));
|
|
||||||
this.onlCgformEnhanceService.deleteBatchEnhanceJava(var2);
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
} catch (Exception var3) {
|
|
||||||
log.error(var3.getMessage(), var3);
|
|
||||||
return Result.error(DEL_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryTables"})
|
|
||||||
public Result<ArrayList<HashMap<String,String>>> a(@RequestParam(name = "tableName", required = false) String var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
String var5 = JwtUtil.getUserNameByToken(var4);
|
|
||||||
if (!"admin".equals(var5)) {
|
|
||||||
return Result.error("noadminauth");
|
|
||||||
} else {
|
|
||||||
new ArrayList<>();
|
|
||||||
|
|
||||||
List<String> var6;
|
|
||||||
try {
|
|
||||||
var6 = DbReadTableUtil.listTableName();
|
|
||||||
} catch (SQLException var12) {
|
|
||||||
log.error(var12.getMessage(), var12);
|
|
||||||
return Result.error("同步失败,未获取数据库表信息");
|
|
||||||
}
|
|
||||||
|
|
||||||
CgformUtil.b(var6);
|
|
||||||
var6 = CgformUtil.f(var6);
|
|
||||||
List<String> var7 = this.onlCgformHeadService.queryOnlinetables();
|
|
||||||
this.b();
|
|
||||||
var6.removeAll(var7);
|
|
||||||
ArrayList<HashMap<String,String>> var8 = new ArrayList<>();
|
|
||||||
|
|
||||||
for (String var10 : var6) {
|
|
||||||
if (!this.l(var10)) {
|
|
||||||
HashMap<String,String> var11 = new HashMap<>();
|
|
||||||
var11.put("id", var10);
|
|
||||||
var8.add(var11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK(var8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/transTables/{tbnames}"})
|
|
||||||
@RequiresRoles({"admin"})
|
|
||||||
public Result<T> d(@PathVariable("tbnames") String var1, HttpServletRequest var2) {
|
|
||||||
String var3 = JwtUtil.getUserNameByToken(var2);
|
|
||||||
if (!"admin".equals(var3)) {
|
|
||||||
return Result.error("noadminauth");
|
|
||||||
} else if (oConvertUtils.isEmpty(var1)) {
|
|
||||||
return Result.error("未识别的表名信息");
|
|
||||||
} else if (c != null && c.equals(var1)) {
|
|
||||||
return Result.error("不允许重复生成!");
|
|
||||||
} else {
|
|
||||||
c = var1;
|
|
||||||
String[] var4 = var1.split(",");
|
|
||||||
|
|
||||||
for (int var5 = 0; var5 < var4.length; ++var5) {
|
|
||||||
if (oConvertUtils.isNotEmpty(var4[var5])) {
|
|
||||||
int var6 = this.onlCgformHeadService.count(new LambdaQueryWrapper<OnlCgformHead>().eq(OnlCgformHead::getTableName, var4[var5]));
|
|
||||||
if (var6 <= 0) {
|
|
||||||
log.info("[IP] [online数据库导入表] --表名:" + var4[var5]);
|
|
||||||
this.onlCgformHeadService.saveDbTable2Online(var4[var5]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c = null;
|
|
||||||
return Result.OK("同步完成!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取磁盘根目录
|
|
||||||
*
|
|
||||||
* @param
|
|
||||||
* @return com.jero.common.api.vo.Result
|
|
||||||
* @date 2021/4/6 11:20
|
|
||||||
*/
|
|
||||||
@GetMapping({"/rootFile"})
|
|
||||||
public Result<JSONArray> rootFile() {
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
|
||||||
File[] files = File.listRoots();
|
|
||||||
int var4 = files.length;
|
|
||||||
|
|
||||||
for (int i = 0; i < var4; ++i) {
|
|
||||||
File file = files[i];
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
jsonObject.put("key", file.getAbsolutePath());
|
|
||||||
jsonObject.put("title", file.getPath());
|
|
||||||
jsonObject.put("opened", false);
|
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
|
||||||
jsonObject1.put("icon", "custom");
|
|
||||||
jsonObject.put("scopedSlots", jsonObject1);
|
|
||||||
jsonObject.put("isLeaf", file.listFiles() == null || file.listFiles().length == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonArray.add(jsonObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK(jsonArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取磁盘文件树
|
|
||||||
*
|
|
||||||
* @param parentPath
|
|
||||||
* @return com.jero.common.api.vo.Result
|
|
||||||
* @date 2021/4/6 11:20
|
|
||||||
*/
|
|
||||||
@GetMapping({"/fileTree"})
|
|
||||||
public Result<JSONArray> fileTree(@RequestParam(name = "parentPath", required = true) String parentPath) {
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
|
||||||
File file = new File(parentPath);
|
|
||||||
File[] files = file.listFiles();
|
|
||||||
int length = files.length;
|
|
||||||
|
|
||||||
for (int i = 0; i < length; ++i) {
|
|
||||||
File file1 = files[i];
|
|
||||||
if (file1.isDirectory() && oConvertUtils.isNotEmpty(file1.getPath())) {
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
log.info(file1.getPath());
|
|
||||||
jsonObject.put("key", file1.getAbsolutePath());
|
|
||||||
jsonObject.put("title", file1.getPath().substring(file1.getPath().lastIndexOf(File.separator) + 1));
|
|
||||||
jsonObject.put("isLeaf", file1.listFiles() == null || file1.listFiles().length == 0);
|
|
||||||
jsonObject.put("opened", false);
|
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
|
||||||
jsonObject1.put("icon", "custom");
|
|
||||||
jsonObject.put("scopedSlots", jsonObject1);
|
|
||||||
jsonArray.add(jsonObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK(jsonArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/tableInfo"})
|
|
||||||
public Result<HashMap<String, Object>> tableInfo(@RequestParam(name = "code", required = true) String code) {
|
|
||||||
OnlCgformHead onlCgformHead = this.onlCgformHeadService.getById(code);
|
|
||||||
if (onlCgformHead == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("main", onlCgformHead);
|
|
||||||
getTableType(onlCgformHead, map);
|
|
||||||
|
|
||||||
Integer tableType = onlCgformHead.getTableType();
|
|
||||||
if ("Y".equals(onlCgformHead.getIsTree())) {
|
|
||||||
tableType = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String, Object>> jspModelList = CgformEnum.getJspModelList(tableType);
|
|
||||||
map.put("jspModeList", jspModelList);
|
|
||||||
map.put("projectPath", CodeConfigProperties.getProjectPath());
|
|
||||||
return Result.OK(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getTableType(OnlCgformHead onlCgformHead, HashMap<String, Object> map) {
|
|
||||||
if (onlCgformHead.getTableType() == 2) {
|
|
||||||
String subTableStr = onlCgformHead.getSubTableStr();
|
|
||||||
if (oConvertUtils.isNotEmpty(subTableStr)) {
|
|
||||||
ArrayList<OnlCgformHead> list = new ArrayList<>();
|
|
||||||
String[] subTableArray = subTableStr.split(",");
|
|
||||||
int length = subTableArray.length;
|
|
||||||
|
|
||||||
for (int i = 0; i < length; ++i) {
|
|
||||||
String subTable = subTableArray[i];
|
|
||||||
LambdaQueryWrapper<OnlCgformHead> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.eq(OnlCgformHead::getTableName, subTable);
|
|
||||||
OnlCgformHead onlCgformHead1 = this.onlCgformHeadService.getOne(lambdaQueryWrapper);
|
|
||||||
list.add(onlCgformHead1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(list, (onlCgformHead1, onlCgformHead2) -> {
|
|
||||||
Integer tabOrderNum = onlCgformHead1.getTabOrderNum();
|
|
||||||
if (tabOrderNum == null) {
|
|
||||||
tabOrderNum = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer tabOrderNum1 = onlCgformHead2.getTabOrderNum();
|
|
||||||
if (tabOrderNum1 == null) {
|
|
||||||
tabOrderNum1 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tabOrderNum.compareTo(tabOrderNum1);
|
|
||||||
});
|
|
||||||
map.put("sub", list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/copyOnline"})
|
|
||||||
public Result<T> k(@RequestParam(name = "code", required = true) String var1) {
|
|
||||||
try {
|
|
||||||
OnlCgformHead var2 = this.onlCgformHeadService.getById(var1);
|
|
||||||
if (var2 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.onlCgformHeadService.copyOnlineTableConfig(var2);
|
|
||||||
} catch (Exception var3) {
|
|
||||||
var3.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean l(String var1) {
|
|
||||||
Iterator<String> var2 = b.iterator();
|
|
||||||
|
|
||||||
String var3;
|
|
||||||
do {
|
|
||||||
if (!var2.hasNext()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3 = var2.next();
|
|
||||||
} while (!var1.startsWith(var3) && !var1.startsWith(var3.toUpperCase()));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void b() {
|
|
||||||
if (b == null) {
|
|
||||||
Resource var1 = this.resourceLoader.getResource("classpath:jero" + File.separator + "jero_config.properties");
|
|
||||||
InputStream var2 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var2 = var1.getInputStream();
|
|
||||||
Properties var3 = new Properties();
|
|
||||||
var3.load(var2);
|
|
||||||
String var4 = var3.getProperty("exclude_table");
|
|
||||||
if (var4 != null) {
|
|
||||||
b = Arrays.asList(var4.split(","));
|
|
||||||
}
|
|
||||||
} catch (IOException var13) {
|
|
||||||
var13.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
if (var2 != null) {
|
|
||||||
try {
|
|
||||||
var2.close();
|
|
||||||
} catch (IOException var12) {
|
|
||||||
var12.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
package com.jero.generater.modules.online.cgform.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.constant.CommonConstant;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformIndex;
|
|
||||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformIndexService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController("onlCgformIndexController")
|
|
||||||
@RequestMapping({"/online/cgform/index"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgformIndexController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgformIndexService onlCgformIndexService;
|
|
||||||
|
|
||||||
private static final String EN_IS_NULL = "未找到对应实体";
|
|
||||||
|
|
||||||
@GetMapping({"/listByHeadId"})
|
|
||||||
public Result<List<OnlCgformIndex>> listByHeadId(@RequestParam("headId") String headId) {
|
|
||||||
QueryWrapper<OnlCgformIndex> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("cgform_head_id", headId);
|
|
||||||
queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
List<OnlCgformIndex> cgformIndexList = this.onlCgformIndexService.list(queryWrapper);
|
|
||||||
return Result.OK(cgformIndexList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgformIndex>> list(OnlCgformIndex cgformIndex,
|
|
||||||
@RequestParam(name = "pageNo",defaultValue = "1") Integer pageNo,
|
|
||||||
@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize,
|
|
||||||
HttpServletRequest request) {
|
|
||||||
QueryWrapper<OnlCgformIndex> queryWrapper = QueryGenerator.initQueryWrapper(cgformIndex, request.getParameterMap());
|
|
||||||
Page<OnlCgformIndex> page = new Page<>(pageNo, pageSize);
|
|
||||||
IPage<OnlCgformIndex> cgformIndexPage = this.onlCgformIndexService.page(page, queryWrapper);
|
|
||||||
return Result.OK(cgformIndexPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<Object> add(@RequestBody OnlCgformIndex cgformIndex) {
|
|
||||||
try {
|
|
||||||
this.onlCgformIndexService.save(cgformIndex);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<Object> edit(@RequestBody OnlCgformIndex cgformIndex) {
|
|
||||||
OnlCgformIndex existCgformIndex = this.onlCgformIndexService.getById(cgformIndex.getId());
|
|
||||||
if (existCgformIndex == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean flag = this.onlCgformIndexService.updateById(cgformIndex);
|
|
||||||
if (flag) {
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
|
||||||
String id = map.get("id");
|
|
||||||
if(StringUtils.isBlank(id)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
OnlCgformIndex cgformIndex = this.onlCgformIndexService.getById(id);
|
|
||||||
if (cgformIndex == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
boolean flag = this.onlCgformIndexService.removeById(id);
|
|
||||||
if (flag) {
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
|
||||||
String ids = map.get("ids");
|
|
||||||
if (ids != null && !"".equals(ids.trim())) {
|
|
||||||
this.onlCgformIndexService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
} else {
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgformIndex> queryById(@RequestParam(name = "id",required = true) String var1) {
|
|
||||||
OnlCgformIndex cgformIndex = this.onlCgformIndexService.getById(var1);
|
|
||||||
if (cgformIndex == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
return Result.OK(cgformIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,35 +14,6 @@ public class ConvertUtil {
|
|||||||
private ConvertUtil() {
|
private ConvertUtil() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void a(int var0, List<Map<String, Object>> var1, List<OnlCgformField> var2) {
|
|
||||||
Map<String, FieldCommentConverter> var3 = ConvertFactory.a(var2);
|
|
||||||
|
|
||||||
for (Map<String, Object> stringObjectMap : var1) {
|
|
||||||
Map<String, Object> var5 = stringObjectMap;
|
|
||||||
Iterator<Entry<String, Object>> var6 = var5.entrySet().iterator();
|
|
||||||
HashMap<String, Object> var7 = new HashMap<>();
|
|
||||||
|
|
||||||
while (var6.hasNext()) {
|
|
||||||
Entry<String, Object> var8 = var6.next();
|
|
||||||
Object var9 = var8.getValue();
|
|
||||||
if (var9 != null) {
|
|
||||||
String var10 = var8.getKey();
|
|
||||||
FieldCommentConverter var11 = var3.get(var10.toLowerCase());
|
|
||||||
if (var11 != null) {
|
|
||||||
String var12 = var9.toString();
|
|
||||||
String var13 = var0 == 1 ? var11.converterToTxt(var12) : var11.converterToVal(var12);
|
|
||||||
a(var11, var5, var0);
|
|
||||||
a(var11, var7, var12);
|
|
||||||
var5.put(var10, var13);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
putVar(var5, var7);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void putVar(Map<String, Object> var5, HashMap<String, Object> var7) {
|
private static void putVar(Map<String, Object> var5, HashMap<String, Object> var7) {
|
||||||
for (String o : var7.keySet()) {
|
for (String o : var7.keySet()) {
|
||||||
String var15 = o;
|
String var15 = o;
|
||||||
@@ -50,28 +21,6 @@ public class ConvertUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void a(FieldCommentConverter var0, Map<String, Object> var1, int var2) {
|
|
||||||
Map<String, String> var3 = var0.getConfig();
|
|
||||||
if (var3 != null) {
|
|
||||||
String var4 = var3.get("linkField");
|
|
||||||
if (oConvertUtils.isNotEmpty(var4)) {
|
|
||||||
String[] var5 = var4.split(",");
|
|
||||||
int var6 = var5.length;
|
|
||||||
|
|
||||||
for(int var7 = 0; var7 < var6; ++var7) {
|
|
||||||
String var8 = var5[var7];
|
|
||||||
Object var9 = var1.get(var8);
|
|
||||||
if (var9 != null) {
|
|
||||||
String var10 = var9.toString();
|
|
||||||
String var11 = var2 == 1 ? var0.converterToTxt(var10) : var0.converterToVal(var10);
|
|
||||||
var1.put(var8, var11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void a(FieldCommentConverter var0, Map<String, Object> var1, String var2) {
|
private static void a(FieldCommentConverter var0, Map<String, Object> var1, String var2) {
|
||||||
Map<String, String> var3 = var0.getConfig();
|
Map<String, String> var3 = var0.getConfig();
|
||||||
if (var3 != null) {
|
if (var3 != null) {
|
||||||
|
|||||||
@@ -8,7 +8,5 @@ import com.jero.generater.modules.online.cgform.entity.OnlCgformHead;
|
|||||||
import com.jero.generater.modules.online.config.exception.BusinessException;
|
import com.jero.generater.modules.online.config.exception.BusinessException;
|
||||||
|
|
||||||
public interface IOnlCgformSqlService {
|
public interface IOnlCgformSqlService {
|
||||||
void saveBatchOnlineTable(OnlCgformHead var1, List<OnlCgformField> var2, List<Map<String, Object>> var3) throws BusinessException;
|
|
||||||
|
|
||||||
void saveOrUpdateSubData(String var1, OnlCgformHead var2, List<OnlCgformField> var3) throws BusinessException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,44 +27,6 @@ public class OnlCgformSqlServiceImpl implements IOnlCgformSqlService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IOnlCgformHeadService onlCgformHeadService;
|
private IOnlCgformHeadService onlCgformHeadService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveBatchOnlineTable(OnlCgformHead head, List<OnlCgformField> fieldList, List<Map<String, Object>> dataList) throws BusinessException {
|
|
||||||
|
|
||||||
try(SqlSession var4 = this.sqlSessionTemplate.getSqlSessionFactory().openSession(ExecutorType.BATCH, false)) {
|
|
||||||
ConvertUtil.a(2, dataList, fieldList);
|
|
||||||
OnlCgformFieldMapper var5 = var4.getMapper(OnlCgformFieldMapper.class);
|
|
||||||
short var6 = 1000;
|
|
||||||
int var7;
|
|
||||||
String var8;
|
|
||||||
if (var6 >= dataList.size()) {
|
|
||||||
for(var7 = 0; var7 < dataList.size(); ++var7) {
|
|
||||||
var8 = JSON.toJSONString(dataList.get(var7));
|
|
||||||
this.a(var8, head, fieldList, var5);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(var7 = 0; var7 < dataList.size(); ++var7) {
|
|
||||||
var8 = JSON.toJSONString(dataList.get(var7));
|
|
||||||
this.a(var8, head, fieldList, var5);
|
|
||||||
if (var7 % var6 == 0) {
|
|
||||||
var4.commit();
|
|
||||||
var4.clearCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var4.commit();
|
|
||||||
} catch (Exception var12) {
|
|
||||||
throw new BusinessException(var12.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveOrUpdateSubData(String subDataJsonStr, OnlCgformHead head, List<OnlCgformField> subFiledList) throws BusinessException {
|
|
||||||
OnlCgformFieldMapper var4 = SpringContextUtils.getBean(OnlCgformFieldMapper.class);
|
|
||||||
this.a(subDataJsonStr, head, subFiledList, var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void a(String var1, OnlCgformHead var2, List<OnlCgformField> var3, OnlCgformFieldMapper var4) throws BusinessException {
|
private void a(String var1, OnlCgformHead var2, List<OnlCgformField> var3, OnlCgformFieldMapper var4) throws BusinessException {
|
||||||
JSONObject var5 = JSON.parseObject(var1);
|
JSONObject var5 = JSON.parseObject(var1);
|
||||||
int var6 = this.onlCgformHeadService.executeEnhanceJava("import", "start", var2, var5);
|
int var6 = this.onlCgformHeadService.executeEnhanceJava("import", "start", var2, var5);
|
||||||
|
|||||||
@@ -1,551 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.controller;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.aspect.annotation.PermissionData;
|
|
||||||
import com.jero.common.exception.JeroBootException;
|
|
||||||
import com.jero.common.system.api.ISysBaseAPI;
|
|
||||||
import com.jero.common.system.vo.DictModel;
|
|
||||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
|
||||||
import com.jero.common.util.BrowserUtils;
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportItemService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportParamService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.a.OnlCgreportHeadServiceImpl;
|
|
||||||
import com.jero.generater.modules.online.cgreport.util.SqlUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
@RestController("onlCgreportAPI")
|
|
||||||
@RequestMapping({"/online/cgreport/api"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgreportAPI {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OnlCgreportHeadServiceImpl onlCgreportHeadService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportItemService onlCgreportItemService;
|
|
||||||
@Autowired
|
|
||||||
private ISysBaseAPI sysBaseAPI;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportParamService onlCgreportParamService;
|
|
||||||
|
|
||||||
private static final String EN_IS_NULL = "实体不存在";
|
|
||||||
private static final String CGR_HEAD_ID = "cgrhead_id";
|
|
||||||
private static final String IS_SHOW = "is_show";
|
|
||||||
private static final String ORDER_NUM = "order_num";
|
|
||||||
private static final String TITLE = "title";
|
|
||||||
private static final String DATA_INDEX = "dataIndex";
|
|
||||||
private static final String ALIGN = "align";
|
|
||||||
private static final String CENTER = "center";
|
|
||||||
private static final String SORTER = "sorter";
|
|
||||||
private static final String CUSTOM_RENDER = "customRender";
|
|
||||||
private static final String COLUMNS = "columns";
|
|
||||||
private static final String DICT_OPTIONS = "dictOptions";
|
|
||||||
private static final String GET_ALL = "getAll";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping({"/getColumnsAndData/{code}"})
|
|
||||||
@PermissionData
|
|
||||||
public Result<Map<String, Object>> a(@PathVariable("code") String var1, HttpServletRequest var2) {
|
|
||||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getById(var1);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
return getMapResult(var1, var2, var3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Result<Map<String, Object>> getMapResult(@PathVariable("code") String var1, HttpServletRequest var2, OnlCgreportHead var3) {
|
|
||||||
Result<Map<String, Object>> var4 = this.b(var1, var2);
|
|
||||||
if (var4.getCode().equals(200)) {
|
|
||||||
JSONObject var5 = JSON.parseObject(JSON.toJSONString(var4.getResult()));
|
|
||||||
JSONArray var6 = var5.getJSONArray("records");
|
|
||||||
QueryWrapper<OnlCgreportItem> var7 = new QueryWrapper<>();
|
|
||||||
var7.eq(CGR_HEAD_ID, var1).eq(IS_SHOW, 1).orderByAsc(ORDER_NUM);
|
|
||||||
List<OnlCgreportItem> var8 = this.onlCgreportItemService.list(var7);
|
|
||||||
HashMap<String, Object> var9 = new HashMap<>();
|
|
||||||
JSONArray var10 = new JSONArray();
|
|
||||||
JSONArray var11 = new JSONArray();
|
|
||||||
boolean var12 = false;
|
|
||||||
|
|
||||||
for (OnlCgreportItem var14 : var8) {
|
|
||||||
JSONObject var15 = new JSONObject(4);
|
|
||||||
var15.put(TITLE, var14.getFieldTxt());
|
|
||||||
var15.put(DATA_INDEX, var14.getFieldName());
|
|
||||||
var15.put(ALIGN, CENTER);
|
|
||||||
var15.put(SORTER, "true");
|
|
||||||
var15.put("isTotal", var14.getIsTotal());
|
|
||||||
var15.put("groupTitle", var14.getGroupTitle());
|
|
||||||
if (oConvertUtils.isNotEmpty(var14.getGroupTitle())) {
|
|
||||||
var12 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String var16;
|
|
||||||
if (StringUtils.isNotBlank(var14.getFieldHref())) {
|
|
||||||
var16 = "fieldHref_" + var14.getFieldName();
|
|
||||||
JSONObject var17 = new JSONObject();
|
|
||||||
var17.put(CUSTOM_RENDER, var16);
|
|
||||||
var15.put("scopedSlots", var17);
|
|
||||||
JSONObject var18 = new JSONObject();
|
|
||||||
var18.put("slotName", var16);
|
|
||||||
var18.put("href", var14.getFieldHref());
|
|
||||||
var10.add(var18);
|
|
||||||
}
|
|
||||||
|
|
||||||
var11.add(var15);
|
|
||||||
var16 = var14.getDictCode();
|
|
||||||
List<DictModel> var20 = this.a(var16, var6, var14.getFieldName());
|
|
||||||
if (var20 != null) {
|
|
||||||
var9.put(var14.getFieldName(), var20);
|
|
||||||
var15.put(CUSTOM_RENDER, var14.getFieldName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String, Object> var19 = new HashMap<>(3);
|
|
||||||
var19.put("data", var4.getResult());
|
|
||||||
var19.put(COLUMNS, var11);
|
|
||||||
var19.put(DICT_OPTIONS, var9);
|
|
||||||
var19.put("fieldHrefSlots", var10);
|
|
||||||
var19.put("cgreportHeadName", var3.getName());
|
|
||||||
var19.put("isGroupTitle", var12);
|
|
||||||
return Result.OK(var19);
|
|
||||||
} else {
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DictModel> a(String var1, JSONArray var2, String var3) {
|
|
||||||
List<DictModel> var4 = null;
|
|
||||||
if (oConvertUtils.isNotEmpty(var1)) {
|
|
||||||
if (var1.trim().toLowerCase().indexOf("select ") == 0 && (var3 == null || !var2.isEmpty())) {
|
|
||||||
var1 = var1.trim();
|
|
||||||
int var5 = var1.lastIndexOf(";");
|
|
||||||
var1 = getString(var1, var5);
|
|
||||||
|
|
||||||
String var6 = "SELECT * FROM (" + var1 + ") temp ";
|
|
||||||
String var12;
|
|
||||||
if (var2 != null) {
|
|
||||||
ArrayList<String> var7 = new ArrayList<>();
|
|
||||||
|
|
||||||
addVar7(var2, var3, var7);
|
|
||||||
|
|
||||||
var12 = "'" + StringUtils.join(var7, "','") + "'";
|
|
||||||
var6 = var6 + "WHERE temp.value IN (" + var12 + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String,Object>> var11 = this.onlCgreportHeadService.getBaseMapper().executeSelete(var6);
|
|
||||||
if (var11 != null && !var11.isEmpty()) {
|
|
||||||
var12 = JSON.toJSONString(var11);
|
|
||||||
var4 = JSON.parseArray(var12, DictModel.class);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var4 = this.sysBaseAPI.queryDictItemsByCode(var1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private String getString(String var1, int var5) {
|
|
||||||
if (var5 == var1.length() - 1) {
|
|
||||||
var1 = var1.substring(0, var5);
|
|
||||||
}
|
|
||||||
return var1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addVar7(JSONArray var2, String var3, ArrayList<String> var7) {
|
|
||||||
for(int var8 = 0; var8 < var2.size(); ++var8) {
|
|
||||||
JSONObject var9 = var2.getJSONObject(var8);
|
|
||||||
String var10 = var9.getString(var3);
|
|
||||||
if (StringUtils.isNotBlank(var10)) {
|
|
||||||
var7.add(var10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
@Deprecated
|
|
||||||
@GetMapping({"/getColumns/{code}"})
|
|
||||||
public Result<Map<String,Object>> a(@PathVariable("code") String var1) {
|
|
||||||
OnlCgreportHead var2 = this.onlCgreportHeadService.getById(var1);
|
|
||||||
if (var2 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
QueryWrapper<OnlCgreportItem> var3 = new QueryWrapper<>();
|
|
||||||
var3.eq(CGR_HEAD_ID, var1);
|
|
||||||
var3.eq(IS_SHOW, 1);
|
|
||||||
var3.orderByAsc(ORDER_NUM);
|
|
||||||
List<OnlCgreportItem> var4 = this.onlCgreportItemService.list(var3);
|
|
||||||
ArrayList<Map<String,Object>> var5 = new ArrayList<>();
|
|
||||||
HashMap<String,Object> var6 = new HashMap<>();
|
|
||||||
|
|
||||||
for (OnlCgreportItem var8 : var4) {
|
|
||||||
HashMap<String,Object> var9 = new HashMap<>(3);
|
|
||||||
var9.put(TITLE, var8.getFieldTxt());
|
|
||||||
var9.put(DATA_INDEX, var8.getFieldName());
|
|
||||||
var9.put(ALIGN, CENTER);
|
|
||||||
var9.put(SORTER, "true");
|
|
||||||
var5.add(var9);
|
|
||||||
String var10 = var8.getDictCode();
|
|
||||||
if (oConvertUtils.isNotEmpty(var10)) {
|
|
||||||
List<DictModel> var11 = getDictModels(var10);
|
|
||||||
|
|
||||||
if (var11 != null) {
|
|
||||||
var6.put(var8.getFieldName(), var11);
|
|
||||||
var9.put(CUSTOM_RENDER, var8.getFieldName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String,Object> var14 = new HashMap<>(1);
|
|
||||||
var14.put(COLUMNS, var5);
|
|
||||||
var14.put(DICT_OPTIONS, var6);
|
|
||||||
var14.put("cgreportHeadName", var2.getName());
|
|
||||||
return Result.OK(var14);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private List<DictModel> getDictModels(String var10) {
|
|
||||||
List<DictModel> var11 = null;
|
|
||||||
if (var10.toLowerCase().indexOf("select ") == 0) {
|
|
||||||
List<Map<String,Object>> var12 = this.onlCgreportHeadService.getBaseMapper().executeSelete(var10);
|
|
||||||
if (var12 != null && !var12.isEmpty()) {
|
|
||||||
String var13 = JSON.toJSONString(var12);
|
|
||||||
var11 = JSON.parseArray(var13, DictModel.class);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var11 = this.sysBaseAPI.queryDictItemsByCode(var10);
|
|
||||||
}
|
|
||||||
return var11;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/getData/{code}"})
|
|
||||||
@PermissionData
|
|
||||||
public Result<Map<String, Object>> b(@PathVariable("code") String var1, HttpServletRequest var2) {
|
|
||||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getById(var1);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
String var4 = var3.getCgrSql().trim();
|
|
||||||
String var5 = var3.getDbSource();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Map<String, Object> var6 = SqlUtil.a(var2);
|
|
||||||
var6.put(GET_ALL, var2.getAttribute(GET_ALL));
|
|
||||||
Map<String, Object> var7;
|
|
||||||
if (StringUtils.isNotBlank(var5)) {
|
|
||||||
log.debug("Online报表: 走了多数据源逻辑");
|
|
||||||
var7 = this.onlCgreportHeadService.executeSelectSqlDynamic(var5, var4, var6, var3.getId());
|
|
||||||
} else {
|
|
||||||
log.debug("Online报表: 走了稳定逻辑");
|
|
||||||
var7 = this.onlCgreportHeadService.executeSelectSql(var4, var3.getId(), var6);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK(var7);
|
|
||||||
} catch (Exception var8) {
|
|
||||||
log.error(var8.getMessage(), var8);
|
|
||||||
return Result.error("SQL执行失败:" + var8.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/getQueryInfo/{code}"})
|
|
||||||
public Result<List<Map<String, String>>> b(@PathVariable("code") String var1) {
|
|
||||||
try {
|
|
||||||
List<Map<String, String>> var2 = this.onlCgreportItemService.getAutoListQueryInfo(var1);
|
|
||||||
return Result.OK(var2);
|
|
||||||
} catch (Exception var3) {
|
|
||||||
log.info(var3.getMessage(), var3);
|
|
||||||
return Result.error("查询失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/getParamsInfo/{code}"})
|
|
||||||
public Result<List<OnlCgreportParam>> c(@PathVariable("code") String var1) {
|
|
||||||
try {
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var2 = new LambdaQueryWrapper<>();
|
|
||||||
var2.eq(OnlCgreportParam::getCgrheadId, var1);
|
|
||||||
List<OnlCgreportParam> var3 = this.onlCgreportParamService.list(var2);
|
|
||||||
return Result.OK(var3);
|
|
||||||
} catch (Exception var4) {
|
|
||||||
log.info(var4.getMessage(), var4);
|
|
||||||
return Result.error("查询失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PermissionData
|
|
||||||
@RequestMapping({"/exportXls/{reportId}"})
|
|
||||||
public void a(@PathVariable("reportId") String var1, HttpServletRequest var2, HttpServletResponse var3) {
|
|
||||||
String var4 = "报表";
|
|
||||||
String var5 = "导出信息";
|
|
||||||
if (!oConvertUtils.isNotEmpty(var1)) {
|
|
||||||
throw new JeroBootException("参数错误");
|
|
||||||
} else {
|
|
||||||
getVar6(var1, var2, var3, var4, var5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar6(@PathVariable("reportId") String var1, HttpServletRequest var2, HttpServletResponse var3, String var4, String var5) {
|
|
||||||
Map<String, Object> var6 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var6 = this.onlCgreportHeadService.queryCgReportConfig(var1);
|
|
||||||
} catch (Exception var35) {
|
|
||||||
throw new JeroBootException("动态报表配置不存在!");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String, Object>> var7 = (List)var6.get("items");
|
|
||||||
var2.setAttribute(GET_ALL, true);
|
|
||||||
Result<Map<String, Object>> var8 = this.b(var1, var2);
|
|
||||||
List<Map<String, Object>> var9 = null;
|
|
||||||
if (var8.getCode().equals(200)) {
|
|
||||||
Map<String, Object> var10 = var8.getResult();
|
|
||||||
var9 = (List)var10.get("records");
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<String> var36 = new ArrayList<>();
|
|
||||||
HashMap<String, Object> var11 = new HashMap<>();
|
|
||||||
HashMap<String, Object> var12 = new HashMap<>();
|
|
||||||
ArrayList<ExcelExportEntity> var13 = new ArrayList<>();
|
|
||||||
|
|
||||||
String var15;
|
|
||||||
for(int var14 = 0; var14 < var7.size(); ++var14) {
|
|
||||||
if ("1".equals(oConvertUtils.getString((var7.get(var14)).get(IS_SHOW)))) {
|
|
||||||
var15 = (var7.get(var14)).get("field_name").toString();
|
|
||||||
ExcelExportEntity var16 = new ExcelExportEntity((var7.get(var14)).get("field_txt").toString(), var15, 15);
|
|
||||||
Object var17 = (var7.get(var14)).get("dict_code");
|
|
||||||
JSONArray var18 = JSON.parseArray(JSON.toJSONString(var9));
|
|
||||||
List<DictModel> var19 = this.a(oConvertUtils.getString(var17), var18, var15);
|
|
||||||
getVar16(var16, var19);
|
|
||||||
|
|
||||||
Object var50 = (var7.get(var14)).get("replace_val");
|
|
||||||
getVar16(var16, var50);
|
|
||||||
|
|
||||||
if (oConvertUtils.isNotEmpty((var7.get(var14)).get("group_title"))) {
|
|
||||||
String var52 = (var7.get(var14)).get("group_title").toString();
|
|
||||||
Object var53 = new ArrayList<>();
|
|
||||||
if (var12.containsKey(var52)) {
|
|
||||||
var53 = var12.get(var52);
|
|
||||||
((List)var53).add(var15);
|
|
||||||
} else {
|
|
||||||
ExcelExportEntity var23 = new ExcelExportEntity(var52, var52, true);
|
|
||||||
var13.add(var23);
|
|
||||||
((List)var53).add(var15);
|
|
||||||
}
|
|
||||||
|
|
||||||
var12.put(var52, var53);
|
|
||||||
var16.setColspan(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var13.add(var16);
|
|
||||||
}
|
|
||||||
|
|
||||||
getVar36(var7, var36, var14);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator<Entry<String, Object>> var37 = var12.entrySet().iterator();
|
|
||||||
|
|
||||||
String var42;
|
|
||||||
while(var37.hasNext()) {
|
|
||||||
Entry<String, Object> var39 = var37.next();
|
|
||||||
var42 = var39.getKey();
|
|
||||||
List<String> var43 = (List)var39.getValue();
|
|
||||||
|
|
||||||
getVar48(var13, var42, var43);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!var36.isEmpty()) {
|
|
||||||
getVar38(var9, var36, var11);
|
|
||||||
var9.add(var11);
|
|
||||||
}
|
|
||||||
|
|
||||||
var3.setContentType("application/vnd.ms-excel");
|
|
||||||
getVar41(var2, var3, var4, var5, var9, var13);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar36(List<Map<String, Object>> var7, ArrayList<String> var36, int var14) {
|
|
||||||
if ("1".equals(oConvertUtils.getString((var7.get(var14)).get("is_total")))) {
|
|
||||||
var36.add((var7.get(var14)).get("field_name").toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar16(ExcelExportEntity var16, Object var50) {
|
|
||||||
if (oConvertUtils.isNotEmpty(var50)) {
|
|
||||||
var16.setReplace(var50.toString().split(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar38(List<Map<String, Object>> var9, ArrayList<String> var36, HashMap<String, Object> var11) {
|
|
||||||
String var42;
|
|
||||||
BigDecimal var38 = BigDecimal.valueOf(0.0D);
|
|
||||||
|
|
||||||
for (String o : var36) {
|
|
||||||
var42 = o;
|
|
||||||
var38 = getBigDecimal(var9, var42, var38);
|
|
||||||
var11.put(var42, var38);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar48(ArrayList<ExcelExportEntity> var13, String var42, List<String> var43) {
|
|
||||||
for (ExcelExportEntity o : var13) {
|
|
||||||
ExcelExportEntity var48 = o;
|
|
||||||
if (var42.equals(var48.getName()) && var48.isColspan()) {
|
|
||||||
var48.setSubColumnList(var43);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar16(ExcelExportEntity var16, List<DictModel> var19) {
|
|
||||||
if (var19 != null && !var19.isEmpty()) {
|
|
||||||
ArrayList<String> var20 = new ArrayList<>();
|
|
||||||
|
|
||||||
for (DictModel o : var19) {
|
|
||||||
var20.add(o.getText() + "_" + o.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
var16.setReplace(var20.toArray(new String[var20.size()]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal getBigDecimal(List<Map<String, Object>> var9, String var42, BigDecimal var38) {
|
|
||||||
for (Map<String, Object> value : var9) {
|
|
||||||
Map<String, Object> var47 = value;
|
|
||||||
String var49 = var47.get(var42).toString();
|
|
||||||
if (var49.matches("\\d+(.\\d+)?")) {
|
|
||||||
BigDecimal var51 = new BigDecimal(var49);
|
|
||||||
var38 = var38.add(var51);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return var38;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getVar41(HttpServletRequest var2, HttpServletResponse var3, String var4, String var5, List<Map<String, Object>> var9, ArrayList<ExcelExportEntity> var13) {
|
|
||||||
String var15;
|
|
||||||
String var42;
|
|
||||||
ServletOutputStream var41 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var15 = BrowserUtils.checkBrowse(var2);
|
|
||||||
if ("MSIE".equalsIgnoreCase(var15.substring(0, 4))) {
|
|
||||||
var3.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(var4, "UTF-8") + ".xls");
|
|
||||||
} else {
|
|
||||||
var42 = new String(var4.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
|
|
||||||
var3.setHeader("content-disposition", "attachment;filename=" + var42 + ".xls");
|
|
||||||
}
|
|
||||||
|
|
||||||
Workbook var44 = ExcelExportUtil.exportExcel(new ExportParams(null, var5), var13, var9);
|
|
||||||
var41 = var3.getOutputStream();
|
|
||||||
var44.write(var41);
|
|
||||||
} catch (Exception var33) {
|
|
||||||
log.error("异常",var33);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if(var41 != null){var41.flush();var41.close();}
|
|
||||||
} catch (Exception var32) {
|
|
||||||
log.error("异常",var32);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/getRpColumns/{code}"})
|
|
||||||
public Result<Map<String,Object>> d(@PathVariable("code") String var1) {
|
|
||||||
LambdaQueryWrapper<OnlCgreportHead> var2 = new LambdaQueryWrapper<>();
|
|
||||||
var2.eq(OnlCgreportHead::getCode, var1);
|
|
||||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getOne(var2);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error(EN_IS_NULL);
|
|
||||||
} else {
|
|
||||||
QueryWrapper<OnlCgreportItem> var4 = new QueryWrapper<>();
|
|
||||||
var4.eq(CGR_HEAD_ID, var3.getId());
|
|
||||||
var4.eq(IS_SHOW, 1);
|
|
||||||
var4.orderByAsc(ORDER_NUM);
|
|
||||||
List<OnlCgreportItem> var5 = this.onlCgreportItemService.list(var4);
|
|
||||||
ArrayList<Map<String,Object>> var6 = new ArrayList<>();
|
|
||||||
HashMap<String,Object> var7 = new HashMap<>();
|
|
||||||
|
|
||||||
HashMap<String,Object> var10;
|
|
||||||
for(Iterator<OnlCgreportItem> var8 = var5.iterator(); var8.hasNext(); var6.add(var10)) {
|
|
||||||
OnlCgreportItem var9 = var8.next();
|
|
||||||
var10 = new HashMap<>(3);
|
|
||||||
var10.put(TITLE, var9.getFieldTxt());
|
|
||||||
var10.put(DATA_INDEX, var9.getFieldName());
|
|
||||||
var10.put(ALIGN, CENTER);
|
|
||||||
String var11 = var9.getFieldType();
|
|
||||||
if ("Integer".equals(var11) || "Date".equals(var11) || "Long".equals(var11)) {
|
|
||||||
var10.put(SORTER, "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
String var12 = var9.getDictCode();
|
|
||||||
if (oConvertUtils.isNotEmpty(var12)) {
|
|
||||||
List<DictModel> var13 = this.a(var9.getDictCode(), (JSONArray)null, (String)null);
|
|
||||||
var7.put(var9.getFieldName(), var13);
|
|
||||||
var10.put(CUSTOM_RENDER, var9.getFieldName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String,Object> var14 = new HashMap<>(1);
|
|
||||||
var14.put(COLUMNS, var6);
|
|
||||||
var14.put(DICT_OPTIONS, var7);
|
|
||||||
var14.put("cgRpConfigId", var3.getId());
|
|
||||||
var14.put("cgRpConfigName", var3.getName());
|
|
||||||
return Result.OK(var14);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/testConnection"})
|
|
||||||
public Result<String> a(@RequestBody DynamicDataSourceModel var1) {
|
|
||||||
Result<String> var4;
|
|
||||||
try (Connection var2 = DriverManager.getConnection(var1.getDbUrl(), var1.getDbUsername(), var1.getDbPassword())){
|
|
||||||
Class.forName(var1.getDbDriver());
|
|
||||||
Result<String> var3;
|
|
||||||
if (var2 == null) {
|
|
||||||
var3 = Result.OK("数据库连接失败:错误未知");
|
|
||||||
return var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3 = Result.OK("数据库连接成功");
|
|
||||||
return var3;
|
|
||||||
} catch (ClassNotFoundException var17) {
|
|
||||||
log.error(var17.toString());
|
|
||||||
var4 = Result.error("数据库连接失败:驱动类不存在");
|
|
||||||
} catch (Exception var18) {
|
|
||||||
log.error(var18.toString());
|
|
||||||
var4 = Result.error("数据库连接失败:" + var18.getMessage());
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,195 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.system.api.ISysBaseAPI;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
|
||||||
import com.jero.common.util.SqlInjectionUtil;
|
|
||||||
import com.jero.generater.modules.online.cgform.util.CgformUtil;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
|
|
||||||
import com.jero.generater.modules.online.cgreport.model.OnlCgreportModel;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportHeadService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportItemService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportParamService;
|
|
||||||
import com.jero.modules.base.service.BaseCommonService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RestController("onlCgreportHeadController")
|
|
||||||
@RequestMapping({"/online/cgreport/head"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgreportHeadController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysBaseAPI sysBaseAPI;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportHeadService onlCgreportHeadService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportParamService onlCgreportParamService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportItemService onlCgreportItemService;
|
|
||||||
@Autowired
|
|
||||||
private BaseCommonService baseCommonService;
|
|
||||||
|
|
||||||
@GetMapping({"/parseSql"})
|
|
||||||
public Result<Map<String, Object>> a(@RequestParam(name = "sql") String var1, @RequestParam(name = "dbKey",required = false) String var2) {
|
|
||||||
if (StringUtils.isNotBlank(var2)) {
|
|
||||||
DynamicDataSourceModel var3 = this.sysBaseAPI.getDynamicDbSourceByCode(var2);
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error("数据源不存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String, Object> var13 = new HashMap<>();
|
|
||||||
ArrayList<OnlCgreportItem> var4 = new ArrayList<>();
|
|
||||||
ArrayList<OnlCgreportParam> var5 = new ArrayList<>();
|
|
||||||
List<String> var6;
|
|
||||||
List<String> var7;
|
|
||||||
|
|
||||||
try {
|
|
||||||
log.info("Online报表,sql解析:" + var1);
|
|
||||||
this.baseCommonService.addLog("Online报表,sql解析:" + var1, 2, 2);
|
|
||||||
SqlInjectionUtil.specialFilterContentForOnlineReport(var1);
|
|
||||||
var6 = this.onlCgreportHeadService.getSqlFields(var1, var2);
|
|
||||||
var7 = this.onlCgreportHeadService.getSqlParams(var1);
|
|
||||||
int var8 = 1;
|
|
||||||
|
|
||||||
String var14;
|
|
||||||
Iterator<String> var15;
|
|
||||||
for(var15 = var6.iterator(); var15.hasNext(); ++var8) {
|
|
||||||
var14 = var15.next();
|
|
||||||
OnlCgreportItem var11 = new OnlCgreportItem();
|
|
||||||
var11.setFieldName(var14.toLowerCase());
|
|
||||||
var11.setFieldTxt(var14);
|
|
||||||
var11.setIsShow(1);
|
|
||||||
var11.setOrderNum(var8);
|
|
||||||
var11.setId(CgformUtil.a());
|
|
||||||
var11.setFieldType("String");
|
|
||||||
var4.add(var11);
|
|
||||||
}
|
|
||||||
|
|
||||||
var15 = var7.iterator();
|
|
||||||
|
|
||||||
while(var15.hasNext()) {
|
|
||||||
var14 = var15.next();
|
|
||||||
OnlCgreportParam var16 = new OnlCgreportParam();
|
|
||||||
var16.setParamName(var14);
|
|
||||||
var16.setParamTxt(var14);
|
|
||||||
var5.add(var16);
|
|
||||||
}
|
|
||||||
|
|
||||||
var13.put("fields", var4);
|
|
||||||
var13.put("params", var5);
|
|
||||||
return Result.OK(var13);
|
|
||||||
} catch (Exception var12) {
|
|
||||||
log.error(var12.getMessage(), var12);
|
|
||||||
String var9 = "解析失败,";
|
|
||||||
int var10 = var12.getMessage().indexOf("Connection refused: connect");
|
|
||||||
if (var10 != -1) {
|
|
||||||
var9 = var9 + "数据源连接失败.";
|
|
||||||
} else if (var12.getMessage().contains("值可能存在SQL注入风险")) {
|
|
||||||
var9 = var9 + "SQL可能存在SQL注入风险.";
|
|
||||||
} else if (var12.getMessage().contains("该报表sql没有数据")) {
|
|
||||||
var9 = var9 + "报表sql查询数据为空,无法解析字段.";
|
|
||||||
} else if (var12.getMessage().contains("SqlServer不支持SQL内排序")) {
|
|
||||||
var9 = var9 + "SqlServer不支持SQL内排序.";
|
|
||||||
} else {
|
|
||||||
var9 = var9 + "SQL语法错误.";
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.error(var9);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgreportHead>> a(OnlCgreportHead var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
Result<IPage<OnlCgreportHead>> var5 = new Result<>();
|
|
||||||
QueryWrapper<OnlCgreportHead> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgreportHead> var7 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgreportHead> var8 = this.onlCgreportHeadService.page(var7, var6);
|
|
||||||
var5.setSuccess(true);
|
|
||||||
var5.setResult(var8);
|
|
||||||
return var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<String> add(@RequestBody OnlCgreportModel var1) {
|
|
||||||
try {
|
|
||||||
String var3 = CgformUtil.a();
|
|
||||||
OnlCgreportHead var4 = var1.getHead();
|
|
||||||
List<OnlCgreportParam> var5 = var1.getParams();
|
|
||||||
List<OnlCgreportItem> var6 = var1.getItems();
|
|
||||||
var4.setId(var3);
|
|
||||||
Iterator<OnlCgreportParam> var7 = var5.iterator();
|
|
||||||
Iterator<OnlCgreportItem> var9 = var6.iterator();
|
|
||||||
|
|
||||||
while(var7.hasNext()) {
|
|
||||||
OnlCgreportParam var8 = var7.next();
|
|
||||||
var8.setId(null);
|
|
||||||
var8.setCgrheadId(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var9.hasNext()) {
|
|
||||||
OnlCgreportItem var10 = var9.next();
|
|
||||||
var10.setId(null);
|
|
||||||
var10.setFieldName(var10.getFieldName().trim().toLowerCase());
|
|
||||||
var10.setCgrheadId(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.onlCgreportHeadService.save(var4);
|
|
||||||
this.onlCgreportParamService.saveBatch(var5);
|
|
||||||
this.onlCgreportItemService.saveBatch(var6);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
} catch (Exception var9) {
|
|
||||||
log.error(var9.getMessage(), var9);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/editAll"})
|
|
||||||
public Result<String> editAll(@RequestBody OnlCgreportModel cgreportModel) {
|
|
||||||
try {
|
|
||||||
return this.onlCgreportHeadService.editAll(cgreportModel);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
return Result.error("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<String> delete(@RequestBody Map<String,String> map) {
|
|
||||||
String id = map.get("id");
|
|
||||||
if(StringUtils.isBlank(id)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
return this.onlCgreportHeadService.delete(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<String> deleteBatch(@RequestBody Map<String,String> map) {
|
|
||||||
String ids = map.get("ids");
|
|
||||||
if(StringUtils.isBlank(ids)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
return this.onlCgreportHeadService.bathDelete(ids.split(","));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgreportHead> queryById(@RequestParam(name = "id",required = true) String id) {
|
|
||||||
Result<OnlCgreportHead> result = new Result<>();
|
|
||||||
OnlCgreportHead cgreportHead = this.onlCgreportHeadService.getById(id);
|
|
||||||
result.setResult(cgreportHead);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportItemService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController("onlCgreportItemController")
|
|
||||||
@RequestMapping({"/online/cgreport/item"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgreportItemController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportItemService onlCgreportItemService;
|
|
||||||
|
|
||||||
@GetMapping({"/listByHeadId"})
|
|
||||||
public Result<List<OnlCgreportItem>> a(@RequestParam("headId") String var1) {
|
|
||||||
QueryWrapper<OnlCgreportItem> var2 = new QueryWrapper<>();
|
|
||||||
var2.eq("cgrhead_id", var1);
|
|
||||||
var2.orderByAsc("order_num");
|
|
||||||
List<OnlCgreportItem> var3 = this.onlCgreportItemService.list(var2);
|
|
||||||
Result<List<OnlCgreportItem>> var4 = new Result<>();
|
|
||||||
var4.setSuccess(true);
|
|
||||||
var4.setResult(var3);
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgreportItem>> a(OnlCgreportItem var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
Result<IPage<OnlCgreportItem>> var5 = new Result<>();
|
|
||||||
QueryWrapper<OnlCgreportItem> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgreportItem> var7 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgreportItem> var8 = this.onlCgreportItemService.page(var7, var6);
|
|
||||||
var5.setSuccess(true);
|
|
||||||
var5.setResult(var8);
|
|
||||||
return var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<String> a(@RequestBody OnlCgreportItem var1) {
|
|
||||||
this.onlCgreportItemService.save(var1);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<String> b(@RequestBody OnlCgreportItem var1) {
|
|
||||||
this.onlCgreportItemService.updateById(var1);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<String> b(@RequestBody Map<String,String> map) {
|
|
||||||
String var1 = map.get("id");
|
|
||||||
if(StringUtils.isEmpty(var1)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
this.onlCgreportItemService.removeById(var1);
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<String> c(@RequestBody Map<String,String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
if(StringUtils.isBlank(var1)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
this.onlCgreportItemService.removeByIds(Arrays.asList(var1.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgreportItem> d(@RequestParam(name = "id",required = true) String var1) {
|
|
||||||
Result<OnlCgreportItem> var2 = new Result<>();
|
|
||||||
OnlCgreportItem var3 = this.onlCgreportItemService.getById(var1);
|
|
||||||
var2.setResult(var3);
|
|
||||||
var2.setSuccess(true);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportParamService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController("onlCgreportParamController")
|
|
||||||
@RequestMapping({"/online/cgreport/param"})
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgreportParamController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportParamService onlCgreportParamService;
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping({"/listByHeadId"})
|
|
||||||
public Result<List<OnlCgreportParam>> a(@RequestParam("headId") String var1) {
|
|
||||||
QueryWrapper<OnlCgreportParam> var2 = new QueryWrapper<>();
|
|
||||||
var2.eq("cgrhead_id", var1);
|
|
||||||
var2.orderByAsc("order_num");
|
|
||||||
List<OnlCgreportParam> var3 = this.onlCgreportParamService.list(var2);
|
|
||||||
Result<List<OnlCgreportParam>> var4 = new Result<>();
|
|
||||||
var4.setSuccess(true);
|
|
||||||
var4.setResult(var3);
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/list"})
|
|
||||||
public Result<IPage<OnlCgreportParam>> a(OnlCgreportParam var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
|
||||||
Result<IPage<OnlCgreportParam>> var5 = new Result<>();
|
|
||||||
QueryWrapper<OnlCgreportParam> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
|
||||||
Page<OnlCgreportParam> var7 = new Page<>(var2, var3);
|
|
||||||
IPage<OnlCgreportParam> var8 = this.onlCgreportParamService.page(var7, var6);
|
|
||||||
var5.setSuccess(true);
|
|
||||||
var5.setResult(var8);
|
|
||||||
return var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/add"})
|
|
||||||
public Result<String> a(@RequestBody OnlCgreportParam var1) {
|
|
||||||
this.onlCgreportParamService.save(var1);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/edit"})
|
|
||||||
public Result<String> b(@RequestBody OnlCgreportParam var1) {
|
|
||||||
this.onlCgreportParamService.updateById(var1);
|
|
||||||
return Result.OK("操作成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/delete"})
|
|
||||||
public Result<Object> b(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("id");
|
|
||||||
if(StringUtils.isBlank(var1)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
this.onlCgreportParamService.removeById(var1);
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping({"/deleteBatch"})
|
|
||||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
|
||||||
String var1 = map.get("ids");
|
|
||||||
if(StringUtils.isBlank(var1)){
|
|
||||||
return Result.error("参数不识别!");
|
|
||||||
}
|
|
||||||
this.onlCgreportParamService.removeByIds(Arrays.asList(var1.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/queryById"})
|
|
||||||
public Result<OnlCgreportParam> d(@RequestParam(name = "id", required = true) String var1) {
|
|
||||||
Result<OnlCgreportParam> var2 = new Result<>();
|
|
||||||
OnlCgreportParam var3 = this.onlCgreportParamService.getById(var1);
|
|
||||||
var2.setResult(var3);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
|
|
||||||
import com.jero.generater.modules.online.cgreport.model.OnlCgreportModel;
|
|
||||||
|
|
||||||
public interface IOnlCgreportHeadService extends IService<OnlCgreportHead> {
|
|
||||||
Result<String> editAll(OnlCgreportModel var1);
|
|
||||||
|
|
||||||
Result<String> delete(String var1);
|
|
||||||
|
|
||||||
Result<String> bathDelete(String[] var1);
|
|
||||||
|
|
||||||
Map<String, Object> executeSelectSql(String var1, String var2, Map<String, Object> var3) throws SQLException;
|
|
||||||
|
|
||||||
Map<String, Object> executeSelectSqlDynamic(String var1, String var2, Map<String, Object> var3, String var4);
|
|
||||||
|
|
||||||
List<String> getSqlFields(String var1, String var2) throws SQLException;
|
|
||||||
|
|
||||||
List<String> getSqlParams(String var1);
|
|
||||||
|
|
||||||
Map<String, Object> queryCgReportConfig(String var1);
|
|
||||||
}
|
|
||||||
@@ -1,411 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.service.a;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ReUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.jero.common.api.vo.Result;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import com.jero.common.exception.JeroBootException;
|
|
||||||
import com.jero.common.system.api.ISysBaseAPI;
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import com.jero.common.util.dynamic.db.DataSourceCachePool;
|
|
||||||
import com.jero.common.util.dynamic.db.DynamicDBUtil;
|
|
||||||
import com.jero.common.util.dynamic.db.SqlUtils;
|
|
||||||
import com.jero.generater.modules.online.cgform.enums.DataBaseEnum;
|
|
||||||
import com.jero.generater.modules.online.cgform.util.CgformUtil;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
|
|
||||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
|
|
||||||
import com.jero.generater.modules.online.cgreport.mapper.OnlCgreportHeadMapper;
|
|
||||||
import com.jero.generater.modules.online.cgreport.model.OnlCgreportModel;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportHeadService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportItemService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportParamService;
|
|
||||||
import com.jero.generater.modules.online.cgreport.util.CgReportQueryParamUtil;
|
|
||||||
import com.jero.generater.modules.online.cgreport.util.SqlUtil;
|
|
||||||
import com.jero.generater.modules.online.config.util.DbTableUtil;
|
|
||||||
import com.jero.generater.modules.online.config.exception.DBException;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service("onlCgreportHeadServiceImpl")
|
|
||||||
@Slf4j
|
|
||||||
public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMapper, OnlCgreportHead> implements IOnlCgreportHeadService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportParamService onlCgreportParamService;
|
|
||||||
@Autowired
|
|
||||||
private IOnlCgreportItemService onlCgreportItemService;
|
|
||||||
@Autowired
|
|
||||||
private OnlCgreportHeadMapper mapper;
|
|
||||||
@Autowired
|
|
||||||
private ISysBaseAPI sysBaseAPI;
|
|
||||||
|
|
||||||
private static final String ORDER_S_BY = " order\\s+by ";
|
|
||||||
private static final String SQL_SERVER_NOT_ORDER = "SqlServer不支持SQL内排序!";
|
|
||||||
private static final String COLUMN = "column";
|
|
||||||
private static final String ORDER = "order";
|
|
||||||
private static final String TOTAL = "total";
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> executeSelectSql(String sql, String onlCgreportHeadId, Map<String, Object> params) throws SQLException {
|
|
||||||
String var4 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var4 = DbTableUtil.getDatabaseType();
|
|
||||||
} catch (DBException var19) {
|
|
||||||
var19.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var5 = new LambdaQueryWrapper<>();
|
|
||||||
var5.eq(OnlCgreportParam::getCgrheadId, onlCgreportHeadId);
|
|
||||||
List<OnlCgreportParam> var6 = this.onlCgreportParamService.list(var5);
|
|
||||||
if (var6 != null && !var6.isEmpty()) {
|
|
||||||
|
|
||||||
for (OnlCgreportParam var8 : var6) {
|
|
||||||
Object var9 = params.get("self_" + var8.getParamName());
|
|
||||||
String var10 = "";
|
|
||||||
var10 = getString(var8, var9, var10);
|
|
||||||
|
|
||||||
String var11 = "${" + var8.getParamName() + "}";
|
|
||||||
if (sql.contains(var11)) {
|
|
||||||
if (var10 != null && var10.startsWith("'") && var10.endsWith("'")) {
|
|
||||||
var10 = var10.substring(1, var10.length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sql = sql.replace(var11, var10);
|
|
||||||
} else if (oConvertUtils.isNotEmpty(var10)) {
|
|
||||||
params.put("popup_param_pre__" + var8.getParamName(), var10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return getStringObjectMap(sql, onlCgreportHeadId, params, var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getString(OnlCgreportParam var8, Object var9, String var10) {
|
|
||||||
if (var9 != null) {
|
|
||||||
var10 = var9.toString();
|
|
||||||
} else if (oConvertUtils.isNotEmpty(var8.getParamValue())) {
|
|
||||||
var10 = var8.getParamValue();
|
|
||||||
}
|
|
||||||
return var10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Map<String, Object> getStringObjectMap(String sql, String onlCgreportHeadId, Map<String, Object> params, String var4) {
|
|
||||||
HashMap<String, Object> var20 = new HashMap<>();
|
|
||||||
int var21 = oConvertUtils.getInt(params.get("pageSize"), 10);
|
|
||||||
int var22 = oConvertUtils.getInt(params.get("pageNo"), 1);
|
|
||||||
Page<Map<String, Object>> var24 = new Page<>(var22, var21);
|
|
||||||
LambdaQueryWrapper<OnlCgreportItem> var23 = new LambdaQueryWrapper<>();
|
|
||||||
var23.eq(OnlCgreportItem::getCgrheadId, onlCgreportHeadId);
|
|
||||||
var23.eq(OnlCgreportItem::getIsSearch, 1);
|
|
||||||
List<OnlCgreportItem> var12 = this.onlCgreportItemService.list(var23);
|
|
||||||
String var13 = "jero_rp_temp.";
|
|
||||||
String var14 = CgReportQueryParamUtil.a(var12, params, var13, null);
|
|
||||||
if (ReUtil.contains(ORDER_S_BY, sql.toLowerCase()) && "SQLSERVER".equalsIgnoreCase(var4)) {
|
|
||||||
throw new JeroBootException(SQL_SERVER_NOT_ORDER);
|
|
||||||
} else {
|
|
||||||
String var15 = "select * from (" + sql + ") jero_rp_temp where 1=1 " + var14;
|
|
||||||
var15 = SqlUtil.b(var15);
|
|
||||||
Object var16 = params.get(COLUMN);
|
|
||||||
if (var16 != null) {
|
|
||||||
var15 = var15 + " order by jero_rp_temp." + var16.toString() + " " + params.get(ORDER).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("报表查询sql=>\r\n" + var15);
|
|
||||||
Object var17;
|
|
||||||
if (Boolean.TRUE.equals(Boolean.valueOf(String.valueOf(params.get("getAll"))))) {
|
|
||||||
List<Map<String, Object>> var18 = this.mapper.executeSelect(var15);
|
|
||||||
var17 = new Page<>();
|
|
||||||
((IPage)var17).setRecords(var18);
|
|
||||||
((IPage)var17).setTotal(var18.size());
|
|
||||||
} else {
|
|
||||||
var17 = this.mapper.selectPageBySql(var24, var15);
|
|
||||||
}
|
|
||||||
|
|
||||||
var20.put(TOTAL, ((IPage)var17).getTotal());
|
|
||||||
var20.put("records", CgformUtil.d(((IPage)var17).getRecords()));
|
|
||||||
return var20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> executeSelectSqlDynamic(String dbKey, String sql, Map<String, Object> params, String onlCgreportHeadId) {
|
|
||||||
DynamicDataSourceModel var5 = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
|
|
||||||
int var8 = oConvertUtils.getInt(params.get("pageNo"), 1);
|
|
||||||
int var9 = oConvertUtils.getInt(params.get("pageSize"), 10);
|
|
||||||
log.info("【Online多数据源逻辑】报表查询参数params: " + JSON.toJSONString(params));
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var10 = new LambdaQueryWrapper<>();
|
|
||||||
var10.eq(OnlCgreportParam::getCgrheadId, onlCgreportHeadId);
|
|
||||||
List<OnlCgreportParam> var11 = this.onlCgreportParamService.list(var10);
|
|
||||||
OnlCgreportParam var13;
|
|
||||||
String var15;
|
|
||||||
if (var11 != null && !var11.isEmpty()) {
|
|
||||||
for(Iterator<OnlCgreportParam> var12 = var11.iterator(); var12.hasNext(); sql = sql.replace("${" + var13.getParamName() + "}", var15)) {
|
|
||||||
var13 = var12.next();
|
|
||||||
Object var14 = params.get("self_" + var13.getParamName());
|
|
||||||
var15 = "";
|
|
||||||
if (var14 != null) {
|
|
||||||
var15 = var14.toString();
|
|
||||||
} else if (oConvertUtils.isNotEmpty(var13.getParamValue())) {
|
|
||||||
var15 = var13.getParamValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LambdaQueryWrapper<OnlCgreportItem> var24 = new LambdaQueryWrapper<>();
|
|
||||||
var24.eq(OnlCgreportItem::getCgrheadId, onlCgreportHeadId);
|
|
||||||
var24.eq(OnlCgreportItem::getIsSearch, 1);
|
|
||||||
List<OnlCgreportItem> var25 = this.onlCgreportItemService.list(var24);
|
|
||||||
if (ReUtil.contains(ORDER_S_BY, sql.toLowerCase()) && "3".equalsIgnoreCase(var5.getDbType())) {
|
|
||||||
throw new JeroBootException(SQL_SERVER_NOT_ORDER);
|
|
||||||
} else {
|
|
||||||
String var26 = "jero_rp_temp.";
|
|
||||||
var15 = DataBaseEnum.getDataBaseNameByValue(var5.getDbType());
|
|
||||||
String var16 = CgReportQueryParamUtil.a(var25, params, var26, var15);
|
|
||||||
String var17 = "select * from (" + sql + ") jero_rp_temp where 1=1 " + var16;
|
|
||||||
var17 = SqlUtil.b(var17);
|
|
||||||
String var18 = SqlUtils.getCountSql(var17);
|
|
||||||
Object var19 = params.get(COLUMN);
|
|
||||||
if (var19 != null) {
|
|
||||||
var17 = var17 + " order by jero_rp_temp." + var19.toString() + " " + params.get(ORDER).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
String var20 = var17;
|
|
||||||
if (Boolean.FALSE.equals(Boolean.valueOf(String.valueOf(params.get("getAll"))))) {
|
|
||||||
var20 = SqlUtils.createPageSqlByDBType(var5.getDbType(), var17, var8, var9);
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("多数据源 报表查询sql=>querySql: " + var17);
|
|
||||||
log.info("多数据源 报表查询sql=>pageSQL: " + var20);
|
|
||||||
log.info("多数据源 报表查询sql=>countSql: " + var18);
|
|
||||||
HashMap<String, Object> var21 = new HashMap<>();
|
|
||||||
Map<String, Object> var22 = (Map)DynamicDBUtil.findOne(dbKey, var18);
|
|
||||||
var21.put(TOTAL, var22.get(TOTAL));
|
|
||||||
List<Map<String, Object>> var23 = DynamicDBUtil.findList(dbKey, var20);
|
|
||||||
var21.put("records", CgformUtil.d(var23));
|
|
||||||
return var21;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(
|
|
||||||
rollbackFor = {Exception.class}
|
|
||||||
)
|
|
||||||
public Result<String> editAll(OnlCgreportModel values) {
|
|
||||||
OnlCgreportHead var2 = values.getHead();
|
|
||||||
OnlCgreportHead var3 = super.getById(var2.getId());
|
|
||||||
if (var3 == null) {
|
|
||||||
return Result.error("未找到对应实体");
|
|
||||||
} else {
|
|
||||||
super.updateById(var2);
|
|
||||||
LambdaQueryWrapper<OnlCgreportItem> var4 = new LambdaQueryWrapper<>();
|
|
||||||
var4.eq(OnlCgreportItem::getCgrheadId, var2.getId());
|
|
||||||
this.onlCgreportItemService.remove(var4);
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var5 = new LambdaQueryWrapper<>();
|
|
||||||
var5.eq(OnlCgreportParam::getCgrheadId, var2.getId());
|
|
||||||
this.onlCgreportParamService.remove(var5);
|
|
||||||
Iterator<OnlCgreportParam> var6 = values.getParams().iterator();
|
|
||||||
Iterator<OnlCgreportItem> var9 = values.getItems().iterator();
|
|
||||||
while(var6.hasNext()) {
|
|
||||||
OnlCgreportParam var7 = var6.next();
|
|
||||||
var7.setCgrheadId(var2.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
while(var9.hasNext()) {
|
|
||||||
OnlCgreportItem var8 = var9.next();
|
|
||||||
var8.setFieldName(var8.getFieldName().trim().toLowerCase());
|
|
||||||
var8.setCgrheadId(var2.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.onlCgreportItemService.saveBatch(values.getItems());
|
|
||||||
this.onlCgreportParamService.saveBatch(values.getParams());
|
|
||||||
return Result.OK("全部修改成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(
|
|
||||||
rollbackFor = {Exception.class}
|
|
||||||
)
|
|
||||||
public Result<String> delete(String id) {
|
|
||||||
boolean var2 = super.removeById(id);
|
|
||||||
if (var2) {
|
|
||||||
LambdaQueryWrapper<OnlCgreportItem> var3 = new LambdaQueryWrapper<>();
|
|
||||||
var3.eq(OnlCgreportItem::getCgrheadId, id);
|
|
||||||
this.onlCgreportItemService.remove(var3);
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var4 = new LambdaQueryWrapper<>();
|
|
||||||
var4.eq(OnlCgreportParam::getCgrheadId, id);
|
|
||||||
this.onlCgreportParamService.remove(var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(
|
|
||||||
rollbackFor = {Exception.class}
|
|
||||||
)
|
|
||||||
public Result<String> bathDelete(String[] ids) {
|
|
||||||
String[] var2 = ids;
|
|
||||||
int var3 = ids.length;
|
|
||||||
|
|
||||||
for(int var4 = 0; var4 < var3; ++var4) {
|
|
||||||
String var5 = var2[var4];
|
|
||||||
boolean var6 = super.removeById(var5);
|
|
||||||
if (var6) {
|
|
||||||
LambdaQueryWrapper<OnlCgreportItem> var7 = new LambdaQueryWrapper<>();
|
|
||||||
var7.eq(OnlCgreportItem::getCgrheadId, var5);
|
|
||||||
this.onlCgreportItemService.remove(var7);
|
|
||||||
LambdaQueryWrapper<OnlCgreportParam> var8 = new LambdaQueryWrapper<>();
|
|
||||||
var8.eq(OnlCgreportParam::getCgrheadId, var5);
|
|
||||||
this.onlCgreportParamService.remove(var8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.OK("删除成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getSqlFields(String sql, String dbKey) throws SQLException {
|
|
||||||
List<String> var3;
|
|
||||||
if (StringUtils.isNotBlank(dbKey)) {
|
|
||||||
var3 = this.a(sql, dbKey);
|
|
||||||
} else {
|
|
||||||
var3 = this.a(sql, (String)null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getSqlParams(String sql) {
|
|
||||||
if (oConvertUtils.isEmpty(sql)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
} else {
|
|
||||||
ArrayList<String> var2 = new ArrayList<>();
|
|
||||||
String var3 = "\\$\\{\\w+\\}";
|
|
||||||
Pattern var4 = Pattern.compile(var3);
|
|
||||||
Matcher var5 = var4.matcher(sql);
|
|
||||||
|
|
||||||
while(var5.find()) {
|
|
||||||
String var6 = var5.group();
|
|
||||||
var2.add(var6.substring(var6.indexOf("{") + 1, var6.indexOf("}")));
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> a(String var1, String var2) throws SQLException {
|
|
||||||
if (oConvertUtils.isEmpty(var1)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
} else {
|
|
||||||
return getStrings(var1, var2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private List<String> getStrings(String var1, String var2) throws SQLException {
|
|
||||||
var1 = var1.trim();
|
|
||||||
if (var1.endsWith(";")) {
|
|
||||||
var1 = var1.substring(0, var1.length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
var1 = QueryGenerator.convertSystemVariables(var1);
|
|
||||||
var1 = SqlUtil.a(var1);
|
|
||||||
Set<String> var3;
|
|
||||||
if (StringUtils.isNotBlank(var2)) {
|
|
||||||
log.info("parse sql : " + var1);
|
|
||||||
DynamicDataSourceModel var4 = DataSourceCachePool.getCacheDynamicDataSourceModel(var2);
|
|
||||||
var1 = getString(var1, var4);
|
|
||||||
|
|
||||||
log.info("parse sql with page : " + var1);
|
|
||||||
Map<String, Object> var5 = (Map) DynamicDBUtil.findOne(var2, var1);
|
|
||||||
if (var5 == null) {
|
|
||||||
throw new JeroBootException("该报表sql没有数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
var3 = var5.keySet();
|
|
||||||
} else {
|
|
||||||
log.info("parse sql: " + var1);
|
|
||||||
String var8 = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var8 = DbTableUtil.getDatabaseType();
|
|
||||||
} catch (DBException var7) {
|
|
||||||
var7.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ReUtil.contains(ORDER_S_BY, var1.toLowerCase()) && "SQLSERVER".equalsIgnoreCase(var8)) {
|
|
||||||
throw new JeroBootException(SQL_SERVER_NOT_ORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPage<Map<String, Object>> var9 = this.mapper.selectPageBySql(new Page<>(1L, 1L), var1);
|
|
||||||
List<Map<String, Object>> var6 = var9.getRecords();
|
|
||||||
if (var6.isEmpty()) {
|
|
||||||
throw new JeroBootException("该报表sql没有数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
var3 = ((Map)var6.get(0)).keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var3 != null) {
|
|
||||||
var3.remove("ROW_ID");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ArrayList<>(var3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private String getString(String var1, DynamicDataSourceModel var4) {
|
|
||||||
if (ReUtil.contains(ORDER_S_BY, var1.toLowerCase()) && "3".equalsIgnoreCase(var4.getDbType())) {
|
|
||||||
throw new JeroBootException(SQL_SERVER_NOT_ORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("1".equals(var4.getDbType())) {
|
|
||||||
var1 = "SELECT * FROM (" + var1 + ") temp LIMIT 1";
|
|
||||||
} else if ("2".equals(var4.getDbType())) {
|
|
||||||
var1 = "SELECT * FROM (" + var1 + ") temp WHERE ROWNUM <= 1";
|
|
||||||
} else if ("3".equals(var4.getDbType())) {
|
|
||||||
var1 = "SELECT TOP 1 * FROM (" + var1 + ") temp";
|
|
||||||
}
|
|
||||||
return var1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> queryCgReportConfig(String reportId) {
|
|
||||||
HashMap<String,Object> var2 = new HashMap<>(0);
|
|
||||||
Map<String, Object> var3 = this.mapper.queryCgReportMainConfig(reportId);
|
|
||||||
List<Map<String, Object>> var4 = this.mapper.queryCgReportItems(reportId);
|
|
||||||
List<OnlCgreportParam> var5 = this.mapper.queryCgReportParams(reportId);
|
|
||||||
if (DbTableUtil.a()) {
|
|
||||||
var2.put("main", CgformUtil.b(var3));
|
|
||||||
var2.put("items", CgformUtil.d(var4));
|
|
||||||
} else {
|
|
||||||
var2.put("main", var3);
|
|
||||||
var2.put("items", var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
var2.put("params", var5);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
|
|
||||||
package com.jero.generater.modules.online.cgreport.util;
|
|
||||||
|
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class SqlUtil {
|
|
||||||
|
|
||||||
public static final String A_SQL = "select * from ( {0}) sel_tab00 limit {1},{2}";
|
|
||||||
public static final String B_SQL = "select * from ( {0}) sel_tab00 limit {2} offset {1}";
|
|
||||||
public static final String C_SQL = "select * from (select row_.*,rownum rownum_ from ({0}) row_ where rownum <= {1}) where rownum_>{2}";
|
|
||||||
public static final String D_SQL = "select * from ( select row_number() over(order by tempColumn) tempRowNumber, * from (select top {1} tempColumn = 0, {0}) t ) tt where tempRowNumber > {2}";
|
|
||||||
public static final String E_SQL = "select distinct table_name from information_schema.columns where table_schema = {0}";
|
|
||||||
public static final String F_SQL = "SELECT distinct c.relname AS table_name FROM pg_class c";
|
|
||||||
public static final String G_SQL = "select distinct colstable.table_name as table_name from user_tab_cols colstable";
|
|
||||||
public static final String H_SQL = "select distinct c.name as table_name from sys.objects c";
|
|
||||||
public static final String I_SQL = "select column_name from information_schema.columns where table_name = {0} and table_schema = {1}";
|
|
||||||
public static final String J_SQL = "select table_name from information_schema.columns where table_name = {0}";
|
|
||||||
public static final String K_SQL = "select column_name from all_tab_columns where table_name ={0}";
|
|
||||||
public static final String L_SQL = "select name from syscolumns where id={0}";
|
|
||||||
|
|
||||||
public static final String MYSQL = "MYSQL";
|
|
||||||
public static final String POST_GRE_SQL = "POSTGRESQL";
|
|
||||||
public static final String ORACLE = "ORACLE";
|
|
||||||
public static final String SQL_SERVER = "SQLSERVER";
|
|
||||||
|
|
||||||
private SqlUtil() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String a(String var0, Map<String, Object> var1) {
|
|
||||||
StringBuilder var2 = new StringBuilder();
|
|
||||||
var2.append("SELECT t.* FROM ( ");
|
|
||||||
var2.append(var0).append(" ");
|
|
||||||
var2.append(") t ");
|
|
||||||
if (var1 != null && var1.size() >= 1) {
|
|
||||||
var2.append("WHERE 1=1 ");
|
|
||||||
|
|
||||||
for (String s : var1.keySet()) {
|
|
||||||
String var4 = String.valueOf(s);
|
|
||||||
String var5 = String.valueOf(var1.get(var4));
|
|
||||||
if (oConvertUtils.isNotEmpty(var5)) {
|
|
||||||
var2.append(" AND ");
|
|
||||||
var2.append(" ").append(var4).append(var5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String b(String var0, Map<String,Object> var1) {
|
|
||||||
String var2 = a(var0, var1);
|
|
||||||
var2 = "SELECT COUNT(*) COUNT FROM (" + var2 + ") t2";
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String a(String var0, String var1, String var2, Map<String, Object> var3, int var4, int var5) {
|
|
||||||
var2 = a(var2, var3);
|
|
||||||
int var6 = (var4 - 1) * var5;
|
|
||||||
String[] var7 = new String[]{var2, var6 + "", var5 + ""};
|
|
||||||
String var8 = "";
|
|
||||||
if (MYSQL.equalsIgnoreCase(var8)) {
|
|
||||||
var2 = MessageFormat.format(A_SQL, var7);
|
|
||||||
} else if (POST_GRE_SQL.equalsIgnoreCase(var8)) {
|
|
||||||
var2 = MessageFormat.format(B_SQL, var7);
|
|
||||||
} else {
|
|
||||||
int var9 = (var4 - 1) * var5;
|
|
||||||
int var10 = var9 + var5;
|
|
||||||
var7[2] = Integer.toString(var9);
|
|
||||||
var7[1] = Integer.toString(var10);
|
|
||||||
if (ORACLE.equalsIgnoreCase(var8)) {
|
|
||||||
var2 = MessageFormat.format(C_SQL, var7);
|
|
||||||
} else if (SQL_SERVER.equalsIgnoreCase(var8)) {
|
|
||||||
var7[0] = var2.substring(c(var2));
|
|
||||||
var2 = MessageFormat.format(D_SQL, var7);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info(var0 + var1);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int c(String var0) {
|
|
||||||
int var1 = var0.toLowerCase().indexOf("select");
|
|
||||||
int var2 = var0.toLowerCase().indexOf("select distinct");
|
|
||||||
return var1 + (var2 == var1 ? 15 : 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String a(String var0, String... var1) {
|
|
||||||
if (oConvertUtils.isNotEmpty(var0)) {
|
|
||||||
if (MYSQL.equals(var0)) {
|
|
||||||
return MessageFormat.format(E_SQL, var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ORACLE.equals(var0)) {
|
|
||||||
return G_SQL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (POST_GRE_SQL.equals(var0)) {
|
|
||||||
return F_SQL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SQL_SERVER.equals(var0)) {
|
|
||||||
return H_SQL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String b(String var0, String... var1) {
|
|
||||||
if (oConvertUtils.isNotEmpty(var0)) {
|
|
||||||
if (MYSQL.equals(var0)) {
|
|
||||||
return MessageFormat.format(I_SQL, var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ORACLE.equals(var0)) {
|
|
||||||
return MessageFormat.format(K_SQL, var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (POST_GRE_SQL.equals(var0)) {
|
|
||||||
return MessageFormat.format(J_SQL, var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SQL_SERVER.equals(var0)) {
|
|
||||||
return MessageFormat.format(L_SQL, var1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String a(String var0) {
|
|
||||||
var0 = var0.toLowerCase();
|
|
||||||
String var1 = "[\\w.]*+ *\\S+ *\\S*\\$\\{\\w+}\\S*";
|
|
||||||
Pattern var2 = Pattern.compile(var1);
|
|
||||||
|
|
||||||
for(Matcher var3 = var2.matcher(var0); var3.find();) {
|
|
||||||
String var4 = var3.group();
|
|
||||||
log.info("${}匹配带参SQL片段 ==>" + var4);
|
|
||||||
if (var4.contains("where")) {
|
|
||||||
var0 = var0.replace(var4, "where 1=1");
|
|
||||||
} else if (var4.contains("and")) {
|
|
||||||
var0 = var0.replace(var4, "and 1=1");
|
|
||||||
} else if (var4.contains("or")) {
|
|
||||||
var0 = var0.replace(var4, "or 1=1");
|
|
||||||
} else {
|
|
||||||
var0 = var0.replace(var4, "1=1");
|
|
||||||
}
|
|
||||||
log.info("${}替换后结果 ==>" + var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var0 = var0.replaceAll("(?i)AND *1=1", "");
|
|
||||||
return var0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String var1 = "select * from sys_user where id ='${id}' and del_flag= ${flag}";
|
|
||||||
log.info(a(var1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, Object> a(HttpServletRequest var0) {
|
|
||||||
Map<String, String[]> var1 = var0.getParameterMap();
|
|
||||||
HashMap<String, Object> var2 = new HashMap<>();
|
|
||||||
|
|
||||||
for(Map.Entry<String, String[]> entry: var1.entrySet()) {
|
|
||||||
String var5 = entry.getKey();
|
|
||||||
String[] var7 = entry.getValue();
|
|
||||||
String var6 = "";
|
|
||||||
if (!"_t".equals(var5) && null != var7) {
|
|
||||||
if (!(var7 instanceof String[])) {
|
|
||||||
var6 = Arrays.toString(var7);
|
|
||||||
} else {
|
|
||||||
String[] var8 = var7;
|
|
||||||
for(int var9 = 0; var9 < var8.length; ++var9) {
|
|
||||||
var6 = var8[var9] + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
var6 = var6.substring(0, var6.length() - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var6 = "";
|
|
||||||
}
|
|
||||||
var2.put(var5, var6);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String b(String var0) {
|
|
||||||
String var1 = QueryGenerator.convertSystemVariables(var0);
|
|
||||||
String var2 = QueryGenerator.getAllConfigAuth();
|
|
||||||
return var0.toLowerCase().contains("where") ? var1 + var2 : var1 + " where 1=1 " + var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -523,30 +523,6 @@ public class SystemAPIController {
|
|||||||
return sysBaseAPI.loadCategoryDictItem(ids);
|
return sysBaseAPI.loadCategoryDictItem(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code加载字典text
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param keys 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadDictItem")
|
|
||||||
public List<String> loadDictItem(@RequestParam("dictCode") String dictCode, @RequestParam("keys") String keys) {
|
|
||||||
return sysBaseAPI.loadDictItem(dictCode, keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code查询字典项
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param dictCode 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/getDictItems")
|
|
||||||
public List<DictModel> getDictItems(@RequestParam("dictCode") String dictCode) {
|
|
||||||
return sysBaseAPI.getDictItems(dictCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据多个字典code查询多个字典项
|
* 根据多个字典code查询多个字典项
|
||||||
*
|
*
|
||||||
@@ -558,19 +534,6 @@ public class SystemAPIController {
|
|||||||
return sysBaseAPI.getManyDictItems(dictCodeList);
|
return sysBaseAPI.getManyDictItems(dictCodeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 【下拉搜索】
|
|
||||||
* 大数据量的字典表 走异步加载,即前端输入内容过滤数据
|
|
||||||
*
|
|
||||||
* @param dictCode 字典code格式:table,text,code
|
|
||||||
* @param keyword 过滤关键字
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadDictItemByKeyword")
|
|
||||||
public List<DictModel> loadDictItemByKeyword(@RequestParam("dictCode") String dictCode, @RequestParam("keyword") String keyword, @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
||||||
return sysBaseAPI.loadDictItemByKeyword(dictCode, keyword, pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 48 普通字典的翻译,根据多个dictCode和多条数据,多个以逗号分割
|
* 48 普通字典的翻译,根据多个dictCode和多条数据,多个以逗号分割
|
||||||
* @param dictCodes
|
* @param dictCodes
|
||||||
@@ -595,35 +558,6 @@ public class SystemAPIController {
|
|||||||
return sysBaseAPI.queryTableDictItemsByCode(table, text, code);
|
return sysBaseAPI.queryTableDictItemsByCode(table, text, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询表字典 支持过滤数据 【接口签名验证】
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param filterSql
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/queryFilterTableDictInfo")
|
|
||||||
List<DictModel> queryFilterTableDictInfo(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("filterSql") String filterSql){
|
|
||||||
return sysBaseAPI.queryFilterTableDictInfo(table, text, code, filterSql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【接口签名验证】
|
|
||||||
* 查询指定table的 text code 获取字典,包含text和value
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keyArray
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@GetMapping("/queryTableDictByKeys")
|
|
||||||
public List<String> queryTableDictByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keyArray") String[] keyArray){
|
|
||||||
return sysBaseAPI.queryTableDictByKeys(table, text, code, keyArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表的 翻译【接口签名验证】
|
* 字典表的 翻译【接口签名验证】
|
||||||
@@ -638,20 +572,4 @@ public class SystemAPIController {
|
|||||||
return sysBaseAPI.translateDictFromTable(table, text, code, key);
|
return sysBaseAPI.translateDictFromTable(table, text, code, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【接口签名验证】
|
|
||||||
* 49 字典表的 翻译,可批量
|
|
||||||
*
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keys 多个用逗号分割
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/translateDictFromTableByKeys")
|
|
||||||
public List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys) {
|
|
||||||
return this.sysBaseAPI.translateDictFromTableByKeys(table, text, code, keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,177 +187,6 @@ public class SysDictController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取字典数据 【接口签名验证】
|
|
||||||
* @param dictCode 字典code
|
|
||||||
* @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/getDictItems/{dictCode}")
|
|
||||||
public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) {
|
|
||||||
log.info(" dictCode : "+ dictCode);
|
|
||||||
Result<List<DictModel>> result = new Result<>();
|
|
||||||
try {
|
|
||||||
List<DictModel> ls = sysDictService.getDictItems(dictCode);
|
|
||||||
if (ls == null) {
|
|
||||||
return Result.error(DICT_CODE_ERROE);
|
|
||||||
}
|
|
||||||
result.setSuccess(true);
|
|
||||||
result.setResult(ls);
|
|
||||||
log.debug(result.toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
return Result.error(ResultCommon.ERROR);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【接口签名验证】
|
|
||||||
* 【JSearchSelectTag下拉搜索组件专用接口】
|
|
||||||
* 大数据量的字典表 走异步加载 即前端输入内容过滤数据
|
|
||||||
* @param dictCode 字典code格式:table,text,code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadDict/{dictCode}")
|
|
||||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,
|
|
||||||
@RequestParam(name="keyword",required = false) String keyword,
|
|
||||||
@RequestParam(value = "sign",required = false) String sign,
|
|
||||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
||||||
log.info(" 加载字典表数据,加载关键字: "+ keyword);
|
|
||||||
Result<List<DictModel>> result = new Result<>();
|
|
||||||
try {
|
|
||||||
List<DictModel> ls = sysDictService.loadDict(dictCode, keyword, pageSize);
|
|
||||||
if (ls == null) {
|
|
||||||
return Result.error(DICT_CODE_ERROE);
|
|
||||||
}
|
|
||||||
result.setSuccess(true);
|
|
||||||
result.setResult(ls);
|
|
||||||
log.info(result.toString());
|
|
||||||
return result;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return Result.error(ResultCommon.ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【给表单设计器的表字典使用】下拉搜索模式,有值时动态拼接数据
|
|
||||||
* @param dictCode
|
|
||||||
* @param keyword 当前控件的值,可以逗号分割
|
|
||||||
* @param sign
|
|
||||||
* @param pageSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadDictOrderByValue/{dictCode}")
|
|
||||||
public Result<List<DictModel>> loadDictOrderByValue(
|
|
||||||
@PathVariable String dictCode,
|
|
||||||
@RequestParam(name = "keyword",required = false) String keyword,
|
|
||||||
@RequestParam(value = "sign", required = false) String sign,
|
|
||||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
||||||
// 首次查询查出来用户选中的值,并且不分页
|
|
||||||
Result<List<DictModel>> firstRes = this.loadDict(dictCode, keyword, sign, null);
|
|
||||||
if (!firstRes.isSuccess()) {
|
|
||||||
return firstRes;
|
|
||||||
}
|
|
||||||
// 然后再查询出第一页的数据
|
|
||||||
Result<List<DictModel>> result = this.loadDict(dictCode, "", sign, pageSize);
|
|
||||||
if (!result.isSuccess()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// 合并两次查询的数据
|
|
||||||
List<DictModel> firstList = firstRes.getResult();
|
|
||||||
List<DictModel> list = result.getResult();
|
|
||||||
for (DictModel firstItem : firstList) {
|
|
||||||
// anyMatch 表示:判断的条件里,任意一个元素匹配成功,返回true
|
|
||||||
// allMatch 表示:判断条件里的元素,所有的都匹配成功,返回true
|
|
||||||
// noneMatch 跟 allMatch 相反,表示:判断条件里的元素,所有的都匹配失败,返回true
|
|
||||||
boolean none = list.stream().noneMatch(item -> item.getValue().equals(firstItem.getValue()));
|
|
||||||
// 当元素不存在时,再添加到集合里
|
|
||||||
if (none) {
|
|
||||||
list.add(0, firstItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*【接口签名验证】
|
|
||||||
* 根据字典code加载字典text 返回
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param keys 要查询的key
|
|
||||||
* @param sign
|
|
||||||
* @param delNotExist 是否移除不存在的项,默认为true,设为false如果某个key不存在数据库中,则直接返回key本身
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadDictItem/{dictCode}")
|
|
||||||
public Result<List<String>> loadDictItem(@PathVariable String dictCode, @RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign, @RequestParam(value = "delNotExist",required = false,defaultValue = "true") boolean delNotExist, HttpServletRequest request) {
|
|
||||||
Result<List<String>> result = new Result<>();
|
|
||||||
try {
|
|
||||||
if(dictCode.indexOf(",")!=-1) {
|
|
||||||
String[] params = dictCode.split(",");
|
|
||||||
if(params.length!=3) {
|
|
||||||
return Result.error(DICT_CODE_ERROE);
|
|
||||||
}
|
|
||||||
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, delNotExist);
|
|
||||||
|
|
||||||
result.setSuccess(true);
|
|
||||||
result.setResult(texts);
|
|
||||||
log.info(result.toString());
|
|
||||||
}else {
|
|
||||||
return Result.error(DICT_CODE_ERROE);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return Result.error(ResultCommon.ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【接口签名验证】
|
|
||||||
* 根据表名——显示字段-存储字段 pid 加载树形数据
|
|
||||||
*/
|
|
||||||
@GetMapping("/loadTreeData")
|
|
||||||
public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField,
|
|
||||||
@RequestParam(name="tableName") String tbname,
|
|
||||||
@RequestParam(name="text") String text,
|
|
||||||
@RequestParam(name="code") String code,
|
|
||||||
@RequestParam(name="hasChildField", required = false) String hasChildField,
|
|
||||||
@RequestParam(value = "sign", required = false) String sign, HttpServletRequest request) {
|
|
||||||
Result<List<TreeSelectModel>> result = new Result<>();
|
|
||||||
|
|
||||||
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
|
|
||||||
String dictCode = tbname +","+ text +","+ code;
|
|
||||||
SqlInjectionUtil.filterContent(dictCode);
|
|
||||||
List<TreeSelectModel> ls = sysDictService.queryTreeList(null, tbname, text, code, pidField, pid, hasChildField);
|
|
||||||
result.setSuccess(true);
|
|
||||||
result.setResult(ls);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询后返回树型数据
|
|
||||||
*/
|
|
||||||
@GetMapping("/queryAllTreeData")
|
|
||||||
public Result<List<TreeSelectModel>> queryAllTreeData(@RequestParam(name="pidField") String pidField,
|
|
||||||
@RequestParam(name="tableName") String tbname,
|
|
||||||
@RequestParam(name="text") String text,
|
|
||||||
@RequestParam(name="code") String code,
|
|
||||||
HttpServletRequest request) {
|
|
||||||
Result<List<TreeSelectModel>> result = new Result<>();
|
|
||||||
|
|
||||||
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
|
|
||||||
String dictCode = tbname +","+ text +","+ code;
|
|
||||||
SqlInjectionUtil.filterContent(dictCode);
|
|
||||||
List<TreeSelectModel> ls = sysDictService.queryAllTreeData(tbname, text, code, pidField);
|
|
||||||
result.setSuccess(true);
|
|
||||||
result.setResult(ls);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @功能:新增
|
* @功能:新增
|
||||||
* @param sysDict
|
* @param sysDict
|
||||||
|
|||||||
@@ -26,20 +26,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface SysDictMapper extends BaseMapper<SysDict> {
|
public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 重复检查SQL
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Long duplicateCheckCountSql(DuplicateCheckVo duplicateCheckVo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Long duplicateCheckCountSqlNoDataId(DuplicateCheckVo duplicateCheckVo);
|
|
||||||
|
|
||||||
public List<DictModel> queryDictItemsByCode(@Param("code") String code);
|
public List<DictModel> queryDictItemsByCode(@Param("code") String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,16 +43,7 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<DictModelMany> queryDictItemsByCodeList(@Param("dictCodeList") List<String> dictCodeList);
|
public List<DictModelMany> queryDictItemsByCodeList(@Param("dictCodeList") List<String> dictCodeList);
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictItemsByCode(@Param("table") String table,@Param("text") String text,@Param("code") String code);
|
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictItemsByCodeAndFilter(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("filterSql") String filterSql);
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 不推荐
|
* @deprecated 不推荐
|
||||||
*/
|
*/
|
||||||
@@ -83,29 +60,6 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DictModelMany> queryManyDictByKeys(@Param("dictCodeList") List<String> dictCodeList, @Param("keys") List<String> keys);
|
List<DictModelMany> queryManyDictByKeys(@Param("dictCodeList") List<String> dictCodeList, @Param("keys") List<String> keys);
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public String queryTableDictTextByKey(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("key") String key);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过查询指定table的 text code key 获取字典值,可批量查询
|
|
||||||
*
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keys
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<DictModel> queryTableDictTextByKeys(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keys") List<String> keys);
|
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictByKeys(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyArray") String[] keyArray);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有部门 作为字典信息 id -->value,departName -->text
|
* 查询所有部门 作为字典信息 id -->value,departName -->text
|
||||||
@@ -119,62 +73,6 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||||||
*/
|
*/
|
||||||
public List<DictModel> queryAllUserBackDictModel();
|
public List<DictModel> queryAllUserBackDictModel();
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过关键字查询出字典表
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keyword
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过关键字查询出字典表
|
|
||||||
* @param page
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keyword
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<DictModel> queryTableDictItems(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyword") String keyword);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据表名、显示字段名、存储字段名 查询树
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param pid
|
|
||||||
* @param hasChildField
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<TreeSelectModel> queryTreeList(@Param("query") Map<String, String> query,@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("pidField") String pidField,@Param("pid") String pid,@Param("hasChildField") String hasChildField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据表名、显示字段名、存储字段名拼接树结构
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TreeSelectModel> queryTreeDataByKeyword(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("pidField") String pidField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据表名、显示字段名、存储字段名、自身ID查询
|
|
||||||
* @param id
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TreeSelectModel queryTreeDataItemById(@Param("id") String id,@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("pidField") String pidField);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
* @param id
|
* @param id
|
||||||
@@ -197,42 +95,5 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||||||
@Update("update sys_dict set del_flag = #{flag,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR}")
|
@Update("update sys_dict set del_flag = #{flag,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR}")
|
||||||
public void updateDictDelFlag(@Param("flag") int delFlag, @Param("id") String id);
|
public void updateDictDelFlag(@Param("flag") int delFlag, @Param("id") String id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询字典表数据
|
|
||||||
* @param page
|
|
||||||
* @param query
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Page<DictModel> queryDictTablePageList(Page<DictModel> page, @Param("query") DictQuery query);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询 字典表数据 支持查询条件 分页
|
|
||||||
* @param page
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param filterSql
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
IPage<DictModel> queryTableDictWithFilter(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询 字典表数据 支持查询条件 查询所有
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param filterSql
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<DictModel> queryAllTableDictItems(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
|
|
||||||
|
|
||||||
Integer checkUsed(@Param("dictCode") String dictCode);
|
Integer checkUsed(@Param("dictCode") String dictCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,57 +62,6 @@
|
|||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--通过查询指定table的 text code 获取字典-->
|
|
||||||
<select id="queryTableDictItemsByCode" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text",${code} as "value" from ${table}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code 获取字典(指定查询条件)-->
|
|
||||||
<select id="queryTableDictItemsByCodeAndFilter" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text",${code} as "value" from ${table}
|
|
||||||
<if test="filterSql != null and filterSql != ''">
|
|
||||||
where ${filterSql}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code key 获取字典值-->
|
|
||||||
<select id="queryTableDictTextByKey" parameterType="String" resultType="String">
|
|
||||||
select ${text} as "text" from ${table} where ${code}= #{key}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code key 获取字典值,可批量查询-->
|
|
||||||
<select id="queryTableDictTextByKeys" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
|
|
||||||
<foreach item="key" collection="keys" separator=",">
|
|
||||||
#{key}
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code key 获取字典值,包含value-->
|
|
||||||
<select id="queryTableDictByKeys" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text", ${code} as "value" from ${table} where ${code} in
|
|
||||||
<foreach item="key" collection="keyArray" open="(" separator="," close=")">
|
|
||||||
#{key}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 重复校验 sql语句 -->
|
|
||||||
<select id="duplicateCheckCountSql" resultType="Long" parameterType="com.jero.modules.system.model.DuplicateCheckVo">
|
|
||||||
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal} and id <> #{dataId}
|
|
||||||
<if test="tableName == 'sys_user' or tableName == 'sys_depart'">
|
|
||||||
and del_flag = 0
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 重复校验 sql语句 -->
|
|
||||||
<select id="duplicateCheckCountSqlNoDataId" resultType="Long" parameterType="com.jero.modules.system.model.DuplicateCheckVo">
|
|
||||||
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal}
|
|
||||||
<if test="tableName == 'sys_user' or tableName == 'sys_depart'">
|
|
||||||
and del_flag = 0
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 查询部门信息 作为字典数据 -->
|
<!-- 查询部门信息 作为字典数据 -->
|
||||||
<select id="queryAllDepartBackDictModel" resultType="com.jero.common.system.vo.DictModel">
|
<select id="queryAllDepartBackDictModel" resultType="com.jero.common.system.vo.DictModel">
|
||||||
select id as "value",depart_name as "text" from sys_depart where del_flag = '0'
|
select id as "value",depart_name as "text" from sys_depart where del_flag = '0'
|
||||||
@@ -123,80 +72,6 @@
|
|||||||
select username as "value",realname as "text" from sys_user where del_flag = '0'
|
select username as "value",realname as "text" from sys_user where del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--通过查询指定table的 text code 获取字典数据,且支持关键字查询 -->
|
|
||||||
<select id="queryTableDictItems" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text",${code} as "value" from ${table} where ${text} like #{keyword}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据表名、显示字段名、存储字段名、父ID查询树 -->
|
|
||||||
<select id="queryTreeList" parameterType="Object" resultType="com.jero.modules.system.model.TreeSelectModel">
|
|
||||||
select ${text} as "title",
|
|
||||||
${code} as "key",
|
|
||||||
<if test="hasChildField != null and hasChildField != ''">
|
|
||||||
(case when ${hasChildField} = '1' then 0 else 1 end) as isLeaf,
|
|
||||||
</if>
|
|
||||||
${pidField} as parentId
|
|
||||||
from ${table}
|
|
||||||
where
|
|
||||||
<choose>
|
|
||||||
<when test="pid != null and pid != ''">
|
|
||||||
${pidField} = #{pid}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
(${pidField} = '' OR ${pidField} IS NULL)
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
<if test="query!= null">
|
|
||||||
and ${text} like concat(concat('%',#{query}),'%')
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据表名、显示字段名、存储字段名、父ID查询树 -->
|
|
||||||
<select id="queryTreeDataByKeyword" parameterType="Object" resultType="com.jero.modules.system.model.TreeSelectModel">
|
|
||||||
select ${text} as "title",
|
|
||||||
${code} as "key",
|
|
||||||
${pidField} as parentId
|
|
||||||
from ${table}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据表名、显示字段名、存储字段名、自身ID查询 -->
|
|
||||||
<select id="queryTreeDataItemById" parameterType="Object" resultType="com.jero.modules.system.model.TreeSelectModel">
|
|
||||||
select ${text} as "title",
|
|
||||||
${code} as "key",
|
|
||||||
${pidField} as parentId
|
|
||||||
from ${table}
|
|
||||||
where
|
|
||||||
id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 分页查询字典表数据 -->
|
|
||||||
<select id="queryDictTablePageList" parameterType="Object" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${query.text} as "text",${query.code} as "value" from ${query.table}
|
|
||||||
where 1 = 1
|
|
||||||
<if test="query.keyword != null and query.keyword != ''">
|
|
||||||
and (${query.text} like '%${query.keyword}%' or ${query.code} like '%${query.keyword}%')
|
|
||||||
</if>
|
|
||||||
<if test="query.codeValue != null and query.codeValue != ''">
|
|
||||||
and ${query.code} = #{query.codeValue}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 分页-->
|
|
||||||
<select id="queryTableDictWithFilter" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text", ${code} as "value" from ${table}
|
|
||||||
<if test="filterSql != null and filterSql != ''">
|
|
||||||
${filterSql}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--通过查询指定table的 text code 获取字典数据,且支持关键字和自定义查询条件查询 获取所有 -->
|
|
||||||
<select id="queryAllTableDictItems" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
|
|
||||||
select ${text} as "text", ${code} as "value" from ${table}
|
|
||||||
<if test="filterSql != null and filterSql != ''">
|
|
||||||
${filterSql}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="checkUsed" resultType="java.lang.Integer">
|
<select id="checkUsed" resultType="java.lang.Integer">
|
||||||
select count(*) from laws_tag where dict_field = #{dictCode}
|
select count(*) from laws_tag where dict_field = #{dictCode}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ public interface ISysDictService extends IService<SysDict> {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
|
List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictItemsByCodeAndFilter(String table, String text, String code, String filterSql);
|
|
||||||
|
|
||||||
public String queryDictTextByKey(String code, String key);
|
public String queryDictTextByKey(String code, String key);
|
||||||
|
|
||||||
@@ -65,27 +60,6 @@ public interface ISysDictService extends IService<SysDict> {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
String queryTableDictTextByKey(String table, String text, String code, String key);
|
String queryTableDictTextByKey(String table, String text, String code, String key);
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过查询指定table的 text code key 获取字典值,可批量查询
|
|
||||||
*
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keys
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> keys);
|
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<String> queryTableDictByKeys(String table, String text, String code, String keys);
|
|
||||||
/**
|
|
||||||
* @deprecated 不推荐
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<String> queryTableDictByKeys(String table, String text, String code, String keys,boolean delNotExist);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型删除关联表中其对应的数据
|
* 根据字典类型删除关联表中其对应的数据
|
||||||
*
|
*
|
||||||
@@ -105,69 +79,6 @@ public interface ISysDictService extends IService<SysDict> {
|
|||||||
*/
|
*/
|
||||||
public List<DictModel> queryAllDepartBackDictModel();
|
public List<DictModel> queryAllDepartBackDictModel();
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有用户 作为字典信息 username -->value,realname -->text
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<DictModel> queryAllUserBackDictModel();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过关键字查询字典表
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keyword
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryTableDictItems(String table, String text, String code,String keyword);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询字典表数据 只查询前10条
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keyword
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code, String condition, String keyword, int pageSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询字典表所有数据
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param condition
|
|
||||||
* @param keyword
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> queryAllTableDictItems(String table, String text, String code, String condition, String keyword);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据表名、显示字段名、存储字段名 查询树
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param pidField
|
|
||||||
* @param pid
|
|
||||||
* @param hasChildField
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<TreeSelectModel> queryTreeList(Map<String, String> query,String table, String text, String code, String pidField,String pid,String hasChildField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据表名、显示字段名、存储字段名 和查询条件拼接树结构
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param pidField
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<TreeSelectModel> queryAllTreeData(String table, String text, String code, String pidField);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 真实删除
|
* 真实删除
|
||||||
* @param id
|
* @param id
|
||||||
@@ -187,34 +98,6 @@ public interface ISysDictService extends IService<SysDict> {
|
|||||||
*/
|
*/
|
||||||
public List<SysDict> queryDeleteList();
|
public List<SysDict> queryDeleteList();
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
* @param query
|
|
||||||
* @param pageSize
|
|
||||||
* @param pageNo
|
|
||||||
* @deprecated 不推荐
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public List<DictModel> queryDictTablePageList(DictQuery query,int pageSize, int pageNo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取字典数据
|
|
||||||
* @param dictCode 字典code
|
|
||||||
* @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> getDictItems(String dictCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 【JSearchSelectTag下拉搜索组件专用接口】
|
|
||||||
* 大数据量的字典表 走异步加载 即前端输入内容过滤数据
|
|
||||||
*
|
|
||||||
* @param dictCode 字典code格式:table,text,code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictModel> loadDict(String dictCode, String keyword, Integer pageSize);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新dict缓存
|
* 刷新dict缓存
|
||||||
* @date 2021/4/8 9:06
|
* @date 2021/4/8 9:06
|
||||||
|
|||||||
@@ -569,12 +569,12 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DictModel> queryFilterTableDictInfo(String table, String text, String code, String filterSql) {
|
public List<DictModel> queryFilterTableDictInfo(String table, String text, String code, String filterSql) {
|
||||||
return sysDictService.queryTableDictItemsByCodeAndFilter(table,text,code,filterSql);
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) {
|
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) {
|
||||||
return sysDictService.queryTableDictByKeys(table,text,code,Joiner.on(",").join(keyArray));
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1121,35 +1121,6 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
return sysCategoryService.loadDictItem(ids, false);
|
return sysCategoryService.loadDictItem(ids, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code加载字典text
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param keys 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<String> loadDictItem(String dictCode, String keys) {
|
|
||||||
String[] params = dictCode.split(",");
|
|
||||||
return sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典code查询字典项
|
|
||||||
*
|
|
||||||
* @param dictCode 顺序:tableName,text,code
|
|
||||||
* @param dictCode 要查询的key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<DictModel> getDictItems(String dictCode) {
|
|
||||||
List<DictModel> ls = sysDictService.getDictItems(dictCode);
|
|
||||||
if (ls == null) {
|
|
||||||
ls = new ArrayList<>();
|
|
||||||
}
|
|
||||||
return ls;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据多个字典code查询多个字典项
|
* 根据多个字典code查询多个字典项
|
||||||
*
|
*
|
||||||
@@ -1161,19 +1132,6 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
return sysDictService.queryDictItemsByCodeList(dictCodeList);
|
return sysDictService.queryDictItemsByCodeList(dictCodeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 【下拉搜索】
|
|
||||||
* 大数据量的字典表 走异步加载,即前端输入内容过滤数据
|
|
||||||
*
|
|
||||||
* @param dictCode 字典code格式:table,text,code
|
|
||||||
* @param keyword 过滤关键字
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<DictModel> loadDictItemByKeyword(String dictCode, String keyword, Integer pageSize) {
|
|
||||||
return sysDictService.loadDict(dictCode, keyword, pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translateByDictMap(Map<String, String> dictMap, String keys) {
|
public String translateByDictMap(Map<String, String> dictMap, String keys) {
|
||||||
if (keys == null){
|
if (keys == null){
|
||||||
@@ -1196,17 +1154,6 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
return sysDictService.queryManyDictByKeys(dictCodeList, values);
|
return sysDictService.queryManyDictByKeys(dictCodeList, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys) {
|
|
||||||
List<DictModel> dictModels = sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(",")));
|
|
||||||
dictModels.forEach(i ->{
|
|
||||||
if (i.getText() == null){
|
|
||||||
i.setText(StringUtils.EMPTY);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return dictModels;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictItemCore> getDictItemAll() {
|
public List<SysDictItemCore> getDictItemAll() {
|
||||||
List<SysDictItem> listSysDictItem = sysDictItemService.getDictItemAll();
|
List<SysDictItem> listSysDictItem = sysDictItemService.getDictItemAll();
|
||||||
|
|||||||
@@ -144,13 +144,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||||||
//@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE)
|
//@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE)
|
||||||
public List<DictModel> queryTableDictItemsByCode(String table, String text, String code) {
|
public List<DictModel> queryTableDictItemsByCode(String table, String text, String code) {
|
||||||
log.debug("无缓存dictTableList的时候调用这里!");
|
log.debug("无缓存dictTableList的时候调用这里!");
|
||||||
return sysDictMapper.queryTableDictItemsByCode(table,text,code);
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryTableDictItemsByCodeAndFilter(String table, String text, String code, String filterSql) {
|
|
||||||
log.debug("无缓存dictTableList的时候调用这里!");
|
|
||||||
return sysDictMapper.queryTableDictItemsByCodeAndFilter(table,text,code,filterSql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,54 +160,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||||||
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE, unless = "#result == null ")
|
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE, unless = "#result == null ")
|
||||||
public String queryTableDictTextByKey(String table,String text,String code, String key) {
|
public String queryTableDictTextByKey(String table,String text,String code, String key) {
|
||||||
log.debug("无缓存dictTable的时候调用这里!");
|
log.debug("无缓存dictTable的时候调用这里!");
|
||||||
return sysDictMapper.queryTableDictTextByKey(table,text,code,key);
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> keys) {
|
|
||||||
return sysDictMapper.queryTableDictTextByKeys(table, text, code, keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys) {
|
|
||||||
return this.queryTableDictByKeys(table, text, code, keys, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过查询指定table的 text code 获取字典,包含text和value
|
|
||||||
* dictTableCache采用redis缓存有效期10分钟
|
|
||||||
* @param table
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param keys (逗号分隔)
|
|
||||||
* @param delNotExist 是否移除不存在的项,默认为true,设为false如果某个key不存在数据库中,则直接返回key本身
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
//update-begin--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
|
||||||
//@Cacheable(value = CacheConstant.SYS_DICT_TABLE_BY_KEYS_CACHE)
|
|
||||||
//update-end--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
|
||||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys, boolean delNotExist) {
|
|
||||||
if(oConvertUtils.isEmpty(keys)){
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
String[] keyArray = keys.split(",");
|
|
||||||
List<DictModel> dicts = sysDictMapper.queryTableDictByKeys(table, text, code, keyArray);
|
|
||||||
List<String> texts = new ArrayList<>(dicts.size());
|
|
||||||
|
|
||||||
// update-begin--author:sunjianlei--date:20210514--for:新增delNotExist参数,设为false不删除数据库里不存在的key ----
|
|
||||||
// 查询出来的顺序可能是乱的,需要排个序
|
|
||||||
for (String key : keyArray) {
|
|
||||||
List<DictModel> res = dicts.stream().filter(i -> key.equals(i.getValue())).collect(Collectors.toList());
|
|
||||||
if (!res.isEmpty()) {
|
|
||||||
texts.add(res.get(0).getText());
|
|
||||||
} else if (!delNotExist) {
|
|
||||||
texts.add(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// update-end--author:sunjianlei--date:20210514--for:新增delNotExist参数,设为false不删除数据库里不存在的key ----
|
|
||||||
|
|
||||||
return texts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,118 +200,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||||||
return baseMapper.queryAllDepartBackDictModel();
|
return baseMapper.queryAllDepartBackDictModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryAllUserBackDictModel() {
|
|
||||||
return baseMapper.queryAllUserBackDictModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryTableDictItems(String table, String text, String code, String keyword) {
|
|
||||||
return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code, String condition, String keyword, int pageSize) {
|
|
||||||
Page<DictModel> page = new Page<>(1, pageSize);
|
|
||||||
page.setSearchCount(false);
|
|
||||||
String filterSql = getFilterSql(text, code, condition, keyword);
|
|
||||||
IPage<DictModel> pageList = baseMapper.queryTableDictWithFilter(page, table, text, code, filterSql);
|
|
||||||
return pageList.getRecords();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取条件语句
|
|
||||||
* @param text
|
|
||||||
* @param code
|
|
||||||
* @param condition
|
|
||||||
* @param keyword
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String getFilterSql(String text, String code, String condition, String keyword){
|
|
||||||
String keywordSql = null;
|
|
||||||
String filterSql = "";
|
|
||||||
String sqlWhere = " where ";
|
|
||||||
if(oConvertUtils.isNotEmpty(keyword)){
|
|
||||||
// 判断是否是多选
|
|
||||||
if (keyword.contains(",")) {
|
|
||||||
String inKeywords = "\"" + keyword.replace(",", "\",\"") + "\"";
|
|
||||||
keywordSql = "(" + text + " in (" + inKeywords + ") or " + code + " in (" + inKeywords + "))";
|
|
||||||
} else {
|
|
||||||
keywordSql = "("+text + " like '%"+keyword+"%' or "+ code + " like '%"+keyword+"%')";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(oConvertUtils.isNotEmpty(condition) && oConvertUtils.isNotEmpty(keywordSql)){
|
|
||||||
filterSql+= sqlWhere + condition + " and " + keywordSql;
|
|
||||||
}else if(oConvertUtils.isNotEmpty(condition)){
|
|
||||||
filterSql+= sqlWhere + condition;
|
|
||||||
}else if(oConvertUtils.isNotEmpty(keywordSql)){
|
|
||||||
filterSql+= sqlWhere + keywordSql;
|
|
||||||
}
|
|
||||||
return filterSql;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryAllTableDictItems(String table, String text, String code, String condition, String keyword) {
|
|
||||||
String filterSql = getFilterSql(text, code, condition, keyword);
|
|
||||||
return baseMapper.queryAllTableDictItems(table, text, code, filterSql);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TreeSelectModel> queryTreeList(Map<String, String> query,String table, String text, String code, String pidField,String pid,String hasChildField) {
|
|
||||||
return baseMapper.queryTreeList(query,table, text, code, pidField, pid,hasChildField);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TreeSelectModel> queryAllTreeData(String table, String text, String code, String pidField) {
|
|
||||||
// 先查出要查询的数据
|
|
||||||
List<TreeSelectModel> serachTreeNode = this.baseMapper.queryTreeDataByKeyword(table, text, code, pidField);
|
|
||||||
|
|
||||||
// 构建一个HashMap,按ID为key存储全部查询出的数据结构
|
|
||||||
HashMap<String, TreeSelectModel> resultMap = new HashMap<>();
|
|
||||||
for (TreeSelectModel treeSelectModel : serachTreeNode){
|
|
||||||
resultMap.put(treeSelectModel.getKey(), treeSelectModel);
|
|
||||||
|
|
||||||
TreeSelectModel copyTreeSelectModel = treeSelectModel;
|
|
||||||
// 叠加的查询父节点
|
|
||||||
while (StringUtils.isNotEmpty(copyTreeSelectModel.getParentId())){
|
|
||||||
if (resultMap.get(copyTreeSelectModel.getParentId()) != null){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeSelectModel newTreeSelectModel = this.baseMapper.queryTreeDataItemById(copyTreeSelectModel.getParentId(), table, text, code, pidField);
|
|
||||||
if(newTreeSelectModel == null){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
resultMap.put(newTreeSelectModel.getKey(), newTreeSelectModel);
|
|
||||||
|
|
||||||
copyTreeSelectModel = newTreeSelectModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<TreeSelectModel> treeNodeList = getTreeSelectModels(resultMap);
|
|
||||||
|
|
||||||
return treeNodeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private List<TreeSelectModel> getTreeSelectModels(HashMap<String, TreeSelectModel> resultMap) {
|
|
||||||
// 遍历map里全部的节点,取出父节点放入list,并循环添加他的子节点
|
|
||||||
List<TreeSelectModel> treeNodeList = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, TreeSelectModel> entry : resultMap.entrySet()){
|
|
||||||
TreeSelectModel curTreeSelectModel = entry.getValue();
|
|
||||||
if (StringUtils.isEmpty(curTreeSelectModel.getParentId())){
|
|
||||||
treeNodeList.add(curTreeSelectModel);
|
|
||||||
} else {
|
|
||||||
// 如果有父节点,则找出自己的父节点,把自己添加进父节点的children属性里
|
|
||||||
TreeSelectModel existParentNode = resultMap.get(curTreeSelectModel.getParentId());
|
|
||||||
if (existParentNode != null){
|
|
||||||
existParentNode.getChildren().add(curTreeSelectModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return treeNodeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteOneDictPhysically(String id) {
|
public void deleteOneDictPhysically(String id) {
|
||||||
this.baseMapper.deleteOneById(id);
|
this.baseMapper.deleteOneById(id);
|
||||||
@@ -381,71 +216,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||||||
return baseMapper.queryDeleteList();
|
return baseMapper.queryDeleteList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> queryDictTablePageList(DictQuery query, int pageSize, int pageNo) {
|
|
||||||
Page<DictModel> page = new Page<>(pageNo,pageSize,false);
|
|
||||||
Page<DictModel> pageList = baseMapper.queryDictTablePageList(page, query);
|
|
||||||
return pageList.getRecords();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> getDictItems(String dictCode) {
|
|
||||||
List<DictModel> ls;
|
|
||||||
if (dictCode.contains(",")) {
|
|
||||||
//关联表字典(举例:sys_user,realname,id)
|
|
||||||
String[] params = dictCode.split(",");
|
|
||||||
if (params.length < 3) {
|
|
||||||
// 字典Code格式不正确
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
//SQL注入校验(只限制非法串改数据库)
|
|
||||||
final String[] sqlInjCheck = {params[0], params[1], params[2]};
|
|
||||||
SqlInjectionUtil.filterContent(sqlInjCheck);
|
|
||||||
if (params.length == 4) {
|
|
||||||
// SQL注入校验(查询条件SQL 特殊check,此方法仅供此处使用)
|
|
||||||
SqlInjectionUtil.specialFilterContent(params[3]);
|
|
||||||
ls = this.queryTableDictItemsByCodeAndFilter(params[0], params[1], params[2], params[3]);
|
|
||||||
} else if (params.length == 3) {
|
|
||||||
ls = this.queryTableDictItemsByCode(params[0], params[1], params[2]);
|
|
||||||
} else {
|
|
||||||
// 字典Code格式不正确
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//字典表
|
|
||||||
ls = this.queryDictItemsByCode(dictCode);
|
|
||||||
}
|
|
||||||
return ls;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictModel> loadDict(String dictCode, String keyword, Integer pageSize) {
|
|
||||||
if (dictCode.contains(",")) {
|
|
||||||
//update-begin-author:taoyan date:20210329 for: 下拉搜索不支持表名后加查询条件
|
|
||||||
String[] params = dictCode.split(",");
|
|
||||||
String condition = null;
|
|
||||||
if (params.length != 3 && params.length != 4) {
|
|
||||||
// 字典Code格式不正确
|
|
||||||
return Collections.emptyList();
|
|
||||||
} else if (params.length == 4) {
|
|
||||||
condition = params[3];
|
|
||||||
}
|
|
||||||
List<DictModel> ls;
|
|
||||||
if (pageSize != null) {
|
|
||||||
ls = this.queryLittleTableDictItems(params[0], params[1], params[2], condition, keyword, pageSize);
|
|
||||||
} else {
|
|
||||||
ls = this.queryAllTableDictItems(params[0], params[1], params[2], condition, keyword);
|
|
||||||
}
|
|
||||||
//update-end-author:taoyan date:20210329 for: 下拉搜索不支持表名后加查询条件
|
|
||||||
return ls;
|
|
||||||
} else {
|
|
||||||
// 字典Code格式不正确
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新dict、depart等的缓存
|
* 刷新dict、depart等的缓存
|
||||||
* @date 2021/4/8 9:07
|
* @date 2021/4/8 9:07
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ public class FileSpiltService {
|
|||||||
|
|
||||||
@Value("${mathToImg.url}")
|
@Value("${mathToImg.url}")
|
||||||
private String mathToImgUrl;
|
private String mathToImgUrl;
|
||||||
|
@Value("${mathToImg.requestKey}")
|
||||||
|
private String mathToImgRequestKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比亚迪-下载文件url
|
* 比亚迪-下载文件url
|
||||||
@@ -1467,6 +1469,7 @@ public class FileSpiltService {
|
|||||||
String encode = this.encode(xmlStr);
|
String encode = this.encode(xmlStr);
|
||||||
JSONObject requestParam = new JSONObject();
|
JSONObject requestParam = new JSONObject();
|
||||||
requestParam.put("encode",encode);
|
requestParam.put("encode",encode);
|
||||||
|
requestParam.put("requestKey",mathToImgRequestKey);
|
||||||
// 创建请求体并添加数据
|
// 创建请求体并添加数据
|
||||||
StringEntity requestEntity = new StringEntity(requestParam.toString(),"UTF-8");
|
StringEntity requestEntity = new StringEntity(requestParam.toString(),"UTF-8");
|
||||||
// 此处相当于在header里头添加content-type等参数
|
// 此处相当于在header里头添加content-type等参数
|
||||||
@@ -1477,7 +1480,7 @@ public class FileSpiltService {
|
|||||||
HttpResponse res = client.execute(post);
|
HttpResponse res = client.execute(post);
|
||||||
String results = EntityUtils.toString(res.getEntity());
|
String results = EntityUtils.toString(res.getEntity());
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(results)) {
|
if (StringUtils.isNotEmpty(results) && !StringUtils.equals(results,"非法请求!") && !StringUtils.equals(results,"非法参数!")) {
|
||||||
result = new File(results);
|
result = new File(results);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ public class LawsTagController extends JeroController<LawsTag, ILawsTagService>
|
|||||||
private ILawsTagService lawsTagService;
|
private ILawsTagService lawsTagService;
|
||||||
@Resource
|
@Resource
|
||||||
private SysDictMapper dictMapper;
|
private SysDictMapper dictMapper;
|
||||||
//@Autowired
|
|
||||||
//private OnlCgformApiController onlCgformApiController;
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ adminRoleCode: admin
|
|||||||
# 特殊公式处理服务URL
|
# 特殊公式处理服务URL
|
||||||
mathToImg:
|
mathToImg:
|
||||||
url: http://127.0.0.1:9998/mathToImg
|
url: http://127.0.0.1:9998/mathToImg
|
||||||
|
requestKey: f6817f48af4fb3af11b9e8bf182f618b
|
||||||
|
|
||||||
# onlyOffice在线编辑页Url
|
# onlyOffice在线编辑页Url
|
||||||
onlyOffice:
|
onlyOffice:
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ adminRoleCode: admin
|
|||||||
# 特殊公式处理服务URL
|
# 特殊公式处理服务URL
|
||||||
mathToImg:
|
mathToImg:
|
||||||
url: http://127.0.0.1:9998/mathToImg
|
url: http://127.0.0.1:9998/mathToImg
|
||||||
|
requestKey: f6817f48af4fb3af11b9e8bf182f618b
|
||||||
# onlyOffice在线编辑页Url
|
# onlyOffice在线编辑页Url
|
||||||
onlyOffice:
|
onlyOffice:
|
||||||
editorUrl: http://39.98.140.126:8999/editor?
|
editorUrl: http://39.98.140.126:8999/editor?
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ adminRoleCode: admin
|
|||||||
# 特殊公式处理服务URL
|
# 特殊公式处理服务URL
|
||||||
mathToImg:
|
mathToImg:
|
||||||
url: http://127.0.0.1:9998/mathToImg
|
url: http://127.0.0.1:9998/mathToImg
|
||||||
|
requestKey: f6817f48af4fb3af11b9e8bf182f618b
|
||||||
# onlyOffice在线编辑页Url
|
# onlyOffice在线编辑页Url
|
||||||
onlyOffice:
|
onlyOffice:
|
||||||
editorUrl: http://39.98.140.126:8999/editor?
|
editorUrl: http://39.98.140.126:8999/editor?
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 108 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 830 B |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 367 B |
|
Before Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 601 B |
|
Before Width: | Height: | Size: 361 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 953 B |
|
Before Width: | Height: | Size: 687 B |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 775 B |
@@ -1,130 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
|
|
||||||
<script src="js/jstools.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/raphael.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
|
|
||||||
<script src="js/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/jquery/jquery.progressbar.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/jquery/jquery.asyncqueue.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
|
|
||||||
<script src="js/Color.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/Polyline.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/ActivityImpl.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/ActivitiRest.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/LineBreakMeasurer.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/ProcessDiagramGenerator.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="js/ProcessDiagramCanvas.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
|
|
||||||
<style type="text/css" media="screen">
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div id="pb1"></div>
|
|
||||||
<div id="overlayBox" >
|
|
||||||
<div id="diagramBreadCrumbs" class="diagramBreadCrumbs" onmousedown="return false" onselectstart="return false"></div>
|
|
||||||
<div id="diagramHolder" class="diagramHolder"></div>
|
|
||||||
<div class="diagram-info" id="diagramInfo"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script language='javascript'>
|
|
||||||
var DiagramGenerator = {};
|
|
||||||
var pb1;
|
|
||||||
$(document).ready(function(){
|
|
||||||
var query_string = {};
|
|
||||||
var query = window.location.search.substring(1);
|
|
||||||
var vars = query.split("&");
|
|
||||||
for (var i=0;i<vars.length;i++) {
|
|
||||||
var pair = vars[i].split("=");
|
|
||||||
query_string[pair[0]] = pair[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
var processDefinitionId = query_string["processDefinitionId"];
|
|
||||||
var processInstanceId = query_string["processInstanceId"];
|
|
||||||
|
|
||||||
console.log("Initialize progress bar");
|
|
||||||
|
|
||||||
pb1 = new $.ProgressBar({
|
|
||||||
boundingBox: '#pb1',
|
|
||||||
label: 'Progressbar!',
|
|
||||||
on: {
|
|
||||||
complete: function() {
|
|
||||||
console.log("Progress Bar COMPLETE");
|
|
||||||
this.set('label', 'complete!');
|
|
||||||
if (processInstanceId) {
|
|
||||||
ProcessDiagramGenerator.drawHighLights(processInstanceId);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
valueChange: function(e) {
|
|
||||||
this.set('label', e.newVal + '%');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
value: 0
|
|
||||||
});
|
|
||||||
console.log("Progress bar inited");
|
|
||||||
|
|
||||||
ProcessDiagramGenerator.options = {
|
|
||||||
diagramBreadCrumbsId: "diagramBreadCrumbs",
|
|
||||||
diagramHolderId: "diagramHolder",
|
|
||||||
diagramInfoId: "diagramInfo",
|
|
||||||
on: {
|
|
||||||
click: function(canvas, element, contextObject){
|
|
||||||
var mouseEvent = this;
|
|
||||||
console.log("[CLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
|
|
||||||
|
|
||||||
if (contextObject.getProperty("type") == "callActivity") {
|
|
||||||
var processDefinitonKey = contextObject.getProperty("processDefinitonKey");
|
|
||||||
var processDefinitons = contextObject.getProperty("processDefinitons");
|
|
||||||
var processDefiniton = processDefinitons[0];
|
|
||||||
console.log("Load callActivity '" + processDefiniton.processDefinitionKey + "', contextObject: ", contextObject);
|
|
||||||
|
|
||||||
// Load processDefinition
|
|
||||||
ProcessDiagramGenerator.drawDiagram(processDefiniton.processDefinitionId);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rightClick: function(canvas, element, contextObject){
|
|
||||||
var mouseEvent = this;
|
|
||||||
console.log("[RIGHTCLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
|
|
||||||
},
|
|
||||||
over: function(canvas, element, contextObject){
|
|
||||||
var mouseEvent = this;
|
|
||||||
//console.log("[OVER] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
|
|
||||||
|
|
||||||
// TODO: show tooltip-window with contextObject info
|
|
||||||
ProcessDiagramGenerator.showActivityInfo(contextObject);
|
|
||||||
},
|
|
||||||
out: function(canvas, element, contextObject){
|
|
||||||
var mouseEvent = this;
|
|
||||||
//console.log("[OUT] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
|
|
||||||
|
|
||||||
ProcessDiagramGenerator.hideInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var baseUrl = window.document.location.protocol + "//" + window.document.location.host + "/";
|
|
||||||
var shortenedUrl = window.document.location.href.replace(baseUrl, "");
|
|
||||||
baseUrl = baseUrl + shortenedUrl.substring(0, shortenedUrl.indexOf("/"));
|
|
||||||
|
|
||||||
ActivitiRest.options = {
|
|
||||||
processInstanceHighLightsUrl: baseUrl + "/bat-wkflow/service/process-instance/{processInstanceId}/highlights?callback=?",
|
|
||||||
processDefinitionUrl: baseUrl + "/bat-wkflow/service/process-definition/{processDefinitionId}/diagram-layout?callback=?",
|
|
||||||
processDefinitionByKeyUrl: baseUrl + "/bat-wkflow/service/process-definition/{processDefinitionKey}/diagram-layout?callback=?"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (processDefinitionId) {
|
|
||||||
ProcessDiagramGenerator.drawDiagram(processDefinitionId);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
alert("processDefinitionId parameter is required");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
var ActivitiRest = {
|
|
||||||
options: {},
|
|
||||||
getProcessDefinitionByKey: function(processDefinitionKey, callback) {
|
|
||||||
var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
cache: false,
|
|
||||||
async: true,
|
|
||||||
success: function(data, textStatus) {
|
|
||||||
var processDefinition = data;
|
|
||||||
if (!processDefinition) {
|
|
||||||
console.error("Process definition '" + processDefinitionKey + "' not found");
|
|
||||||
} else {
|
|
||||||
callback.apply({processDefinitionId: processDefinition.id});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).done(function(data, textStatus) {
|
|
||||||
console.log("ajax done");
|
|
||||||
}).fail(function(jqXHR, textStatus, error){
|
|
||||||
console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getProcessDefinition: function(processDefinitionId, callback) {
|
|
||||||
var url = Lang.sub(this.options.processDefinitionUrl, {processDefinitionId: processDefinitionId});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
cache: false,
|
|
||||||
async: true,
|
|
||||||
success: function(data, textStatus) {
|
|
||||||
var processDefinitionDiagramLayout = data;
|
|
||||||
if (!processDefinitionDiagramLayout) {
|
|
||||||
console.error("Process definition diagram layout '" + processDefinitionId + "' not found");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
callback.apply({processDefinitionDiagramLayout: processDefinitionDiagramLayout});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).done(function(data, textStatus) {
|
|
||||||
console.log("ajax done");
|
|
||||||
}).fail(function(jqXHR, textStatus, error){
|
|
||||||
console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getHighLights: function(processInstanceId, callback) {
|
|
||||||
var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
cache: false,
|
|
||||||
async: true,
|
|
||||||
success: function(data, textStatus) {
|
|
||||||
console.log("ajax returned data");
|
|
||||||
var highLights = data;
|
|
||||||
if (!highLights) {
|
|
||||||
console.log("highLights not found");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
callback.apply({highLights: highLights});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).done(function(data, textStatus) {
|
|
||||||
console.log("ajax done");
|
|
||||||
}).fail(function(jqXHR, textStatus, error){
|
|
||||||
console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* @author Tom Baeyens
|
|
||||||
* @author (Javascript) Dmitry Farafonov
|
|
||||||
*/
|
|
||||||
|
|
||||||
var ActivityImpl = function(activityJson){
|
|
||||||
this.outgoingTransitions = [];
|
|
||||||
this.outgoingTransitions = [];
|
|
||||||
this.incomingTransitions = [];
|
|
||||||
this.activityBehavior = null;
|
|
||||||
this.parent = null;
|
|
||||||
this.isScope = false;
|
|
||||||
this.isAsync = false;
|
|
||||||
this.isExclusive = false;
|
|
||||||
this.x = -1;
|
|
||||||
this.y = -1;
|
|
||||||
this.width = -1;
|
|
||||||
this.height = -1;
|
|
||||||
this.properties = {};
|
|
||||||
|
|
||||||
//console.log("activityJson: ", activityJson);
|
|
||||||
|
|
||||||
if (activityJson != undefined) {
|
|
||||||
this.setId(activityJson.activityId);
|
|
||||||
|
|
||||||
for (var propertyName in activityJson.properties) {
|
|
||||||
this.setProperty(propertyName, activityJson.properties[propertyName]);
|
|
||||||
}
|
|
||||||
//this.setProperty("name", activityJson.activityName);
|
|
||||||
//this.setProperty("type", activityJson.activityType);
|
|
||||||
this.setX(activityJson.x);
|
|
||||||
this.setY(activityJson.y);
|
|
||||||
this.setWidth(activityJson.width);
|
|
||||||
this.setHeight(activityJson.height);
|
|
||||||
|
|
||||||
if (activityJson.multiInstance)
|
|
||||||
this.setProperty("multiInstance", activityJson.multiInstance);
|
|
||||||
if (activityJson.collapsed) {
|
|
||||||
this.setProperty("collapsed", activityJson.collapsed);
|
|
||||||
}
|
|
||||||
if (activityJson.isInterrupting != undefined)
|
|
||||||
this.setProperty("isInterrupting", activityJson.isInterrupting);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ActivityImpl.prototype = {
|
|
||||||
outgoingTransitions: [],
|
|
||||||
outgoingTransitions: [],
|
|
||||||
incomingTransitions: [],
|
|
||||||
activityBehavior: null,
|
|
||||||
parent: null,
|
|
||||||
isScope: false,
|
|
||||||
isAsync: false,
|
|
||||||
isExclusive: false,
|
|
||||||
|
|
||||||
id: null,
|
|
||||||
|
|
||||||
properties: {},
|
|
||||||
|
|
||||||
// Graphical information
|
|
||||||
x: -1,
|
|
||||||
y: -1,
|
|
||||||
width: -1,
|
|
||||||
height: -1,
|
|
||||||
|
|
||||||
setId: function(id){
|
|
||||||
this.id = id;
|
|
||||||
},
|
|
||||||
|
|
||||||
getId: function(){
|
|
||||||
return this.id;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
setProperty: function(name, value){
|
|
||||||
this.properties[name] = value;
|
|
||||||
},
|
|
||||||
getProperty: function(name){
|
|
||||||
return this.properties[name];
|
|
||||||
},
|
|
||||||
|
|
||||||
createOutgoingTransition: function(transitionId){
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
toString: function(id) {
|
|
||||||
return "Activity("+id+")";
|
|
||||||
},
|
|
||||||
|
|
||||||
getParentActivity: function(){
|
|
||||||
/*
|
|
||||||
if (parent instanceof ActivityImpl) {
|
|
||||||
79 return (ActivityImpl) parent;
|
|
||||||
80 }
|
|
||||||
81 return null;
|
|
||||||
*/
|
|
||||||
return this.parent;
|
|
||||||
},
|
|
||||||
|
|
||||||
// restricted setters ///////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
setOutgoingTransitions: function(outgoingTransitions){
|
|
||||||
this.outgoingTransitions = outgoingTransitions;
|
|
||||||
},
|
|
||||||
|
|
||||||
setParent: function(parent){
|
|
||||||
this.parent = parent;
|
|
||||||
},
|
|
||||||
|
|
||||||
setIncomingTransitions: function(incomingTransitions){
|
|
||||||
this.incomingTransitions = incomingTransitions;
|
|
||||||
},
|
|
||||||
|
|
||||||
// getters and setters //////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
getOutgoingTransitions: function(){
|
|
||||||
return this.outgoingTransitions;
|
|
||||||
},
|
|
||||||
|
|
||||||
getActivityBehavior: function(){
|
|
||||||
return this.activityBehavior;
|
|
||||||
},
|
|
||||||
|
|
||||||
setActivityBehavior: function(activityBehavior){
|
|
||||||
this.activityBehavior = activityBehavior;
|
|
||||||
},
|
|
||||||
|
|
||||||
getParent: function(){
|
|
||||||
return this.parent;
|
|
||||||
},
|
|
||||||
|
|
||||||
getIncomingTransitions: function(){
|
|
||||||
return this.incomingTransitions;
|
|
||||||
},
|
|
||||||
|
|
||||||
isScope: function(){
|
|
||||||
return this.isScope;
|
|
||||||
},
|
|
||||||
|
|
||||||
setScope: function(isScope){
|
|
||||||
this.isScope = isScope;
|
|
||||||
},
|
|
||||||
|
|
||||||
getX: function(){
|
|
||||||
return this.x;
|
|
||||||
},
|
|
||||||
|
|
||||||
setX: function(x){
|
|
||||||
this.x = x;
|
|
||||||
},
|
|
||||||
|
|
||||||
getY: function(){
|
|
||||||
return this.y;
|
|
||||||
},
|
|
||||||
|
|
||||||
setY: function(y){
|
|
||||||
this.y = y;
|
|
||||||
},
|
|
||||||
|
|
||||||
getWidth: function(){
|
|
||||||
return this.width;
|
|
||||||
},
|
|
||||||
|
|
||||||
setWidth: function(width){
|
|
||||||
this.width = width;
|
|
||||||
},
|
|
||||||
|
|
||||||
getHeight: function(){
|
|
||||||
return this.height;
|
|
||||||
},
|
|
||||||
|
|
||||||
setHeight: function(height){
|
|
||||||
this.height = height;
|
|
||||||
},
|
|
||||||
|
|
||||||
isAsync: function() {
|
|
||||||
return this.isAsync;
|
|
||||||
},
|
|
||||||
|
|
||||||
setAsync: function(isAsync) {
|
|
||||||
this.isAsync = isAsync;
|
|
||||||
},
|
|
||||||
|
|
||||||
isExclusive: function() {
|
|
||||||
return this.isExclusive;
|
|
||||||
},
|
|
||||||
|
|
||||||
setExclusive: function(isExclusive) {
|
|
||||||
this.isExclusive = isExclusive;
|
|
||||||
},
|
|
||||||
|
|
||||||
vvoid: function(){}
|
|
||||||
};
|
|
||||||
@@ -1,603 +0,0 @@
|
|||||||
/**
|
|
||||||
* Web color table
|
|
||||||
*
|
|
||||||
* @author Dmitry Farafonov
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Color = {
|
|
||||||
/**
|
|
||||||
* The color white. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
white : Raphael.getRGB("rgb(255,255,255)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color white. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
WHITE : this.white,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color light gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
lightGray : Raphael.getRGB("rgb(192, 192, 192)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color light gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
LIGHT_GRAY : this.lightGray,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
gray : Raphael.getRGB("rgb(128, 128, 128)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
GRAY : this.gray,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color dark gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
darkGray : Raphael.getRGB("rgb(64, 64, 64)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color dark gray. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
DARK_GRAY : this.darkGray,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color black. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
black : Raphael.getRGB("rgb(0, 0, 0)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color black. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
BLACK : this.black,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color red. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
red : Raphael.getRGB("rgb(255, 0, 0)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color red. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
RED : this.red,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color pink. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
pink : Raphael.getRGB("rgb(255, 175, 175)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color pink. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
PINK : this.pink,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color orange. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
orange : Raphael.getRGB("rgb(255, 200, 0)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color orange. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
ORANGE : this.orange,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color yellow. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
yellow : Raphael.getRGB("rgb(255, 255, 0)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color yellow. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
YELLOW : this.yellow,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color green. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
green : Raphael.getRGB("rgb(0, 255, 0)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color green. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
GREEN : this.green,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color magenta. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
magenta : Raphael.getRGB("rgb(255, 0, 255)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color magenta. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
MAGENTA : this.magenta,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color cyan. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
cyan : Raphael.getRGB("rgb(0, 255, 255)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color cyan. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
CYAN : this.cyan,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color blue. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
blue : Raphael.getRGB("rgb(0, 0, 255)"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color blue. In the default sRGB space.
|
|
||||||
*/
|
|
||||||
BLUE : this.blue,
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
// http://www.stm.dp.ua/web-design/color-html.php
|
|
||||||
|
|
||||||
Snow : Raphael.getRGB("#FFFAFA "), // 255 250 250
|
|
||||||
GhostWhite : Raphael.getRGB("#F8F8FF "), // 248 248 255
|
|
||||||
WhiteSmoke : Raphael.getRGB("#F5F5F5 "), // 245 245 245
|
|
||||||
Gainsboro : Raphael.getRGB("#DCDCDC "), // 220 220 220
|
|
||||||
FloralWhite : Raphael.getRGB("#FFFAF0 "), // 255 250 240
|
|
||||||
OldLace : Raphael.getRGB("#FDF5E6 "), // 253 245 230
|
|
||||||
Linen : Raphael.getRGB("#FAF0E6 "), // 250 240 230
|
|
||||||
AntiqueWhite : Raphael.getRGB("#FAEBD7 "), // 250 235 215
|
|
||||||
PapayaWhip : Raphael.getRGB("#FFEFD5 "), // 255 239 213
|
|
||||||
BlanchedAlmond : Raphael.getRGB("#FFEBCD "), // 255 235 205
|
|
||||||
Bisque : Raphael.getRGB("#FFE4C4 "), // 255 228 196
|
|
||||||
PeachPuff : Raphael.getRGB("#FFDAB9 "), // 255 218 185
|
|
||||||
NavajoWhite : Raphael.getRGB("#FFDEAD "), // 255 222 173
|
|
||||||
Moccasin : Raphael.getRGB("#FFE4B5 "), // 255 228 181
|
|
||||||
Cornsilk : Raphael.getRGB("#FFF8DC "), // 255 248 220
|
|
||||||
Ivory : Raphael.getRGB("#FFFFF0 "), // 255 255 240
|
|
||||||
LemonChiffon : Raphael.getRGB("#FFFACD "), // 255 250 205
|
|
||||||
Seashell : Raphael.getRGB("#FFF5EE "), // 255 245 238
|
|
||||||
Honeydew : Raphael.getRGB("#F0FFF0 "), // 240 255 240
|
|
||||||
MintCream : Raphael.getRGB("#F5FFFA "), // 245 255 250
|
|
||||||
Azure : Raphael.getRGB("#F0FFFF "), // 240 255 255
|
|
||||||
AliceBlue : Raphael.getRGB("#F0F8FF "), // 240 248 255
|
|
||||||
lavender : Raphael.getRGB("#E6E6FA "), // 230 230 250
|
|
||||||
LavenderBlush : Raphael.getRGB("#FFF0F5 "), // 255 240 245
|
|
||||||
MistyRose : Raphael.getRGB("#FFE4E1 "), // 255 228 225
|
|
||||||
White : Raphael.getRGB("#FFFFFF "), // 255 255 255
|
|
||||||
Black : Raphael.getRGB("#000000 "), // 0 0 0
|
|
||||||
DarkSlateGray : Raphael.getRGB("#2F4F4F "), // 47 79 79
|
|
||||||
DimGrey : Raphael.getRGB("#696969 "), // 105 105 105
|
|
||||||
SlateGrey : Raphael.getRGB("#708090 "), // 112 128 144
|
|
||||||
LightSlateGray : Raphael.getRGB("#778899 "), // 119 136 153
|
|
||||||
Grey : Raphael.getRGB("#BEBEBE "), // 190 190 190
|
|
||||||
LightGray : Raphael.getRGB("#D3D3D3 "), // 211 211 211
|
|
||||||
MidnightBlue : Raphael.getRGB("#191970 "), // 25 25 112
|
|
||||||
NavyBlue : Raphael.getRGB("#000080 "), // 0 0 128
|
|
||||||
CornflowerBlue : Raphael.getRGB("#6495ED "), // 100 149 237
|
|
||||||
DarkSlateBlue : Raphael.getRGB("#483D8B "), // 72 61 139
|
|
||||||
SlateBlue : Raphael.getRGB("#6A5ACD "), // 106 90 205
|
|
||||||
MediumSlateBlue : Raphael.getRGB("#7B68EE "), // 123 104 238
|
|
||||||
LightSlateBlue : Raphael.getRGB("#8470FF "), // 132 112 255
|
|
||||||
MediumBlue : Raphael.getRGB("#0000CD "), // 0 0 205
|
|
||||||
RoyalBlue : Raphael.getRGB("#4169E1 "), // 65 105 225
|
|
||||||
Blue : Raphael.getRGB("#0000FF "), // 0 0 255
|
|
||||||
DodgerBlue : Raphael.getRGB("#1E90FF "), // 30 144 255
|
|
||||||
DeepSkyBlue : Raphael.getRGB("#00BFFF "), // 0 191 255
|
|
||||||
SkyBlue : Raphael.getRGB("#87CEEB "), // 135 206 235
|
|
||||||
LightSkyBlue : Raphael.getRGB("#87CEFA "), // 135 206 250
|
|
||||||
SteelBlue : Raphael.getRGB("#4682B4 "), // 70 130 180
|
|
||||||
LightSteelBlue : Raphael.getRGB("#B0C4DE "), // 176 196 222
|
|
||||||
LightBlue : Raphael.getRGB("#ADD8E6 "), // 173 216 230
|
|
||||||
PowderBlue : Raphael.getRGB("#B0E0E6 "), // 176 224 230
|
|
||||||
PaleTurquoise : Raphael.getRGB("#AFEEEE "), // 175 238 238
|
|
||||||
DarkTurquoise : Raphael.getRGB("#00CED1 "), // 0 206 209
|
|
||||||
MediumTurquoise : Raphael.getRGB("#48D1CC "), // 72 209 204
|
|
||||||
Turquoise : Raphael.getRGB("#40E0D0 "), // 64 224 208
|
|
||||||
Cyan : Raphael.getRGB("#00FFFF "), // 0 255 255
|
|
||||||
LightCyan : Raphael.getRGB("#E0FFFF "), // 224 255 255
|
|
||||||
CadetBlue : Raphael.getRGB("#5F9EA0 "), // 95 158 160
|
|
||||||
MediumAquamarine: Raphael.getRGB("#66CDAA "), // 102 205 170
|
|
||||||
Aquamarine : Raphael.getRGB("#7FFFD4 "), // 127 255 212
|
|
||||||
DarkGreen : Raphael.getRGB("#006400 "), // 0 100 0
|
|
||||||
DarkOliveGreen : Raphael.getRGB("#556B2F "), // 85 107 47
|
|
||||||
DarkSeaGreen : Raphael.getRGB("#8FBC8F "), // 143 188 143
|
|
||||||
SeaGreen : Raphael.getRGB("#2E8B57 "), // 46 139 87
|
|
||||||
MediumSeaGreen : Raphael.getRGB("#3CB371 "), // 60 179 113
|
|
||||||
LightSeaGreen : Raphael.getRGB("#20B2AA "), // 32 178 170
|
|
||||||
PaleGreen : Raphael.getRGB("#98FB98 "), // 152 251 152
|
|
||||||
SpringGreen : Raphael.getRGB("#00FF7F "), // 0 255 127
|
|
||||||
LawnGreen : Raphael.getRGB("#7CFC00 "), // 124 252 0
|
|
||||||
Green : Raphael.getRGB("#00FF00 "), // 0 255 0
|
|
||||||
Chartreuse : Raphael.getRGB("#7FFF00 "), // 127 255 0
|
|
||||||
MedSpringGreen : Raphael.getRGB("#00FA9A "), // 0 250 154
|
|
||||||
GreenYellow : Raphael.getRGB("#ADFF2F "), // 173 255 47
|
|
||||||
LimeGreen : Raphael.getRGB("#32CD32 "), // 50 205 50
|
|
||||||
YellowGreen : Raphael.getRGB("#9ACD32 "), // 154 205 50
|
|
||||||
ForestGreen : Raphael.getRGB("#228B22 "), // 34 139 34
|
|
||||||
OliveDrab : Raphael.getRGB("#6B8E23 "), // 107 142 35
|
|
||||||
DarkKhaki : Raphael.getRGB("#BDB76B "), // 189 183 107
|
|
||||||
PaleGoldenrod : Raphael.getRGB("#EEE8AA "), // 238 232 170
|
|
||||||
LtGoldenrodYello: Raphael.getRGB("#FAFAD2 "), // 250 250 210
|
|
||||||
LightYellow : Raphael.getRGB("#FFFFE0 "), // 255 255 224
|
|
||||||
Yellow : Raphael.getRGB("#FFFF00 "), // 255 255 0
|
|
||||||
Gold : Raphael.getRGB("#FFD700 "), // 255 215 0
|
|
||||||
LightGoldenrod : Raphael.getRGB("#EEDD82 "), // 238 221 130
|
|
||||||
goldenrod : Raphael.getRGB("#DAA520 "), // 218 165 32
|
|
||||||
DarkGoldenrod : Raphael.getRGB("#B8860B "), // 184 134 11
|
|
||||||
RosyBrown : Raphael.getRGB("#BC8F8F "), // 188 143 143
|
|
||||||
IndianRed : Raphael.getRGB("#CD5C5C "), // 205 92 92
|
|
||||||
SaddleBrown : Raphael.getRGB("#8B4513 "), // 139 69 19
|
|
||||||
Sienna : Raphael.getRGB("#A0522D "), // 160 82 45
|
|
||||||
Peru : Raphael.getRGB("#CD853F "), // 205 133 63
|
|
||||||
Burlywood : Raphael.getRGB("#DEB887 "), // 222 184 135
|
|
||||||
Beige : Raphael.getRGB("#F5F5DC "), // 245 245 220
|
|
||||||
Wheat : Raphael.getRGB("#F5DEB3 "), // 245 222 179
|
|
||||||
SandyBrown : Raphael.getRGB("#F4A460 "), // 244 164 96
|
|
||||||
Tan : Raphael.getRGB("#D2B48C "), // 210 180 140
|
|
||||||
Chocolate : Raphael.getRGB("#D2691E "), // 210 105 30
|
|
||||||
Firebrick : Raphael.getRGB("#B22222 "), // 178 34 34
|
|
||||||
Brown : Raphael.getRGB("#A52A2A "), // 165 42 42
|
|
||||||
DarkSalmon : Raphael.getRGB("#E9967A "), // 233 150 122
|
|
||||||
Salmon : Raphael.getRGB("#FA8072 "), // 250 128 114
|
|
||||||
LightSalmon : Raphael.getRGB("#FFA07A "), // 255 160 122
|
|
||||||
Orange : Raphael.getRGB("#FFA500 "), // 255 165 0
|
|
||||||
DarkOrange : Raphael.getRGB("#FF8C00 "), // 255 140 0
|
|
||||||
Coral : Raphael.getRGB("#FF7F50 "), // 255 127 80
|
|
||||||
LightCoral : Raphael.getRGB("#F08080 "), // 240 128 128
|
|
||||||
Tomato : Raphael.getRGB("#FF6347 "), // 255 99 71
|
|
||||||
OrangeRed : Raphael.getRGB("#FF4500 "), // 255 69 0
|
|
||||||
Red : Raphael.getRGB("#FF0000 "), // 255 0 0
|
|
||||||
HotPink : Raphael.getRGB("#FF69B4 "), // 255 105 180
|
|
||||||
DeepPink : Raphael.getRGB("#FF1493 "), // 255 20 147
|
|
||||||
Pink : Raphael.getRGB("#FFC0CB "), // 255 192 203
|
|
||||||
LightPink : Raphael.getRGB("#FFB6C1 "), // 255 182 193
|
|
||||||
PaleVioletRed : Raphael.getRGB("#DB7093 "), // 219 112 147
|
|
||||||
Maroon : Raphael.getRGB("#B03060 "), // 176 48 96
|
|
||||||
MediumVioletRed : Raphael.getRGB("#C71585 "), // 199 21 133
|
|
||||||
VioletRed : Raphael.getRGB("#D02090 "), // 208 32 144
|
|
||||||
Magenta : Raphael.getRGB("#FF00FF "), // 255 0 255
|
|
||||||
Violet : Raphael.getRGB("#EE82EE "), // 238 130 238
|
|
||||||
Plum : Raphael.getRGB("#DDA0DD "), // 221 160 221
|
|
||||||
Orchid : Raphael.getRGB("#DA70D6 "), // 218 112 214
|
|
||||||
MediumOrchid : Raphael.getRGB("#BA55D3 "), // 186 85 211
|
|
||||||
DarkOrchid : Raphael.getRGB("#9932CC "), // 153 50 204
|
|
||||||
DarkViolet : Raphael.getRGB("#9400D3 "), // 148 0 211
|
|
||||||
BlueViolet : Raphael.getRGB("#8A2BE2 "), // 138 43 226
|
|
||||||
Purple : Raphael.getRGB("#A020F0 "), // 160 32 240
|
|
||||||
MediumPurple : Raphael.getRGB("#9370DB "), // 147 112 219
|
|
||||||
Thistle : Raphael.getRGB("#D8BFD8 "), // 216 191 216
|
|
||||||
Snow1 : Raphael.getRGB("#FFFAFA "), // 255 250 250
|
|
||||||
Snow2 : Raphael.getRGB("#EEE9E9 "), // 238 233 233
|
|
||||||
Snow3 : Raphael.getRGB("#CDC9C9 "), // 205 201 201
|
|
||||||
Snow4 : Raphael.getRGB("#8B8989 "), // 139 137 137
|
|
||||||
Seashell1 : Raphael.getRGB("#FFF5EE "), // 255 245 238
|
|
||||||
Seashell2 : Raphael.getRGB("#EEE5DE "), // 238 229 222
|
|
||||||
Seashell3 : Raphael.getRGB("#CDC5BF "), // 205 197 191
|
|
||||||
Seashell4 : Raphael.getRGB("#8B8682 "), // 139 134 130
|
|
||||||
AntiqueWhite1 : Raphael.getRGB("#FFEFDB "), // 255 239 219
|
|
||||||
AntiqueWhite2 : Raphael.getRGB("#EEDFCC "), // 238 223 204
|
|
||||||
AntiqueWhite3 : Raphael.getRGB("#CDC0B0 "), // 205 192 176
|
|
||||||
AntiqueWhite4 : Raphael.getRGB("#8B8378 "), // 139 131 120
|
|
||||||
Bisque1 : Raphael.getRGB("#FFE4C4 "), // 255 228 196
|
|
||||||
Bisque2 : Raphael.getRGB("#EED5B7 "), // 238 213 183
|
|
||||||
Bisque3 : Raphael.getRGB("#CDB79E "), // 205 183 158
|
|
||||||
Bisque4 : Raphael.getRGB("#8B7D6B "), // 139 125 107
|
|
||||||
PeachPuff1 : Raphael.getRGB("#FFDAB9 "), // 255 218 185
|
|
||||||
PeachPuff2 : Raphael.getRGB("#EECBAD "), // 238 203 173
|
|
||||||
PeachPuff3 : Raphael.getRGB("#CDAF95 "), // 205 175 149
|
|
||||||
PeachPuff4 : Raphael.getRGB("#8B7765 "), // 139 119 101
|
|
||||||
NavajoWhite1 : Raphael.getRGB("#FFDEAD "), // 255 222 173
|
|
||||||
NavajoWhite2 : Raphael.getRGB("#EECFA1 "), // 238 207 161
|
|
||||||
NavajoWhite3 : Raphael.getRGB("#CDB38B "), // 205 179 139
|
|
||||||
NavajoWhite4 : Raphael.getRGB("#8B795E "), // 139 121 94
|
|
||||||
LemonChiffon1 : Raphael.getRGB("#FFFACD "), // 255 250 205
|
|
||||||
LemonChiffon2 : Raphael.getRGB("#EEE9BF "), // 238 233 191
|
|
||||||
LemonChiffon3 : Raphael.getRGB("#CDC9A5 "), // 205 201 165
|
|
||||||
LemonChiffon4 : Raphael.getRGB("#8B8970 "), // 139 137 112
|
|
||||||
Cornsilk1 : Raphael.getRGB("#FFF8DC "), // 255 248 220
|
|
||||||
Cornsilk2 : Raphael.getRGB("#EEE8CD "), // 238 232 205
|
|
||||||
Cornsilk3 : Raphael.getRGB("#CDC8B1 "), // 205 200 177
|
|
||||||
Cornsilk4 : Raphael.getRGB("#8B8878 "), // 139 136 120
|
|
||||||
Ivory1 : Raphael.getRGB("#FFFFF0 "), // 255 255 240
|
|
||||||
Ivory2 : Raphael.getRGB("#EEEEE0 "), // 238 238 224
|
|
||||||
Ivory3 : Raphael.getRGB("#CDCDC1 "), // 205 205 193
|
|
||||||
Ivory4 : Raphael.getRGB("#8B8B83 "), // 139 139 131
|
|
||||||
Honeydew1 : Raphael.getRGB("#F0FFF0 "), // 240 255 240
|
|
||||||
Honeydew2 : Raphael.getRGB("#E0EEE0 "), // 224 238 224
|
|
||||||
Honeydew3 : Raphael.getRGB("#C1CDC1 "), // 193 205 193
|
|
||||||
Honeydew4 : Raphael.getRGB("#838B83 "), // 131 139 131
|
|
||||||
LavenderBlush1 : Raphael.getRGB("#FFF0F5 "), // 255 240 245
|
|
||||||
LavenderBlush2 : Raphael.getRGB("#EEE0E5 "), // 238 224 229
|
|
||||||
LavenderBlush3 : Raphael.getRGB("#CDC1C5 "), // 205 193 197
|
|
||||||
LavenderBlush4 : Raphael.getRGB("#8B8386 "), // 139 131 134
|
|
||||||
MistyRose1 : Raphael.getRGB("#FFE4E1 "), // 255 228 225
|
|
||||||
MistyRose2 : Raphael.getRGB("#EED5D2 "), // 238 213 210
|
|
||||||
MistyRose3 : Raphael.getRGB("#CDB7B5 "), // 205 183 181
|
|
||||||
MistyRose4 : Raphael.getRGB("#8B7D7B "), // 139 125 123
|
|
||||||
Azure1 : Raphael.getRGB("#F0FFFF "), // 240 255 255
|
|
||||||
Azure2 : Raphael.getRGB("#E0EEEE "), // 224 238 238
|
|
||||||
Azure3 : Raphael.getRGB("#C1CDCD "), // 193 205 205
|
|
||||||
Azure4 : Raphael.getRGB("#838B8B "), // 131 139 139
|
|
||||||
SlateBlue1 : Raphael.getRGB("#836FFF "), // 131 111 255
|
|
||||||
SlateBlue2 : Raphael.getRGB("#7A67EE "), // 122 103 238
|
|
||||||
SlateBlue3 : Raphael.getRGB("#6959CD "), // 105 89 205
|
|
||||||
SlateBlue4 : Raphael.getRGB("#473C8B "), // 71 60 139
|
|
||||||
RoyalBlue1 : Raphael.getRGB("#4876FF "), // 72 118 255
|
|
||||||
RoyalBlue2 : Raphael.getRGB("#436EEE "), // 67 110 238
|
|
||||||
RoyalBlue3 : Raphael.getRGB("#3A5FCD "), // 58 95 205
|
|
||||||
RoyalBlue4 : Raphael.getRGB("#27408B "), // 39 64 139
|
|
||||||
Blue1 : Raphael.getRGB("#0000FF "), // 0 0 255
|
|
||||||
Blue2 : Raphael.getRGB("#0000EE "), // 0 0 238
|
|
||||||
Blue3 : Raphael.getRGB("#0000CD "), // 0 0 205
|
|
||||||
Blue4 : Raphael.getRGB("#00008B "), // 0 0 139
|
|
||||||
DodgerBlue1 : Raphael.getRGB("#1E90FF "), // 30 144 255
|
|
||||||
DodgerBlue2 : Raphael.getRGB("#1C86EE "), // 28 134 238
|
|
||||||
DodgerBlue3 : Raphael.getRGB("#1874CD "), // 24 116 205
|
|
||||||
DodgerBlue4 : Raphael.getRGB("#104E8B "), // 16 78 139
|
|
||||||
SteelBlue1 : Raphael.getRGB("#63B8FF "), // 99 184 255
|
|
||||||
SteelBlue2 : Raphael.getRGB("#5CACEE "), // 92 172 238
|
|
||||||
SteelBlue3 : Raphael.getRGB("#4F94CD "), // 79 148 205
|
|
||||||
SteelBlue4 : Raphael.getRGB("#36648B "), // 54 100 139
|
|
||||||
DeepSkyBlue1 : Raphael.getRGB("#00BFFF "), // 0 191 255
|
|
||||||
DeepSkyBlue2 : Raphael.getRGB("#00B2EE "), // 0 178 238
|
|
||||||
DeepSkyBlue3 : Raphael.getRGB("#009ACD "), // 0 154 205
|
|
||||||
DeepSkyBlue4 : Raphael.getRGB("#00688B "), // 0 104 139
|
|
||||||
SkyBlue1 : Raphael.getRGB("#87CEFF "), // 135 206 255
|
|
||||||
SkyBlue2 : Raphael.getRGB("#7EC0EE "), // 126 192 238
|
|
||||||
SkyBlue3 : Raphael.getRGB("#6CA6CD "), // 108 166 205
|
|
||||||
SkyBlue4 : Raphael.getRGB("#4A708B "), // 74 112 139
|
|
||||||
LightSkyBlue1 : Raphael.getRGB("#B0E2FF "), // 176 226 255
|
|
||||||
LightSkyBlue2 : Raphael.getRGB("#A4D3EE "), // 164 211 238
|
|
||||||
LightSkyBlue3 : Raphael.getRGB("#8DB6CD "), // 141 182 205
|
|
||||||
LightSkyBlue4 : Raphael.getRGB("#607B8B "), // 96 123 139
|
|
||||||
SlateGray1 : Raphael.getRGB("#C6E2FF "), // 198 226 255
|
|
||||||
SlateGray2 : Raphael.getRGB("#B9D3EE "), // 185 211 238
|
|
||||||
SlateGray3 : Raphael.getRGB("#9FB6CD "), // 159 182 205
|
|
||||||
SlateGray4 : Raphael.getRGB("#6C7B8B "), // 108 123 139
|
|
||||||
LightSteelBlue1 : Raphael.getRGB("#CAE1FF "), // 202 225 255
|
|
||||||
LightSteelBlue2 : Raphael.getRGB("#BCD2EE "), // 188 210 238
|
|
||||||
LightSteelBlue3 : Raphael.getRGB("#A2B5CD "), // 162 181 205
|
|
||||||
LightSteelBlue4 : Raphael.getRGB("#6E7B8B "), // 110 123 139
|
|
||||||
LightBlue1 : Raphael.getRGB("#BFEFFF "), // 191 239 255
|
|
||||||
LightBlue2 : Raphael.getRGB("#B2DFEE "), // 178 223 238
|
|
||||||
LightBlue3 : Raphael.getRGB("#9AC0CD "), // 154 192 205
|
|
||||||
LightBlue4 : Raphael.getRGB("#68838B "), // 104 131 139
|
|
||||||
LightCyan1 : Raphael.getRGB("#E0FFFF "), // 224 255 255
|
|
||||||
LightCyan2 : Raphael.getRGB("#D1EEEE "), // 209 238 238
|
|
||||||
LightCyan3 : Raphael.getRGB("#B4CDCD "), // 180 205 205
|
|
||||||
LightCyan4 : Raphael.getRGB("#7A8B8B "), // 122 139 139
|
|
||||||
PaleTurquoise1 : Raphael.getRGB("#BBFFFF "), // 187 255 255
|
|
||||||
PaleTurquoise2 : Raphael.getRGB("#AEEEEE "), // 174 238 238
|
|
||||||
PaleTurquoise3 : Raphael.getRGB("#96CDCD "), // 150 205 205
|
|
||||||
PaleTurquoise4 : Raphael.getRGB("#668B8B "), // 102 139 139
|
|
||||||
CadetBlue1 : Raphael.getRGB("#98F5FF "), // 152 245 255
|
|
||||||
CadetBlue2 : Raphael.getRGB("#8EE5EE "), // 142 229 238
|
|
||||||
CadetBlue3 : Raphael.getRGB("#7AC5CD "), // 122 197 205
|
|
||||||
CadetBlue4 : Raphael.getRGB("#53868B "), // 83 134 139
|
|
||||||
Turquoise1 : Raphael.getRGB("#00F5FF "), // 0 245 255
|
|
||||||
Turquoise2 : Raphael.getRGB("#00E5EE "), // 0 229 238
|
|
||||||
Turquoise3 : Raphael.getRGB("#00C5CD "), // 0 197 205
|
|
||||||
Turquoise4 : Raphael.getRGB("#00868B "), // 0 134 139
|
|
||||||
Cyan1 : Raphael.getRGB("#00FFFF "), // 0 255 255
|
|
||||||
Cyan2 : Raphael.getRGB("#00EEEE "), // 0 238 238
|
|
||||||
Cyan3 : Raphael.getRGB("#00CDCD "), // 0 205 205
|
|
||||||
Cyan4 : Raphael.getRGB("#008B8B "), // 0 139 139
|
|
||||||
DarkSlateGray1 : Raphael.getRGB("#97FFFF "), // 151 255 255
|
|
||||||
DarkSlateGray2 : Raphael.getRGB("#8DEEEE "), // 141 238 238
|
|
||||||
DarkSlateGray3 : Raphael.getRGB("#79CDCD "), // 121 205 205
|
|
||||||
DarkSlateGray4 : Raphael.getRGB("#528B8B "), // 82 139 139
|
|
||||||
Aquamarine1 : Raphael.getRGB("#7FFFD4 "), // 127 255 212
|
|
||||||
Aquamarine2 : Raphael.getRGB("#76EEC6 "), // 118 238 198
|
|
||||||
Aquamarine3 : Raphael.getRGB("#66CDAA "), // 102 205 170
|
|
||||||
Aquamarine4 : Raphael.getRGB("#458B74 "), // 69 139 116
|
|
||||||
DarkSeaGreen1 : Raphael.getRGB("#C1FFC1 "), // 193 255 193
|
|
||||||
DarkSeaGreen2 : Raphael.getRGB("#B4EEB4 "), // 180 238 180
|
|
||||||
DarkSeaGreen3 : Raphael.getRGB("#9BCD9B "), // 155 205 155
|
|
||||||
DarkSeaGreen4 : Raphael.getRGB("#698B69 "), // 105 139 105
|
|
||||||
SeaGreen1 : Raphael.getRGB("#54FF9F "), // 84 255 159
|
|
||||||
SeaGreen2 : Raphael.getRGB("#4EEE94 "), // 78 238 148
|
|
||||||
SeaGreen3 : Raphael.getRGB("#43CD80 "), // 67 205 128
|
|
||||||
SeaGreen4 : Raphael.getRGB("#2E8B57 "), // 46 139 87
|
|
||||||
PaleGreen1 : Raphael.getRGB("#9AFF9A "), // 154 255 154
|
|
||||||
PaleGreen2 : Raphael.getRGB("#90EE90 "), // 144 238 144
|
|
||||||
PaleGreen3 : Raphael.getRGB("#7CCD7C "), // 124 205 124
|
|
||||||
PaleGreen4 : Raphael.getRGB("#548B54 "), // 84 139 84
|
|
||||||
SpringGreen1 : Raphael.getRGB("#00FF7F "), // 0 255 127
|
|
||||||
SpringGreen2 : Raphael.getRGB("#00EE76 "), // 0 238 118
|
|
||||||
SpringGreen3 : Raphael.getRGB("#00CD66 "), // 0 205 102
|
|
||||||
SpringGreen4 : Raphael.getRGB("#008B45 "), // 0 139 69
|
|
||||||
Green1 : Raphael.getRGB("#00FF00 "), // 0 255 0
|
|
||||||
Green2 : Raphael.getRGB("#00EE00 "), // 0 238 0
|
|
||||||
Green3 : Raphael.getRGB("#00CD00 "), // 0 205 0
|
|
||||||
Green4 : Raphael.getRGB("#008B00 "), // 0 139 0
|
|
||||||
Chartreuse1 : Raphael.getRGB("#7FFF00 "), // 127 255 0
|
|
||||||
Chartreuse2 : Raphael.getRGB("#76EE00 "), // 118 238 0
|
|
||||||
Chartreuse3 : Raphael.getRGB("#66CD00 "), // 102 205 0
|
|
||||||
Chartreuse4 : Raphael.getRGB("#458B00 "), // 69 139 0
|
|
||||||
OliveDrab1 : Raphael.getRGB("#C0FF3E "), // 192 255 62
|
|
||||||
OliveDrab2 : Raphael.getRGB("#B3EE3A "), // 179 238 58
|
|
||||||
OliveDrab3 : Raphael.getRGB("#9ACD32 "), // 154 205 50
|
|
||||||
OliveDrab4 : Raphael.getRGB("#698B22 "), // 105 139 34
|
|
||||||
DarkOliveGreen1 : Raphael.getRGB("#CAFF70 "), // 202 255 112
|
|
||||||
DarkOliveGreen2 : Raphael.getRGB("#BCEE68 "), // 188 238 104
|
|
||||||
DarkOliveGreen3 : Raphael.getRGB("#A2CD5A "), // 162 205 90
|
|
||||||
DarkOliveGreen4 : Raphael.getRGB("#6E8B3D "), // 110 139 61
|
|
||||||
Khaki1 : Raphael.getRGB("#FFF68F "), // 255 246 143
|
|
||||||
Khaki2 : Raphael.getRGB("#EEE685 "), // 238 230 133
|
|
||||||
Khaki3 : Raphael.getRGB("#CDC673 "), // 205 198 115
|
|
||||||
Khaki4 : Raphael.getRGB("#8B864E "), // 139 134 78
|
|
||||||
LightGoldenrod1 : Raphael.getRGB("#FFEC8B "), // 255 236 139
|
|
||||||
LightGoldenrod2 : Raphael.getRGB("#EEDC82 "), // 238 220 130
|
|
||||||
LightGoldenrod3 : Raphael.getRGB("#CDBE70 "), // 205 190 112
|
|
||||||
LightGoldenrod4 : Raphael.getRGB("#8B814C "), // 139 129 76
|
|
||||||
LightYellow1 : Raphael.getRGB("#FFFFE0 "), // 255 255 224
|
|
||||||
LightYellow2 : Raphael.getRGB("#EEEED1 "), // 238 238 209
|
|
||||||
LightYellow3 : Raphael.getRGB("#CDCDB4 "), // 205 205 180
|
|
||||||
LightYellow4 : Raphael.getRGB("#8B8B7A "), // 139 139 122
|
|
||||||
Yellow1 : Raphael.getRGB("#FFFF00 "), // 255 255 0
|
|
||||||
Yellow2 : Raphael.getRGB("#EEEE00 "), // 238 238 0
|
|
||||||
Yellow3 : Raphael.getRGB("#CDCD00 "), // 205 205 0
|
|
||||||
Yellow4 : Raphael.getRGB("#8B8B00 "), // 139 139 0
|
|
||||||
Gold1 : Raphael.getRGB("#FFD700 "), // 255 215 0
|
|
||||||
Gold2 : Raphael.getRGB("#EEC900 "), // 238 201 0
|
|
||||||
Gold3 : Raphael.getRGB("#CDAD00 "), // 205 173 0
|
|
||||||
Gold4 : Raphael.getRGB("#8B7500 "), // 139 117 0
|
|
||||||
Goldenrod1 : Raphael.getRGB("#FFC125 "), // 255 193 37
|
|
||||||
Goldenrod2 : Raphael.getRGB("#EEB422 "), // 238 180 34
|
|
||||||
Goldenrod3 : Raphael.getRGB("#CD9B1D "), // 205 155 29
|
|
||||||
Goldenrod4 : Raphael.getRGB("#8B6914 "), // 139 105 20
|
|
||||||
DarkGoldenrod1 : Raphael.getRGB("#FFB90F "), // 255 185 15
|
|
||||||
DarkGoldenrod2 : Raphael.getRGB("#EEAD0E "), // 238 173 14
|
|
||||||
DarkGoldenrod3 : Raphael.getRGB("#CD950C "), // 205 149 12
|
|
||||||
DarkGoldenrod4 : Raphael.getRGB("#8B658B "), // 139 101 8
|
|
||||||
RosyBrown1 : Raphael.getRGB("#FFC1C1 "), // 255 193 193
|
|
||||||
RosyBrown2 : Raphael.getRGB("#EEB4B4 "), // 238 180 180
|
|
||||||
RosyBrown3 : Raphael.getRGB("#CD9B9B "), // 205 155 155
|
|
||||||
RosyBrown4 : Raphael.getRGB("#8B6969 "), // 139 105 105
|
|
||||||
IndianRed1 : Raphael.getRGB("#FF6A6A "), // 255 106 106
|
|
||||||
IndianRed2 : Raphael.getRGB("#EE6363 "), // 238 99 99
|
|
||||||
IndianRed3 : Raphael.getRGB("#CD5555 "), // 205 85 85
|
|
||||||
IndianRed4 : Raphael.getRGB("#8B3A3A "), // 139 58 58
|
|
||||||
Sienna1 : Raphael.getRGB("#FF8247 "), // 255 130 71
|
|
||||||
Sienna2 : Raphael.getRGB("#EE7942 "), // 238 121 66
|
|
||||||
Sienna3 : Raphael.getRGB("#CD6839 "), // 205 104 57
|
|
||||||
Sienna4 : Raphael.getRGB("#8B4726 "), // 139 71 38
|
|
||||||
Burlywood1 : Raphael.getRGB("#FFD39B "), // 255 211 155
|
|
||||||
Burlywood2 : Raphael.getRGB("#EEC591 "), // 238 197 145
|
|
||||||
Burlywood3 : Raphael.getRGB("#CDAA7D "), // 205 170 125
|
|
||||||
Burlywood4 : Raphael.getRGB("#8B7355 "), // 139 115 85
|
|
||||||
Wheat1 : Raphael.getRGB("#FFE7BA "), // 255 231 186
|
|
||||||
Wheat2 : Raphael.getRGB("#EED8AE "), // 238 216 174
|
|
||||||
Wheat3 : Raphael.getRGB("#CDBA96 "), // 205 186 150
|
|
||||||
Wheat4 : Raphael.getRGB("#8B7E66 "), // 139 126 102
|
|
||||||
Tan1 : Raphael.getRGB("#FFA54F "), // 255 165 79
|
|
||||||
Tan2 : Raphael.getRGB("#EE9A49 "), // 238 154 73
|
|
||||||
Tan3 : Raphael.getRGB("#CD853F "), // 205 133 63
|
|
||||||
Tan4 : Raphael.getRGB("#8B5A2B "), // 139 90 43
|
|
||||||
Chocolate1 : Raphael.getRGB("#FF7F24 "), // 255 127 36
|
|
||||||
Chocolate2 : Raphael.getRGB("#EE7621 "), // 238 118 33
|
|
||||||
Chocolate3 : Raphael.getRGB("#CD661D "), // 205 102 29
|
|
||||||
Chocolate4 : Raphael.getRGB("#8B4513 "), // 139 69 19
|
|
||||||
Firebrick1 : Raphael.getRGB("#FF3030 "), // 255 48 48
|
|
||||||
Firebrick2 : Raphael.getRGB("#EE2C2C "), // 238 44 44
|
|
||||||
Firebrick3 : Raphael.getRGB("#CD2626 "), // 205 38 38
|
|
||||||
Firebrick4 : Raphael.getRGB("#8B1A1A "), // 139 26 26
|
|
||||||
Brown1 : Raphael.getRGB("#FF4040 "), // 255 64 64
|
|
||||||
Brown2 : Raphael.getRGB("#EE3B3B "), // 238 59 59
|
|
||||||
Brown3 : Raphael.getRGB("#CD3333 "), // 205 51 51
|
|
||||||
Brown4 : Raphael.getRGB("#8B2323 "), // 139 35 35
|
|
||||||
Salmon1 : Raphael.getRGB("#FF8C69 "), // 255 140 105
|
|
||||||
Salmon2 : Raphael.getRGB("#EE8262 "), // 238 130 98
|
|
||||||
Salmon3 : Raphael.getRGB("#CD7054 "), // 205 112 84
|
|
||||||
Salmon4 : Raphael.getRGB("#8B4C39 "), // 139 76 57
|
|
||||||
LightSalmon1 : Raphael.getRGB("#FFA07A "), // 255 160 122
|
|
||||||
LightSalmon2 : Raphael.getRGB("#EE9572 "), // 238 149 114
|
|
||||||
LightSalmon3 : Raphael.getRGB("#CD8162 "), // 205 129 98
|
|
||||||
LightSalmon4 : Raphael.getRGB("#8B5742 "), // 139 87 66
|
|
||||||
Orange1 : Raphael.getRGB("#FFA500 "), // 255 165 0
|
|
||||||
Orange2 : Raphael.getRGB("#EE9A00 "), // 238 154 0
|
|
||||||
Orange3 : Raphael.getRGB("#CD8500 "), // 205 133 0
|
|
||||||
Orange4 : Raphael.getRGB("#8B5A00 "), // 139 90 0
|
|
||||||
DarkOrange1 : Raphael.getRGB("#FF7F00 "), // 255 127 0
|
|
||||||
DarkOrange2 : Raphael.getRGB("#EE7600 "), // 238 118 0
|
|
||||||
DarkOrange3 : Raphael.getRGB("#CD6600 "), // 205 102 0
|
|
||||||
DarkOrange4 : Raphael.getRGB("#8B4500 "), // 139 69 0
|
|
||||||
Coral1 : Raphael.getRGB("#FF7256 "), // 255 114 86
|
|
||||||
Coral2 : Raphael.getRGB("#EE6A50 "), // 238 106 80
|
|
||||||
Coral3 : Raphael.getRGB("#CD5B45 "), // 205 91 69
|
|
||||||
Coral4 : Raphael.getRGB("#8B3E2F "), // 139 62 47
|
|
||||||
Tomato1 : Raphael.getRGB("#FF6347 "), // 255 99 71
|
|
||||||
Tomato2 : Raphael.getRGB("#EE5C42 "), // 238 92 66
|
|
||||||
Tomato3 : Raphael.getRGB("#CD4F39 "), // 205 79 57
|
|
||||||
Tomato4 : Raphael.getRGB("#8B3626 "), // 139 54 38
|
|
||||||
OrangeRed1 : Raphael.getRGB("#FF4500 "), // 255 69 0
|
|
||||||
OrangeRed2 : Raphael.getRGB("#EE4000 "), // 238 64 0
|
|
||||||
OrangeRed3 : Raphael.getRGB("#CD3700 "), // 205 55 0
|
|
||||||
OrangeRed4 : Raphael.getRGB("#8B2500 "), // 139 37 0
|
|
||||||
Red1 : Raphael.getRGB("#FF0000 "), // 255 0 0
|
|
||||||
Red2 : Raphael.getRGB("#EE0000 "), // 238 0 0
|
|
||||||
Red3 : Raphael.getRGB("#CD0000 "), // 205 0 0
|
|
||||||
Red4 : Raphael.getRGB("#8B0000 "), // 139 0 0
|
|
||||||
DeepPink1 : Raphael.getRGB("#FF1493 "), // 255 20 147
|
|
||||||
DeepPink2 : Raphael.getRGB("#EE1289 "), // 238 18 137
|
|
||||||
DeepPink3 : Raphael.getRGB("#CD1076 "), // 205 16 118
|
|
||||||
DeepPink4 : Raphael.getRGB("#8B0A50 "), // 139 10 80
|
|
||||||
HotPink1 : Raphael.getRGB("#FF6EB4 "), // 255 110 180
|
|
||||||
HotPink2 : Raphael.getRGB("#EE6AA7 "), // 238 106 167
|
|
||||||
HotPink3 : Raphael.getRGB("#CD6090 "), // 205 96 144
|
|
||||||
HotPink4 : Raphael.getRGB("#8B3A62 "), // 139 58 98
|
|
||||||
Pink1 : Raphael.getRGB("#FFB5C5 "), // 255 181 197
|
|
||||||
Pink2 : Raphael.getRGB("#EEA9B8 "), // 238 169 184
|
|
||||||
Pink3 : Raphael.getRGB("#CD919E "), // 205 145 158
|
|
||||||
Pink4 : Raphael.getRGB("#8B636C "), // 139 99 108
|
|
||||||
LightPink1 : Raphael.getRGB("#FFAEB9 "), // 255 174 185
|
|
||||||
LightPink2 : Raphael.getRGB("#EEA2AD "), // 238 162 173
|
|
||||||
LightPink3 : Raphael.getRGB("#CD8C95 "), // 205 140 149
|
|
||||||
LightPink4 : Raphael.getRGB("#8B5F65 "), // 139 95 101
|
|
||||||
PaleVioletRed1 : Raphael.getRGB("#FF82AB "), // 255 130 171
|
|
||||||
PaleVioletRed2 : Raphael.getRGB("#EE799F "), // 238 121 159
|
|
||||||
PaleVioletRed3 : Raphael.getRGB("#CD6889 "), // 205 104 137
|
|
||||||
PaleVioletRed4 : Raphael.getRGB("#8B475D "), // 139 71 93
|
|
||||||
Maroon1 : Raphael.getRGB("#FF34B3 "), // 255 52 179
|
|
||||||
Maroon2 : Raphael.getRGB("#EE30A7 "), // 238 48 167
|
|
||||||
Maroon3 : Raphael.getRGB("#CD2990 "), // 205 41 144
|
|
||||||
Maroon4 : Raphael.getRGB("#8B1C62 "), // 139 28 98
|
|
||||||
VioletRed1 : Raphael.getRGB("#FF3E96 "), // 255 62 150
|
|
||||||
VioletRed2 : Raphael.getRGB("#EE3A8C "), // 238 58 140
|
|
||||||
VioletRed3 : Raphael.getRGB("#CD3278 "), // 205 50 120
|
|
||||||
VioletRed4 : Raphael.getRGB("#8B2252 "), // 139 34 82
|
|
||||||
Magenta1 : Raphael.getRGB("#FF00FF "), // 255 0 255
|
|
||||||
Magenta2 : Raphael.getRGB("#EE00EE "), // 238 0 238
|
|
||||||
Magenta3 : Raphael.getRGB("#CD00CD "), // 205 0 205
|
|
||||||
Magenta4 : Raphael.getRGB("#8B008B "), // 139 0 139
|
|
||||||
Orchid1 : Raphael.getRGB("#FF83FA "), // 255 131 250
|
|
||||||
Orchid2 : Raphael.getRGB("#EE7AE9 "), // 238 122 233
|
|
||||||
Orchid3 : Raphael.getRGB("#CD69C9 "), // 205 105 201
|
|
||||||
Orchid4 : Raphael.getRGB("#8B4789 "), // 139 71 137
|
|
||||||
Plum1 : Raphael.getRGB("#FFBBFF "), // 255 187 255
|
|
||||||
Plum2 : Raphael.getRGB("#EEAEEE "), // 238 174 238
|
|
||||||
Plum3 : Raphael.getRGB("#CD96CD "), // 205 150 205
|
|
||||||
Plum4 : Raphael.getRGB("#8B668B "), // 139 102 139
|
|
||||||
MediumOrchid1 : Raphael.getRGB("#E066FF "), // 224 102 255
|
|
||||||
MediumOrchid2 : Raphael.getRGB("#D15FEE "), // 209 95 238
|
|
||||||
MediumOrchid3 : Raphael.getRGB("#B452CD "), // 180 82 205
|
|
||||||
MediumOrchid4 : Raphael.getRGB("#7A378B "), // 122 55 139
|
|
||||||
DarkOrchid1 : Raphael.getRGB("#BF3EFF "), // 191 62 255
|
|
||||||
DarkOrchid2 : Raphael.getRGB("#B23AEE "), // 178 58 238
|
|
||||||
DarkOrchid3 : Raphael.getRGB("#9A32CD "), // 154 50 205
|
|
||||||
DarkOrchid4 : Raphael.getRGB("#68228B "), // 104 34 139
|
|
||||||
Purple1 : Raphael.getRGB("#9B30FF "), // 155 48 255
|
|
||||||
Purple2 : Raphael.getRGB("#912CEE "), // 145 44 238
|
|
||||||
Purple3 : Raphael.getRGB("#7D26CD "), // 125 38 205
|
|
||||||
Purple4 : Raphael.getRGB("#551A8B "), // 85 26 139
|
|
||||||
MediumPurple1 : Raphael.getRGB("#AB82FF "), // 171 130 255
|
|
||||||
MediumPurple2 : Raphael.getRGB("#9F79EE "), // 159 121 238
|
|
||||||
MediumPurple3 : Raphael.getRGB("#8968CD "), // 137 104 205
|
|
||||||
MediumPurple4 : Raphael.getRGB("#5D478B "), // 93 71 139
|
|
||||||
Thistle1 : Raphael.getRGB("#FFE1FF "), // 255 225 255
|
|
||||||
Thistle2 : Raphael.getRGB("#EED2EE "), // 238 210 238
|
|
||||||
Thistle3 : Raphael.getRGB("#CDB5CD "), // 205 181 205
|
|
||||||
Thistle4 : Raphael.getRGB("#8B7B8B "), // 139 123 139
|
|
||||||
grey11 : Raphael.getRGB("#1C1C1C "), // 28 28 28
|
|
||||||
grey21 : Raphael.getRGB("#363636 "), // 54 54 54
|
|
||||||
grey31 : Raphael.getRGB("#4F4F4F "), // 79 79 79
|
|
||||||
grey41 : Raphael.getRGB("#696969 "), // 105 105 105
|
|
||||||
grey51 : Raphael.getRGB("#828282 "), // 130 130 130
|
|
||||||
grey61 : Raphael.getRGB("#9C9C9C "), // 156 156 156
|
|
||||||
grey71 : Raphael.getRGB("#B5B5B5 "), // 181 181 181
|
|
||||||
gray81 : Raphael.getRGB("#CFCFCF "), // 207 207 207
|
|
||||||
gray91 : Raphael.getRGB("#E8E8E8 "), // 232 232 232
|
|
||||||
DarkGrey : Raphael.getRGB("#A9A9A9 "), // 169 169 169
|
|
||||||
DarkBlue : Raphael.getRGB("#00008B "), // 0 0 139
|
|
||||||
DarkCyan : Raphael.getRGB("#008B8B "), // 0 139 139
|
|
||||||
DarkMagenta : Raphael.getRGB("#8B008B "), // 139 0 139
|
|
||||||
DarkRed : Raphael.getRGB("#8B0000 "), // 139 0 0
|
|
||||||
LightGreen : Raphael.getRGB("#90EE90 "), // 144 238 144
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
get: function(R, G, B){
|
|
||||||
return Raphael.getRGB("rgb(" + R + ", " + G + ", " + B + ")");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,270 +0,0 @@
|
|||||||
/**
|
|
||||||
* Word wrapping
|
|
||||||
*
|
|
||||||
* @author (Javascript) Dmitry Farafonov
|
|
||||||
*/
|
|
||||||
|
|
||||||
var AttributedStringIterator = function(text){
|
|
||||||
//this.text = this.rtrim(this.ltrim(text));
|
|
||||||
text = text.replace(/(\s)+/, " ");
|
|
||||||
this.text = this.rtrim(text);
|
|
||||||
/*
|
|
||||||
if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) {
|
|
||||||
throw new IllegalArgumentException("Invalid substring range");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
this.beginIndex = 0;
|
|
||||||
this.endIndex = this.text.length;
|
|
||||||
this.currentIndex = this.beginIndex;
|
|
||||||
|
|
||||||
//console.group("[AttributedStringIterator]");
|
|
||||||
var i = 0;
|
|
||||||
var string = this.text;
|
|
||||||
var fullPos = 0;
|
|
||||||
|
|
||||||
//console.log("string: \"" + string + "\", length: " + string.length);
|
|
||||||
this.startWordOffsets = [];
|
|
||||||
this.startWordOffsets.push(fullPos);
|
|
||||||
|
|
||||||
// TODO: remove i 1000
|
|
||||||
while (i<1000) {
|
|
||||||
var pos = string.search(/[ \t\n\f-\.\,]/);
|
|
||||||
if (pos == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// whitespace start
|
|
||||||
fullPos += pos;
|
|
||||||
string = string.substr(pos);
|
|
||||||
////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string);
|
|
||||||
|
|
||||||
// remove whitespaces
|
|
||||||
var pos = string.search(/[^ \t\n\f-\.\,]/);
|
|
||||||
if (pos == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// whitespace end
|
|
||||||
fullPos += pos;
|
|
||||||
string = string.substr(pos);
|
|
||||||
|
|
||||||
////console.log("fullPos: " + fullPos);
|
|
||||||
this.startWordOffsets.push(fullPos);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//console.log("startWordOffsets: ", this.startWordOffsets);
|
|
||||||
//console.groupEnd();
|
|
||||||
};
|
|
||||||
AttributedStringIterator.prototype = {
|
|
||||||
getEndIndex: function(pos){
|
|
||||||
if (typeof(pos) == "undefined")
|
|
||||||
return this.endIndex;
|
|
||||||
|
|
||||||
var string = this.text.substr(pos, this.endIndex - pos);
|
|
||||||
|
|
||||||
var posEndOfLine = string.search(/[\n]/);
|
|
||||||
if (posEndOfLine == -1)
|
|
||||||
return this.endIndex;
|
|
||||||
else
|
|
||||||
return pos + posEndOfLine;
|
|
||||||
},
|
|
||||||
getBeginIndex: function(){
|
|
||||||
return this.beginIndex;
|
|
||||||
},
|
|
||||||
isWhitespace: function(pos){
|
|
||||||
var str = this.text[pos];
|
|
||||||
var whitespaceChars = " \t\n\f";
|
|
||||||
|
|
||||||
return (whitespaceChars.indexOf(str) != -1);
|
|
||||||
},
|
|
||||||
isNewLine: function(pos){
|
|
||||||
var str = this.text[pos];
|
|
||||||
var whitespaceChars = "\n";
|
|
||||||
|
|
||||||
return (whitespaceChars.indexOf(str) != -1);
|
|
||||||
},
|
|
||||||
preceding: function(pos){
|
|
||||||
//console.group("[AttributedStringIterator.preceding]");
|
|
||||||
for(var i in this.startWordOffsets) {
|
|
||||||
var startWordOffset = this.startWordOffsets[i];
|
|
||||||
if (pos < startWordOffset && i>0) {
|
|
||||||
//console.log("startWordOffset: " + this.startWordOffsets[i-1]);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i-1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log("pos: " + pos);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
},
|
|
||||||
following: function(pos){
|
|
||||||
//console.group("[AttributedStringIterator.following]");
|
|
||||||
for(var i in this.startWordOffsets) {
|
|
||||||
var startWordOffset = this.startWordOffsets[i];
|
|
||||||
if (pos < startWordOffset && i>0) {
|
|
||||||
//console.log("startWordOffset: " + this.startWordOffsets[i]);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log("pos: " + pos);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
},
|
|
||||||
ltrim: function(str){
|
|
||||||
var patt2=/^\s+/g;
|
|
||||||
return str.replace(patt2, "");
|
|
||||||
},
|
|
||||||
rtrim: function(str){
|
|
||||||
var patt2=/\s+$/g;
|
|
||||||
return str.replace(patt2, "");
|
|
||||||
},
|
|
||||||
getLayout: function(start, limit){
|
|
||||||
return this.text.substr(start, limit - start);
|
|
||||||
},
|
|
||||||
getCharAtPos: function(pos) {
|
|
||||||
return this.text[pos];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var LineBreakMeasurer = function(paper, x, y, text, fontAttrs){
|
|
||||||
this.paper = paper;
|
|
||||||
this.text = new AttributedStringIterator(text);
|
|
||||||
this.fontAttrs = fontAttrs;
|
|
||||||
|
|
||||||
if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) {
|
|
||||||
throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"};
|
|
||||||
}
|
|
||||||
|
|
||||||
//this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs);
|
|
||||||
this.limit = this.text.getEndIndex();
|
|
||||||
this.pos = this.start = this.text.getBeginIndex();
|
|
||||||
|
|
||||||
this.rafaelTextObject = this.paper.text(x, y, this.text.text).attr(fontAttrs).attr("text-anchor", "start");
|
|
||||||
this.svgTextObject = this.rafaelTextObject[0];
|
|
||||||
};
|
|
||||||
LineBreakMeasurer.prototype = {
|
|
||||||
nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) {
|
|
||||||
//console.group("[nextOffset]");
|
|
||||||
var nextOffset = this.pos;
|
|
||||||
if (this.pos < this.limit) {
|
|
||||||
if (offsetLimit <= this.pos) {
|
|
||||||
throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"};
|
|
||||||
}
|
|
||||||
|
|
||||||
var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth);
|
|
||||||
//charAtMaxAdvance --;
|
|
||||||
//console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]");
|
|
||||||
|
|
||||||
if (charAtMaxAdvance == this.limit) {
|
|
||||||
nextOffset = this.limit;
|
|
||||||
//console.log("charAtMaxAdvance == this.limit");
|
|
||||||
} else if (this.text.isNewLine(charAtMaxAdvance)) {
|
|
||||||
//console.log("isNewLine");
|
|
||||||
nextOffset = charAtMaxAdvance+1;
|
|
||||||
} else if (this.text.isWhitespace(charAtMaxAdvance)) {
|
|
||||||
// TODO: find next noSpaceChar
|
|
||||||
//return nextOffset;
|
|
||||||
nextOffset = this.text.following(charAtMaxAdvance);
|
|
||||||
} else {
|
|
||||||
// Break is in a word; back up to previous break.
|
|
||||||
/*
|
|
||||||
var testPos = charAtMaxAdvance + 1;
|
|
||||||
if (testPos == this.limit) {
|
|
||||||
console.error("hbz...");
|
|
||||||
} else {
|
|
||||||
nextOffset = this.text.preceding(charAtMaxAdvance);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
nextOffset = this.text.preceding(charAtMaxAdvance);
|
|
||||||
|
|
||||||
if (nextOffset <= this.pos) {
|
|
||||||
nextOffset = Math.max(this.pos+1, charAtMaxAdvance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nextOffset > offsetLimit) {
|
|
||||||
nextOffset = offsetLimit;
|
|
||||||
}
|
|
||||||
//console.log("nextOffset: " + nextOffset);
|
|
||||||
//console.groupEnd();
|
|
||||||
return nextOffset;
|
|
||||||
},
|
|
||||||
nextLayout: function(wrappingWidth) {
|
|
||||||
//console.groupCollapsed("[nextLayout]");
|
|
||||||
if (this.pos < this.limit) {
|
|
||||||
var requireNextWord = false;
|
|
||||||
var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord);
|
|
||||||
//console.log("layoutLimit:", layoutLimit);
|
|
||||||
if (layoutLimit == this.pos) {
|
|
||||||
//console.groupEnd();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var result = this.text.getLayout(this.pos, layoutLimit);
|
|
||||||
//console.log("layout: \"" + result + "\"");
|
|
||||||
|
|
||||||
// remove end of line
|
|
||||||
|
|
||||||
//var posEndOfLine = this.text.getEndIndex(this.pos);
|
|
||||||
//if (posEndOfLine < result.length)
|
|
||||||
// result = result.substr(0, posEndOfLine);
|
|
||||||
|
|
||||||
this.pos = layoutLimit;
|
|
||||||
|
|
||||||
//console.groupEnd();
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
//console.groupEnd();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getLineBreakIndex: function(pos, wrappingWidth) {
|
|
||||||
//console.group("[getLineBreakIndex]");
|
|
||||||
//console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\"");
|
|
||||||
|
|
||||||
var bb = this.rafaelTextObject.getBBox();
|
|
||||||
|
|
||||||
var charNum = -1;
|
|
||||||
try {
|
|
||||||
var svgPoint = this.svgTextObject.getStartPositionOfChar(pos);
|
|
||||||
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue});
|
|
||||||
svgPoint.x = svgPoint.x + wrappingWidth;
|
|
||||||
//svgPoint.y = bb.y;
|
|
||||||
//console.log("svgPoint:", svgPoint);
|
|
||||||
|
|
||||||
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red});
|
|
||||||
|
|
||||||
charNum = this.svgTextObject.getCharNumAtPosition(svgPoint);
|
|
||||||
} catch (e){
|
|
||||||
console.warn("getStartPositionOfChar error, pos:" + pos);
|
|
||||||
/*
|
|
||||||
var testPos = pos + 1;
|
|
||||||
if (testPos < this.limit) {
|
|
||||||
return testPos
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
//console.log("charNum:", charNum);
|
|
||||||
if (charNum == -1) {
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.text.getEndIndex(pos);
|
|
||||||
} else {
|
|
||||||
// When case there is new line between pos and charnum then use this new line
|
|
||||||
var newLineIndex = this.text.getEndIndex(pos);
|
|
||||||
if (newLineIndex < charNum ) {
|
|
||||||
console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "?") + "\"");
|
|
||||||
//console.groupEnd();
|
|
||||||
|
|
||||||
return newLineIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1);
|
|
||||||
var charAtMaxAdvance = this.text.getCharAtPos(charNum);
|
|
||||||
//console.log("!!charAtMaxAdvance: " + charAtMaxAdvance);
|
|
||||||
//console.groupEnd();
|
|
||||||
return charNum;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getPosition: function() {
|
|
||||||
return this.pos;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,387 +0,0 @@
|
|||||||
/**
|
|
||||||
* Class to generate polyline
|
|
||||||
*
|
|
||||||
* @author Dmitry Farafonov
|
|
||||||
*/
|
|
||||||
|
|
||||||
var ANCHOR_TYPE= {
|
|
||||||
main: "main",
|
|
||||||
middle: "middle",
|
|
||||||
first: "first",
|
|
||||||
last: "last"
|
|
||||||
};
|
|
||||||
|
|
||||||
function Anchor(uuid, type, x, y) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.x = x
|
|
||||||
this.y = y
|
|
||||||
this.type = (type == ANCHOR_TYPE.middle) ? ANCHOR_TYPE.middle : ANCHOR_TYPE.main;
|
|
||||||
};
|
|
||||||
Anchor.prototype = {
|
|
||||||
uuid: null,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
type: ANCHOR_TYPE.main,
|
|
||||||
isFirst: false,
|
|
||||||
isLast: false,
|
|
||||||
ndex: 0,
|
|
||||||
typeIndex: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
function Polyline(uuid, points, strokeWidth) {
|
|
||||||
/* Array on coordinates:
|
|
||||||
* points: [{x: 410, y: 110}, 1
|
|
||||||
* {x: 570, y: 110}, 1 2
|
|
||||||
* {x: 620, y: 240}, 2 3
|
|
||||||
* {x: 750, y: 270}, 3 4
|
|
||||||
* {x: 650, y: 370}]; 4
|
|
||||||
*/
|
|
||||||
this.points = points;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* path for graph
|
|
||||||
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
|
|
||||||
*/
|
|
||||||
this.path = [];
|
|
||||||
|
|
||||||
this.anchors = [];
|
|
||||||
|
|
||||||
if (strokeWidth) this.strokeWidth = strokeWidth;
|
|
||||||
|
|
||||||
this.closePath = false;
|
|
||||||
|
|
||||||
this.init();
|
|
||||||
};
|
|
||||||
|
|
||||||
Polyline.prototype = {
|
|
||||||
id: null,
|
|
||||||
points: [],
|
|
||||||
path: [],
|
|
||||||
anchors: [],
|
|
||||||
strokeWidth: 1,
|
|
||||||
radius: 15,
|
|
||||||
showDetails: false,
|
|
||||||
element: null,
|
|
||||||
isDefaultConditionAvailable: false,
|
|
||||||
closePath: false,
|
|
||||||
|
|
||||||
init: function(points){
|
|
||||||
var linesCount = this.getLinesCount();
|
|
||||||
if (linesCount < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.normalizeCoordinates();
|
|
||||||
|
|
||||||
// create anchors
|
|
||||||
|
|
||||||
this.pushAnchor(ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1);
|
|
||||||
|
|
||||||
for(var i = 1; i < linesCount; i++){
|
|
||||||
var line1 = this.getLine(i-1),
|
|
||||||
line2 = this.getLine(i);
|
|
||||||
|
|
||||||
//this.pushAnchor(ANCHOR_TYPE.middle, line1.x1 + line1.x2-line1.x1, line1.y1 + line1.y2-line1.y1);
|
|
||||||
this.pushAnchor(ANCHOR_TYPE.main, line1.x2, line1.y2);
|
|
||||||
//this.pushAnchor(ANCHOR_TYPE.middle, line2.x1 + line2.x2-line2.x1, line2.y1 + line2.y2-line2.y1);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pushAnchor(ANCHOR_TYPE.last, this.getLine(linesCount-1).x2, this.getLine(linesCount-1).y2);
|
|
||||||
|
|
||||||
this.rebuildPath();
|
|
||||||
},
|
|
||||||
|
|
||||||
normalizeCoordinates: function(){
|
|
||||||
for(var i=0; i < this.points.length; i++){
|
|
||||||
this.points[i].x = parseFloat(this.points[i].x);
|
|
||||||
this.points[i].y = parseFloat(this.points[i].y);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getLinesCount: function(){
|
|
||||||
return this.points.length-1;
|
|
||||||
},
|
|
||||||
_getLine: function(i){
|
|
||||||
return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i+1].x, y2: this.points[i+1].y};
|
|
||||||
},
|
|
||||||
getLine: function(i){
|
|
||||||
var line = this._getLine(i);
|
|
||||||
line.angle = this.getLineAngle(i) ;
|
|
||||||
return line;
|
|
||||||
},
|
|
||||||
getLineAngle: function(i){
|
|
||||||
var line = this._getLine(i);
|
|
||||||
return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
|
|
||||||
},
|
|
||||||
getLineLengthX: function(i){
|
|
||||||
var line = this.getLine(i);
|
|
||||||
return (line.x2 - line.x1);
|
|
||||||
},
|
|
||||||
getLineLengthY: function(i){
|
|
||||||
var line = this.getLine(i);
|
|
||||||
return (line.y2 - line.y1);
|
|
||||||
},
|
|
||||||
getLineLength: function(i){
|
|
||||||
var line = this.getLine(i);
|
|
||||||
return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2));
|
|
||||||
},
|
|
||||||
|
|
||||||
getAnchors: function(){
|
|
||||||
// ������� ��������������� ������
|
|
||||||
// ????
|
|
||||||
return this.anchors;
|
|
||||||
},
|
|
||||||
getAnchorsCount: function(type){
|
|
||||||
if (!type)
|
|
||||||
return this.anchors.length;
|
|
||||||
else {
|
|
||||||
var count = 0;
|
|
||||||
for(var i=0; i < this.getAnchorsCount(); i++){
|
|
||||||
var anchor = this.anchors[i];
|
|
||||||
if (anchor.getType() == type) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
pushAnchor: function(type, x, y, index){
|
|
||||||
if (type == ANCHOR_TYPE.first) {
|
|
||||||
index = 0;
|
|
||||||
typeIndex = 0;
|
|
||||||
} else if (type == ANCHOR_TYPE.last) {
|
|
||||||
index = this.getAnchorsCount();
|
|
||||||
typeIndex = 0;
|
|
||||||
} else if (!index) {
|
|
||||||
index = this.anchors.length;
|
|
||||||
} else {
|
|
||||||
// ��������� anchors, �������� ������� ��� �������, ������� � index
|
|
||||||
//var anchor = this.getAnchor()
|
|
||||||
for(var i=0; i < this.getAnchorsCount(); i++){
|
|
||||||
var anchor = this.anchors[i];
|
|
||||||
if (anchor.index > index) {
|
|
||||||
anchor.index++;
|
|
||||||
anchor.typeIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var anchor = new Anchor(this.id, ANCHOR_TYPE.main, x, y, index, typeIndex);
|
|
||||||
|
|
||||||
this.anchors.push(anchor);
|
|
||||||
},
|
|
||||||
|
|
||||||
getAnchor: function(position){
|
|
||||||
return this.anchors[position];
|
|
||||||
},
|
|
||||||
|
|
||||||
getAnchorByType: function(type, position){
|
|
||||||
if (type == ANCHOR_TYPE.first)
|
|
||||||
return this.anchors[0];
|
|
||||||
if (type == ANCHOR_TYPE.last)
|
|
||||||
return this.anchors[this.getAnchorsCount()-1];
|
|
||||||
|
|
||||||
for(var i=0; i < this.getAnchorsCount(); i++){
|
|
||||||
var anchor = this.anchors[i];
|
|
||||||
if (anchor.type == type) {
|
|
||||||
if( position == anchor.position)
|
|
||||||
return anchor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
addNewPoint: function(position, x, y){
|
|
||||||
//
|
|
||||||
for(var i = 0; i < this.getLinesCount(); i++){
|
|
||||||
var line = this.getLine(i);
|
|
||||||
if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) {
|
|
||||||
this.points.splice(i+1,0,{x: x, y: y});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rebuildPath();
|
|
||||||
},
|
|
||||||
|
|
||||||
rebuildPath: function(){
|
|
||||||
var path = [];
|
|
||||||
|
|
||||||
for(var i = 0; i < this.getAnchorsCount(); i++){
|
|
||||||
var anchor = this.getAnchor(i);
|
|
||||||
|
|
||||||
var pathType = ""
|
|
||||||
if (i==0)
|
|
||||||
pathType = "M";
|
|
||||||
else
|
|
||||||
pathType = "L";
|
|
||||||
|
|
||||||
// TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous
|
|
||||||
|
|
||||||
var targetX = anchor.x, targetY = anchor.y;
|
|
||||||
if (i>0 && i < this.getAnchorsCount()-1) {
|
|
||||||
// get new x,y
|
|
||||||
var cx = anchor.x, cy = anchor.y;
|
|
||||||
|
|
||||||
// pivot point of prev line
|
|
||||||
var AO = this.getLineLength(i-1);
|
|
||||||
if (AO < this.radius) {
|
|
||||||
AO = this.radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
|
|
||||||
//console.log("isDefaultConditionAvailable", this.isDefaultConditionAvailable);
|
|
||||||
|
|
||||||
var ED = this.getLineLengthY(i-1) * this.radius / AO;
|
|
||||||
var OD = this.getLineLengthX(i-1) * this.radius / AO;
|
|
||||||
targetX = anchor.x - OD;
|
|
||||||
targetY = anchor.y - ED;
|
|
||||||
|
|
||||||
if (AO < 2*this.radius && i>1) {
|
|
||||||
targetX = anchor.x - this.getLineLengthX(i-1)/2;
|
|
||||||
targetY = anchor.y - this.getLineLengthY(i-1)/2;;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pivot point of next line
|
|
||||||
var AO = this.getLineLength(i);
|
|
||||||
if (AO < this.radius) {
|
|
||||||
AO = this.radius;
|
|
||||||
}
|
|
||||||
var ED = this.getLineLengthY(i) * this.radius / AO;
|
|
||||||
var OD = this.getLineLengthX(i) * this.radius / AO;
|
|
||||||
var nextSrcX = anchor.x + OD;
|
|
||||||
var nextSrcY = anchor.y + ED;
|
|
||||||
|
|
||||||
if (AO < 2*this.radius && i<this.getAnchorsCount()-2) {
|
|
||||||
nextSrcX = anchor.x + this.getLineLengthX(i)/2;
|
|
||||||
nextSrcY = anchor.y + this.getLineLengthY(i)/2;;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var dx0 = (cx - targetX) / 3,
|
|
||||||
dy0 = (cy - targetY) / 3,
|
|
||||||
ax = cx - dx0,
|
|
||||||
ay = cy - dy0,
|
|
||||||
|
|
||||||
dx1 = (cx - nextSrcX) / 3,
|
|
||||||
dy1 = (cy - nextSrcY) / 3,
|
|
||||||
bx = cx - dx1,
|
|
||||||
by = cy - dy1,
|
|
||||||
|
|
||||||
zx=nextSrcX, zy=nextSrcY;
|
|
||||||
|
|
||||||
if (this.showDetails) {
|
|
||||||
var c = ProcessDiagramCanvas.g.path("M"+targetX+","+targetY+"L"+ax+","+ay).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
|
|
||||||
var c = ProcessDiagramCanvas.g.path("M"+nextSrcX+","+nextSrcY+"L"+bx+","+by).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
|
|
||||||
var c = ProcessDiagramCanvas.g.ellipse(ax, ay, 2, 2).attr({stroke: Color.SlateGrey});
|
|
||||||
var c = ProcessDiagramCanvas.g.ellipse(bx, by, 2, 2).attr({stroke: Color.SlateGrey});
|
|
||||||
var c = ProcessDiagramCanvas.g.ellipse(cx, cy, this.radius, this.radius).attr({stroke: Color.Gainsboro});
|
|
||||||
var c = ProcessDiagramCanvas.g.ellipse(targetX, targetY, 2, 2).attr({fill: Color.red});
|
|
||||||
var c = ProcessDiagramCanvas.g.ellipse(nextSrcX, nextSrcY, 2, 2).attr({fill: Color.red});
|
|
||||||
}
|
|
||||||
} else if (i==1 && this.getAnchorsCount() == 2){
|
|
||||||
var AO = this.getLineLength(i-1);
|
|
||||||
if (AO < this.radius) {
|
|
||||||
AO = this.radius;
|
|
||||||
}
|
|
||||||
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
|
|
||||||
//console.log("-- isDefaultConditionAvailable", this.isDefaultConditionAvailable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// anti smoothing
|
|
||||||
if (this.strokeWidth%2 == 1) {
|
|
||||||
targetX += 0.5;
|
|
||||||
targetY += 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
path.push([pathType, targetX, targetY]);
|
|
||||||
|
|
||||||
if (i>0 && i < this.getAnchorsCount()-1) {
|
|
||||||
path.push(["C", ax, ay, bx, by, zx, zy]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.closePath) {
|
|
||||||
console.log("closePath:", this.closePath);
|
|
||||||
path.push(["Z"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.path = path;
|
|
||||||
},
|
|
||||||
|
|
||||||
transform: function(transformation){
|
|
||||||
this.element.transform(transformation);
|
|
||||||
},
|
|
||||||
attr: function(attrs){
|
|
||||||
//console.log("attrs: " +attrs, "", this.element);
|
|
||||||
// TODO: foreach and set each
|
|
||||||
this.element.attr(attrs);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function Polygone(points, strokeWidth) {
|
|
||||||
/* Array on coordinates:
|
|
||||||
* points: [{x: 410, y: 110}, 1
|
|
||||||
* {x: 570, y: 110}, 1 2
|
|
||||||
* {x: 620, y: 240}, 2 3
|
|
||||||
* {x: 750, y: 270}, 3 4
|
|
||||||
* {x: 650, y: 370}]; 4
|
|
||||||
*/
|
|
||||||
this.points = points;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* path for graph
|
|
||||||
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
|
|
||||||
*/
|
|
||||||
this.path = [];
|
|
||||||
|
|
||||||
this.anchors = [];
|
|
||||||
|
|
||||||
if (strokeWidth) this.strokeWidth = strokeWidth;
|
|
||||||
|
|
||||||
this.closePath = true;
|
|
||||||
this.init();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Poligone is inherited from Poliline: draws closedPath of polyline
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Foo = function () { };
|
|
||||||
Foo.prototype = Polyline.prototype;
|
|
||||||
|
|
||||||
Polygone.prototype = new Foo();
|
|
||||||
|
|
||||||
Polygone.prototype.rebuildPath = function(){
|
|
||||||
var path = [];
|
|
||||||
//console.log("Polygone rebuildPath");
|
|
||||||
for(var i = 0; i < this.getAnchorsCount(); i++){
|
|
||||||
var anchor = this.getAnchor(i);
|
|
||||||
|
|
||||||
var pathType = ""
|
|
||||||
if (i==0)
|
|
||||||
pathType = "M";
|
|
||||||
else
|
|
||||||
pathType = "L";
|
|
||||||
|
|
||||||
var targetX = anchor.x, targetY = anchor.y;
|
|
||||||
|
|
||||||
// anti smoothing
|
|
||||||
if (this.strokeWidth%2 == 1) {
|
|
||||||
targetX += 0.5;
|
|
||||||
targetY += 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
path.push([pathType, targetX, targetY]);
|
|
||||||
}
|
|
||||||
if (this.closePath)
|
|
||||||
path.push(["Z"]);
|
|
||||||
|
|
||||||
this.path = path;
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
Polygone.prototype.transform = function(transformation){
|
|
||||||
this.element.transform(transformation);
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the jquery plugin "asyncQueue".
|
|
||||||
*
|
|
||||||
* (c) Sebastien Roch <roch.sebastien@gmail.com>
|
|
||||||
* @author (parallel) Dmitry Farafonov
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
(function($){
|
|
||||||
$.AsyncQueue = function() {
|
|
||||||
var that = this,
|
|
||||||
queue = [],
|
|
||||||
completeFunc,
|
|
||||||
failureFunc,
|
|
||||||
paused = false,
|
|
||||||
lastCallbackData,
|
|
||||||
_run,
|
|
||||||
_complete,
|
|
||||||
inQueue = 0,
|
|
||||||
defaultTimeOut = 10;
|
|
||||||
|
|
||||||
_run = function() {
|
|
||||||
var f = queue.shift();
|
|
||||||
|
|
||||||
if (f) {
|
|
||||||
inQueue++;
|
|
||||||
setTimeout(function(){
|
|
||||||
f.fn.apply(that, [that]);
|
|
||||||
|
|
||||||
if (!f.isParallel)
|
|
||||||
if (paused === false) {
|
|
||||||
_run();
|
|
||||||
}
|
|
||||||
inQueue --;
|
|
||||||
if (inQueue == 0 && queue.length == 0)
|
|
||||||
_complete();
|
|
||||||
}, f.timeOut);
|
|
||||||
|
|
||||||
if (f.isParallel)
|
|
||||||
if (paused === false) {
|
|
||||||
_run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_complete = function(){
|
|
||||||
if (completeFunc)
|
|
||||||
completeFunc.apply(that, [that]);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.onComplete = function(func) {
|
|
||||||
completeFunc = func;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.onFailure = function(func) {
|
|
||||||
failureFunc = func;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.add = function(func) {
|
|
||||||
// TODO: add callback for queue[i] complete
|
|
||||||
|
|
||||||
var obj = arguments[0];
|
|
||||||
if (obj && Object.prototype.toString.call(obj) === "[object Array]") {
|
|
||||||
var fn = arguments[1];
|
|
||||||
var timeOut = (typeof(arguments[2]) != "undefined")? arguments[2] : defaultTimeOut;
|
|
||||||
if (typeof(fn) == "function") {
|
|
||||||
for(var i = 0; i < obj.length; i++) {
|
|
||||||
var f = function(objx){
|
|
||||||
queue.push({isParallel: true, fn: function(){fn.apply(that, [that, objx]);}, timeOut: timeOut});
|
|
||||||
}(obj[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var fn = arguments[0];
|
|
||||||
var timeOut = (typeof(arguments[1]) != "undefined")? arguments[2] : defaultTimeOut;
|
|
||||||
queue.push({isParallel: false, fn: func, timeOut: timeOut});
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.addParallel = function(func, timeOut) {
|
|
||||||
// TODO: add callback for queue[i] complete
|
|
||||||
|
|
||||||
queue.push({isParallel: true, fn: func, timeOut: timeOut});
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.storeData = function(dataObject) {
|
|
||||||
lastCallbackData = dataObject;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.lastCallbackData = function () {
|
|
||||||
return lastCallbackData;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.run = function() {
|
|
||||||
paused = false;
|
|
||||||
_run();
|
|
||||||
};
|
|
||||||
|
|
||||||
this.pause = function () {
|
|
||||||
paused = true;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.failure = function() {
|
|
||||||
paused = true;
|
|
||||||
if (failureFunc) {
|
|
||||||
var args = [that];
|
|
||||||
for(i = 0; i < arguments.length; i++) {
|
|
||||||
args.push(arguments[i]);
|
|
||||||
}
|
|
||||||
failureFunc.apply(that, args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.size = function(){
|
|
||||||
return queue.length;
|
|
||||||
};
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
})(jQuery);
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* @ Dmitry Farafonov
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($){
|
|
||||||
$.ProgressBar = function(options) {
|
|
||||||
this.element = $(options.boundingBox);
|
|
||||||
if (options.on && options.on.complete){
|
|
||||||
this.onComplete = options.on.complete;
|
|
||||||
}
|
|
||||||
if (options.on && options.on.valueChange){
|
|
||||||
this.onValueChange = options.on.valueChange;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._create();
|
|
||||||
|
|
||||||
if (options.label)
|
|
||||||
this.set("label", options.label);
|
|
||||||
if (options.value)
|
|
||||||
this.value(options.value);
|
|
||||||
if (options.max)
|
|
||||||
this.set("max", options.max);
|
|
||||||
};
|
|
||||||
$.ProgressBar.prototype = {
|
|
||||||
options: {
|
|
||||||
value: 0,
|
|
||||||
max: 100
|
|
||||||
},
|
|
||||||
|
|
||||||
min: 0,
|
|
||||||
|
|
||||||
_create: function() {
|
|
||||||
this.element
|
|
||||||
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
|
||||||
.attr({
|
|
||||||
role: "progressbar",
|
|
||||||
"aria-valuemin": this.min,
|
|
||||||
"aria-valuemax": this.options.max,
|
|
||||||
"aria-valuenow": this._value()
|
|
||||||
});
|
|
||||||
|
|
||||||
this.valueDiv = $( "<div class='ui-progressbar-label'></div>" )
|
|
||||||
.appendTo( this.element );
|
|
||||||
|
|
||||||
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
|
|
||||||
.appendTo( this.element );
|
|
||||||
|
|
||||||
this.oldValue = this._value();
|
|
||||||
this._refreshValue();
|
|
||||||
},
|
|
||||||
|
|
||||||
_destroy: function() {
|
|
||||||
this.element
|
|
||||||
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
|
||||||
.removeAttr( "role" )
|
|
||||||
.removeAttr( "aria-valuemin" )
|
|
||||||
.removeAttr( "aria-valuemax" )
|
|
||||||
.removeAttr( "aria-valuenow" );
|
|
||||||
|
|
||||||
this.valueDiv.remove();
|
|
||||||
},
|
|
||||||
|
|
||||||
value: function( newValue ) {
|
|
||||||
if ( newValue === undefined ) {
|
|
||||||
return this._value();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._setOption( "value", newValue );
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
_setOption: function( key, value ) {
|
|
||||||
if ( key === "value" ) {
|
|
||||||
//var oldVal = this.options.value;
|
|
||||||
this.options.value = value;
|
|
||||||
this._refreshValue();
|
|
||||||
|
|
||||||
if (this.onValueChange)
|
|
||||||
this.onValueChange.apply(this, [{oldVal: this.oldValue, newVal: value}]);
|
|
||||||
|
|
||||||
if ( this._value() === this.options.max ) {
|
|
||||||
//this._trigger( "complete" );
|
|
||||||
if (this.onComplete)
|
|
||||||
this.onComplete.apply(this);
|
|
||||||
}
|
|
||||||
} else if (key === "label") {
|
|
||||||
$(this.element).find(".ui-progressbar-label").html(value);
|
|
||||||
} else if (key === "max") {
|
|
||||||
this.options.max = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//this._super( key, value );
|
|
||||||
},
|
|
||||||
|
|
||||||
_value: function() {
|
|
||||||
var val = this.options.value;
|
|
||||||
// normalize invalid value
|
|
||||||
if ( typeof val !== "number" ) {
|
|
||||||
val = 0;
|
|
||||||
}
|
|
||||||
return Math.min( this.options.max, Math.max( this.min, val ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
_percentage: function() {
|
|
||||||
return 100 * this._value() / this.options.max;
|
|
||||||
},
|
|
||||||
|
|
||||||
_refreshValue: function() {
|
|
||||||
var value = this.value(),
|
|
||||||
percentage = this._percentage();
|
|
||||||
|
|
||||||
if ( this.oldValue !== value ) {
|
|
||||||
this.oldValue = value;
|
|
||||||
//this._trigger( "change" );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.valueDiv
|
|
||||||
.toggle( value > this.min )
|
|
||||||
.toggleClass( "ui-corner-right", value === this.options.max )
|
|
||||||
.width( percentage.toFixed(0) + "%" );
|
|
||||||
this.element.attr( "aria-valuenow", value );
|
|
||||||
|
|
||||||
//$(this.element).find(".ui-progressbar-label").html(value + "%");
|
|
||||||
},
|
|
||||||
|
|
||||||
set: function(key, value){
|
|
||||||
this._setOption(key, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})( jQuery );
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
if (typeof(console) == "undefined") {
|
|
||||||
var console = {
|
|
||||||
info: function(){},
|
|
||||||
warn: function(){},
|
|
||||||
error: function(){},
|
|
||||||
log: function(){},
|
|
||||||
time: function(){},
|
|
||||||
timeEnd: function(){}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Array.isArray) {
|
|
||||||
Array.isArray = function (vArg) {
|
|
||||||
return Object.prototype.toString.call(vArg) === "[object Array]";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Object.isSVGElement) {
|
|
||||||
Object.isSVGElement = function(vArg) {
|
|
||||||
var str = Object.prototype.toString.call(vArg);
|
|
||||||
return (str.indexOf("[object SVG") == 0);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,441 +0,0 @@
|
|||||||
window.onload = function () {
|
|
||||||
var paper = Raphael("holder");
|
|
||||||
|
|
||||||
//var curve = paper.ellipse(100, 100, 1, 1).attr({"stroke-width": 0, fill: Color.red});
|
|
||||||
|
|
||||||
var text = "Betty Botter bought some butter but, she said, the butter's bitter. If I put it in my batter, it will make my batter bitter. But a bit of better butter will make my batter better. So, she bought a bit of butter, better than her bitter butter, and she put it in her batter, and the batter was not bitter. It was better Betty Botter bought a bit better butter.";
|
|
||||||
var font = {font: "11px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR, stroke: LABEL_COLOR, "stroke-width":.3};
|
|
||||||
var font = {font: "11px Arial", opacity: 1, "fill": LABEL_COLOR};
|
|
||||||
var boxWidth = 100
|
|
||||||
|
|
||||||
var AttributedStringIterator = function(text){
|
|
||||||
//this.text = this.rtrim(this.ltrim(text));
|
|
||||||
text = text.replace(/(\s)+/, " ");
|
|
||||||
this.text = this.rtrim(text);
|
|
||||||
/*
|
|
||||||
if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) {
|
|
||||||
throw new IllegalArgumentException("Invalid substring range");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
this.beginIndex = 0;
|
|
||||||
this.endIndex = this.text.length;
|
|
||||||
this.currentIndex = this.beginIndex;
|
|
||||||
|
|
||||||
//console.group("[AttributedStringIterator]");
|
|
||||||
var i = 0;
|
|
||||||
var string = this.text;
|
|
||||||
var fullPos = 0;
|
|
||||||
|
|
||||||
//console.log("string: \"" + string + "\", length: " + string.length);
|
|
||||||
this.startWordOffsets = [];
|
|
||||||
this.startWordOffsets.push(fullPos);
|
|
||||||
|
|
||||||
// TODO: remove i 1000
|
|
||||||
while (i<1000) {
|
|
||||||
var pos = string.search(/[ \t\n\f-\.\,]/);
|
|
||||||
if (pos == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// whitespace start
|
|
||||||
fullPos += pos;
|
|
||||||
string = string.substr(pos);
|
|
||||||
////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string);
|
|
||||||
|
|
||||||
// remove whitespaces
|
|
||||||
var pos = string.search(/[^ \t\n\f-\.\,]/);
|
|
||||||
if (pos == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// whitespace end
|
|
||||||
fullPos += pos;
|
|
||||||
string = string.substr(pos);
|
|
||||||
|
|
||||||
////console.log("fullPos: " + fullPos);
|
|
||||||
this.startWordOffsets.push(fullPos);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//console.log("startWordOffsets: ", this.startWordOffsets);
|
|
||||||
//console.groupEnd();
|
|
||||||
};
|
|
||||||
AttributedStringIterator.prototype = {
|
|
||||||
getEndIndex: function(pos){
|
|
||||||
if (typeof(pos) == "undefined")
|
|
||||||
return this.endIndex;
|
|
||||||
|
|
||||||
var string = this.text.substr(pos, this.endIndex - pos);
|
|
||||||
|
|
||||||
var posEndOfLine = string.search(/[\n]/);
|
|
||||||
if (posEndOfLine == -1)
|
|
||||||
return this.endIndex;
|
|
||||||
else
|
|
||||||
return pos + posEndOfLine;
|
|
||||||
},
|
|
||||||
getBeginIndex: function(){
|
|
||||||
return this.beginIndex;
|
|
||||||
},
|
|
||||||
isWhitespace: function(pos){
|
|
||||||
var str = this.text[pos];
|
|
||||||
var whitespaceChars = " \t\n\f";
|
|
||||||
|
|
||||||
return (whitespaceChars.indexOf(str) != -1);
|
|
||||||
},
|
|
||||||
isNewLine: function(pos){
|
|
||||||
var str = this.text[pos];
|
|
||||||
var whitespaceChars = "\n";
|
|
||||||
|
|
||||||
return (whitespaceChars.indexOf(str) != -1);
|
|
||||||
},
|
|
||||||
preceding: function(pos){
|
|
||||||
//console.group("[AttributedStringIterator.preceding]");
|
|
||||||
for(var i in this.startWordOffsets) {
|
|
||||||
var startWordOffset = this.startWordOffsets[i];
|
|
||||||
if (pos < startWordOffset && i>0) {
|
|
||||||
//console.log("startWordOffset: " + this.startWordOffsets[i-1]);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i-1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log("pos: " + pos);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
},
|
|
||||||
following: function(pos){
|
|
||||||
//console.group("[AttributedStringIterator.following]");
|
|
||||||
for(var i in this.startWordOffsets) {
|
|
||||||
var startWordOffset = this.startWordOffsets[i];
|
|
||||||
if (pos < startWordOffset && i>0) {
|
|
||||||
//console.log("startWordOffset: " + this.startWordOffsets[i]);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log("pos: " + pos);
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.startWordOffsets[i];
|
|
||||||
},
|
|
||||||
ltrim: function(str){
|
|
||||||
var patt2=/^\s+/g;
|
|
||||||
return str.replace(patt2, "");
|
|
||||||
},
|
|
||||||
rtrim: function(str){
|
|
||||||
var patt2=/\s+$/g;
|
|
||||||
return str.replace(patt2, "");
|
|
||||||
},
|
|
||||||
getLayout: function(start, limit){
|
|
||||||
return this.text.substr(start, limit - start);
|
|
||||||
},
|
|
||||||
getCharAtPos: function(pos) {
|
|
||||||
return this.text[pos];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
var TextMeasurer = function(paper, text, fontAttrs){
|
|
||||||
this.text = text;
|
|
||||||
this.paper = paper;
|
|
||||||
this.fontAttrs = fontAttrs;
|
|
||||||
|
|
||||||
this.fStart = this.text.getBeginIndex();
|
|
||||||
|
|
||||||
};
|
|
||||||
TextMeasurer.prototype = {
|
|
||||||
getLineBreakIndex: function(start, maxAdvance){
|
|
||||||
var localStart = start - this.fStart;
|
|
||||||
},
|
|
||||||
getLayout: function(){
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var LineBreakMeasurer = function(paper, text, fontAttrs){
|
|
||||||
this.paper = paper;
|
|
||||||
this.text = new AttributedStringIterator(text);
|
|
||||||
this.fontAttrs = fontAttrs;
|
|
||||||
|
|
||||||
if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) {
|
|
||||||
throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"};
|
|
||||||
}
|
|
||||||
|
|
||||||
//this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs);
|
|
||||||
this.limit = this.text.getEndIndex();
|
|
||||||
this.pos = this.start = this.text.getBeginIndex();
|
|
||||||
|
|
||||||
this.rafaelTextObject = this.paper.text(100, 100, this.text.text).attr(fontAttrs).attr("text-anchor", "start");
|
|
||||||
this.svgTextObject = this.rafaelTextObject[0];
|
|
||||||
};
|
|
||||||
LineBreakMeasurer.prototype = {
|
|
||||||
nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) {
|
|
||||||
//console.group("[nextOffset]");
|
|
||||||
var nextOffset = this.pos;
|
|
||||||
if (this.pos < this.limit) {
|
|
||||||
if (offsetLimit <= this.pos) {
|
|
||||||
throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"};
|
|
||||||
}
|
|
||||||
|
|
||||||
var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth);
|
|
||||||
//charAtMaxAdvance --;
|
|
||||||
//console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]");
|
|
||||||
|
|
||||||
if (charAtMaxAdvance == this.limit) {
|
|
||||||
nextOffset = this.limit;
|
|
||||||
//console.log("charAtMaxAdvance == this.limit");
|
|
||||||
} else if (this.text.isNewLine(charAtMaxAdvance)) {
|
|
||||||
console.log("isNewLine");
|
|
||||||
nextOffset = charAtMaxAdvance+1;
|
|
||||||
} else if (this.text.isWhitespace(charAtMaxAdvance)) {
|
|
||||||
// TODO: find next noSpaceChar
|
|
||||||
//return nextOffset;
|
|
||||||
nextOffset = this.text.following(charAtMaxAdvance);
|
|
||||||
} else {
|
|
||||||
// Break is in a word; back up to previous break.
|
|
||||||
/*
|
|
||||||
var testPos = charAtMaxAdvance + 1;
|
|
||||||
if (testPos == this.limit) {
|
|
||||||
console.error("hbz...");
|
|
||||||
} else {
|
|
||||||
nextOffset = this.text.preceding(charAtMaxAdvance);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
nextOffset = this.text.preceding(charAtMaxAdvance);
|
|
||||||
|
|
||||||
if (nextOffset <= this.pos) {
|
|
||||||
nextOffset = Math.max(this.pos+1, charAtMaxAdvance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nextOffset > offsetLimit) {
|
|
||||||
nextOffset = offsetLimit;
|
|
||||||
}
|
|
||||||
//console.log("nextOffset: " + nextOffset);
|
|
||||||
//console.groupEnd();
|
|
||||||
return nextOffset;
|
|
||||||
},
|
|
||||||
nextLayout: function(wrappingWidth) {
|
|
||||||
//console.groupCollapsed("[nextLayout]");
|
|
||||||
if (this.pos < this.limit) {
|
|
||||||
var requireNextWord = false;
|
|
||||||
var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord);
|
|
||||||
//console.log("layoutLimit:", layoutLimit);
|
|
||||||
if (layoutLimit == this.pos) {
|
|
||||||
//console.groupEnd();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var result = this.text.getLayout(this.pos, layoutLimit);
|
|
||||||
//console.log("layout: \"" + result + "\"");
|
|
||||||
|
|
||||||
// remove end of line
|
|
||||||
|
|
||||||
//var posEndOfLine = this.text.getEndIndex(this.pos);
|
|
||||||
//if (posEndOfLine < result.length)
|
|
||||||
// result = result.substr(0, posEndOfLine);
|
|
||||||
|
|
||||||
this.pos = layoutLimit;
|
|
||||||
|
|
||||||
//console.groupEnd();
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
//console.groupEnd();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getLineBreakIndex: function(pos, wrappingWidth) {
|
|
||||||
//console.group("[getLineBreakIndex]");
|
|
||||||
//console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\"");
|
|
||||||
|
|
||||||
var bb = this.rafaelTextObject.getBBox();
|
|
||||||
|
|
||||||
var charNum = -1;
|
|
||||||
try {
|
|
||||||
var svgPoint = this.svgTextObject.getStartPositionOfChar(pos);
|
|
||||||
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue});
|
|
||||||
svgPoint.x = svgPoint.x + wrappingWidth;
|
|
||||||
//svgPoint.y = bb.y;
|
|
||||||
//console.log("svgPoint:", svgPoint);
|
|
||||||
|
|
||||||
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red});
|
|
||||||
|
|
||||||
charNum = this.svgTextObject.getCharNumAtPosition(svgPoint);
|
|
||||||
} catch (e){
|
|
||||||
console.warn("getStartPositionOfChar error, pos:" + pos);
|
|
||||||
/*
|
|
||||||
var testPos = pos + 1;
|
|
||||||
if (testPos < this.limit) {
|
|
||||||
return testPos
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
//console.log("charNum:", charNum);
|
|
||||||
if (charNum == -1) {
|
|
||||||
//console.groupEnd();
|
|
||||||
return this.text.getEndIndex(pos);
|
|
||||||
} else {
|
|
||||||
// When case there is new line between pos and charnum then use this new line
|
|
||||||
var newLineIndex = this.text.getEndIndex(pos);
|
|
||||||
if (newLineIndex < charNum ) {
|
|
||||||
console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "↵") + "\"");
|
|
||||||
//console.groupEnd();
|
|
||||||
|
|
||||||
return newLineIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1);
|
|
||||||
var charAtMaxAdvance = this.text.getCharAtPos(charNum);
|
|
||||||
//console.log("!!charAtMaxAdvance: " + charAtMaxAdvance);
|
|
||||||
//console.groupEnd();
|
|
||||||
return charNum;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getPosition: function() {
|
|
||||||
return this.pos;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ******
|
|
||||||
function drawMultilineText(text, x, y, boxWidth, boxHeight, options) {
|
|
||||||
var TEXT_PADDING = 3;
|
|
||||||
var width = boxWidth - (2 * TEXT_PADDING);
|
|
||||||
if (boxHeight)
|
|
||||||
var height = boxHeight - (2 * TEXT_PADDING);
|
|
||||||
|
|
||||||
var layouts = [];
|
|
||||||
|
|
||||||
var measurer = new LineBreakMeasurer(paper, text, font);
|
|
||||||
var lineHeight = measurer.rafaelTextObject.getBBox().height;
|
|
||||||
console.log("text: ", text.replace(/\n/g, "↵"));
|
|
||||||
|
|
||||||
if (height) {
|
|
||||||
var availableLinesCount = parseInt(height/lineHeight);
|
|
||||||
console.log("availableLinesCount: " + availableLinesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
var i = 1;
|
|
||||||
while (measurer.getPosition() < measurer.text.getEndIndex()) {
|
|
||||||
var layout = measurer.nextLayout(width);
|
|
||||||
//console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition());
|
|
||||||
|
|
||||||
if (layout != null) {
|
|
||||||
if (!availableLinesCount || i < availableLinesCount) {
|
|
||||||
layouts.push(layout);
|
|
||||||
} else {
|
|
||||||
layouts.push(fitTextToWidth(layout + "...", boxWidth));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
};
|
|
||||||
console.log(layouts);
|
|
||||||
|
|
||||||
measurer.rafaelTextObject.attr({"text": layouts.join("\n")});
|
|
||||||
//measurer.rafaelTextObject.attr({"text-anchor": "end"});
|
|
||||||
//measurer.rafaelTextObject.attr({"text-anchor": "middle"});
|
|
||||||
if (options)
|
|
||||||
measurer.rafaelTextObject.attr({"text-anchor": options["text-anchor"]});
|
|
||||||
|
|
||||||
var bb = measurer.rafaelTextObject.getBBox();
|
|
||||||
//measurer.rafaelTextObject.attr({"x": x + boxWidth/2});
|
|
||||||
if (options["vertical-align"] == "top")
|
|
||||||
measurer.rafaelTextObject.attr({"y": y + bb.height/2 + TEXT_PADDING});
|
|
||||||
else
|
|
||||||
measurer.rafaelTextObject.attr({"y": y + height/2});
|
|
||||||
//var bb = measurer.rafaelTextObject.getBBox();
|
|
||||||
|
|
||||||
if (measurer.rafaelTextObject.attr("text-anchor") == "middle" )
|
|
||||||
measurer.rafaelTextObject.attr("x", x + boxWidth/2 + TEXT_PADDING/2);
|
|
||||||
else if (measurer.rafaelTextObject.attr("text-anchor") == "end" )
|
|
||||||
measurer.rafaelTextObject.attr("x", x + boxWidth + TEXT_PADDING/2);
|
|
||||||
else
|
|
||||||
measurer.rafaelTextObject.attr("x", x + boxWidth/2 - bb.width/2 + TEXT_PADDING/2);
|
|
||||||
|
|
||||||
var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
|
|
||||||
/*
|
|
||||||
var box = paper.rect(x+.0 + boxWidth/2 - bb.width/2+ TEXT_PADDING/2, y + .5 + boxHeight/2 - bb.height/2, width, height).attr(boxStyle);
|
|
||||||
box.attr("height", bb.height);
|
|
||||||
*/
|
|
||||||
//var box = paper.rect(bb.x - .5 + bb.width/2 + TEXT_PADDING, bb.y + bb.height/2, bb.width, bb.height).attr(boxStyle);
|
|
||||||
|
|
||||||
var textAreaCX = x + boxWidth/2;
|
|
||||||
var textAreaCY = y + height/2;
|
|
||||||
var dotLeftTop = paper.ellipse(x, y, 3, 3).attr({"stroke-width": 0, fill: Color.LightSteelBlue, stroke: "none"});
|
|
||||||
var dotCenter = paper.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"});
|
|
||||||
|
|
||||||
/*
|
|
||||||
// real bbox
|
|
||||||
var bb = measurer.rafaelTextObject.getBBox();
|
|
||||||
var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1});
|
|
||||||
*/
|
|
||||||
var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
|
|
||||||
var rect = paper.rect(x+.5, y + .5, boxWidth, boxHeight).attr(boxStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (var i=0; i<1; i++) {
|
|
||||||
var t = text;
|
|
||||||
//var t = "Высококвалифицирова";
|
|
||||||
|
|
||||||
var text = paper.text(300, 100, t).attr(font).attr("text-anchor", "start");
|
|
||||||
var bbText = text.getBBox();
|
|
||||||
paper.rect(300+.5, 100 + .5, bbText.width, bbText.height).attr({"stroke-width": 1});
|
|
||||||
console.log("t: ", t.replace(/\n/g, "↵"));
|
|
||||||
|
|
||||||
while (measurer.getPosition() < measurer.text.getEndIndex()) {
|
|
||||||
var layout = measurer.nextLayout(width);
|
|
||||||
//console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition());
|
|
||||||
if (layout != null)
|
|
||||||
layouts.push(layout);
|
|
||||||
};
|
|
||||||
|
|
||||||
measurer.rafaelTextObject.attr("text", layouts.join("\n"));
|
|
||||||
var bb = measurer.rafaelTextObject.getBBox();
|
|
||||||
var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1});
|
|
||||||
|
|
||||||
lay.push(layouts);
|
|
||||||
console.log(layouts);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var fitTextToWidth = function(original, width) {
|
|
||||||
var text = original;
|
|
||||||
|
|
||||||
// TODO: move attr on parameters
|
|
||||||
var attr = {font: "11px Arial", opacity: 0};
|
|
||||||
|
|
||||||
// remove length for "..."
|
|
||||||
var dots = paper.text(0, 0, "...").attr(attr).hide();
|
|
||||||
var dotsBB = dots.getBBox();
|
|
||||||
|
|
||||||
var maxWidth = width - dotsBB.width;
|
|
||||||
|
|
||||||
var textElement = paper.text(0, 0, text).attr(attr).hide();
|
|
||||||
var bb = textElement.getBBox();
|
|
||||||
|
|
||||||
// it's a little bit incorrect with "..."
|
|
||||||
while (bb.width > maxWidth && text.length > 0) {
|
|
||||||
text = text.substring(0, text.length - 1);
|
|
||||||
textElement.attr({"text": text});
|
|
||||||
bb = textElement.getBBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove element from paper
|
|
||||||
textElement.remove();
|
|
||||||
|
|
||||||
if (text != original) {
|
|
||||||
text = text + "...";
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var x=100, y=90, height=20;
|
|
||||||
var options = {"text-anchor": "middle", "boxHeight": 150, "vertical-align": "top"};
|
|
||||||
var options = {"boxHeight": 150, "vertical-align": "top"};
|
|
||||||
drawMultilineText(text, x, y, 150, 100, options);
|
|
||||||
};
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
body {
|
|
||||||
background: #fafafa;
|
|
||||||
color: #708090;
|
|
||||||
/* font: 300 100.1% "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif; */
|
|
||||||
font-family: Verdana, sans-serif, Arial;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
.wrapper{
|
|
||||||
height: 100%;
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
#holder {
|
|
||||||
height: 480px;
|
|
||||||
width: 640px;
|
|
||||||
b_ackground: #F8F8FF;
|
|
||||||
|
|
||||||
-moz-border-radius: 10px;
|
|
||||||
-webkit-border-radius: 10px;
|
|
||||||
-webkit-box-shadow: 0 1px 3px #666;
|
|
||||||
background: #DDD url(./images/bg.png);
|
|
||||||
/* background: #DDD url(./images/checker-bg.png); * /
|
|
||||||
b_order:0px solid #dedede;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
div.diagramHolder {
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
div.diagram{
|
|
||||||
border:1px solid #dedede;
|
|
||||||
margin: 5px;
|
|
||||||
padding: 5px;
|
|
||||||
background: #FFF;
|
|
||||||
}
|
|
||||||
div.diagram.hidden{
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
svg {
|
|
||||||
background: #DDD url(./images/bg.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.diagram-info {
|
|
||||||
float:left;
|
|
||||||
position: relative;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Breadcrumbs */
|
|
||||||
|
|
||||||
#diagramBreadCrumbs {
|
|
||||||
margin-left: 2px;
|
|
||||||
margin-right: 2px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
#diagramBreadCrumbs ul {
|
|
||||||
list-style: none;
|
|
||||||
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #DEDEDE;
|
|
||||||
border-color: #C0C2C5;
|
|
||||||
margin: 0;
|
|
||||||
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-left: 0;
|
|
||||||
|
|
||||||
-webkit-padding-start: 0px;
|
|
||||||
-moz-border-radius: 4px;
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
#diagramBreadCrumbs li {
|
|
||||||
/*text-decoration: underline;*/
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
padding-left: .75em;
|
|
||||||
padding-right: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
#diagramBreadCrumbs li.selected {
|
|
||||||
color: #9370DB;
|
|
||||||
color: #4876FF;
|
|
||||||
color: #4F94CD;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
#diagramBreadCrumbs li span {
|
|
||||||
background: url(images/breadcrumbs.png) no-repeat 100% 50%;
|
|
||||||
display: block;
|
|
||||||
padding: .5em 15px .5em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Progress bar */
|
|
||||||
|
|
||||||
.ui-progressbar {
|
|
||||||
height: 25px;
|
|
||||||
/*height:2em; text-align: left; overflow: hidden; */
|
|
||||||
background: white;
|
|
||||||
border: 1px solid #949DAD;
|
|
||||||
margin: 2px;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 1px;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
-moz-border-radius: 4px;
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.ui-progressbar .ui-progressbar-value {
|
|
||||||
m_argin: -1px;
|
|
||||||
height:100%;
|
|
||||||
background: #D4E4FF;
|
|
||||||
|
|
||||||
-moz-border-radius: 4px;
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
|
|
||||||
|
|
||||||
.ui-progressbar .ui-progressbar-label{
|
|
||||||
position: absolute;
|
|
||||||
margin-top: 7px;
|
|
||||||
border:0px solid red;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var ACTIVITI = ACTIVITI || {};
|
|
||||||
|
|
||||||
ACTIVITI.CONFIG = {
|
|
||||||
'contextRoot' : '/laws-sinotruk/service',
|
|
||||||
|
|
||||||
};
|
|
||||||
@@ -1,432 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var activitiModeler = angular.module('activitiModeler', [
|
|
||||||
'ngCookies',
|
|
||||||
'ngResource',
|
|
||||||
'ngSanitize',
|
|
||||||
'ngRoute',
|
|
||||||
'ngDragDrop',
|
|
||||||
'mgcrea.ngStrap',
|
|
||||||
'ngGrid',
|
|
||||||
'ngAnimate',
|
|
||||||
'pascalprecht.translate',
|
|
||||||
'duScroll'
|
|
||||||
]);
|
|
||||||
|
|
||||||
var activitiModule = activitiModeler;
|
|
||||||
|
|
||||||
activitiModeler
|
|
||||||
// Initialize routes
|
|
||||||
.config(['$selectProvider', '$translateProvider', function ($selectProvider, $translateProvider) {
|
|
||||||
|
|
||||||
// Override caret for bs-select directive
|
|
||||||
angular.extend($selectProvider.defaults, {
|
|
||||||
caretHtml: ' <i class="icon icon-caret-down"></i>'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initialize angular-translate
|
|
||||||
$translateProvider.useStaticFilesLoader({
|
|
||||||
prefix: './editor-app/i18n/',
|
|
||||||
suffix: '.json'
|
|
||||||
});
|
|
||||||
|
|
||||||
$translateProvider.preferredLanguage('en');
|
|
||||||
|
|
||||||
// remember language
|
|
||||||
$translateProvider.useCookieStorage();
|
|
||||||
|
|
||||||
}])
|
|
||||||
.run(['$rootScope', '$timeout', '$modal', '$translate', '$location', '$window', '$http', '$q',
|
|
||||||
function($rootScope, $timeout, $modal, $translate, $location, $window, $http, $q) {
|
|
||||||
|
|
||||||
$rootScope.config = ACTIVITI.CONFIG;
|
|
||||||
|
|
||||||
$rootScope.editorInitialized = false;
|
|
||||||
|
|
||||||
$rootScope.editorFactory = $q.defer();
|
|
||||||
|
|
||||||
$rootScope.forceSelectionRefresh = false;
|
|
||||||
|
|
||||||
$rootScope.ignoreChanges = false; // by default never ignore changes
|
|
||||||
|
|
||||||
$rootScope.validationErrors = [];
|
|
||||||
|
|
||||||
$rootScope.staticIncludeVersion = Date.now();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A 'safer' apply that avoids concurrent updates (which $apply allows).
|
|
||||||
*/
|
|
||||||
$rootScope.safeApply = function(fn) {
|
|
||||||
var phase = this.$root.$$phase;
|
|
||||||
if(phase == '$apply' || phase == '$digest') {
|
|
||||||
if(fn && (typeof(fn) === 'function')) {
|
|
||||||
fn();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$apply(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the event bus: couple all Oryx events with a dispatch of the
|
|
||||||
* event of the event bus. This way, it gets much easier to attach custom logic
|
|
||||||
* to any event.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Helper method to fetch model from server (always needed) */
|
|
||||||
function fetchModel(modelId) {
|
|
||||||
|
|
||||||
var modelUrl = KISBPM.URL.getModel(modelId);
|
|
||||||
|
|
||||||
$http({method: 'GET', url: modelUrl}).
|
|
||||||
success(function (data, status, headers, config) {
|
|
||||||
$rootScope.editor = new ORYX.Editor(data);
|
|
||||||
$rootScope.modelData = angular.fromJson(data);
|
|
||||||
$rootScope.editorFactory.resolve();
|
|
||||||
}).
|
|
||||||
error(function (data, status, headers, config) {
|
|
||||||
console.log('Error loading model with id ' + modelId + ' ' + data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function initScrollHandling() {
|
|
||||||
var canvasSection = jQuery('#canvasSection');
|
|
||||||
canvasSection.scroll(function() {
|
|
||||||
|
|
||||||
// Hides the resizer and quick menu items during scrolling
|
|
||||||
|
|
||||||
var selectedElements = $rootScope.editor.selection;
|
|
||||||
var subSelectionElements = $rootScope.editor._subSelection;
|
|
||||||
|
|
||||||
$rootScope.selectedElements = selectedElements;
|
|
||||||
$rootScope.subSelectionElements = subSelectionElements;
|
|
||||||
if (selectedElements && selectedElements.length > 0) {
|
|
||||||
$rootScope.selectedElementBeforeScrolling = selectedElements[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery('.Oryx_button').each(function(i, obj) {
|
|
||||||
$rootScope.orginalOryxButtonStyle = obj.style.display;
|
|
||||||
obj.style.display = 'none';
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery('.resizer_southeast').each(function(i, obj) {
|
|
||||||
$rootScope.orginalResizerSEStyle = obj.style.display;
|
|
||||||
obj.style.display = 'none';
|
|
||||||
});
|
|
||||||
jQuery('.resizer_northwest').each(function(i, obj) {
|
|
||||||
$rootScope.orginalResizerNWStyle = obj.style.display;
|
|
||||||
obj.style.display = 'none';
|
|
||||||
});
|
|
||||||
$rootScope.editor.handleEvents({type:ORYX.CONFIG.EVENT_CANVAS_SCROLL});
|
|
||||||
});
|
|
||||||
|
|
||||||
canvasSection.scrollStopped(function(){
|
|
||||||
|
|
||||||
// Puts the quick menu items and resizer back when scroll is stopped.
|
|
||||||
|
|
||||||
$rootScope.editor.setSelection([]); // needed cause it checks for element changes and does nothing if the elements are the same
|
|
||||||
$rootScope.editor.setSelection($rootScope.selectedElements, $rootScope.subSelectionElements);
|
|
||||||
$rootScope.selectedElements = undefined;
|
|
||||||
$rootScope.subSelectionElements = undefined;
|
|
||||||
|
|
||||||
function handleDisplayProperty(obj) {
|
|
||||||
if (jQuery(obj).position().top > 0) {
|
|
||||||
obj.style.display = 'block';
|
|
||||||
} else {
|
|
||||||
obj.style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery('.Oryx_button').each(function(i, obj) {
|
|
||||||
handleDisplayProperty(obj);
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery('.resizer_southeast').each(function(i, obj) {
|
|
||||||
handleDisplayProperty(obj);
|
|
||||||
});
|
|
||||||
jQuery('.resizer_northwest').each(function(i, obj) {
|
|
||||||
handleDisplayProperty(obj);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the Oryx Editor when the content has been loaded
|
|
||||||
*/
|
|
||||||
$rootScope.$on('$includeContentLoaded', function (event) {
|
|
||||||
if (!$rootScope.editorInitialized) {
|
|
||||||
|
|
||||||
ORYX._loadPlugins();
|
|
||||||
|
|
||||||
var modelId = EDITOR.UTIL.getParameterByName('modelId');
|
|
||||||
fetchModel(modelId);
|
|
||||||
|
|
||||||
$rootScope.window = {};
|
|
||||||
var updateWindowSize = function() {
|
|
||||||
$rootScope.window.width = $window.innerWidth;
|
|
||||||
$rootScope.window.height = $window.innerHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Window resize hook
|
|
||||||
angular.element($window).bind('resize', function() {
|
|
||||||
$rootScope.safeApply(updateWindowSize());
|
|
||||||
});
|
|
||||||
|
|
||||||
$rootScope.$watch('window.forceRefresh', function(newValue) {
|
|
||||||
if(newValue) {
|
|
||||||
$timeout(function() {
|
|
||||||
updateWindowSize();
|
|
||||||
$rootScope.window.forceRefresh = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateWindowSize();
|
|
||||||
|
|
||||||
// Hook in resizing of main panels when window resizes
|
|
||||||
// TODO: perhaps move to a separate JS-file?
|
|
||||||
jQuery(window).resize(function () {
|
|
||||||
|
|
||||||
// Calculate the offset based on the bottom of the module header
|
|
||||||
var offset = jQuery("#editor-header").offset();
|
|
||||||
var propSectionHeight = jQuery('#propertySection').height();
|
|
||||||
var canvas = jQuery('#canvasSection');
|
|
||||||
var mainHeader = jQuery('#main-header');
|
|
||||||
|
|
||||||
if (offset == undefined || offset === null
|
|
||||||
|| propSectionHeight === undefined || propSectionHeight === null
|
|
||||||
|| canvas === undefined || canvas === null || mainHeader === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rootScope.editor)
|
|
||||||
{
|
|
||||||
var selectedElements = $rootScope.editor.selection;
|
|
||||||
var subSelectionElements = $rootScope.editor._subSelection;
|
|
||||||
|
|
||||||
$rootScope.selectedElements = selectedElements;
|
|
||||||
$rootScope.subSelectionElements = subSelectionElements;
|
|
||||||
if (selectedElements && selectedElements.length > 0)
|
|
||||||
{
|
|
||||||
$rootScope.selectedElementBeforeScrolling = selectedElements[0];
|
|
||||||
|
|
||||||
$rootScope.editor.setSelection([]); // needed cause it checks for element changes and does nothing if the elements are the same
|
|
||||||
$rootScope.editor.setSelection($rootScope.selectedElements, $rootScope.subSelectionElements);
|
|
||||||
$rootScope.selectedElements = undefined;
|
|
||||||
$rootScope.subSelectionElements = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var totalAvailable = jQuery(window).height() - offset.top - mainHeader.height() - 21;
|
|
||||||
canvas.height(totalAvailable - propSectionHeight);
|
|
||||||
jQuery('#paletteSection').height(totalAvailable);
|
|
||||||
|
|
||||||
// Update positions of the resize-markers, according to the canvas
|
|
||||||
|
|
||||||
var actualCanvas = null;
|
|
||||||
if (canvas && canvas[0].children[1]) {
|
|
||||||
actualCanvas = canvas[0].children[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
var canvasTop = canvas.position().top;
|
|
||||||
var canvasLeft = canvas.position().left;
|
|
||||||
var canvasHeight = canvas[0].clientHeight;
|
|
||||||
var canvasWidth = canvas[0].clientWidth;
|
|
||||||
var iconCenterOffset = 8;
|
|
||||||
var widthDiff = 0;
|
|
||||||
|
|
||||||
var actualWidth = 0;
|
|
||||||
if(actualCanvas) {
|
|
||||||
// In some browsers, the SVG-element clientwidth isn't available, so we revert to the parent
|
|
||||||
actualWidth = actualCanvas.clientWidth || actualCanvas.parentNode.clientWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(actualWidth < canvas[0].clientWidth) {
|
|
||||||
widthDiff = actualWidth - canvas[0].clientWidth;
|
|
||||||
// In case the canvas is smaller than the actual viewport, the resizers should be moved
|
|
||||||
canvasLeft -= widthDiff / 2;
|
|
||||||
canvasWidth += widthDiff;
|
|
||||||
}
|
|
||||||
|
|
||||||
var iconWidth = 17;
|
|
||||||
var iconOffset = 20;
|
|
||||||
|
|
||||||
var north = jQuery('#canvas-grow-N');
|
|
||||||
north.css('top', canvasTop + iconOffset + 'px');
|
|
||||||
north.css('left', canvasLeft - 10 + (canvasWidth - iconWidth) / 2 + 'px');
|
|
||||||
|
|
||||||
var south = jQuery('#canvas-grow-S');
|
|
||||||
south.css('top', (canvasTop + canvasHeight - iconOffset - iconCenterOffset) + 'px');
|
|
||||||
south.css('left', canvasLeft - 10 + (canvasWidth - iconWidth) / 2 + 'px');
|
|
||||||
|
|
||||||
var east = jQuery('#canvas-grow-E');
|
|
||||||
east.css('top', canvasTop - 10 + (canvasHeight - iconWidth) / 2 + 'px');
|
|
||||||
east.css('left', (canvasLeft + canvasWidth - iconOffset - iconCenterOffset) + 'px');
|
|
||||||
|
|
||||||
var west = jQuery('#canvas-grow-W');
|
|
||||||
west.css('top', canvasTop -10 + (canvasHeight - iconWidth) / 2 + 'px');
|
|
||||||
west.css('left', canvasLeft + iconOffset + 'px');
|
|
||||||
|
|
||||||
north = jQuery('#canvas-shrink-N');
|
|
||||||
north.css('top', canvasTop + iconOffset + 'px');
|
|
||||||
north.css('left', canvasLeft + 10 + (canvasWidth - iconWidth) / 2 + 'px');
|
|
||||||
|
|
||||||
south = jQuery('#canvas-shrink-S');
|
|
||||||
south.css('top', (canvasTop + canvasHeight - iconOffset - iconCenterOffset) + 'px');
|
|
||||||
south.css('left', canvasLeft +10 + (canvasWidth - iconWidth) / 2 + 'px');
|
|
||||||
|
|
||||||
east = jQuery('#canvas-shrink-E');
|
|
||||||
east.css('top', canvasTop + 10 + (canvasHeight - iconWidth) / 2 + 'px');
|
|
||||||
east.css('left', (canvasLeft + canvasWidth - iconOffset - iconCenterOffset) + 'px');
|
|
||||||
|
|
||||||
west = jQuery('#canvas-shrink-W');
|
|
||||||
west.css('top', canvasTop + 10 + (canvasHeight - iconWidth) / 2 + 'px');
|
|
||||||
west.css('left', canvasLeft + iconOffset + 'px');
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery(window).trigger('resize');
|
|
||||||
|
|
||||||
jQuery.fn.scrollStopped = function(callback) {
|
|
||||||
jQuery(this).scroll(function(){
|
|
||||||
var self = this, $this = jQuery(self);
|
|
||||||
if ($this.data('scrollTimeout')) {
|
|
||||||
clearTimeout($this.data('scrollTimeout'));
|
|
||||||
}
|
|
||||||
$this.data('scrollTimeout', setTimeout(callback,50,self));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Always needed, cause the DOM element on which the scroll event listeners are attached are changed for every new model
|
|
||||||
initScrollHandling();
|
|
||||||
|
|
||||||
$rootScope.editorInitialized = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the event bus: couple all Oryx events with a dispatch of the
|
|
||||||
* event of the event bus. This way, it gets much easier to attach custom logic
|
|
||||||
* to any event.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$rootScope.editorFactory.promise.then(function() {
|
|
||||||
|
|
||||||
KISBPM.eventBus.editor = $rootScope.editor;
|
|
||||||
|
|
||||||
var eventMappings = [
|
|
||||||
{ oryxType : ORYX.CONFIG.EVENT_SELECTION_CHANGED, kisBpmType : KISBPM.eventBus.EVENT_TYPE_SELECTION_CHANGE },
|
|
||||||
{ oryxType : ORYX.CONFIG.EVENT_DBLCLICK, kisBpmType : KISBPM.eventBus.EVENT_TYPE_DOUBLE_CLICK },
|
|
||||||
{ oryxType : ORYX.CONFIG.EVENT_MOUSEOUT, kisBpmType : KISBPM.eventBus.EVENT_TYPE_MOUSE_OUT },
|
|
||||||
{ oryxType : ORYX.CONFIG.EVENT_MOUSEOVER, kisBpmType : KISBPM.eventBus.EVENT_TYPE_MOUSE_OVER }
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
eventMappings.forEach(function(eventMapping) {
|
|
||||||
$rootScope.editor.registerOnEvent(eventMapping.oryxType, function(event) {
|
|
||||||
KISBPM.eventBus.dispatch(eventMapping.kisBpmType, event);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$rootScope.editor.registerOnEvent(ORYX.CONFIG.EVENT_SHAPEREMOVED, function (event) {
|
|
||||||
var validateButton = document.getElementById(event.shape.resourceId + "-validate-button");
|
|
||||||
if (validateButton)
|
|
||||||
{
|
|
||||||
validateButton.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// The Oryx canvas is ready (we know since we're in this promise callback) and the
|
|
||||||
// event bus is ready. The editor is now ready for use
|
|
||||||
KISBPM.eventBus.dispatch(KISBPM.eventBus.EVENT_TYPE_EDITOR_READY, {type : KISBPM.eventBus.EVENT_TYPE_EDITOR_READY});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Alerts
|
|
||||||
$rootScope.alerts = {
|
|
||||||
queue: []
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.showAlert = function(alert) {
|
|
||||||
if(alert.queue.length > 0) {
|
|
||||||
alert.current = alert.queue.shift();
|
|
||||||
// Start timout for message-pruning
|
|
||||||
alert.timeout = $timeout(function() {
|
|
||||||
if (alert.queue.length == 0) {
|
|
||||||
alert.current = undefined;
|
|
||||||
alert.timeout = undefined;
|
|
||||||
} else {
|
|
||||||
$rootScope.showAlert(alert);
|
|
||||||
}
|
|
||||||
}, (alert.current.type == 'error' ? 5000 : 1000));
|
|
||||||
} else {
|
|
||||||
$rootScope.alerts.current = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.addAlert = function(message, type) {
|
|
||||||
var newAlert = {message: message, type: type};
|
|
||||||
if (!$rootScope.alerts.timeout) {
|
|
||||||
// Timeout for message queue is not running, start one
|
|
||||||
$rootScope.alerts.queue.push(newAlert);
|
|
||||||
$rootScope.showAlert($rootScope.alerts);
|
|
||||||
} else {
|
|
||||||
$rootScope.alerts.queue.push(newAlert);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.dismissAlert = function() {
|
|
||||||
if (!$rootScope.alerts.timeout) {
|
|
||||||
$rootScope.alerts.current = undefined;
|
|
||||||
} else {
|
|
||||||
$timeout.cancel($rootScope.alerts.timeout);
|
|
||||||
$rootScope.alerts.timeout = undefined;
|
|
||||||
$rootScope.showAlert($rootScope.alerts);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.addAlertPromise = function(promise, type) {
|
|
||||||
if (promise) {
|
|
||||||
promise.then(function(data) {
|
|
||||||
$rootScope.addAlert(data, type);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
// Moment-JS date-formatting filter
|
|
||||||
.filter('dateformat', function() {
|
|
||||||
return function(date, format) {
|
|
||||||
if (date) {
|
|
||||||
if (format) {
|
|
||||||
return moment(date).format(format);
|
|
||||||
} else {
|
|
||||||
return moment(date).calendar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
};
|
|
||||||
});
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Assignment
|
|
||||||
*/
|
|
||||||
var KisBpmAssignmentCtrl = [ '$scope', '$modal', function($scope, $modal) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/assignment-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmAssignmentPopupCtrl = [ '$scope','$http', function($scope,$http) {
|
|
||||||
|
|
||||||
// Put json representing assignment on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.assignment !== undefined
|
|
||||||
&& $scope.property.value.assignment !== null)
|
|
||||||
{
|
|
||||||
$scope.assignment = $scope.property.value.assignment;
|
|
||||||
} else {
|
|
||||||
$scope.assignment = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.assignment.candidateUsers == undefined || $scope.assignment.candidateUsers.length == 0)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateUsers = [{value: ''}];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Click handler for + button after enum value
|
|
||||||
var userValueIndex = 1;
|
|
||||||
$scope.addCandidateUserValue = function(index) {
|
|
||||||
$scope.assignment.candidateUsers.splice(index + 1, 0, {value: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for - button after enum value
|
|
||||||
$scope.removeCandidateUserValue = function(index) {
|
|
||||||
$scope.assignment.candidateUsers.splice(index, 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ($scope.assignment.candidateGroups == undefined || $scope.assignment.candidateGroups.length == 0)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateGroups = [{value: ''}];
|
|
||||||
}
|
|
||||||
|
|
||||||
var groupValueIndex = 1;
|
|
||||||
$scope.addCandidateGroupValue = function(index) {
|
|
||||||
$scope.assignment.candidateGroups.splice(index + 1, 0, {value: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for - button after enum value
|
|
||||||
$scope.removeCandidateGroupValue = function(index) {
|
|
||||||
$scope.assignment.candidateGroups.splice(index, 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
$scope.property.value = {};
|
|
||||||
handleAssignmentInput($scope);
|
|
||||||
$scope.property.value.assignment = $scope.assignment;
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
handleAssignmentInput($scope);
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
var handleAssignmentInput = function($scope) {
|
|
||||||
if ($scope.assignment.candidateUsers)
|
|
||||||
{
|
|
||||||
var emptyUsers = true;
|
|
||||||
var toRemoveIndexes = [];
|
|
||||||
for (var i = 0; i < $scope.assignment.candidateUsers.length; i++)
|
|
||||||
{
|
|
||||||
if ($scope.assignment.candidateUsers[i].value != '')
|
|
||||||
{
|
|
||||||
emptyUsers = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateUsers.splice(toRemoveIndexes[i], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emptyUsers)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateUsers = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.assignment.candidateGroups)
|
|
||||||
{
|
|
||||||
var emptyGroups = true;
|
|
||||||
var toRemoveIndexes = [];
|
|
||||||
for (var i = 0; i < $scope.assignment.candidateGroups.length; i++)
|
|
||||||
{
|
|
||||||
if ($scope.assignment.candidateGroups[i].value != '')
|
|
||||||
{
|
|
||||||
emptyGroups = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateGroups.splice(toRemoveIndexes[i], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emptyGroups)
|
|
||||||
{
|
|
||||||
$scope.assignment.candidateGroups = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var host = document.domain;
|
|
||||||
if(host.indexOf('localhost')>=0){
|
|
||||||
host = 'http://localhost:14500/filem';
|
|
||||||
}else{
|
|
||||||
host = 'http://dang.77bi.vip/filem';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($scope.assignment.assignee){
|
|
||||||
$http({
|
|
||||||
method: 'get',
|
|
||||||
url: host + '/api/depart/users_departs',
|
|
||||||
params: {ids: $scope.assignment.assignee}, // get请求时的参数 (和JQuery不同,JQuery都放在data中)
|
|
||||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
|
|
||||||
}).success(function(data,status,headers,config) {
|
|
||||||
$scope.assignment.assignee_zh = data.result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var uds = [];
|
|
||||||
for (var i = 0; i < $scope.assignment.candidateUsers.length; i++)
|
|
||||||
{
|
|
||||||
uds.push($scope.assignment.candidateUsers[i].value);
|
|
||||||
}
|
|
||||||
$http({
|
|
||||||
method: 'get',
|
|
||||||
url: host + '/api/depart/users_departs',
|
|
||||||
params: {ids: uds.toString()}, // get请求时的参数 (和JQuery不同,JQuery都放在data中) post请求时的参数 (AngularJS优先支持RESTFUL(不是SOAP接口)接口服务的方式(默认传JSON格式的数据));
|
|
||||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
|
|
||||||
}).success(function(data,status,headers,config) {
|
|
||||||
$scope.assignment.candidateUsers_zh = data.result;
|
|
||||||
});
|
|
||||||
}];
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Condition expression
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmConditionExpressionCtrl = [ '$scope', '$modal', function($scope, $modal) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/condition-expression-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmConditionExpressionPopupCtrl = [ '$scope', '$translate', '$http', function($scope, $translate, $http) {
|
|
||||||
|
|
||||||
// Put json representing condition on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null) {
|
|
||||||
|
|
||||||
$scope.conditionExpression = {value: $scope.property.value};
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.conditionExpression = {value: ''};
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.save = function() {
|
|
||||||
$scope.property.value = $scope.conditionExpression.value;
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* String controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmStringPropertyCtrl = [ '$scope', function ($scope) {
|
|
||||||
|
|
||||||
$scope.shapeId = $scope.selectedShape.id;
|
|
||||||
$scope.valueFlushed = false;
|
|
||||||
/** Handler called when input field is blurred */
|
|
||||||
$scope.inputBlurred = function() {
|
|
||||||
$scope.valueFlushed = true;
|
|
||||||
if ($scope.property.value) {
|
|
||||||
$scope.property.value = $scope.property.value.replace(/(<([^>]+)>)/ig,"");
|
|
||||||
}
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.enterPressed = function(keyEvent) {
|
|
||||||
if (keyEvent && keyEvent.which === 13) {
|
|
||||||
keyEvent.preventDefault();
|
|
||||||
$scope.inputBlurred(); // we want to do the same as if the user would blur the input field
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.$on('$destroy', function controllerDestroyed() {
|
|
||||||
if(!$scope.valueFlushed) {
|
|
||||||
if ($scope.property.value) {
|
|
||||||
$scope.property.value = $scope.property.value.replace(/(<([^>]+)>)/ig,"");
|
|
||||||
}
|
|
||||||
$scope.updatePropertyInModel($scope.property, $scope.shapeId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Boolean controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmBooleanPropertyCtrl = ['$scope', function ($scope) {
|
|
||||||
|
|
||||||
$scope.changeValue = function() {
|
|
||||||
if ($scope.property.key === 'oryx-defaultflow' && $scope.property.value) {
|
|
||||||
var selectedShape = $scope.selectedShape;
|
|
||||||
if (selectedShape) {
|
|
||||||
var incomingNodes = selectedShape.getIncomingShapes();
|
|
||||||
if (incomingNodes && incomingNodes.length > 0) {
|
|
||||||
// get first node, since there can be only one for a sequence flow
|
|
||||||
var rootNode = incomingNodes[0];
|
|
||||||
var flows = rootNode.getOutgoingShapes();
|
|
||||||
if (flows && flows.length > 1) {
|
|
||||||
// in case there are more flows, check if another flow is already defined as default
|
|
||||||
for (var i = 0; i < flows.length; i++) {
|
|
||||||
if (flows[i].resourceId != selectedShape.resourceId) {
|
|
||||||
var defaultFlowProp = flows[i].properties['oryx-defaultflow'];
|
|
||||||
if (defaultFlowProp) {
|
|
||||||
flows[i].setProperty('oryx-defaultflow', false, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Text controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmTextPropertyCtrl = [ '$scope', '$modal', function($scope, $modal) {
|
|
||||||
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/text-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmTextPropertyPopupCtrl = ['$scope', function($scope) {
|
|
||||||
|
|
||||||
$scope.save = function() {
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
@@ -1,266 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Execution listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmEventListenersCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/event-listeners-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
//Need a separate controller for the modal window due to https://github.com/angular-ui/bootstrap/issues/259
|
|
||||||
// Will be fixed in a newer version of Angular UI
|
|
||||||
var KisBpmEventListenersPopupCtrl = [ '$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.eventListeners !== undefined
|
|
||||||
&& $scope.property.value.eventListeners !== null) {
|
|
||||||
|
|
||||||
if ($scope.property.value.eventListeners.constructor == String)
|
|
||||||
{
|
|
||||||
$scope.eventListeners = JSON.parse($scope.property.value.eventListeners);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.eventListeners = angular.copy($scope.property.value.eventListeners);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.eventListeners = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedListeners = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var eventPromise = $translate('PROPERTY.EXECUTIONLISTENERS.EVENT');
|
|
||||||
var implementationPromise = $translate('PROPERTY.EXECUTIONLISTENERS.FIELDS.IMPLEMENTATION');
|
|
||||||
var namePromise = $translate('PROPERTY.EXECUTIONLISTENERS.FIELDS.NAME');
|
|
||||||
|
|
||||||
$q.all([eventPromise, implementationPromise, namePromise]).then(function(results) {
|
|
||||||
$scope.labels.eventLabel = results[0];
|
|
||||||
$scope.labels.implementationLabel = results[1];
|
|
||||||
$scope.labels.nameLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'eventListeners',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedListeners,
|
|
||||||
afterSelectionChange: function (rowItem, event) {
|
|
||||||
|
|
||||||
if ($scope.selectedListeners.length > 0)
|
|
||||||
{
|
|
||||||
var fields = $scope.selectedListeners[0].fields;
|
|
||||||
if (fields !== undefined && fields !== null)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < fields.length; i++)
|
|
||||||
{
|
|
||||||
var field = fields[i];
|
|
||||||
if (field.stringValue !== undefined && field.stringValue !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.stringValue;
|
|
||||||
}
|
|
||||||
else if (field.expression !== undefined && field.expression !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.expression;
|
|
||||||
}
|
|
||||||
else if (field.string !== undefined && field.string !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$scope.selectedListeners[0].events || $scope.selectedListeners[0].events.length == 0)
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].events = [{event: ''}];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
columnDefs: [{ field: 'event', displayName: $scope.labels.eventLabel },
|
|
||||||
{ field: 'implementation', displayName: $scope.labels.implementationLabel }]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click handler for + button after enum value
|
|
||||||
$scope.addEventValue = function(index) {
|
|
||||||
$scope.selectedListeners[0].events.splice(index + 1, 0, {event: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for - button after enum value
|
|
||||||
$scope.removeEventValue = function(index) {
|
|
||||||
$scope.selectedListeners[0].events.splice(index, 1);
|
|
||||||
$scope.listenerDetailsChanged();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.listenerDetailsChanged = function() {
|
|
||||||
var listener = $scope.selectedListeners[0];
|
|
||||||
if (listener.events)
|
|
||||||
{
|
|
||||||
var eventText = '';
|
|
||||||
for (var i = 0; i < listener.events.length; i++)
|
|
||||||
{
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
eventText += ", ";
|
|
||||||
}
|
|
||||||
eventText += listener.events[i].event;
|
|
||||||
}
|
|
||||||
$scope.selectedListeners[0].event = eventText;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listener.rethrowEvent)
|
|
||||||
{
|
|
||||||
var implementationText = '';
|
|
||||||
if (listener.rethrowType && listener.rethrowType.length > 0)
|
|
||||||
{
|
|
||||||
if (listener.rethrowType === 'error' && listener.errorcode !== '')
|
|
||||||
{
|
|
||||||
implementationText = "Rethrow as error " + listener.errorcode;
|
|
||||||
}
|
|
||||||
else if (listener.rethrowType === 'message' && listener.messagename !== '')
|
|
||||||
{
|
|
||||||
implementationText = "Rethrow as message " + listener.messagename;
|
|
||||||
}
|
|
||||||
else if ((listener.rethrowType === 'signal' || listener.rethrowType === 'globalSignal') && listener.signalname !== '')
|
|
||||||
{
|
|
||||||
implementationText = "Rethrow as signal " + listener.signalname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.selectedListeners[0].implementation = implementationText;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($scope.selectedListeners[0].className !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].className;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedListeners[0].delegateExpression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].delegateExpression;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewListener = function() {
|
|
||||||
$scope.eventListeners.push({ event : '',
|
|
||||||
implementation : '',
|
|
||||||
className : '',
|
|
||||||
delegateExpression: '',
|
|
||||||
retrowEvent: false});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeListener = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.eventListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.eventListeners.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedListeners.length = 0;
|
|
||||||
if (index < $scope.eventListeners.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.eventListeners.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveListenerUp = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.eventListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.eventListeners[index];
|
|
||||||
$scope.eventListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.eventListeners.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveListenerDown = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.eventListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != $scope.eventListeners.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.eventListeners[index];
|
|
||||||
$scope.eventListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.eventListeners.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.eventListeners.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.eventListeners = $scope.eventListeners;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,326 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Execution listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmExecutionListenersCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/execution-listeners-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmExecutionListenersPopupCtrl = [ '$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.executionListeners !== undefined
|
|
||||||
&& $scope.property.value.executionListeners !== null) {
|
|
||||||
|
|
||||||
if ($scope.property.value.executionListeners.constructor == String)
|
|
||||||
{
|
|
||||||
$scope.executionListeners = JSON.parse($scope.property.value.executionListeners);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.executionListeners = angular.copy($scope.property.value.executionListeners);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < $scope.executionListeners.length; i++)
|
|
||||||
{
|
|
||||||
var executionListener = $scope.executionListeners[i];
|
|
||||||
if (executionListener.className !== undefined && executionListener.className !== '')
|
|
||||||
{
|
|
||||||
executionListener.implementation = executionListener.className;
|
|
||||||
}
|
|
||||||
else if (executionListener.expression !== undefined && executionListener.expression !== '')
|
|
||||||
{
|
|
||||||
executionListener.implementation = executionListener.expression;
|
|
||||||
}
|
|
||||||
else if (executionListener.delegateExpression !== undefined && executionListener.delegateExpression !== '')
|
|
||||||
{
|
|
||||||
executionListener.implementation = executionListener.delegateExpression;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$scope.executionListeners = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedListeners = [];
|
|
||||||
$scope.selectedFields = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var eventPromise = $translate('PROPERTY.EXECUTIONLISTENERS.EVENT');
|
|
||||||
var implementationPromise = $translate('PROPERTY.EXECUTIONLISTENERS.FIELDS.IMPLEMENTATION');
|
|
||||||
var namePromise = $translate('PROPERTY.EXECUTIONLISTENERS.FIELDS.NAME');
|
|
||||||
|
|
||||||
$q.all([eventPromise, implementationPromise, namePromise]).then(function(results) {
|
|
||||||
$scope.labels.eventLabel = results[0];
|
|
||||||
$scope.labels.implementationLabel = results[1];
|
|
||||||
$scope.labels.nameLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'executionListeners',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedListeners,
|
|
||||||
afterSelectionChange: function (rowItem, event) {
|
|
||||||
$scope.selectedFields.length = 0;
|
|
||||||
if ($scope.selectedListeners.length > 0)
|
|
||||||
{
|
|
||||||
var fields = $scope.selectedListeners[0].fields;
|
|
||||||
if (fields !== undefined && fields !== null)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < fields.length; i++)
|
|
||||||
{
|
|
||||||
var field = fields[i];
|
|
||||||
if (field.stringValue !== undefined && field.stringValue !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.stringValue;
|
|
||||||
}
|
|
||||||
else if (field.expression !== undefined && field.expression !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.expression;
|
|
||||||
}
|
|
||||||
else if (field.string !== undefined && field.string !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
columnDefs: [{ field: 'event', displayName: $scope.labels.eventLabel },
|
|
||||||
{ field: 'implementation', displayName: $scope.labels.implementationLabel }]
|
|
||||||
};
|
|
||||||
|
|
||||||
// Config for field grid
|
|
||||||
$scope.gridFieldOptions = {
|
|
||||||
data: 'selectedListeners[0].fields',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedFields,
|
|
||||||
columnDefs: [{ field: 'name', displayName: $scope.labels.nameLabel },
|
|
||||||
{ field: 'implementation', displayName: $scope.labels.implementationLabel}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.listenerDetailsChanged = function() {
|
|
||||||
if ($scope.selectedListeners[0].className !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].className;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedListeners[0].expression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].expression;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedListeners[0].delegateExpression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].delegateExpression;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewListener = function() {
|
|
||||||
$scope.executionListeners.push({ event : 'start',
|
|
||||||
implementation : '',
|
|
||||||
className : '',
|
|
||||||
expression: '',
|
|
||||||
delegateExpression: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeListener = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.executionListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.executionListeners.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedListeners.length = 0;
|
|
||||||
if (index < $scope.executionListeners.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.executionListeners.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveListenerUp = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.executionListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.executionListeners[index];
|
|
||||||
$scope.executionListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.executionListeners.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveListenerDown = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.executionListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != $scope.executionListeners.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.executionListeners[index];
|
|
||||||
$scope.executionListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.executionListeners.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.fieldDetailsChanged = function() {
|
|
||||||
if ($scope.selectedFields[0].stringValue !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].stringValue;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].expression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].expression;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].string !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewField = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0)
|
|
||||||
{
|
|
||||||
if ($scope.selectedListeners[0].fields == undefined)
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].fields = [];
|
|
||||||
}
|
|
||||||
$scope.selectedListeners[0].fields.push({ name : 'fieldName',
|
|
||||||
implementation : '',
|
|
||||||
stringValue : '',
|
|
||||||
expression: '',
|
|
||||||
string: ''});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeField = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
$scope.gridFieldOptions.selectItem(index, false);
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedFields.length = 0;
|
|
||||||
if (index < $scope.selectedListeners[0].fields.length) {
|
|
||||||
$scope.gridFieldOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.selectedListeners[0].fields.length > 0) {
|
|
||||||
$scope.gridFieldOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveFieldUp = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedListeners[0].fields[index];
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedListeners[0].fields.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveFieldDown = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != $scope.selectedListeners[0].fields.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedListeners[0].fields[index];
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedListeners[0].fields.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.executionListeners.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.executionListeners = $scope.executionListeners;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.$hide();
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.$hide();
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Task listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmFieldsCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/fields-popup.html',
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmFieldsPopupCtrl = [ '$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.fields !== undefined
|
|
||||||
&& $scope.property.value.fields !== null) {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.fields = angular.copy($scope.property.value.fields);
|
|
||||||
|
|
||||||
for (var i = 0; i < $scope.fields.length; i++)
|
|
||||||
{
|
|
||||||
var field = $scope.fields[i];
|
|
||||||
if (field.stringValue !== undefined && field.stringValue !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.stringValue;
|
|
||||||
}
|
|
||||||
else if (field.expression !== undefined && field.expression !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.expression;
|
|
||||||
}
|
|
||||||
else if (field.string !== undefined && field.string !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.fields = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedFields = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var namePromise = $translate('PROPERTY.FIELDS.NAME');
|
|
||||||
var implementationPromise = $translate('PROPERTY.FIELDS.IMPLEMENTATION');
|
|
||||||
|
|
||||||
$q.all([namePromise, implementationPromise]).then(function(results) {
|
|
||||||
$scope.labels.nameLabel = results[0];
|
|
||||||
$scope.labels.implementationLabel = results[1];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'fields',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected: false,
|
|
||||||
selectedItems: $scope.selectedFields,
|
|
||||||
columnDefs: [{field: 'name', displayName: $scope.labels.nameLabel},
|
|
||||||
{field: 'implementation', displayName: $scope.labels.implementationLabel}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.fieldDetailsChanged = function() {
|
|
||||||
if ($scope.selectedFields[0].stringValue != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].stringValue;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].expression != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].expression;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].string != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewField = function() {
|
|
||||||
$scope.fields.push({ name : 'fieldName',
|
|
||||||
implementation : '',
|
|
||||||
stringValue : '',
|
|
||||||
expression: '',
|
|
||||||
string: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeField = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.fields.indexOf($scope.selectedFields[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.fields.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedFields.length = 0;
|
|
||||||
if (index < $scope.fields.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.fields.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveFieldUp = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.fields[index];
|
|
||||||
$scope.fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.fields.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveFieldDown = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != $scope.fields.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.fields[index];
|
|
||||||
$scope.fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.fields.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.fields.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.fields = $scope.fields;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Form Properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmFormPropertiesCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/form-properties-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmFormPropertiesPopupCtrl = ['$scope', '$q', '$translate', '$timeout', function($scope, $q, $translate, $timeout) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.formProperties !== undefined
|
|
||||||
&& $scope.property.value.formProperties !== null) {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happended
|
|
||||||
$scope.formProperties = angular.copy($scope.property.value.formProperties);
|
|
||||||
|
|
||||||
for (var i = 0; i < $scope.formProperties.length; i++) {
|
|
||||||
var formProperty = $scope.formProperties[i];
|
|
||||||
if (formProperty.enumValues && formProperty.enumValues.length > 0) {
|
|
||||||
for (var j = 0; j < formProperty.enumValues.length; j++) {
|
|
||||||
var enumValue = formProperty.enumValues[j];
|
|
||||||
if (!enumValue.id && !enumValue.name && enumValue.value) {
|
|
||||||
enumValue.id = enumValue.value;
|
|
||||||
enumValue.name = enumValue.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.formProperties = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedProperties = [];
|
|
||||||
$scope.selectedEnumValues = [];
|
|
||||||
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var idPromise = $translate('PROPERTY.FORMPROPERTIES.ID');
|
|
||||||
var namePromise = $translate('PROPERTY.FORMPROPERTIES.NAME');
|
|
||||||
var typePromise = $translate('PROPERTY.FORMPROPERTIES.TYPE');
|
|
||||||
|
|
||||||
$q.all([idPromise, namePromise, typePromise]).then(function(results) {
|
|
||||||
$scope.labels.idLabel = results[0];
|
|
||||||
$scope.labels.nameLabel = results[1];
|
|
||||||
$scope.labels.typeLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'formProperties',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedProperties,
|
|
||||||
columnDefs: [{ field: 'id', displayName: $scope.labels.idLabel },
|
|
||||||
{ field: 'name', displayName: $scope.labels.nameLabel},
|
|
||||||
{ field: 'type', displayName: $scope.labels.typeLabel}]
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.enumGridOptions = {
|
|
||||||
data: 'selectedProperties[0].enumValues',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedEnumValues,
|
|
||||||
columnDefs: [{ field: 'id', displayName: $scope.labels.idLabel },
|
|
||||||
{ field: 'name', displayName: $scope.labels.nameLabel}]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handler for when the value of the type dropdown changes
|
|
||||||
$scope.propertyTypeChanged = function() {
|
|
||||||
|
|
||||||
// Check date. If date, show date pattern
|
|
||||||
if ($scope.selectedProperties[0].type === 'date') {
|
|
||||||
$scope.selectedProperties[0].datePattern = 'MM-dd-yyyy hh:mm';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
delete $scope.selectedProperties[0].datePattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check enum. If enum, show list of options
|
|
||||||
if ($scope.selectedProperties[0].type === 'enum') {
|
|
||||||
$scope.selectedProperties[0].enumValues = [ {id: 'value1', name: 'Value 1'}, {id: 'value2', name: 'Value 2'}];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
delete $scope.selectedProperties[0].enumValues;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
var propertyIndex = 1;
|
|
||||||
$scope.addNewProperty = function() {
|
|
||||||
$scope.formProperties.push({ id : 'new_property_' + propertyIndex++,
|
|
||||||
name : '',
|
|
||||||
type : 'string',
|
|
||||||
readable: true,
|
|
||||||
writable: true});
|
|
||||||
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.gridOptions.selectItem($scope.formProperties.length - 1, true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeProperty = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0) {
|
|
||||||
var index = $scope.formProperties.indexOf($scope.selectedProperties[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.formProperties.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedProperties.length = 0;
|
|
||||||
if (index < $scope.formProperties.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.formProperties.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.movePropertyUp = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0) {
|
|
||||||
var index = $scope.formProperties.indexOf($scope.selectedProperties[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.formProperties[index];
|
|
||||||
$scope.formProperties.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.formProperties.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.movePropertyDown = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0) {
|
|
||||||
var index = $scope.formProperties.indexOf($scope.selectedProperties[0]);
|
|
||||||
if (index != $scope.formProperties.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.formProperties[index];
|
|
||||||
$scope.formProperties.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.formProperties.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.addNewEnumValue = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0) {
|
|
||||||
$scope.selectedProperties[0].enumValues.push({ id : '', name : ''});
|
|
||||||
}
|
|
||||||
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.enumGridOptions.selectItem($scope.selectedProperties[0].enumValues.length - 1, true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeEnumValue = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0 && $scope.selectedEnumValues.length > 0) {
|
|
||||||
var index = $scope.selectedProperties[0].enumValues.indexOf($scope.selectedEnumValues[0]);
|
|
||||||
$scope.enumGridOptions.selectItem(index, false);
|
|
||||||
$scope.selectedProperties[0].enumValues.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedEnumValues.length = 0;
|
|
||||||
if (index < $scope.selectedProperties[0].enumValues.length) {
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.enumGridOptions.selectItem(index + 1, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if ($scope.selectedProperties[0].enumValues.length > 0) {
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.enumGridOptions.selectItem(index - 1, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveEnumValueUp = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0 && $scope.selectedEnumValues.length > 0) {
|
|
||||||
var index = $scope.selectedProperties[0].enumValues.indexOf($scope.selectedEnumValues[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedProperties[0].enumValues[index];
|
|
||||||
$scope.selectedProperties[0].enumValues.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedProperties[0].enumValues.splice(index + -1, 0, temp);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveEnumValueDown = function() {
|
|
||||||
if ($scope.selectedProperties.length > 0 && $scope.selectedEnumValues.length > 0) {
|
|
||||||
var index = $scope.selectedProperties[0].enumValues.indexOf($scope.selectedEnumValues[0]);
|
|
||||||
if (index != $scope.selectedProperties[0].enumValues.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedProperties[0].enumValues[index];
|
|
||||||
$scope.selectedProperties[0].enumValues.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedProperties[0].enumValues.splice(index + 1, 0, temp);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.formProperties.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.formProperties = $scope.formProperties;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.$hide();
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.$hide();
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Input parameters for call activity
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmInParametersCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/in-parameters-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmInParametersPopupCtrl = ['$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.inParameters !== undefined
|
|
||||||
&& $scope.property.value.inParameters !== null) {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.parameters = angular.copy($scope.property.value.inParameters);
|
|
||||||
} else {
|
|
||||||
$scope.parameters = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedParameters = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var sourcePromise = $translate('PROPERTY.PARAMETER.SOURCE');
|
|
||||||
var sourceExpressionPromise = $translate('PROPERTY.PARAMETER.SOURCEEXPRESSION');
|
|
||||||
var targetPromise = $translate('PROPERTY.PARAMETER.TARGET');
|
|
||||||
|
|
||||||
$q.all([sourcePromise, sourceExpressionPromise, targetPromise]).then(function(results) {
|
|
||||||
$scope.labels.sourceLabel = results[0];
|
|
||||||
$scope.labels.sourceExpressionLabel = results[1];
|
|
||||||
$scope.labels.targetLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'parameters',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedParameters,
|
|
||||||
columnDefs: [{ field: 'source', displayName: $scope.labels.sourceLabel },
|
|
||||||
{ field: 'sourceExpression', displayName: $scope.labels.sourceExpressionLabel },
|
|
||||||
{ field: 'target', displayName: $scope.labels.targetLabel }]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewParameter = function() {
|
|
||||||
$scope.parameters.push({ source : '',
|
|
||||||
sourceExpression : '',
|
|
||||||
target : ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeParameter = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedParameters.length = 0;
|
|
||||||
if (index < $scope.parameters.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.parameters.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveParameterUp = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.parameters[index];
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.parameters.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveParameterDown = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
if (index != $scope.parameters.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.parameters[index];
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.parameters.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.parameters.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.inParameters = $scope.parameters;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Execution listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
angular.module('activitiModeler').controller('ActivitiMessageDefinitionsCtrl', ['$scope', '$modal', function ($scope, $modal) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/message-definitions-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}]);
|
|
||||||
|
|
||||||
//Need a separate controller for the modal window due to https://github.com/angular-ui/bootstrap/issues/259
|
|
||||||
// Will be fixed in a newer version of Angular UI
|
|
||||||
angular.module('activitiModeler').controller('ActivitiMessageDefinitionsPopupCtrl',
|
|
||||||
['$scope', '$q', '$translate', '$timeout', function ($scope, $q, $translate, $timeout) {
|
|
||||||
|
|
||||||
// Put json representing mesage definitions on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null && $scope.property.value.length > 0) {
|
|
||||||
|
|
||||||
if ($scope.property.value.constructor == String) {
|
|
||||||
$scope.messageDefinitions = JSON.parse($scope.property.value);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.messageDefinitions = angular.copy($scope.property.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.messageDefinitions = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected mesage definitions (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedMessages = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var idPromise = $translate('PROPERTY.MESSAGEDEFINITIONS.ID');
|
|
||||||
var namePromise = $translate('PROPERTY.MESSAGEDEFINITIONS.NAME');
|
|
||||||
|
|
||||||
$q.all([idPromise, namePromise]).then(function (results) {
|
|
||||||
|
|
||||||
$scope.labels.idLabel = results[0];
|
|
||||||
$scope.labels.nameLabel = results[1];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'messageDefinitions',
|
|
||||||
headerRowHeight: 28,
|
|
||||||
enableRowSelection: true,
|
|
||||||
enableRowHeaderSelection: false,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedMessages,
|
|
||||||
columnDefs: [
|
|
||||||
{field: 'id', displayName: $scope.labels.idLabel},
|
|
||||||
{field: 'name', displayName: $scope.labels.nameLabel}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewMessageDefinition = function () {
|
|
||||||
var newMessageDefinition = {id: '', name: ''};
|
|
||||||
|
|
||||||
$scope.messageDefinitions.push(newMessageDefinition);
|
|
||||||
$timeout(function () {
|
|
||||||
$scope.gridOptions.selectItem($scope.messageDefinitions.length - 1, true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeMessageDefinition = function () {
|
|
||||||
if ($scope.selectedMessages && $scope.selectedMessages.length > 0) {
|
|
||||||
var index = $scope.messageDefinitions.indexOf($scope.selectedMessages[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.messageDefinitions.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedMessages.length = 0;
|
|
||||||
if (index < $scope.messageDefinitions.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.messageDefinitions.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function () {
|
|
||||||
|
|
||||||
if ($scope.messageDefinitions.length > 0) {
|
|
||||||
$scope.property.value = $scope.messageDefinitions;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function () {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function () {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
angular.module('activitiModeler').controller('ActivitiMessageRefCtrl', [ '$scope', function($scope) {
|
|
||||||
|
|
||||||
// Find the parent shape on which the message definitions are defined
|
|
||||||
var messageDefinitionsProperty = undefined;
|
|
||||||
var parent = $scope.selectedShape;
|
|
||||||
while (parent !== null && parent !== undefined && messageDefinitionsProperty === undefined) {
|
|
||||||
if (parent.properties && parent.properties['oryx-messagedefinitions']) {
|
|
||||||
messageDefinitionsProperty = parent.properties['oryx-messagedefinitions'];
|
|
||||||
} else {
|
|
||||||
parent = parent.parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
messageDefinitionsProperty = JSON.parse(messageDefinitionsProperty);
|
|
||||||
if (typeof messageDefinitionsProperty == 'string') {
|
|
||||||
messageDefinitionsProperty = JSON.parse(messageDefinitionsProperty);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
// Do nothing here, just to be sure we try-catch it
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.messageDefinitions = messageDefinitionsProperty;
|
|
||||||
|
|
||||||
|
|
||||||
$scope.messageChanged = function() {
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Execution listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmMultiInstanceCtrl = [ '$scope', function($scope) {
|
|
||||||
|
|
||||||
if ($scope.property.value == undefined && $scope.property.value == null)
|
|
||||||
{
|
|
||||||
$scope.property.value = 'None';
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.multiInstanceChanged = function() {
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Input parameters for call activity
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmOutParametersCtrl = [ '$scope' , '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/out-parameters-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmOutParametersPopupCtrl = [ '$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.outParameters !== undefined
|
|
||||||
&& $scope.property.value.outParameters !== null) {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.parameters = angular.copy($scope.property.value.outParameters);
|
|
||||||
} else {
|
|
||||||
$scope.parameters = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedParameters = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var sourcePromise = $translate('PROPERTY.PARAMETER.SOURCE');
|
|
||||||
var sourceExpressionPromise = $translate('PROPERTY.PARAMETER.SOURCEEXPRESSION');
|
|
||||||
var targetPromise = $translate('PROPERTY.PARAMETER.TARGET');
|
|
||||||
|
|
||||||
$q.all([sourcePromise, sourceExpressionPromise, targetPromise]).then(function(results) {
|
|
||||||
$scope.labels.sourceLabel = results[0];
|
|
||||||
$scope.labels.sourceExpressionLabel = results[1];
|
|
||||||
$scope.labels.targetLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'parameters',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedParameters,
|
|
||||||
columnDefs: [{ field: 'source', displayName: $scope.labels.sourceLabel },
|
|
||||||
{ field: 'sourceExpression', displayName: $scope.labels.sourceExpressionLabel },
|
|
||||||
{ field: 'target', displayName: $scope.labels.targetLabel }]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewParameter = function() {
|
|
||||||
$scope.parameters.push({ source : '',
|
|
||||||
sourceExpression : '',
|
|
||||||
target : ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeParameter = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedParameters.length = 0;
|
|
||||||
if (index < $scope.parameters.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.parameters.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveParameterUp = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.parameters[index];
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.parameters.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveParameterDown = function() {
|
|
||||||
if ($scope.selectedParameters.length > 0) {
|
|
||||||
var index = $scope.parameters.indexOf($scope.selectedParameters[0]);
|
|
||||||
if (index != $scope.parameters.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.parameters[index];
|
|
||||||
$scope.parameters.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.parameters.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.parameters.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.outParameters = $scope.parameters;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sequence flow order controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmSequenceFlowOrderCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/sequenceflow-order-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmSequenceFlowOrderPopupCtrl = ['$scope', '$translate', function($scope, $translate) {
|
|
||||||
|
|
||||||
// Find the outgoing sequence flow of the current selected shape
|
|
||||||
var outgoingSequenceFlow = [];
|
|
||||||
var selectedShape = $scope.selectedShape;
|
|
||||||
if (selectedShape) {
|
|
||||||
var outgoingNodes = selectedShape.getOutgoingShapes();
|
|
||||||
for (var i=0; i<outgoingNodes.length; i++) {
|
|
||||||
if (outgoingNodes[i].getStencil().title() === 'Sequence flow') {
|
|
||||||
var targetActivity = outgoingNodes[i].getTarget();
|
|
||||||
// We need the resourceId of a sequence flow, not the id because that will change with every editor load
|
|
||||||
outgoingSequenceFlow.push({
|
|
||||||
id : outgoingNodes[i].resourceId,
|
|
||||||
targetTitle : targetActivity.properties['oryx-name'],
|
|
||||||
targetType : targetActivity.getStencil().title()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('Programmatic error: no selected shape found');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we can apply the order which was (possibly) previously saved
|
|
||||||
var orderedOutgoingSequenceFlow = [];
|
|
||||||
if ($scope.property.value && $scope.property.value.sequenceFlowOrder) {
|
|
||||||
|
|
||||||
var sequenceFlowOrderList = $scope.property.value.sequenceFlowOrder;
|
|
||||||
|
|
||||||
// Loop the list of sequence flow that was saved in the json model and match them with the outgoing sequence flow found above
|
|
||||||
for (var flowIndex=0; flowIndex < sequenceFlowOrderList.length; flowIndex++) {
|
|
||||||
|
|
||||||
// find the sequence flow in the outgoing sequence flows.
|
|
||||||
|
|
||||||
for (var outgoingFlowIndex=0; outgoingFlowIndex < outgoingSequenceFlow.length; outgoingFlowIndex++) {
|
|
||||||
if (outgoingSequenceFlow[outgoingFlowIndex].id === sequenceFlowOrderList[flowIndex]) {
|
|
||||||
orderedOutgoingSequenceFlow.push(outgoingSequenceFlow[outgoingFlowIndex]);
|
|
||||||
outgoingSequenceFlow.splice(outgoingFlowIndex, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now all the matching sequence flow we're removed from the outgoing sequence flow list
|
|
||||||
// We can simply apply the remaining ones (these are new vs. the time when the values were saved to the model)
|
|
||||||
orderedOutgoingSequenceFlow = orderedOutgoingSequenceFlow.concat(outgoingSequenceFlow);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
orderedOutgoingSequenceFlow = outgoingSequenceFlow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we can put it on the scope
|
|
||||||
$scope.outgoingSequenceFlow = orderedOutgoingSequenceFlow;
|
|
||||||
|
|
||||||
// Move up click handler
|
|
||||||
$scope.moveUp = function(index) {
|
|
||||||
var temp = $scope.outgoingSequenceFlow[index];
|
|
||||||
$scope.outgoingSequenceFlow[index] = $scope.outgoingSequenceFlow[index - 1];
|
|
||||||
$scope.outgoingSequenceFlow[index - 1] = temp;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Move down click handler
|
|
||||||
$scope.moveDown = function(index) {
|
|
||||||
var temp = $scope.outgoingSequenceFlow[index];
|
|
||||||
$scope.outgoingSequenceFlow[index] = $scope.outgoingSequenceFlow[index + 1];
|
|
||||||
$scope.outgoingSequenceFlow[index + 1] = temp;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save click handler
|
|
||||||
$scope.save = function() {
|
|
||||||
if ($scope.outgoingSequenceFlow.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.sequenceFlowOrder = [];
|
|
||||||
|
|
||||||
for (var flowIndex=0; flowIndex < $scope.outgoingSequenceFlow.length; flowIndex++) {
|
|
||||||
$scope.property.value.sequenceFlowOrder.push($scope.outgoingSequenceFlow[flowIndex].id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Cancel click handler
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
angular.module('activitiModeler').controller('ActivitiSignalDefinitionsCtrl', ['$scope', '$modal', function ($scope, $modal) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/signal-definitions-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}]);
|
|
||||||
|
|
||||||
//Need a separate controller for the modal window due to https://github.com/angular-ui/bootstrap/issues/259
|
|
||||||
// Will be fixed in a newer version of Angular UI
|
|
||||||
angular.module('activitiModeler').controller('ActivitiSignalDefinitionsPopupCtrl',
|
|
||||||
['$scope', '$q', '$translate', '$timeout', function ($scope, $q, $translate, $timeout) {
|
|
||||||
|
|
||||||
// Put json representing signal definitions on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null && $scope.property.value.length > 0) {
|
|
||||||
|
|
||||||
if ($scope.property.value.constructor == String) {
|
|
||||||
$scope.signalDefinitions = JSON.parse($scope.property.value);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.signalDefinitions = angular.copy($scope.property.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$scope.signalDefinitions = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected signal definitions (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedSignals = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var idPromise = $translate('PROPERTY.SIGNALDEFINITIONS.ID');
|
|
||||||
var namePromise = $translate('PROPERTY.SIGNALDEFINITIONS.NAME');
|
|
||||||
var scopePromise = $translate('PROPERTY.SIGNALDEFINITIONS.SCOPE');
|
|
||||||
|
|
||||||
$q.all([idPromise, namePromise, scopePromise]).then(function (results) {
|
|
||||||
|
|
||||||
$scope.labels.idLabel = results[0];
|
|
||||||
$scope.labels.nameLabel = results[1];
|
|
||||||
$scope.labels.scopeLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'signalDefinitions',
|
|
||||||
headerRowHeight: 28,
|
|
||||||
enableRowSelection: true,
|
|
||||||
enableRowHeaderSelection: false,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedSignals,
|
|
||||||
columnDefs: [
|
|
||||||
{field: 'id', displayName: $scope.labels.idLabel},
|
|
||||||
{field: 'name', displayName: $scope.labels.nameLabel},
|
|
||||||
{field: 'scope', displayName: $scope.labels.scopeLabel}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewSignalDefinition = function () {
|
|
||||||
var newSignalDefinition = {id: '', name: '', scope: 'global'};
|
|
||||||
|
|
||||||
$scope.signalDefinitions.push(newSignalDefinition);
|
|
||||||
$timeout(function () {
|
|
||||||
$scope.gridOptions.selectItem($scope.signalDefinitions.length - 1, true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeSignalDefinition = function () {
|
|
||||||
if ($scope.selectedSignals && $scope.selectedSignals.length > 0) {
|
|
||||||
var index = $scope.signalDefinitions.indexOf($scope.selectedSignals[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.signalDefinitions.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedSignals.length = 0;
|
|
||||||
if (index < $scope.signalDefinitions.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.signalDefinitions.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function () {
|
|
||||||
|
|
||||||
if ($scope.signalDefinitions.length > 0) {
|
|
||||||
$scope.property.value = $scope.signalDefinitions;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function () {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function () {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
angular.module('activitiModeler').controller('ActivitiSignalRefCtrl', [ '$scope', function($scope) {
|
|
||||||
|
|
||||||
// Find the parent shape on which the signal definitions are defined
|
|
||||||
var signalDefinitionsProperty = undefined;
|
|
||||||
var parent = $scope.selectedShape;
|
|
||||||
while (parent !== null && parent !== undefined && signalDefinitionsProperty === undefined) {
|
|
||||||
if (parent.properties && parent.properties['oryx-signaldefinitions']) {
|
|
||||||
signalDefinitionsProperty = parent.properties['oryx-signaldefinitions'];
|
|
||||||
} else {
|
|
||||||
parent = parent.parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
signalDefinitionsProperty = JSON.parse(signalDefinitionsProperty);
|
|
||||||
if (typeof signalDefinitionsProperty == 'string') {
|
|
||||||
signalDefinitionsProperty = JSON.parse(signalDefinitionsProperty);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
// Do nothing here, just to be sure we try-catch it
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.signalDefinitions = signalDefinitionsProperty;
|
|
||||||
|
|
||||||
|
|
||||||
$scope.signalChanged = function() {
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
@@ -1,325 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Task listeners
|
|
||||||
*/
|
|
||||||
|
|
||||||
var KisBpmTaskListenersCtrl = [ '$scope', '$modal', '$timeout', '$translate', function($scope, $modal, $timeout, $translate) {
|
|
||||||
|
|
||||||
// Config for the modal window
|
|
||||||
var opts = {
|
|
||||||
template: 'editor-app/configuration/properties/task-listeners-popup.html?version=' + Date.now(),
|
|
||||||
scope: $scope
|
|
||||||
};
|
|
||||||
|
|
||||||
// Open the dialog
|
|
||||||
$modal(opts);
|
|
||||||
}];
|
|
||||||
|
|
||||||
var KisBpmTaskListenersPopupCtrl = [ '$scope', '$q', '$translate', function($scope, $q, $translate) {
|
|
||||||
|
|
||||||
// Put json representing form properties on scope
|
|
||||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
|
||||||
&& $scope.property.value.taskListeners !== undefined
|
|
||||||
&& $scope.property.value.taskListeners !== null) {
|
|
||||||
|
|
||||||
if ($scope.property.value.taskListeners.constructor == String)
|
|
||||||
{
|
|
||||||
$scope.taskListeners = JSON.parse($scope.property.value.taskListeners);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Note that we clone the json object rather then setting it directly,
|
|
||||||
// this to cope with the fact that the user can click the cancel button and no changes should have happened
|
|
||||||
$scope.taskListeners = angular.copy($scope.property.value.taskListeners);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < $scope.taskListeners.length; i++)
|
|
||||||
{
|
|
||||||
var taskListener = $scope.taskListeners[i];
|
|
||||||
if (taskListener.className !== undefined && taskListener.className !== '')
|
|
||||||
{
|
|
||||||
taskListener.implementation = taskListener.className;
|
|
||||||
}
|
|
||||||
else if (taskListener.expression !== undefined && taskListener.expression !== '')
|
|
||||||
{
|
|
||||||
taskListener.implementation = taskListener.expression;
|
|
||||||
}
|
|
||||||
else if (taskListener.delegateExpression !== undefined && taskListener.delegateExpression !== '')
|
|
||||||
{
|
|
||||||
taskListener.implementation = taskListener.delegateExpression;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$scope.taskListeners = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array to contain selected properties (yes - we only can select one, but ng-grid isn't smart enough)
|
|
||||||
$scope.selectedListeners = [];
|
|
||||||
$scope.selectedFields = [];
|
|
||||||
$scope.translationsRetrieved = false;
|
|
||||||
|
|
||||||
$scope.labels = {};
|
|
||||||
|
|
||||||
var eventPromise = $translate('PROPERTY.TASKLISTENERS.EVENT');
|
|
||||||
var implementationPromise = $translate('PROPERTY.TASKLISTENERS.FIELDS.IMPLEMENTATION');
|
|
||||||
var namePromise = $translate('PROPERTY.TASKLISTENERS.FIELDS.NAME');
|
|
||||||
|
|
||||||
$q.all([eventPromise, implementationPromise, namePromise]).then(function(results) {
|
|
||||||
$scope.labels.eventLabel = results[0];
|
|
||||||
$scope.labels.implementationLabel = results[1];
|
|
||||||
$scope.labels.nameLabel = results[2];
|
|
||||||
$scope.translationsRetrieved = true;
|
|
||||||
|
|
||||||
// Config for grid
|
|
||||||
$scope.gridOptions = {
|
|
||||||
data: 'taskListeners',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedListeners,
|
|
||||||
afterSelectionChange: function (rowItem, event) {
|
|
||||||
$scope.selectedFields.length = 0;
|
|
||||||
if ($scope.selectedListeners.length > 0)
|
|
||||||
{
|
|
||||||
var fields = $scope.selectedListeners[0].fields;
|
|
||||||
if (fields !== undefined && fields !== null)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < fields.length; i++)
|
|
||||||
{
|
|
||||||
var field = fields[i];
|
|
||||||
if (field.stringValue !== undefined && field.stringValue !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.stringValue;
|
|
||||||
}
|
|
||||||
else if (field.expression !== undefined && field.expression !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.expression;
|
|
||||||
}
|
|
||||||
else if (field.string !== undefined && field.string !== '')
|
|
||||||
{
|
|
||||||
field.implementation = field.string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
columnDefs: [{ field: 'event', displayName: $scope.labels.eventLabel },
|
|
||||||
{ field: 'implementation', displayName: $scope.labels.implementationLabel}]
|
|
||||||
};
|
|
||||||
|
|
||||||
// Config for field grid
|
|
||||||
$scope.gridFieldOptions = {
|
|
||||||
data: 'selectedListeners[0].fields',
|
|
||||||
enableRowReordering: true,
|
|
||||||
headerRowHeight: 28,
|
|
||||||
multiSelect: false,
|
|
||||||
keepLastSelected : false,
|
|
||||||
selectedItems: $scope.selectedFields,
|
|
||||||
columnDefs: [{ field: 'name', displayName: $scope.labels.name },
|
|
||||||
{ field: 'implementation', displayName: $scope.labels.implementationLabel}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.listenerDetailsChanged = function() {
|
|
||||||
if ($scope.selectedListeners[0].className !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].className;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedListeners[0].expression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].expression;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedListeners[0].delegateExpression !== '')
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = $scope.selectedListeners[0].delegateExpression;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].implementation = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewListener = function() {
|
|
||||||
$scope.taskListeners.push({ event : 'create',
|
|
||||||
implementation : '',
|
|
||||||
className : '',
|
|
||||||
expression: '',
|
|
||||||
delegateExpression: ''});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeListener = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.taskListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
$scope.gridOptions.selectItem(index, false);
|
|
||||||
$scope.taskListeners.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedListeners.length = 0;
|
|
||||||
if (index < $scope.taskListeners.length) {
|
|
||||||
$scope.gridOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.taskListeners.length > 0) {
|
|
||||||
$scope.gridOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveListenerUp = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.taskListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.taskListeners[index];
|
|
||||||
$scope.taskListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.taskListeners.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveListenerDown = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0) {
|
|
||||||
var index = $scope.taskListeners.indexOf($scope.selectedListeners[0]);
|
|
||||||
if (index != $scope.taskListeners.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.taskListeners[index];
|
|
||||||
$scope.taskListeners.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.taskListeners.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.fieldDetailsChanged = function() {
|
|
||||||
if ($scope.selectedFields[0].stringValue != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].stringValue;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].expression != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].expression;
|
|
||||||
}
|
|
||||||
else if ($scope.selectedFields[0].string != '')
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = $scope.selectedFields[0].string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$scope.selectedFields[0].implementation = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for add button
|
|
||||||
$scope.addNewField = function() {
|
|
||||||
if ($scope.selectedListeners.length > 0)
|
|
||||||
{
|
|
||||||
if ($scope.selectedListeners[0].fields == undefined)
|
|
||||||
{
|
|
||||||
$scope.selectedListeners[0].fields = [];
|
|
||||||
}
|
|
||||||
$scope.selectedListeners[0].fields.push({ name : 'fieldName',
|
|
||||||
implementation : '',
|
|
||||||
stringValue : '',
|
|
||||||
expression: '',
|
|
||||||
string: ''});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for remove button
|
|
||||||
$scope.removeField = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
$scope.gridFieldOptions.selectItem(index, false);
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
|
|
||||||
$scope.selectedFields.length = 0;
|
|
||||||
if (index < $scope.selectedListeners[0].fields.length) {
|
|
||||||
$scope.gridFieldOptions.selectItem(index + 1, true);
|
|
||||||
} else if ($scope.selectedListeners[0].fields.length > 0) {
|
|
||||||
$scope.gridFieldOptions.selectItem(index - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for up button
|
|
||||||
$scope.moveFieldUp = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != 0) { // If it's the first, no moving up of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedListeners[0].fields[index];
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedListeners[0].fields.splice(index + -1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for down button
|
|
||||||
$scope.moveFieldDown = function() {
|
|
||||||
if ($scope.selectedFields.length > 0) {
|
|
||||||
var index = $scope.selectedListeners[0].fields.indexOf($scope.selectedFields[0]);
|
|
||||||
if (index != $scope.selectedListeners[0].fields.length - 1) { // If it's the last element, no moving down of course
|
|
||||||
// Reason for funny way of swapping, see https://github.com/angular-ui/ng-grid/issues/272
|
|
||||||
var temp = $scope.selectedListeners[0].fields[index];
|
|
||||||
$scope.selectedListeners[0].fields.splice(index, 1);
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.selectedListeners[0].fields.splice(index + 1, 0, temp);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Click handler for save button
|
|
||||||
$scope.save = function() {
|
|
||||||
|
|
||||||
if ($scope.taskListeners.length > 0) {
|
|
||||||
$scope.property.value = {};
|
|
||||||
$scope.property.value.taskListeners = $scope.taskListeners;
|
|
||||||
} else {
|
|
||||||
$scope.property.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.updatePropertyInModel($scope.property);
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$scope.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Close button handler
|
|
||||||
$scope.close = function() {
|
|
||||||
$scope.property.mode = 'read';
|
|
||||||
$scope.$hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
}];
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Activiti Modeler component part of the Activiti project
|
|
||||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var KISBPM = KISBPM || {};
|
|
||||||
KISBPM.PROPERTY_CONFIG =
|
|
||||||
{
|
|
||||||
"string": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/default-value-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/string-property-write-mode-template.html"
|
|
||||||
},
|
|
||||||
"boolean": {
|
|
||||||
"templateUrl": "editor-app/configuration/properties/boolean-property-template.html"
|
|
||||||
},
|
|
||||||
"text" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/default-value-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/text-property-write-template.html"
|
|
||||||
},
|
|
||||||
"kisbpm-multiinstance" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/default-value-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/multiinstance-property-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-formproperties-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/form-properties-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/form-properties-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-executionlisteners-multiplecomplex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/execution-listeners-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/execution-listeners-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-tasklisteners-multiplecomplex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/task-listeners-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/task-listeners-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-eventlisteners-multiplecomplex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/event-listeners-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/event-listeners-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-usertaskassignment-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/assignment-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/assignment-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-servicetaskfields-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/fields-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/fields-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-callactivityinparameters-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/in-parameters-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/in-parameters-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-callactivityoutparameters-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/out-parameters-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/out-parameters-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-subprocessreference-complex": {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/subprocess-reference-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/subprocess-reference-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-sequencefloworder-complex" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/sequenceflow-order-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/sequenceflow-order-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-conditionsequenceflow-complex" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/condition-expression-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/condition-expression-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-signaldefinitions-multiplecomplex" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/signal-definitions-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/signal-definitions-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-signalref-string" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/default-value-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/signal-property-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-messagedefinitions-multiplecomplex" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/message-definitions-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/message-definitions-write-template.html"
|
|
||||||
},
|
|
||||||
"oryx-messageref-string" : {
|
|
||||||
"readModeTemplateUrl": "editor-app/configuration/properties/default-value-display-template.html",
|
|
||||||
"writeModeTemplateUrl": "editor-app/configuration/properties/message-property-write-template.html"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<span ng-if="property.value.assignment.assignee">{{'PROPERTY.ASSIGNMENT.ASSIGNEE_DISPLAY' | translate:property.value.assignment }} </span>
|
|
||||||
<span ng-if="property.value.assignment.candidateUsers.length > 0">{{'PROPERTY.ASSIGNMENT.CANDIDATE_USERS_DISPLAY' | translate:property.value.assignment.candidateUsers}} </span>
|
|
||||||
<span ng-if="property.value.assignment.candidateGroups.length > 0">{{'PROPERTY.ASSIGNMENT.CANDIDATE_GROUPS_DISPLAY' | translate:property.value.assignment.candidateGroups}} </span>
|
|
||||||
<span ng-if="!property.value.assignment.assignee && (!property.value.assignment.candidateUsers || property.value.assignment.candidateUsers.length == 0) && (!property.value.assignment.candidateGroups || property.value.assignment.candidateGroups.length == 0)" translate>PROPERTY.ASSIGNMENT.EMPTY</span>
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<div class="modal" ng-controller="KisBpmAssignmentPopupCtrl">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button>
|
|
||||||
<h2 translate>PROPERTY.ASSIGNMENT.TITLE</h2>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="assigneeField">{{'PROPERTY.ASSIGNMENT.ASSIGNEE' | translate}}</label>
|
|
||||||
<input type="text" class="form-control" ng-model="assignment.assignee_zh" placeholder="请双击选择" onblur="loadAssignee(this,1)" ondblclick="load_assignee_show(this,1)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="userField">{{'PROPERTY.ASSIGNMENT.CANDIDATE_USERS' | translate}}</label>
|
|
||||||
<input type="text" class="form-control" ng-model="assignment.candidateUsers_zh" placeholder="请双击选择" onblur="loadAssignee(this,2)" ondblclick="load_assignee_show(this,2)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-body" style="display:none;">
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="assigneeField">{{'PROPERTY.ASSIGNMENT.ASSIGNEE' | translate}}</label>
|
|
||||||
<input type="text" id="assigneeField" class="form-control" ng-model="assignment.assignee" placeholder="可直接输入,或双击选择" ondblclick="load_assignee_show(this,1)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="userField">{{'PROPERTY.ASSIGNMENT.CANDIDATE_USERS' | translate}}</label>
|
|
||||||
<div ng-repeat="candidateUser in assignment.candidateUsers">
|
|
||||||
<input id="userField" class="form-control" type="text" ng-model="candidateUser.value" placeholder="可直接输入,或双击选择" ondblclick="load_assignee_show(this,2)" />
|
|
||||||
<i class="glyphicon glyphicon-minus clickable-property" ng-click="removeCandidateUserValue($index)"></i>
|
|
||||||
<i ng-if="$index == (assignment.candidateUsers.length - 1)" class="glyphicon glyphicon-plus clickable-property" ng-click="addCandidateUserValue($index)"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="groupField">{{'PROPERTY.ASSIGNMENT.CANDIDATE_GROUPS' | translate}}</label>
|
|
||||||
<div ng-repeat="candidateGroup in assignment.candidateGroups">
|
|
||||||
<input id="groupField" class="form-control" type="text" ng-model="candidateGroup.value" placeholder="可直接输入,或双击选择" ondblclick="load_candidate_groups_show(this)" />
|
|
||||||
<i class="glyphicon glyphicon-minus clickable-property" ng-click="removeCandidateGroupValue($index)"></i>
|
|
||||||
<i ng-if="$index == (assignment.candidateGroups.length - 1)" class="glyphicon glyphicon-plus clickable-property" ng-click="addCandidateGroupValue($index)"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button ng-click="close()" class="btn btn-primary" translate>ACTION.CANCEL</button>
|
|
||||||
<button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
<!-- Just need to instantiate the controller, and it will take care of showing the modal dialog -->
|
|
||||||
<span ng-controller="KisBpmAssignmentCtrl">
|
|
||||||
</span>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
<div ng-controller="KisBpmBooleanPropertyCtrl">
|
|
||||||
<input type="checkbox" ng-model="property.value" ng-change="changeValue()"/>
|
|
||||||
</div>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<span ng-if="property.value">{{property.value|limitTo:20}}</span>
|
|
||||||
<span ng-if="!property.value">{{'PROPERTY.SEQUENCEFLOW.CONDITION.NO-CONDITION-DISPLAY' | translate}}</span>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
<div class="modal" ng-controller="KisBpmConditionExpressionPopupCtrl">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button>
|
|
||||||
<h2 translate>PROPERTY.SEQUENCEFLOW.CONDITION.TITLE</h2>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<div class="detail-group clearfix">
|
|
||||||
|
|
||||||
<div class="form-group clearfix">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<label class="col-xs-3">{{'PROPERTY.SEQUENCEFLOW.CONDITION.STATIC' | translate}}</label>
|
|
||||||
<div class="col-xs-9">
|
|
||||||
<textarea class="form-control" ng-model="conditionExpression.value" style="width:90%; height:100%; max-width: 100%; max-height: 100%; min-height: 100px"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button ng-click="close()" class="btn btn-primary" translate>ACTION.CANCEL</button>
|
|
||||||
<button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
<!-- Just need to instantiate the controller, and it will take care of showing the modal dialog -->
|
|
||||||
<span ng-controller="KisBpmConditionExpressionCtrl">
|
|
||||||
</span>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
<span ng-if="!property.noValue">{{property.value|limitTo:20}}</span>
|
|
||||||
<span ng-if="!property.noValue && property.value != null && property.value.length > 20">...</span>
|
|
||||||
<span ng-if="property.noValue" translate>PROPERTY.EMPTY</span>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
<span ng-if="!property.noValue">{{'PROPERTY.EVENTLISTENERS.DISPLAY' | translate:property.value.eventListeners}}</span>
|
|
||||||
<span ng-if="property.noValue" translate>PROPERTY.EVENTLISTENERS.EMPTY</span>
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
|
|
||||||
<div class="modal" ng-controller="KisBpmEventListenersPopupCtrl">
|
|
||||||
<div class="modal-dialog modal-wide">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button>
|
|
||||||
<h2>{{'PROPERTY.PROPERTY.EDIT.TITLE' | translate:property}}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div class="col-xs-10">
|
|
||||||
<div ng-if="translationsRetrieved" class="kis-listener-grid" ng-grid="gridOptions"></div>
|
|
||||||
<div class="pull-right">
|
|
||||||
<div class="btn-group">
|
|
||||||
<a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{ACTION.MOVE.UP | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveListenerUp()"><i class="glyphicon glyphicon-arrow-up"></i></a>
|
|
||||||
<a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{ACTION.MOVE.DOWN | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveListenerDown()"><i class="glyphicon glyphicon-arrow-down"></i></a>
|
|
||||||
</div>
|
|
||||||
<div class="btn-group">
|
|
||||||
<a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{ACTION.ADD | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="addNewListener()"><i class="glyphicon glyphicon-plus"></i></a>
|
|
||||||
<a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{ACTION.REMOVE | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="removeListener()"><i class="glyphicon glyphicon-minus"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row row-no-gutter">
|
|
||||||
<div ng-if="translationsRetrieved" ng-show="selectedListeners.length > 0" class="col-xs-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="userField">{{'PROPERTY.EVENTLISTENERS.EVENTS' | translate}}</label>
|
|
||||||
<div ng-repeat="eventDefinition in selectedListeners[0].events">
|
|
||||||
<select id="eventField" class="form-control" ng-model="eventDefinition.event" ng-change="listenerDetailsChanged()">
|
|
||||||
<option title="{{'EVENT_TYPE.ACTIVITY.COMPENSATE.TOOLTIP' | translate}}">ACTIVITY_COMPENSATE</option>
|
|
||||||
<option title="{{'EVENT_TYPE.ACTIVITY.COMPLETED.TOOLTIP' | translate}}">ACTIVITY_COMPLETED</option>
|
|
||||||
<option title="bla">ACTIVITY_ERROR_RECEIVED</option>
|
|
||||||
<option>ACTIVITY_MESSAGE_RECEIVED</option>
|
|
||||||
<option>ACTIVITY_SIGNALED</option>
|
|
||||||
<option>ACTIVITY_STARTED</option>
|
|
||||||
<option>ENGINE_CLOSED</option>
|
|
||||||
<option>ENGINE_CREATED</option>
|
|
||||||
<option>ENTITY_ACTIVATED</option>
|
|
||||||
<option>ENTITY_CREATED</option>
|
|
||||||
<option>ENTITY_DELETED</option>
|
|
||||||
<option>ENTITY_INITIALIZED</option>
|
|
||||||
<option>ENTITY_SUSPENDED</option>
|
|
||||||
<option>ENTITY_UPDATED</option>
|
|
||||||
<option>JOB_EXECUTION_FAILURE</option>
|
|
||||||
<option>JOB_EXECUTION_SUCCESS</option>
|
|
||||||
<option>JOB_RETRIES_DECREMENTED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.MEMBERSHIP.CREATED.TOOLTIP' | translate}}">MEMBERSHIP_CREATED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.MEMBERSHIP.DELETED.TOOLTIP' | translate}}">MEMBERSHIP_DELETED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.MEMBERSHIPS.DELETED.TOOLTIP' | translate}}">MEMBERSHIPS_DELETED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.TASK.ASSIGNED.TOOLTIP' | translate}}">TASK_ASSIGNED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.TASK.COMPLETED.TOOLTIP' | translate}}">TASK_COMPLETED</option>
|
|
||||||
<option>TIMER_FIRED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.UNCAUGHT.BPMNERROR.TOOLTIP' | translate}}">UNCAUGHT_BPMN_ERROR</option>
|
|
||||||
<option title="{{'EVENT_TYPE.VARIABLE.CREATED.TOOLTIP' | translate}}">VARIABLE_CREATED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.VARIABLE.DELETED.TOOLTIP' | translate}}">VARIABLE_DELETED</option>
|
|
||||||
<option title="{{'EVENT_TYPE.VARIABLE.UPDATED.TOOLTIP' | translate}}">VARIABLE_UPDATED</option>
|
|
||||||
</select>
|
|
||||||
<i ng-if="$index > 0" class="glyphicon glyphicon-minus clickable-property" ng-click="removeEventValue($index)"></i>
|
|
||||||
<i class="glyphicon glyphicon-plus clickable-property" ng-click="addEventValue($index)"></i>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="classField">{{'PROPERTY.EVENTLISTENERS.RETHROW' | translate}}</label>
|
|
||||||
<input type="checkbox" id="rethrowField" class="form-control" ng-model="selectedListeners[0].rethrowEvent" ng-change="listenerDetailsChanged()" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div ng-show="selectedListeners.length > 0 && selectedListeners[0].events[0].event" class="col-xs-6">
|
|
||||||
<div class="form-group" ng-if="!selectedListeners[0].rethrowEvent">
|
|
||||||
<label for="classField">{{'PROPERTY.EVENTLISTENERS.CLASS' | translate}}</label>
|
|
||||||
<input type="text" id="classField" class="form-control" ng-model="selectedListeners[0].className" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.CLASS.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="!selectedListeners[0].rethrowEvent">
|
|
||||||
<label for="delegateExpressionField">{{'PROPERTY.EVENTLISTENERS.DELEGATEEXPRESSION' | translate}}</label>
|
|
||||||
<input type="text" id="delegateExpressionField" class="form-control" ng-model="selectedListeners[0].delegateExpression" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.DELEGATEEXPRESSION.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="!selectedListeners[0].rethrowEvent">
|
|
||||||
<label for="entityTypeField">{{'PROPERTY.EVENTLISTENERS.ENTITYTYPE' | translate}}</label>
|
|
||||||
<input type="text" id="entityTypeField" class="form-control" ng-model="selectedListeners[0].entityType" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.ENTITYTYPE.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="selectedListeners[0].rethrowEvent">
|
|
||||||
<label for="delegateExpressionField">{{'PROPERTY.EVENTLISTENERS.RETHROWTYPE' | translate}}</label>
|
|
||||||
<select id="rethrowTypeField" class="form-control" ng-model="selectedListeners[0].rethrowType" ng-change="rethrowTypeChanged()">
|
|
||||||
<option>error</option>
|
|
||||||
<option>message</option>
|
|
||||||
<option>signal</option>
|
|
||||||
<option>globalSignal</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="selectedListeners[0].rethrowType === 'error'">
|
|
||||||
<label for="errorCodeField">{{'PROPERTY.EVENTLISTENERS.ERRORCODE' | translate}}</label>
|
|
||||||
<input type="text" id="errorCodeField" class="form-control" ng-model="selectedListeners[0].errorcode" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.ERRORCODE.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="selectedListeners[0].rethrowType === 'message'">
|
|
||||||
<label for="messageNameField">{{'PROPERTY.EVENTLISTENERS.MESSAGENAME' | translate}}</label>
|
|
||||||
<input type="text" id="messageNameField" class="form-control" ng-model="selectedListeners[0].messagename" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.MESSAGENAME.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-if="selectedListeners[0].rethrowType === 'signal' || selectedListeners[0].rethrowType === 'globalSignal'">
|
|
||||||
<label for="messageNameField">{{'PROPERTY.EVENTLISTENERS.SIGNALNAME' | translate}}</label>
|
|
||||||
<input type="text" id="signalNameField" class="form-control" ng-model="selectedListeners[0].signalname" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.EVENTLISTENERS.SIGNALNAME.PLACEHOLDER' | translate}}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div ng-show="selectedListeners.length == 0" class="col-xs-6 muted no-property-selected" translate>PROPERTY.EVENTLISTENERS.UNSELECTED</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button ng-click="cancel()" class="btn btn-primary" translate>ACTION.CANCEL</button>
|
|
||||||
<button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||