本文整理匯總了Java中org.oscarehr.common.model.PreventionExt.setVal方法的典型用法代碼示例。如果您正苦於以下問題:Java PreventionExt.setVal方法的具體用法?Java PreventionExt.setVal怎麽用?Java PreventionExt.setVal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.oscarehr.common.model.PreventionExt
的用法示例。
在下文中一共展示了PreventionExt.setVal方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addPreventionWithExts
import org.oscarehr.common.model.PreventionExt; //導入方法依賴的package包/類
public void addPreventionWithExts(Prevention prevention, HashMap<String, String> exts) {
if (prevention == null) return;
preventionDao.persist(prevention);
if (exts != null) {
for (String keyval : exts.keySet()) {
if (StringUtils.filled(keyval) && StringUtils.filled(exts.get(keyval))) {
PreventionExt preventionExt = new PreventionExt();
preventionExt.setPreventionId(prevention.getId());
preventionExt.setKeyval(keyval);
preventionExt.setVal(exts.get(keyval));
preventionExtDao.persist(preventionExt);
}
}
}
}
示例2: addPreventionKeyValue
import org.oscarehr.common.model.PreventionExt; //導入方法依賴的package包/類
public static void addPreventionKeyValue(String preventionId, String keyval, String val) {
try {
PreventionExt preventionExt = new PreventionExt();
preventionExt.setPreventionId(Integer.valueOf(preventionId));
preventionExt.setKeyval(keyval);
preventionExt.setVal(val);
preventionExtDao.persist(preventionExt);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
示例3: testGetPreventionExt
import org.oscarehr.common.model.PreventionExt; //導入方法依賴的package包/類
@Test
public void testGetPreventionExt() throws Exception {
int preventionId1 = 1;
int preventionId2 = 2;
String val1 = "100";
String val2 = "200";
String keyVal1 = "alpha";
String keyVal2 = "bravo";
PreventionExt prevenExt1 = new PreventionExt();
EntityDataGenerator.generateTestDataForModelClass(prevenExt1);
prevenExt1.setPreventionId(preventionId1);
prevenExt1.setVal(val1);
prevenExt1.setKeyval(keyVal1);
dao.persist(prevenExt1);
PreventionExt prevenExt2 = new PreventionExt();
EntityDataGenerator.generateTestDataForModelClass(prevenExt2);
prevenExt2.setPreventionId(preventionId2);
prevenExt2.setVal(val2);
prevenExt2.setKeyval(keyVal2);
dao.persist(prevenExt2);
HashMap<String, String> expectedResult = new HashMap<String, String>();
expectedResult.put(keyVal1, val1);
HashMap<String, String> result = dao.getPreventionExt(preventionId1);
assertEquals(expectedResult, result);
}
示例4: addPreventionKeyValue
import org.oscarehr.common.model.PreventionExt; //導入方法依賴的package包/類
public static void addPreventionKeyValue(String preventionId, String keyval, String val) {
try {
PreventionExt preventionExt = new PreventionExt();
preventionExt.setPreventionId(Integer.valueOf(preventionId));
preventionExt.setKeyval(keyval);
preventionExt.setVal(val);
preventionExtDao.persist(preventionExt);
}
catch (Exception e) {
log.error(e.getMessage(), e);
}
}
示例5: testFindByKeyAndValue
import org.oscarehr.common.model.PreventionExt; //導入方法依賴的package包/類
@Test
public void testFindByKeyAndValue() throws Exception {
String val1 = "100";
String val2 = "200";
String keyVal1 = "alpha";
String keyVal2 = "bravo";
PreventionExt prevenExt1 = new PreventionExt();
EntityDataGenerator.generateTestDataForModelClass(prevenExt1);
prevenExt1.setVal(val1);
prevenExt1.setKeyval(keyVal1);
dao.persist(prevenExt1);
PreventionExt prevenExt2 = new PreventionExt();
EntityDataGenerator.generateTestDataForModelClass(prevenExt2);
prevenExt2.setVal(val2);
prevenExt2.setKeyval(keyVal2);
dao.persist(prevenExt2);
PreventionExt prevenExt3 = new PreventionExt();
EntityDataGenerator.generateTestDataForModelClass(prevenExt3);
prevenExt3.setVal(val1);
prevenExt3.setKeyval(keyVal1);
dao.persist(prevenExt3);
List<PreventionExt> expectedResult = new ArrayList<PreventionExt>(Arrays.asList(prevenExt1, prevenExt3));
List<PreventionExt> result = dao.findByKeyAndValue(keyVal1, val1);
Logger logger = MiscUtils.getLogger();
if (result.size() != expectedResult.size()) {
logger.warn("Array sizes do not match.");
fail("Array sizes do not match.");
}
for (int i = 0; i < expectedResult.size(); i++) {
if (!expectedResult.get(i).equals(result.get(i))){
logger.warn("Items do not match.");
fail("Items do not match.");
}
}
assertTrue(true);
}