Package com.tll.model

Examples of com.tll.model.Interface


    catch(final BusinessKeyNotDefinedException e) {
      throw new IllegalStateException(e);
    }
    bk.setPropertyValue("account.id", accountKey);

    final Interface intf = dao.load(Interface.class, interfaceKey);

    final LinkedHashSet<AccountInterfaceOption> aios = new LinkedHashSet<AccountInterfaceOption>();
    InterfaceOptionAccount ioa;
    for(final InterfaceOption io : intf.getOptions()) {
      bk.setPropertyValue("option.id", io.getId());
      try {
        ioa = dao.load(bk);
      }
      catch(final EntityNotFoundException e) {
        ioa = null;
      }
      final AccountInterfaceOption aio = generateAccountInterfaceOption(io, ioa);
      aios.add(aio);
    }

    final AccountInterface ai = entityAssembler.assembleEntity(AccountInterface.class, null);
    ai.setVersion(Integer.valueOf(1)); // mimic non-new entity
    ai.setAccountKey(accountKey);
    ai.setInterfaceKey(interfaceKey);
    ai.setName(intf.getName());
    ai.setCode(intf.getCode());
    ai.setDescription(intf.getDescription());
    ai.setAvailableAsp(intf.getIsAvailableAsp());
    ai.setAvailableIsp(intf.getIsAvailableIsp());
    ai.setAvailableMerchant(intf.getIsAvailableMerchant());
    ai.setAvailableCustomer(intf.getIsAvailableCustomer());
    ai.setRequiredAsp(intf.getIsRequiredAsp());
    ai.setRequiredIsp(intf.getIsRequiredIsp());
    ai.setRequiredMerchant(intf.getIsRequiredMerchant());
    ai.setRequiredCustomer(intf.getIsRequiredCustomer());
    ai.setOptions(aios);

    return ai;
  }
View Full Code Here


  @Transactional
  @Override
  public void setAccountInterface(AccountInterface accountInterface) {

    final Account account = dao.load(Account.class, accountInterface.getAccountKey());
    final Interface intf = dao.load(Interface.class, accountInterface.getInterfaceKey());

    // remove existing account subscribed options
    IBusinessKey<InterfaceOptionAccount> bk;
    try {
      BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
      bk = bkf.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    }
    catch(final BusinessKeyNotDefinedException e) {
      throw new IllegalStateException(e);
    }
    bk.setPropertyValue("account.id", accountInterface.getAccountKey());

    for(final InterfaceOption io : intf.getOptions()) {
      try {
        bk.setPropertyValue("option.id", io.getId());
        final InterfaceOptionAccount ioa = dao.load(bk);
        dao.purge(ioa);
      }
View Full Code Here

*/
@Test(groups = "service.entity")
public class AccountInterfaceTest extends AbstractEntityServiceTest {

  public void testSetAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    final InterfaceOption io = intf.getOptions().iterator().next();
    final Account a = stub(Asp.class, true);
    final AccountInterface ai = stubAccountInterface(intf, a, false);

    getInterfaceService().setAccountInterface(ai);

View Full Code Here

    final InterfaceOptionAccount ioa = getDao().load(bk);
    Assert.assertNotNull(ioa);
  }

  public void testLoadAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    final Account a = stub(Asp.class, true);
    AccountInterface ai = stubAccountInterface(intf, a, true);

    ai = getInterfaceService().loadAccountInterface(a.getId(), intf.getId());

    Assert.assertNotNull(ai);
  }
View Full Code Here

  }

  @Transactional
  @Override
  public void purgeAccountInterface(Long accountKey, Long interfaceKey) {
    Interface intf;
    try {
      intf = load(interfaceKey);
    }
    catch(final EntityNotFoundException e) {
      // ok
      return;
    }

    IBusinessKey<InterfaceOptionAccount> bk;
    try {
      BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
      bk = bkf.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    }
    catch(final BusinessKeyNotDefinedException e) {
      throw new IllegalStateException(e);
    }
    bk.setPropertyValue("account.id", accountKey);

    for(final InterfaceOption io : intf.getOptions()) {
      bk.setPropertyValue("option.id", io.getId());
      try {
        final InterfaceOptionAccount ioa = dao.load(bk);
        dao.purge(ioa);
      }
View Full Code Here

    Assert.assertNotNull(ai);
  }

  public void testPurgeAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    InterfaceOptionAccount ioa = stubIoa(intf, true);

    getInterfaceService().purgeAccountInterface(ioa.accountKey(), intf.getId());

    try {
      ioa = getDao().load(InterfaceOptionAccount.class, ioa.getId());
      Assert.fail("Not purged: " + ioa);
    }
View Full Code Here

    }
  }

  private Interface stubInterface(boolean persist) {
    if(persist) getDbTrans().startTrans();
    final Interface intf = stub(InterfaceSwitch.class, false);
    final InterfaceOption io = stub(InterfaceOption.class, false);
    final InterfaceOptionParameterDefinition iopd = stub(InterfaceOptionParameterDefinition.class, false);
    io.addParameter(iopd);
    intf.addOption(io);
    if(persist) {
      getDbTrans().setComplete();
      getDao().persist(intf);
      getDbTrans().endTrans();
    }
View Full Code Here

    Asp account = create(Asp.class, true);
    account.setCurrency(currency);
    account = persist(account);
    pkA = account.getId();

    Interface intf = create(InterfaceSwitch.class, true);
    final InterfaceOption option = create(InterfaceOption.class, true);
    final InterfaceOptionParameterDefinition param = create(InterfaceOptionParameterDefinition.class, true);
    option.addParameter(param);
    intf.addOption(option);
    intf = persist(intf);
    pkI = intf.getId();
  }
View Full Code Here

  }

  @Override
  public void assembleTestEntity(InterfaceOptionAccount e) throws Exception {
    e.setAccount(load(Asp.class, pkA));
    final Interface inter = load(Interface.class, pkI);
    final InterfaceOption option = inter.getOptions().iterator().next();
    final InterfaceOptionParameterDefinition param = option.getParameters().iterator().next();
    e.setOption(option);
    e.setParameter(param.getName(), "ioa_pvalue");
    numParameters = e.getNumParameters();
  }
View Full Code Here

*/
@Test(groups = "service.entity")
public class AccountInterfaceTest extends AbstractEntityServiceTest {

  public void testSetAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    final InterfaceOption io = intf.getOptions().iterator().next();
    final Account a = stub(Asp.class, true);
    final AccountInterface ai = stubAccountInterface(intf, a, false);

    getInterfaceService().setAccountInterface(ai);

View Full Code Here

TOP

Related Classes of com.tll.model.Interface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.