当前位置: 首页>>代码示例>>Java>>正文


Java AccountExtension.setAccountTypeCode方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.test.document.bo.AccountExtension.setAccountTypeCode方法的典型用法代码示例。如果您正苦于以下问题:Java AccountExtension.setAccountTypeCode方法的具体用法?Java AccountExtension.setAccountTypeCode怎么用?Java AccountExtension.setAccountTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.test.document.bo.AccountExtension的用法示例。


在下文中一共展示了AccountExtension.setAccountTypeCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLazyRefreshField

import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
/**
 * tests that {@link PersistableBusinessObjectBase#refreshReferenceObject(String)} works for a lazy loaded reference when the foreign key is changed
 */
public void testLazyRefreshField() {
    final String number = "a1";
    AccountExtension accountExtension = KNSServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AccountExtension.class, number);

    assertNotNull( "Unable to retrieve account extension a1", accountExtension );
    assertEquals("Retrieved account extension should have an account type of IAT", "IAT",
            accountExtension.getAccountType().getAccountTypeCode());
    assertEquals("Retrieved account extension should have an account type name of Income Account Type",
            "Income Account Type", accountExtension.getAccountType().getName());
    accountExtension.setAccountTypeCode("CAT");
    accountExtension.refreshReferenceObject("accountType");
    assertEquals("Account extension should now have an account type name of Clearing Account Type",
            "Clearing Account Type", accountExtension.getAccountType().getName());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:BusinessObjectRefreshTest.java

示例2: testLazyRefreshWholeObject

import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
/**
 * tests that {@link PersistableBusinessObjectBase#refresh()} works for a lazy loaded reference when the foreign key is changed
 */
public void testLazyRefreshWholeObject() {
    final String number = "a1";
    AccountExtension accountExtension = KNSServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AccountExtension.class, number);

    assertNotNull( "Unable to retrieve account extension a1", accountExtension );
    assertEquals("Retrieved account extension should have account type IAT", "IAT",
            accountExtension.getAccountType().getAccountTypeCode());
    assertEquals("Retrieved account extension should have an account type name of Income Account Type",
            "Income Account Type", accountExtension.getAccountType().getName());

    accountExtension.setAccountTypeCode("CAT");
    accountExtension.refresh();

    assertEquals("Account extension should now have an account type name of Clearing Account Type",
            "Clearing Account Type", accountExtension.getAccountType().getName());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:BusinessObjectRefreshTest.java

示例3: testExistsSubQueryCriteria

import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
public void testExistsSubQueryCriteria() {

    Logger.getLogger(getClass()).info( "Adding Account" );
    Account acct = new Account();
    acct.setNumber("a1");
    acct.setName("a1 name");
    provider.save(acct, PersistenceOption.FLUSH);

    Logger.getLogger(getClass()).info( "Testing Account Saved" );
    acct = provider.find(Account.class, "a1");
    assertNotNull( "a1 SimpleAccount missing", acct );
    /*
     * Testing query of form:
     *
     * SELECT * FROM SimpleAccount WHERE EXISTS ( SELECT 'x' FROM SimpleAccountExtension WHERE SimpleAccountExtension.number = SimpleAccount.number )
     */
    Predicate subquery = PredicateFactory.existsSubquery(AccountExtension.class.getName(), PredicateFactory.equalsProperty("number", null, "parent.number"));
    QueryByCriteria q = QueryByCriteria.Builder.fromPredicates(subquery);
    Logger.getLogger(getClass()).info( "Performing Lookup with Exists Query: " + q );
    QueryResults<Account> results = provider.findMatching(Account.class, q);

    assertNotNull( "Results should not have been null", results );
    assertEquals( "Should have been no results in the default data", 0, results.getResults().size() );

    Logger.getLogger(getClass()).info( "Building extension object for retest" );
    AccountExtension ext = new AccountExtension();
    ext.setAccount(acct);
    ext.setAccountTypeCode("EAX");
    provider.save(ext, PersistenceOption.FLUSH);

    Logger.getLogger(getClass()).info( "Running query again to test results" );
    results = provider.findMatching(Account.class, q);
    assertNotNull( "Results should not have been null", results );
    assertEquals( "We added an extension record, so there should have been one result", 1, results.getResults().size() );
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:37,代码来源:JpaPersistenceProviderTest.java

示例4: testNotExistsSubQueryCriteria

import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
public void testNotExistsSubQueryCriteria() {

    Logger.getLogger(getClass()).info( "Adding Account1" );
    Account acct = new Account();
    acct.setNumber("a1");
    acct.setName("a1 name");
    provider.save(acct, PersistenceOption.FLUSH);

    Logger.getLogger(getClass()).info( "Adding Account2" );
    Account acct2 = new Account();
    acct.setNumber("a2");
    acct.setName("a2 name");
    provider.save(acct, PersistenceOption.FLUSH);

    acct = null;
    Logger.getLogger(getClass()).info( "Testing Account1 Saved" );
    acct = provider.find(Account.class, "a1");
    assertNotNull( "a1 SimpleAccount missing", acct );

    acct2 = null;
    Logger.getLogger(getClass()).info( "Testing Account2 Saved" );
    acct2 = provider.find(Account.class, "a2");
    assertNotNull( "a2 SimpleAccount missing", acct2 );

    // Just a1 has an AccountExtension
    Logger.getLogger(getClass()).info( "Building extension object for retest" );
    AccountExtension ext = new AccountExtension();
    ext.setAccount(acct);
    ext.setAccountTypeCode("EAX");
    provider.save(ext, PersistenceOption.FLUSH);


    /*
     * Testing query of form:
     *
     * SELECT * FROM SimpleAccount WHERE NOT EXISTS ( SELECT 'x' FROM SimpleAccountExtension WHERE SimpleAccountExtension.number = SimpleAccount.number )
     */
    Predicate subquery = PredicateFactory.notExistsSubquery(AccountExtension.class.getName(),
            PredicateFactory.equalsProperty("number", null, "parent.number"));
    QueryByCriteria q = QueryByCriteria.Builder.fromPredicates(subquery);
    Logger.getLogger(getClass()).info( "Performing Lookup with Exists Query: " + q );
    QueryResults<Account> results = provider.findMatching(Account.class, q);

    assertNotNull( "Results should not have been null", results );
    assertEquals( "Should have been one result in the default data", 1, results.getResults().size() );
    assertEquals(" A2 should be returned for not exists", results.getResults().get(0).getNumber(), "a2");


    // Now acct2 also has AccountExtension
    Logger.getLogger(getClass()).info( "Building extension object for retest" );
    AccountExtension ext2 = new AccountExtension();
    ext2.setAccount(acct2);
    ext2.setAccountTypeCode("EAX2");
    provider.save(ext2, PersistenceOption.FLUSH);

    Logger.getLogger(getClass()).info( "Running query again to test results" );
    results = provider.findMatching(Account.class, q);
    assertNotNull( "Results should not have been null", results );
    assertEquals( "We added an extension record, so there should have been no result", 0, results.getResults().size() );
}
 
开发者ID:kuali,项目名称:rice,代码行数:62,代码来源:JpaPersistenceProviderTest.java


注:本文中的org.kuali.rice.krad.test.document.bo.AccountExtension.setAccountTypeCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。