package com.vci.web.pageModel;
|
|
import org.springframework.util.CollectionUtils;
|
import plm.bs.bom.clientobject.ClientBusinessObject;
|
import plm.bs.bom.clientobject.ClientLinkObject;
|
|
import java.util.HashSet;
|
import java.util.Set;
|
import java.util.stream.Collectors;
|
|
/**
|
* 操作的业务类型和链接类型的数据
|
* @author weidy
|
* @date 2021-12-2
|
*/
|
public class BatchCBO {
|
|
/**
|
* 空的业务类型数组
|
*/
|
private ClientBusinessObject[] nullCboArray = new ClientBusinessObject[0];
|
|
/**
|
* 空的链接类型数组
|
*/
|
private ClientLinkObject[] nullCloArray = new ClientLinkObject[0];
|
|
/**
|
* 创建的业务类型
|
*/
|
private Set<ClientBusinessObject> createCbos = new HashSet<ClientBusinessObject>();
|
|
/**
|
* 创建的链接类型
|
*/
|
private Set<ClientLinkObject> createClos = new HashSet<ClientLinkObject>();
|
|
/**
|
* 更新的业务类型
|
*/
|
private Set<ClientBusinessObject> updateCbos = new HashSet<ClientBusinessObject>();
|
|
/**
|
* 更新的链接类型
|
*/
|
private Set<ClientLinkObject> updateClos = new HashSet<ClientLinkObject>();
|
|
/**
|
* 删除业务类型
|
*/
|
private Set<ClientBusinessObject> deleteCbos = new HashSet<ClientBusinessObject>();
|
|
/**
|
* 删除的链接类型
|
*/
|
private Set<ClientLinkObject> deleteClos = new HashSet<ClientLinkObject>();
|
|
/**
|
* 来源数据集合
|
*/
|
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(ClientBusinessObject cbo){
|
this.createCbos.add(cbo);
|
}
|
|
public void addCreateClo(ClientLinkObject clo){
|
this.createClos.add(clo);
|
}
|
|
public void addUpdateCbo(ClientBusinessObject cbo){
|
this.updateCbos.add(cbo);
|
}
|
|
public void addUpdateClo(ClientLinkObject clo){
|
this.updateClos.add(clo);
|
}
|
|
public void addDeleteCbo(ClientBusinessObject cbo){
|
this.deleteCbos.add(cbo);
|
}
|
|
public void addDeleteClo(ClientLinkObject clo){
|
this.deleteClos.add(clo);
|
}
|
|
|
public ClientBusinessObject[] getCreateCboArray(){
|
if( this.createCbos == null){
|
this.createCbos = new HashSet<ClientBusinessObject>();
|
}
|
return this.createCbos.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCboArray);
|
}
|
|
public ClientLinkObject[] getCreateCloArray(){
|
if( this.createClos == null){
|
this.createClos = new HashSet<ClientLinkObject>();
|
}
|
return this.createClos.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCloArray);
|
}
|
|
|
public ClientBusinessObject[] getUpdateCboArray(){
|
if( this.updateCbos == null){
|
this.updateCbos = new HashSet<ClientBusinessObject>();
|
}
|
return this.updateCbos.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCboArray);
|
}
|
|
public ClientLinkObject[] getUpdateCloArray(){
|
if( this.updateClos == null){
|
this.updateClos = new HashSet<ClientLinkObject>();
|
}
|
return this.updateClos.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCloArray);
|
}
|
|
public ClientBusinessObject[] getDeleteCboArray(){
|
if( this.deleteCbos == null){
|
this.deleteCbos = new HashSet<ClientBusinessObject>();
|
}
|
return this.deleteCbos.toArray(nullCboArray);
|
}
|
|
public ClientLinkObject[] getDeleteCloArray(){
|
if( this.deleteClos == null){
|
this.deleteClos = new HashSet<ClientLinkObject>();
|
}
|
return this.deleteClos.toArray(nullCloArray);
|
}
|
|
public Set<ClientBusinessObject> getCreateCbos() {
|
return createCbos;
|
}
|
|
public void setCreateCbos(Set<ClientBusinessObject> createCbos) {
|
this.createCbos = createCbos;
|
}
|
|
public Set<ClientLinkObject> getCreateClos() {
|
return createClos;
|
}
|
|
public void setCreateClos(Set<ClientLinkObject> createClos) {
|
this.createClos = createClos;
|
}
|
|
public Set<ClientBusinessObject> getUpdateCbos() {
|
return updateCbos;
|
}
|
|
public void setUpdateCbos(Set<ClientBusinessObject> updateCbos) {
|
this.updateCbos = updateCbos;
|
}
|
|
public Set<ClientLinkObject> getUpdateClos() {
|
return updateClos;
|
}
|
|
public void setUpdateClos(Set<ClientLinkObject> updateClos) {
|
this.updateClos = updateClos;
|
}
|
|
public Set<ClientBusinessObject> getDeleteCbos() {
|
return deleteCbos;
|
}
|
|
public void setDeleteCbos(Set<ClientBusinessObject> deleteCbos) {
|
this.deleteCbos = deleteCbos;
|
}
|
|
public Set<ClientLinkObject> getDeleteClos() {
|
return deleteClos;
|
}
|
|
public void setDeleteClos(Set<ClientLinkObject> 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;
|
}
|
|
|
|
}
|