* @param a The associated {@link Account}
* @param persist
*/
private AccountInterface stubAccountInterface(Interface intf, Account a, boolean persist) {
final IEntityFactory efactory = getEntityFactory();
final AccountInterface ai = efactory.createEntity(AccountInterface.class, true);
ai.setAccountKey(a.getId());
ai.setInterfaceKey(intf.getId());
for(final InterfaceOption io : intf.getOptions()) {
final AccountInterfaceOption aio = efactory.createEntity(AccountInterfaceOption.class, true);
aio.setId(io.getId());
aio.setName(io.getName());
aio.setCode(io.getCode());
aio.setDescription(io.getDescription());
aio.setAnnualPrice(1f);
aio.setMonthlyPrice(1f);
aio.setSetUpPrice(1f);
for(final InterfaceOptionParameterDefinition iopd : io.getParameters()) {
final AccountInterfaceOptionParameter aiop =
efactory.createEntity(AccountInterfaceOptionParameter.class, true);
aiop.setId(iopd.getId());
aiop.setName(iopd.getName());
aiop.setCode(iopd.getCode());
aiop.setDescription(iopd.getDescription());
aiop.setValue(Integer.toString(RandomUtils.nextInt(100)));
aio.addParameter(aiop);
}
ai.addOption(aio);
}
if(persist) {
getDbTrans().startTrans();
getDao().persist(ai);
getDbTrans().setComplete();