本文整理汇总了Java中org.kuali.rice.kcb.bo.RecipientPreference.setRecipientId方法的典型用法代码示例。如果您正苦于以下问题:Java RecipientPreference.setRecipientId方法的具体用法?Java RecipientPreference.setRecipientId怎么用?Java RecipientPreference.setRecipientId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kcb.bo.RecipientPreference
的用法示例。
在下文中一共展示了RecipientPreference.setRecipientId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveRecipientPreferences
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.kcb.service.RecipientPreferenceService#saveRecipientPreferences(java.lang.String, java.util.HashMap, org.kuali.rice.kcb.deliverer.MessageDeliverer)
*/
public void saveRecipientPreferences(String recipientId, HashMap<String, String> prefs, MessageDeliverer deliverer) throws ErrorList {
deliverer.validatePreferenceValues(prefs);
for (Map.Entry<String, String> entry: prefs.entrySet()) {
String prop = entry.getKey();
String value = entry.getValue();
// We need to check if this property is already set
// for the user by checking doing a unique key query...if
// it already exists, update, otherwise add it
RecipientPreference currentPreference = getRecipientPreference(recipientId, prop);
if (currentPreference != null) {
currentPreference.setRecipientId(recipientId);
currentPreference.setProperty(prop);
currentPreference.setValue(value);
dataObjectService.save(currentPreference);
} else {
RecipientPreference recipientPreference = new RecipientPreference();
recipientPreference.setRecipientId(recipientId);
recipientPreference.setProperty(prop);
recipientPreference.setValue(value);
dataObjectService.save(recipientPreference);
}
}
}
示例2: testCreate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test
public void testCreate() {
RecipientPreference p2 = new RecipientPreference();
p2.setRecipientId("user1");
p2.setProperty("property2");
p2.setValue("value2");
p2 = prefsvc.saveRecipientPreference(p2);
assertNotNull(p2.getId());
Map<String, String> p = prefsvc.getRecipientPreferences("user1");
assertNotNull(p);
assertEquals(2, p.size());
assertTrue(p.containsKey("property1"));
assertTrue(p.containsKey("property2"));
}
示例3: saveRecipientPreferences
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.kcb.service.RecipientPreferenceService#saveRecipientPreferences(java.lang.String, java.util.HashMap, org.kuali.rice.kcb.deliverer.MessageDeliverer)
*/
public void saveRecipientPreferences(String recipientId, HashMap<String, String> prefs, MessageDeliverer deliverer) throws ErrorList {
deliverer.validatePreferenceValues(prefs);
for (Map.Entry<String, String> entry: prefs.entrySet()) {
String prop = entry.getKey();
String value = entry.getValue();
// We need to check if this property is already set
// for the user by checking doing a unique key query...if
// it already exists, update, otherwise add it
RecipientPreference currentPreference = getRecipientPreference(recipientId, prop);
if (currentPreference != null) {
currentPreference.setRecipientId(recipientId);
currentPreference.setProperty(prop);
currentPreference.setValue(value);
dao.save(currentPreference);
} else {
RecipientPreference recipientPreference = new RecipientPreference();
recipientPreference.setRecipientId(recipientId);
recipientPreference.setProperty(prop);
recipientPreference.setValue(value);
dao.save(recipientPreference);
}
}
}
示例4: saveRecipientPreferences
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test
public void saveRecipientPreferences() throws ErrorList {
RecipientPreferenceService impl = services.getRecipientPreferenceService();
MessageDelivererRegistryService delivererService = services.getMessageDelivererRegistryService();
MessageDeliverer deliverer = delivererService.getDelivererByName(VALID_DELIVERER_NAME);
if (deliverer == null) {
throw new RuntimeException("Message deliverer could not be obtained");
}
HashMap<String, String> userprefs = new HashMap<String, String>();
userprefs.put(VALID_PROPERTY, VALID_VALUE);
userprefs.put("Email.email_delivery_format", "text");
impl.saveRecipientPreferences(VALID_USER_ID, userprefs, deliverer);
RecipientPreference recipientPreference = new RecipientPreference();
recipientPreference.setRecipientId(VALID_USER_ID);
Collection<RecipientPreference> prefs = services.getKcbGenericDao().findMatchingByExample(recipientPreference);
assertEquals(2, prefs.size());
}
示例5: testCreate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test
@Override
public void testCreate() {
RecipientPreference p2 = new RecipientPreference();
p2.setRecipientId("user1");
p2.setProperty("property2");
p2.setValue("value2");
prefsvc.saveRecipientPreference(p2);
assertNotNull(p2.getId());
Map<String, String> p = prefsvc.getRecipientPreferences("user1");
assertNotNull(p);
assertEquals(2, p.size());
assertTrue(p.containsKey("property1"));
assertTrue(p.containsKey("property2"));
}
示例6: createRecipientPreference
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
private RecipientPreference createRecipientPreference(int index) {
RecipientPreference recipientPreference = new RecipientPreference();
recipientPreference.setRecipientId(recipientIds[index]);
recipientPreference.setProperty(propertys[index]);
recipientPreference.setValue(values[index]);
return getDataObjectService().save(recipientPreference, PersistenceOption.FLUSH);
}
示例7: setUp
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
prefsvc = GlobalKCBServiceLocator.getInstance().getRecipientPreferenceService();
PREF = new RecipientPreference();
PREF.setRecipientId("user1");
PREF.setProperty("property1");
PREF.setValue("value1");
PREF = prefsvc.saveRecipientPreference(PREF);
}
示例8: testDuplicateCreate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataAccessException.class)
public void testDuplicateCreate() {
final RecipientPreference p = new RecipientPreference();
p.setId(KCBTestData.FAKE_ID);
p.setRecipientId(PREF.getRecipientId());
p.setProperty(PREF.getProperty());
p.setValue(PREF.getValue());
prefsvc.saveRecipientPreference(p);
KRADServiceLocator.getDataObjectService().flush(RecipientPreference.class);
}
示例9: testInvalidUpdate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataAccessException.class)
public void testInvalidUpdate() {
RecipientPreference sample = new RecipientPreference();
sample.setRecipientId("user1");
sample.setProperty("uniqueproperty");
sample.setValue("value1");
prefsvc.saveRecipientPreference(sample);
KRADServiceLocator.getDataObjectService().flush(RecipientPreference.class);
// violates not null property constraint
final RecipientPreference p1 = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
p1.setProperty(null);
prefsvc.saveRecipientPreference(p1);
KRADServiceLocator.getDataObjectService().flush(RecipientPreference.class);
}
示例10: testInvalidUpdateUniqueConstraint
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataAccessException.class)
public void testInvalidUpdateUniqueConstraint() {
RecipientPreference sample = new RecipientPreference();
sample.setRecipientId("user1");
sample.setProperty("uniqueproperty");
sample.setValue("value1");
prefsvc.saveRecipientPreference(sample);
final RecipientPreference p2 = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
p2.setProperty("uniqueproperty");
prefsvc.saveRecipientPreference(p2);
KRADServiceLocator.getDataObjectService().flush(RecipientPreference.class);
}
示例11: setUp
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
prefsvc = GlobalKCBServiceLocator.getInstance().getRecipientPreferenceService();
PREF = new RecipientPreference();
PREF.setRecipientId("user1");
PREF.setProperty("property1");
PREF.setValue("value1");
prefsvc.saveRecipientPreference(PREF);
}
示例12: testDuplicateCreate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataIntegrityViolationException.class)
@Override
public void testDuplicateCreate() {
final RecipientPreference p = new RecipientPreference();
p.setId(KCBTestData.FAKE_ID);
p.setRecipientId(PREF.getRecipientId());
p.setProperty(PREF.getProperty());
p.setValue(PREF.getValue());
prefsvc.saveRecipientPreference(p);
}
示例13: testInvalidUpdate
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataAccessException.class)
@Override
public void testInvalidUpdate() {
RecipientPreference sample = new RecipientPreference();
sample.setRecipientId("user1");
sample.setProperty("uniqueproperty");
sample.setValue("value1");
prefsvc.saveRecipientPreference(sample);
// violates not null property constraint
final RecipientPreference p1 = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
p1.setProperty(null);
prefsvc.saveRecipientPreference(p1);
}
示例14: testInvalidUpdateUniqueConstraint
import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test(expected = DataAccessException.class)
public void testInvalidUpdateUniqueConstraint() {
RecipientPreference sample = new RecipientPreference();
sample.setRecipientId("user1");
sample.setProperty("uniqueproperty");
sample.setValue("value1");
prefsvc.saveRecipientPreference(sample);
final RecipientPreference p2 = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
p2.setProperty("uniqueproperty");
prefsvc.saveRecipientPreference(p2);
}