當前位置: 首頁>>代碼示例>>Java>>正文


Java NotificationContentTypeBo.getVersion方法代碼示例

本文整理匯總了Java中org.kuali.rice.ken.bo.NotificationContentTypeBo.getVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java NotificationContentTypeBo.getVersion方法的具體用法?Java NotificationContentTypeBo.getVersion怎麽用?Java NotificationContentTypeBo.getVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kuali.rice.ken.bo.NotificationContentTypeBo的用法示例。


在下文中一共展示了NotificationContentTypeBo.getVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findHighestContentTypeVersion

import org.kuali.rice.ken.bo.NotificationContentTypeBo; //導入方法依賴的package包/類
/**
 * Returns the highest version found for the given name or negative one if the name is not found.
 * @param name the name to query for
 * @return the highest version number found or negative one if the name is not found.
 */
protected int findHighestContentTypeVersion(String name) {

    int highestVersion = -1;

    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal("name", name));
    List<NotificationContentTypeBo> ntfyCntTypes = dataObjectService.findMatching(NotificationContentTypeBo.class, criteria.build()).getResults();

    for (NotificationContentTypeBo ntfyCntType : ntfyCntTypes) {
        if (ntfyCntType.getVersion() > highestVersion) {
            highestVersion = ntfyCntType.getVersion();
        }
    }

    return highestVersion;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:22,代碼來源:NotificationContentTypeServiceImpl.java

示例2: testVersioning

import org.kuali.rice.ken.bo.NotificationContentTypeBo; //導入方法依賴的package包/類
@Test public void testVersioning() {
    NotificationContentTypeService impl = services.getNotificationContentTypeService();
    int originalCurrentSize = impl.getAllCurrentContentTypes().size();
    int originalSize = impl.getAllContentTypes().size();

    NotificationBo n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
    
    NotificationContentTypeBo ct = n.getContentType();
    int originalVersion = ct.getVersion();
    assertTrue(ct.isCurrent());

    ct.setDescription("I was updated");
    impl.saveNotificationContentType(ct);
    
    assertEquals(originalCurrentSize, impl.getAllCurrentContentTypes().size());
    assertEquals(originalSize + 1, impl.getAllContentTypes().size());

    ct = impl.getNotificationContentType(ct.getName());
    assertEquals("I was updated", ct.getDescription());
    assertTrue(ct.isCurrent());
    assertEquals(originalVersion + 1, ct.getVersion().intValue());
    
    n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
    NotificationContentTypeBo nct = n.getContentType();
    assertEquals(ct.getId(), nct.getId());
    assertEquals(ct.getVersion(), nct.getVersion());
    assertEquals(ct.isCurrent(), nct.isCurrent());
    assertEquals(originalVersion + 1, nct.getVersion().intValue());
    
    
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:32,代碼來源:NotificationContentTypeServiceImplTest.java


注:本文中的org.kuali.rice.ken.bo.NotificationContentTypeBo.getVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。