bk.setPropertyValue("account.id", accountInterface.getAccountId());
for(final InterfaceOption io : intf.getOptions()) {
try {
bk.setPropertyValue("option.id", io.getId());
final InterfaceOptionAccount ioa = dao.load(bk);
dao.purge(ioa);
}
catch(final EntityNotFoundException e) {
// ok
}
}
// add the replacement ioas
for(final AccountInterfaceOption aio : accountInterface.getOptions()) {
final InterfaceOptionAccount ioa = entityAssembler.assembleEntity(InterfaceOptionAccount.class, null, true);
ioa.setAccount(account);
final InterfaceOption io = dao.load(new PrimaryKey<InterfaceOption>(InterfaceOption.class, aio.getId()));
ioa.setOption(io);
ioa.setSetUpPrice(aio.getSetUpPrice());
ioa.setMonthlyPrice(aio.getMonthlyPrice());
ioa.setAnnualPrice(aio.getAnnualPrice());
final HashMap<String, String> mparams = new HashMap<String, String>();
for(final AccountInterfaceOptionParameter aiop : aio.getParameters()) {
mparams.put(aiop.getName(), aiop.getValue());
}
ioa.setParameters(mparams);
dao.persist(ioa);
}
}