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
|
private List<CustomObject> constructCustomObjectFromMainObject(MainObject mainObject) {
List<CustomObject> customObjectList = new ArrayList<CustomObject>();
for (ItemObject item : mainObject.getItems()) {
customObjectList.add(constructCustomObject(item, true, true, true, true));
}
return customObjectList;
}
private CustomObject constructCustomObject(ItemObject item, boolean property1Flag, boolean property2Flag, boolean property3Flag, boolean property4Flag) {
CustomObject customObject = new CustomObject();
customObject.setItemProperty1(item.getProperty1());
customObject.setItemProperty2(item.getProperty2());
customObject.setItemProperty3(item.getProperty3());
customObject.setItemProperty4(item.getProperty4());
Set<Assoc> assocSet = item.getAssoc();
List<PaObject> paObjectList = new ArrayList<PaObject>();
for (Assoc assoc : assocSet) {
paObjectList.add(assoc.getPaObject());
}
customObject.setpaObjectList(paObjectList);
if (property1Flag) {
customObject.setProperty1Object(item.getProperty1Object());
}
if (property2Flag) {
customObject.setProperty2Object(item.getProperty2Objects());
}
if (property3Flag) {
customObject.setProperty3Object(item.getProperty3Object());
}
if (property4Flag) {
customObject.setProperty4Object(new DataConverter().toProperty4Object(item));
}
return customObject;
} |
Partager