cloudcc-cli 1.9.7 → 1.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- import java.util.Map;
4
-
5
- public abstract class CCTriggerHandler extends CCService {
6
- public Map record_new;
7
- public Map record_old;
8
- public ServiceResult trigger;
9
- public CCTriggerHandler(Map triggernew, Map triggerold, ServiceResult svc, UserInfo uinfo){
10
- super(uinfo);
11
- this.record_new = triggernew;
12
- this.record_old = triggerold;
13
- this.trigger = svc;
14
- }
15
- }
@@ -1,39 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- /**
4
- * @author jarry
5
- *
6
- * 系统日志输出
7
- */
8
- public class DevLogger {
9
- UserInfo userInfo;
10
- public DevLogger(UserInfo userInfo){
11
- this.userInfo = userInfo;
12
- }
13
-
14
- /**
15
- * info日志
16
- * @param log
17
- */
18
- public static void devLogInfo(String log){
19
- System.out.println("Info日志"+log);
20
- }
21
-
22
- /**
23
- * Error日志
24
- * @param log
25
- */
26
- public static void devLogError(String log){
27
- System.out.println("Info日志"+log);
28
- }
29
-
30
- /**
31
- * 异常日志
32
- * @param log
33
- * @param e
34
- */
35
- public static void devLogError(String log,Exception e){
36
- System.out.println("Info日志"+log);
37
- System.out.println(e);
38
- }
39
- }
@@ -1,5 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- public enum OperatationEnum {
4
- INSERT,UPDATE,UPSERT,DELETE,APPROVE
5
- }
@@ -1,6 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- public interface PeakInterf {
4
- public UserInfo uinfo = new UserInfo();
5
- public void execute();
6
- }
@@ -1,8 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- import org.springframework.beans.factory.annotation.Autowired;
4
-
5
- public class PeakSvc {
6
- @Autowired
7
- public CCService ccService;
8
- }
@@ -1,35 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- import com.alibaba.fastjson.JSONObject;
4
-
5
- import java.util.HashMap;
6
-
7
- public class ServiceResult extends HashMap {
8
- public String success;
9
- public String message;
10
- public String Id;
11
-
12
- public void addErrorMessage(String msg) throws Exception{
13
- this.put("message",msg);
14
- this.put("success","false");
15
- throw new Exception(msg);
16
- }
17
-
18
- public String getMessage(){
19
- return (String)this.get("message");
20
- }
21
-
22
- public String getSuccess(){
23
- return (String)this.get("success");
24
- }
25
- public String getId(){
26
- return (String)this.get("id");
27
- }
28
-
29
- @Override
30
- public String toString(){
31
- JSONObject data = new JSONObject();
32
- data.putAll(this);
33
- return data.toString();
34
- }
35
- }
@@ -1,83 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- import com.cloudcc.core.CCObject;
4
- import org.reflections.Reflections;
5
-
6
- import java.lang.reflect.Constructor;
7
- import java.lang.reflect.InvocationTargetException;
8
- import java.util.Set;
9
-
10
- public class TriggerInvoker {
11
- UserInfo uinfo = null;
12
- String operate = "";
13
- String triggerTime = "";
14
- public TriggerInvoker (UserInfo userInfo,String operate,String triggerTime){
15
- this.uinfo = userInfo;
16
- this.operate = operate;
17
- this.triggerTime = triggerTime;
18
- }
19
- public TriggerInvoker(){
20
-
21
- }
22
- public ServiceResult handler(CCObject data) throws Exception{
23
- String objectApiName = data.getObjectApiName();
24
- ServiceResult sr = new ServiceResult();
25
- Reflections ref = new Reflections("com.cloudcc.trigger");
26
- Set<Class<? extends CCTrigger>> clsSets = ref.getSubTypesOf(CCTrigger.class);
27
- for (Class<? extends CCTrigger> subCls : clsSets){
28
- try {
29
- Constructor cons = subCls.getConstructor(CCObject.class,CCObject.class,ServiceResult.class,UserInfo.class);
30
- CCTrigger trigger = (CCTrigger) cons.newInstance(data,null,sr,uinfo);
31
- String objectApiNameTmp = (String) trigger.getObjectApiName();
32
- if (objectApiName != null && objectApiName.equals(objectApiNameTmp)) {
33
- if ("before".equals(triggerTime) && "insert".equals(operate)) {
34
- trigger.do_insert_before();
35
- }
36
- if ("after".equals(triggerTime) && "insert".equals(operate)) {
37
- String id = (String)data.get("id");
38
- trigger.setRecordOldVal(id);
39
- trigger.do_insert_after();
40
- }
41
- if ("before".equals(triggerTime) && "update".equals(operate)) {
42
- trigger.do_update_before();
43
- }
44
- if ("after".equals(triggerTime) && "update".equals(operate)) {
45
- String id = (String)data.get("id");
46
- trigger.setRecordOldVal(id);
47
- trigger.do_update_after();
48
- }
49
- if ("before".equals(triggerTime) && "upsert".equals(operate)) {
50
- trigger.do_upsert_before();
51
- }
52
- if ("after".equals(triggerTime) && "upsert".equals(operate)) {
53
- String id = (String)data.get("id");
54
- trigger.setRecordOldVal(id);
55
- trigger.do_upsert_after();
56
- }
57
- if ("before".equals(triggerTime) && "delete".equals(operate)) {
58
- trigger.do_delete_before();
59
- }
60
- if ("after".equals(triggerTime) && "delete".equals(operate)) {
61
- String id = (String)data.get("id");
62
- trigger.setRecordOldVal(id);
63
- trigger.do_delete_after();
64
- }
65
- if ("approval".equals(operate)) {
66
- trigger.do_approval();
67
- }
68
- }
69
- } catch (NoSuchMethodException e) {
70
- throw new RuntimeException(e);
71
- } catch (InvocationTargetException e) {
72
- throw new RuntimeException(e);
73
- } catch (InstantiationException e) {
74
- throw new RuntimeException(e);
75
- } catch (IllegalAccessException e) {
76
- throw new RuntimeException(e);
77
- }catch (Exception ex) {
78
- throw ex;
79
- }
80
- }
81
- return sr;
82
- }
83
- }
@@ -1,9 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- public @interface TriggerMethod {
4
- String name();
5
- OperatationEnum operate();
6
- TriggerTimeEnum triggerTime();
7
- boolean isEnable() ;
8
- String remark() default "";
9
- }
@@ -1,5 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- public enum TriggerTimeEnum {
4
- BEFORE,AFTER
5
- }
@@ -1,45 +0,0 @@
1
- package com.cloudcc.core;
2
-
3
- import com.cloudcc.core.CCObject;
4
-
5
- public class UserInfo extends CCObject{
6
- public String binding;
7
- public String getUserId() {
8
- return (String)this.get("id");
9
- }
10
-
11
- public String getRoleId() {
12
- return (String)this.get("role");
13
- }
14
-
15
- public UserInfo (String username,String pwd) throws Exception {
16
- this.put("userName", username);
17
- this.put("password", pwd);
18
- }
19
-
20
- public UserInfo() {
21
-
22
- }
23
-
24
- public String getLoginName(){
25
- return (String)this.get("userName");
26
- }
27
- public String getProfileId() {
28
- // TODO Auto-generated method stub
29
- return (String)this.get("profileId");
30
- }
31
- public void setBinding(String bind){
32
- this.binding = bind;
33
- this.put("binding",bind);
34
- }
35
- public String getBinding(){
36
- if (this.binding == null){
37
- return (String)this.get("binding");
38
- } else {
39
- return this.binding;
40
- }
41
- }
42
- public String getUserName() {
43
- return (String)this.get("name");
44
- }
45
- }
package/core/pom.xml DELETED
@@ -1,75 +0,0 @@
1
- <project xmlns="http://maven.apache.org/POM/4.0.0"
2
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
- <modelVersion>4.0.0</modelVersion>
4
-
5
- <groupId>com.example</groupId>
6
- <artifactId>my-maven-project</artifactId>
7
- <version>1.0-SNAPSHOT</version>
8
-
9
- <dependencies>
10
- <dependency>
11
- <groupId>junit</groupId>
12
- <artifactId>junit</artifactId>
13
- <version>4.13.2</version>
14
- <scope>test</scope>
15
- </dependency>
16
- <!-- 添加 fastjson 依赖 -->
17
- <dependency>
18
- <groupId>com.alibaba</groupId>
19
- <artifactId>fastjson</artifactId>
20
- <version>1.2.75</version>
21
- </dependency>
22
- <!-- 添加 log4j 依赖 -->
23
- <dependency>
24
- <groupId>log4j</groupId>
25
- <artifactId>log4j</artifactId>
26
- <version>1.2.17</version>
27
- </dependency>
28
- <!-- 添加 org.reflections 依赖 -->
29
- <dependency>
30
- <groupId>org.reflections</groupId>
31
- <artifactId>reflections</artifactId>
32
- <version>0.9.12</version>
33
- </dependency>
34
- <!-- 添加 Jackson 依赖 -->
35
- <dependency>
36
- <groupId>com.fasterxml.jackson.core</groupId>
37
- <artifactId>jackson-databind</artifactId>
38
- <version>2.13.3</version>
39
- </dependency>
40
- <!-- 添加 slf4j 依赖 -->
41
- <dependency>
42
- <groupId>org.slf4j</groupId>
43
- <artifactId>slf4j-api</artifactId>
44
- <version>1.7.32</version>
45
- </dependency>
46
- <dependency>
47
- <groupId>org.slf4j</groupId>
48
- <artifactId>slf4j-log4j12</artifactId>
49
- <version>1.7.32</version>
50
- </dependency>
51
- <dependency>
52
- <groupId>com.cloudcc.core</groupId>
53
- <artifactId>ccopenapi</artifactId>
54
- <version>0.1</version>
55
- <scope>system</scope>
56
- <systemPath>${project.basedir}/libs/ccopenapi.jar</systemPath>
57
- </dependency>
58
- </dependencies>
59
-
60
- <build>
61
- <sourceDirectory>./classes/demo01</sourceDirectory>
62
- <testSourceDirectory>./classes/demo01</testSourceDirectory>
63
- <plugins>
64
- <plugin>
65
- <groupId>org.apache.maven.plugins</groupId>
66
- <artifactId>maven-compiler-plugin</artifactId>
67
- <version>3.8.1</version>
68
- <configuration>
69
- <source>1.8</source>
70
- <target>1.8</target>
71
- </configuration>
72
- </plugin>
73
- </plugins>
74
- </build>
75
- </project>