yuxc
2025-01-15 9503c595d3508c80cbbacf6e69dca459771d250e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
package com.vci.pagemodel;
 
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.data.LinkObject;
import org.springframework.util.CollectionUtils;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
 
/**
 * 操作的业务类型和链接类型的数据
 * @author weidy
 * @date 2021-12-2
 */
public class BatchCBO {
 
    /**
     * 空的业务类型数组
     */
    private BusinessObject[] nullCboArray = new BusinessObject[0];
 
    /**
     * 空的链接类型数组
     */
    private LinkObject[] nullCloArray = new LinkObject[0];
 
    /**
     * 创建的业务类型
     */
    private Set<BusinessObject> createCbos = new HashSet<BusinessObject>();
 
    /**
     * 创建的链接类型
     */
    private Set<LinkObject> createClos = new HashSet<LinkObject>();
 
    /**
     * 更新的业务类型
     */
    private Set<BusinessObject> updateCbos = new HashSet<BusinessObject>();
 
    /**
     * 更新的链接类型
     */
    private Set<LinkObject> updateClos = new HashSet<LinkObject>();
 
    /**
     * 删除业务类型
     */
    private Set<BusinessObject> deleteCbos = new HashSet<BusinessObject>();
 
    /**
     * 删除的链接类型
     */
    private Set<LinkObject> deleteClos = new HashSet<LinkObject>();
 
    /**
     * 来源数据集合
     */
    private Set<Object> sourceObjectList = new HashSet<Object>();
 
    /**
     * 来源数据
     */
    private Object sourceObject = new HashSet<Object>();
 
    /**
     * 从其他的拷贝
     * @param otherCBO 其他的信息
     */
    public void copyFromOther(BatchCBO otherCBO){
        if(otherCBO!=null){
            if(!CollectionUtils.isEmpty(otherCBO.getCreateCbos())){
                getCreateCbos().addAll(otherCBO.getCreateCbos());
            }
            if(!CollectionUtils.isEmpty(otherCBO.getUpdateCbos())){
                getUpdateCbos().addAll(otherCBO.getUpdateCbos());
            }
            if(!CollectionUtils.isEmpty(otherCBO.getDeleteCbos())){
                getDeleteCbos().addAll(otherCBO.getDeleteCbos());
            }
            if(!CollectionUtils.isEmpty(otherCBO.getCreateClos())){
                getCreateClos().addAll(otherCBO.getCreateClos());
            }
            if(!CollectionUtils.isEmpty(otherCBO.getUpdateClos())){
                getUpdateClos().addAll(otherCBO.getUpdateClos());
            }
            if(!CollectionUtils.isEmpty(otherCBO.getDeleteClos())){
                getDeleteClos().addAll(otherCBO.getDeleteClos());
            }
        }
    }
    
    public void addCreateCbo(BusinessObject cbo){
        this.createCbos.add(cbo);
    }
    
    public void addCreateClo(LinkObject clo){
        this.createClos.add(clo);
    }
    
    public void addUpdateCbo(BusinessObject cbo){
        this.updateCbos.add(cbo);
    }
    
    public void addUpdateClo(LinkObject clo){
        this.updateClos.add(clo);
    }
    
    public void addDeleteCbo(BusinessObject cbo){
        this.deleteCbos.add(cbo);
    }
    
    public void addDeleteClo(LinkObject clo){
        this.deleteClos.add(clo);
    }
    
    
    public BusinessObject[] getCreateCboArray(){
        if( this.createCbos == null){
            this.createCbos = new HashSet<BusinessObject>();
        }
        return this.createCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCboArray);
    }
    
    public LinkObject[] getCreateCloArray(){
        if( this.createClos == null){
            this.createClos = new HashSet<LinkObject>();
        }
        return this.createClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCloArray);
    }
    
 
    public BusinessObject[] getUpdateCboArray(){
        if( this.updateCbos == null){
            this.updateCbos = new HashSet<BusinessObject>();
        }
        return this.updateCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCboArray);
    }
    
    public LinkObject[] getUpdateCloArray(){
        if( this.updateClos == null){
            this.updateClos = new HashSet<LinkObject>();
        }
        return this.updateClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCloArray);
    }
 
    public BusinessObject[] getDeleteCboArray(){
        if( this.deleteCbos == null){
            this.deleteCbos = new HashSet<BusinessObject>();
        }
        return this.deleteCbos.toArray(nullCboArray);
    }
    
    public LinkObject[] getDeleteCloArray(){
        if( this.deleteClos == null){
            this.deleteClos = new HashSet<LinkObject>();
        }
        return this.deleteClos.toArray(nullCloArray);
    }
 
    public Set<BusinessObject> getCreateCbos() {
        return createCbos;
    }
 
    public void setCreateCbos(Set<BusinessObject> createCbos) {
        this.createCbos = createCbos;
    }
 
    public Set<LinkObject> getCreateClos() {
        return createClos;
    }
 
    public void setCreateClos(Set<LinkObject> createClos) {
        this.createClos = createClos;
    }
 
    public Set<BusinessObject> getUpdateCbos() {
        return updateCbos;
    }
 
    public void setUpdateCbos(Set<BusinessObject> updateCbos) {
        this.updateCbos = updateCbos;
    }
 
    public Set<LinkObject> getUpdateClos() {
        return updateClos;
    }
 
    public void setUpdateClos(Set<LinkObject> updateClos) {
        this.updateClos = updateClos;
    }
 
    public Set<BusinessObject> getDeleteCbos() {
        return deleteCbos;
    }
 
    public void setDeleteCbos(Set<BusinessObject> deleteCbos) {
        this.deleteCbos = deleteCbos;
    }
 
    public Set<LinkObject> getDeleteClos() {
        return deleteClos;
    }
 
    public void setDeleteClos(Set<LinkObject> deleteClos) {
        this.deleteClos = deleteClos;
    }
 
    public Set<Object> getSourceObjectList() {
        return sourceObjectList;
    }
 
    public void setSourceObjectList(Set<Object> sourceObjectList) {
        this.sourceObjectList = sourceObjectList;
    }
 
    public Object getSourceObject() {
        return sourceObject;
    }
 
    public void setSourceObject(Object sourceObject) {
        this.sourceObject = sourceObject;
    }
    
    
 
}