Examples of BusinessKeyFactory


Examples of com.tll.model.bk.BusinessKeyFactory

    if(e2 instanceof ITimeStampEntity) {
      ((ITimeStampEntity) e2).setDateCreated(((ITimeStampEntity) e2).getDateCreated());
      ((ITimeStampEntity) e2).setDateModified(((ITimeStampEntity) e2).getDateModified());
    }
    try {
      BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
      bkf.apply(e2, bkf.create(e1));
    }
    catch(final BusinessKeyNotDefinedException e) {
      // assume ok
    }
    catch(final BusinessKeyPropertyException e) {
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

  @SuppressWarnings("unchecked")
  protected <E extends IEntity> E getTestEntity() throws Exception {
    logger.debug("Creating test entity..");
    final E e = (E) getEntityBeanFactory().getEntityCopy(entityHandler.entityClass());
    entityHandler.assembleTestEntity(e);
    BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
    if(bkf.hasBusinessKeys(entityHandler.entityClass())) {
      entityHandler.makeUnique(e);
    }
    testEntityRefStack.add(new PkAndType(e.entityClass(), e.getId()));
    logger.debug("Test entity created: " + e);
    return e;
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

   * @throws Exception
   */
  final void daoDuplicationException() throws Exception {
    // IMPT: don't test run this dao test if there are no business keys defined
    // for the current entity type!!
    BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
    if(!bkf.hasBusinessKeys(entityHandler.entityClass())) {
      return;
    }

    IEntity e = getTestEntity();
    e = dao.persist(e);
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

    Assert.assertEquals(re, e);
  }

  final void daoFindEntityByBusinessKeyCriteria() throws Exception {
    try {
      BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
      final IBusinessKeyDefinition<IEntity>[] bkdefs = bkf.definitions(entityHandler.entityClass());

      // persist the target test entity
      IEntity e = getTestEntity();
      e = dao.persist(e);
      getDbTrans().setComplete();
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

  public <E extends IEntity> E load(final IBusinessKey<E> key) throws EntityNotFoundException, DataAccessException {
    return loadByPredicate(new Predicate<E>(key.getType()) {

      @Override
      public boolean match(E candidate) {
        BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
        return bkf.equals(candidate, key);
      }
    }, key);
  }
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

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

Examples of com.tll.model.bk.BusinessKeyFactory

  @Transactional(readOnly = true)
  @Override
  public AccountInterface loadAccountInterface(Long accountKey, Long interfaceKey) {
    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);
View Full Code Here

Examples of com.tll.model.bk.BusinessKeyFactory

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

Examples of com.tll.model.bk.BusinessKeyFactory

      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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.