Package com.tll.model

Examples of com.tll.model.Interface


    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


    Assert.assertNotNull(ai);
  }

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

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

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

    }
  }

  private Interface stubInterface(boolean persist) {
    if(persist) startNewTransaction();
    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) {
      setComplete();
      getDao().persist(intf);
      endTransaction();
    }
View Full Code Here

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

    final Interface intf = dao.load(new PrimaryKey<Interface>(Interface.class, interfaceId));

    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, false);
    ai.setVersion(1); // mimic non-new entity
    ai.setAccountId(accountId);
    ai.setInterfaceId(interfaceId);
    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

  @Override
  public void setAccountInterface(AccountInterface accountInterface) {

    final Account account = dao.load(new PrimaryKey<Account>(Account.class, accountInterface.getAccountId()));
    final Interface intf = dao.load(new PrimaryKey<Interface>(Interface.class, accountInterface.getInterfaceId()));

    // remove existing account subscribed options
    IBusinessKey<InterfaceOptionAccount> bk;
    try {
      bk = BusinessKeyFactory.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    }
    catch(final BusinessKeyNotDefinedException e) {
      throw new IllegalStateException(e);
    }
    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);
      }
View Full Code Here

    }
  }

  @Override
  public void purgeAccountInterface(String accountId, String interfaceId) {
    Interface intf;
    try {
      intf = load(new PrimaryKey<Interface>(Interface.class, interfaceId));
    }
    catch(final EntityNotFoundException e) {
      // ok
      return;
    }

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

    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

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.