当前位置: 首页>>代码示例>>Java>>正文


Java RecipientPreference.setValue方法代码示例

本文整理汇总了Java中org.kuali.rice.kcb.bo.RecipientPreference.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java RecipientPreference.setValue方法的具体用法?Java RecipientPreference.setValue怎么用?Java RecipientPreference.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kcb.bo.RecipientPreference的用法示例。


在下文中一共展示了RecipientPreference.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
       }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:RecipientPreferenceServiceImpl.java

示例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"));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:RecipientPreferenceTest.java

示例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);
       }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:29,代码来源:RecipientPreferenceServiceImpl.java

示例4: 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"));
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:19,代码来源:RecipientPreferenceTest.java

示例5: testUpdate

import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
/**
 * Tests updating a {@link RecipientPreference}.
 */
@Test
public void testUpdate() {
    RecipientPreference pref1 = createRecipientPreference(0);
    RecipientPreference pref2 = createRecipientPreference(1);

    pref1.setValue(updatedValues[0]);
    pref2.setValue(updatedValues[1]);

    pref1 = KRADServiceLocator.getDataObjectService().save(pref1, PersistenceOption.FLUSH);
    pref2 = KRADServiceLocator.getDataObjectService().save(pref2, PersistenceOption.FLUSH);
    
    assertEquals(updatedValues[0], pref1.getValue());
    assertEquals(updatedValues[1], pref2.getValue());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:RecipientPreferenceDaoTest.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:RecipientPreferenceDaoTest.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:RecipientPreferenceTest.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:RecipientPreferenceTest.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:RecipientPreferenceTest.java

示例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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:RecipientPreferenceTest.java

示例11: testUpdate

import org.kuali.rice.kcb.bo.RecipientPreference; //导入方法依赖的package包/类
@Test
public void testUpdate() {
    RecipientPreference p = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
    p.setValue("different value");

    p = prefsvc.saveRecipientPreference(p);

    RecipientPreference p2 = prefsvc.getRecipientPreference(PREF.getRecipientId(), PREF.getProperty());
    assertEquals(p, p2);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:RecipientPreferenceTest.java

示例12: 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);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:14,代码来源:RecipientPreferenceTest.java

示例13: 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);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:12,代码来源:RecipientPreferenceTest.java

示例14: 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);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:15,代码来源:RecipientPreferenceTest.java

示例15: 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);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:13,代码来源:RecipientPreferenceTest.java


注:本文中的org.kuali.rice.kcb.bo.RecipientPreference.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。