@Override public void load(Element parent, IAdditionalModel model) throws PersistenceException { Element collegesElement = parent.element(TAG_COLLEGES); SiderealCollegeModel collegeModel = (SiderealCollegeModel) model; for (Element collegeElement : ElementUtilities.elements(collegesElement)) { String collegeTypeId = collegeElement.getName(); CollegeType collegeType = CollegeType.valueOf(collegeTypeId); traitPersister.restoreTrait(collegeElement, collegeModel.getCollege(collegeType)); } }
@Override public void save(Element parent, IAdditionalModel model) { Element collegesElement = parent.addElement(TAG_COLLEGES); SiderealCollegeModel collegeModel = (SiderealCollegeModel) model; for (IAstrologicalHouse house : collegeModel.getAllHouses()) { for (IFavorableDefaultTrait college : house.getColleges()) { traitPersister.saveTrait(collegesElement, college.getType().getId(), college); } } }