Package com.tll.model

Examples of com.tll.model.AccountInterface


      }
      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


  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);

    BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
    final IBusinessKey<InterfaceOptionAccount> bk = bkf.create(InterfaceOptionAccount.class, "Option Id and Account Id");
View Full Code Here

  }

  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

   * @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();
View Full Code Here

  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);

    final IBusinessKey<InterfaceOptionAccount> bk = BusinessKeyFactory.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    bk.setPropertyValue("option.id", io.getId());
View Full Code Here

  }

  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

   * @param a The associated {@link Account}
   * @param persist
   */
  private AccountInterface stubAccountInterface(Interface intf, Account a, boolean persist) {
    final IEntityFactory efactory = injector.getInstance(IEntityFactory.class);
    final AccountInterface ai = efactory.createEntity(AccountInterface.class, false);
    ai.setAccountId(a.getId());
    ai.setInterfaceId(intf.getId());
    for(final InterfaceOption io : intf.getOptions()) {
      final AccountInterfaceOption aio = efactory.createEntity(AccountInterfaceOption.class, false);
      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, false);
        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) {
      startNewTransaction();
      getDao().persist(ai);
      setComplete();
View Full Code Here

  public void loadImpl(ISearch search, ModelPayload payload) {
    if(search instanceof AccountInterfaceDataSearch) {
      final AccountInterfaceDataSearch ais = (AccountInterfaceDataSearch) search;

      final IInterfaceService isvc = context.getEntityServiceFactory().instance(IInterfaceService.class);
      final AccountInterface ai = isvc.loadAccountInterface(ais.getAccountId(), ais.getInterfaceId());

      // set the quasi-id
      ai.setId(ais.getAccountId() + '|' + ais.getInterfaceId());

      final Marshaler marshaler = context.getMarshaler();
      final MarshalOptions moptions = context.getMarshalOptionsResolver().resolve(SmbizEntityType.ACCOUNT_INTERFACE);
      final Model m = marshaler.marshalEntity(ai, moptions);
      payload.setModel(m);
View Full Code Here

    final IInterfaceService isvc = context.getEntityServiceFactory().instance(IInterfaceService.class);

    final String id = model.getId();
    final String accountId = id.substring(0, id.indexOf('|'));
    final String intfId = id.substring(id.indexOf('|')+1);
    AccountInterface ai = isvc.loadAccountInterface(accountId, intfId);

    ai = marshaler.marshalModel(model, ai);
    isvc.setAccountInterface(ai);

    final MarshalOptions moptions = context.getMarshalOptionsResolver().resolve(SmbizEntityType.ACCOUNT_INTERFACE);
View Full Code Here

      }
      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

TOP

Related Classes of com.tll.model.AccountInterface

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.