當前位置: 首頁>>代碼示例>>Java>>正文


Java RecipientPreference.setProperty方法代碼示例

本文整理匯總了Java中org.kuali.rice.kcb.bo.RecipientPreference.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java RecipientPreference.setProperty方法的具體用法?Java RecipientPreference.setProperty怎麽用?Java RecipientPreference.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kuali.rice.kcb.bo.RecipientPreference的用法示例。


在下文中一共展示了RecipientPreference.setProperty方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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.setProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。