本文整理匯總了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;
}
示例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());
}