Package com.tll.model

Examples of com.tll.model.Account


        // kill it
        dao.purge(entity.getPaymentInfo());
      }
    }

    final Account pe = super.persist(entity);

    // handle account history
    if(pe != null) {
      final AccountHistoryOp op = isNew ? AccountHistoryOp.ACCOUNT_ADDED : AccountHistoryOp.ACCOUNT_UPDATED;
      addHistoryRecord(new AccountHistoryContext(op, pe));
View Full Code Here


        break;
      }
        // purge account
      case ACCOUNT_PURGED: {
        // add history record to parentAccount
        final Account parent = context.getAccount().getParent();
        if(parent != null) {
          final AccountHistory ah = entityAssembler.assembleEntity(AccountHistory.class, new EntityCache(parent));
          ah.setStatus(AccountStatus.DELETED);
          ah.setNotes("Child account: " + context.getAccount().typeDesc() + "'" + context.getAccount().descriptor()
              + "' DELETED");
View Full Code Here

    if(account.getPaymentInfo() != null && account.getPaymentInfo().isNew() && account.getPersistPymntInfo()) {
      piService.persist(account.getPaymentInfo());
    }

    // create account
    final Account persistedAccount = accountService.persist(account);

    // add the account interface options
    iService.setAccountInterfaces(accountInterfaces);

    // add the users
View Full Code Here

   * Stub a valid account optionally persisting it in the datastore.
   * @param persist persist into datastore?
   * @return The stubbed account
   */
  protected final Account stubValidAccount(boolean persist) {
    Account account = null;

    getDbTrans().startTrans();
    getDbTrans().setComplete();
    try {
      final IEntityDao dao = getDao();

      account = getEntityBeanFactory().getEntityCopy(Asp.class, false);
      final AccountAddress aa = getEntityBeanFactory().getEntityCopy(AccountAddress.class, false);
      final Address a = getEntityBeanFactory().getEntityCopy(Address.class, false);
      aa.setAddress(a);
      account.addAccountAddress(aa);

      final Currency c = dao.persist(getEntityBeanFactory().getEntityCopy(Currency.class, false));
      account.setCurrency(c);

      pi = dao.persist(getEntityBeanFactory().getEntityCopy(PaymentInfo.class, false));
      account.setPaymentInfo(pi);

      if(persist) {
        account = dao.persist(account);
      }
    }
View Full Code Here

  @Override
  public void persistDependentEntities() {
    final Currency currency = createAndPersist(Currency.class, true);

    Account account = create(Asp.class, true);
    account.setCurrency(currency);
    account.setParent(null);
    account = persist(account);
    pkAccount = new PrimaryKey<Account>(account);
    pkCurrency = new PrimaryKey<Currency>(account.getCurrency());

    Customer customer = create(Customer.class, true);
    customer.setParent(null);
    customer.setCurrency(currency);
    customer = persist(customer);
View Full Code Here

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

    final IBusinessKey<InterfaceOptionAccount> bk = BusinessKeyFactory.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    bk.setPropertyValue("option.id", io.getId());
    bk.setPropertyValue("account.id", a.getId());
    final InterfaceOptionAccount ioa = getDao().load(bk);
    Assert.assertNotNull(ioa);
  }
View Full Code Here

    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

    return intf;
  }

  private InterfaceOptionAccount stubIoa(Interface intf, boolean persist) {
    if(persist) startNewTransaction();
    final Account a = stub(Asp.class, false);
    final InterfaceOptionAccount ioa = stub(InterfaceOptionAccount.class, false);
    ioa.setAccount(a);
    ioa.setOption(intf.getOptions().iterator().next());
    if(persist) {
      setComplete();
View Full Code Here

  @Override
  protected Model entityToModel(IEntityType entityType, IEntity e) throws Exception {
    final Model m = super.entityToModel(entityType, e);
    assert m != null;
    final Account a = (Account) e;
    if(a.getParent() != null) {
      final PrimaryKey<Account> pk = new PrimaryKey<Account>(Account.class, a.getParent().getId());
      final IAccountService svc = context.getEntityServiceFactory().instance(IAccountService.class);
      final Account parent = svc.load(pk);
      final Model mparent = new Model(SmbizEntityType.ACCOUNT);
      mparent.set(new StringPropertyValue(Model.ID_PROPERTY, parent.getId()));
      mparent.set(new StringPropertyValue(Model.NAME_PROPERTY, parent.getName()));
      m.set(new RelatedOneProperty(SmbizEntityType.ACCOUNT, mparent, "parent", true));
    }
    return m;
  }
View Full Code Here

    }
    final Collection<Model> musers = request.getUsers();

    try {
      // un-marshal
      Account account = mlr.marshalModel(maccount, accountClass);

      final ArrayList<AccountInterface> aios = new ArrayList<AccountInterface>(maios.size());
      for(final Model maio : maios) {
        aios.add(mlr.marshalModel(maio, AccountInterface.class));
      }
View Full Code Here

TOP

Related Classes of com.tll.model.Account

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.