本文整理汇总了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);
}