|
|
@ -234,14 +234,14 @@ public class ModelEntity extends CorporationAuditorEntity<ModelVo> implements De |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object deepClone() throws Exception{ |
|
|
|
public Object deepClone(Object... args) throws Exception{ |
|
|
|
ModelEntity entity =this.getClass().newInstance(); |
|
|
|
BeanUtils.copyProperties(this, entity, "children","parameters"); |
|
|
|
//深度拷贝 children
|
|
|
|
List<ModelEntity> children =this.getChildren(); |
|
|
|
if(children!=null && children.size()>0) { |
|
|
|
for(ModelEntity child : children) { |
|
|
|
ModelEntity clone =(ModelEntity)child.deepClone(); |
|
|
|
ModelEntity clone =(ModelEntity)child.deepClone(args); |
|
|
|
clone.setParent(entity); |
|
|
|
entity.getChildren().add(clone); |
|
|
|
} |
|
|
@ -252,15 +252,17 @@ public class ModelEntity extends CorporationAuditorEntity<ModelVo> implements De |
|
|
|
List<ParameterEntity> parameters =this.getParameters(); |
|
|
|
if(parameters!=null && parameters.size()>0) { |
|
|
|
for(ParameterEntity parameter : parameters) { |
|
|
|
ParameterEntity clone =(ParameterEntity)parameter.deepClone(); |
|
|
|
ParameterEntity clone =(ParameterEntity)parameter.deepClone(args); |
|
|
|
clone.setModel(entity); |
|
|
|
entity.getParameters().add(clone); |
|
|
|
parameterCodeMapping.put(parameter.getCode(),clone.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
entity.clearId(); |
|
|
|
entity.setCode("M"+System.currentTimeMillis()); |
|
|
|
entity.setName(entity.getName() + "_NEW"); |
|
|
|
if(args==null || args.length==0 || !ResourceEntity.class.equals(args[0])) { |
|
|
|
entity.setCode("M" + System.currentTimeMillis()); |
|
|
|
entity.setName(entity.getName() + "_NEW"); |
|
|
|
} |
|
|
|
|
|
|
|
List<ParameterEntity> clonedParameters =entity.getParameters(); |
|
|
|
if(clonedParameters!=null && clonedParameters.size()>0) { |
|
|
|