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


Java Message類代碼示例

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


Message類屬於org.kuali.rice.kcb.bo包,在下文中一共展示了Message類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: remove

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessagingService#remove(long, java.lang.String, java.lang.String)
 */
@Override
public void remove(long messageId, String user, String cause) throws MessageDismissalException {
    /*if (StringUtils.isBlank(messageId)) {
        throw new RiceIllegalArgumentException("message is null");
    } if we switch to String id*/

    if (StringUtils.isBlank(user)) {
        throw new RiceIllegalArgumentException("user is null");
    }

    if (StringUtils.isBlank(cause)) {
        throw new RiceIllegalArgumentException("cause is null");
    }

    Message m = messageService.getMessage(Long.valueOf(messageId));
    if (m == null) {
        throw new MessageDismissalException("No such message: " + messageId);
    }

    remove (m, user, cause);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:25,代碼來源:MessagingServiceImpl.java

示例2: getMessageByOriginId

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessageService#getMessageByOriginId(java.lang.String)
 */
public Message getMessageByOriginId(String originId) {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal(Message.ORIGINID_FIELD, originId));
    List<Message> messages = dataObjectService.findMatching(Message.class, criteria.build()).getResults();

    if (messages.isEmpty()) {
        return null;
    }

    return messages.get(0);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:15,代碼來源:MessageServiceImpl.java

示例3: removeByOriginId

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessagingService#removeByOriginId(java.lang.String, java.lang.String, java.lang.String)
 */
@Override
public Long removeByOriginId(String originId, String user, String cause) throws MessageDismissalException {
    if (StringUtils.isBlank(originId)) {
        throw new RiceIllegalArgumentException("originId is null");
    }

    Message m = messageService.getMessageByOriginId(originId);
    if (m == null) {
        return null; 
        //throw new MessageDismissalException("No such message with origin id: " + originId);
    }
    remove(m, user, cause);
    return m.getId();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:18,代碼來源:MessagingServiceImpl.java

示例4: getMessageDeliveries

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessageDeliveryService#getMessageDeliveries(org.kuali.rice.kcb.bo.Message)
 */
public Collection<MessageDelivery> getMessageDeliveries(Message message) {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal(MessageDelivery.MESSAGEID_FIELD, message.getId()));

    return dataObjectService.findMatching(MessageDelivery.class, criteria.build()).getResults();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:10,代碼來源:MessageDeliveryServiceImpl.java

示例5: testCreate

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test
public void testCreate() {
    Message m = new Message();
    m.setContent("test content 2");
    m.setChannel("channel2");
    m.setContentType("test content type 2");
    m.setDeliveryType("test delivery type 2");
    m.setRecipient("test recipient 2");
    m.setTitle("test title 2");

    m = messageService.saveMessage(m);
    assertNotNull(m.getId());

    Collection<Message> ms = messageService.getAllMessages();
    assertNotNull(ms);
    assertEquals(2, ms.size());
    
    Message m2 = messageService.getMessage(m.getId());
    assertNotNull(m2);

    assertEqualsMD(m, m2);
    
    Message m1 = new Message();
    m1.setContent("a");
    m1.setChannel("a");
    m1.setContentType("a");
    m1.setDeliveryType("a");
    m1.setRecipient("a");
    m1.setTitle("a");
    
    // should allow more than one record with NULL origin id
    messageService.saveMessage(m1);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:34,代碼來源:MessageServiceTest.java

示例6: testDelete

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test
public void testDelete() {
    messageService.deleteMessage(MESSAGE);
    
    Collection<Message> ms = messageService.getAllMessages();
    assertNotNull(ms);
    assertEquals(0, ms.size());
    
    assertNull(messageService.getMessage(MESSAGE.getId()));
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:11,代碼來源:MessageServiceTest.java

示例7: testUpdate

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test
public void testUpdate() {
    Message m = messageService.getMessage(MESSAGE.getId());
    m.setTitle("A better title");
    m.setContent("different content");
    m = messageService.saveMessage(m);
    
    Message m2 = messageService.getMessage(m.getId());
    assertNotNull(m2);
    
    assertEqualsMD(m, m2);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:13,代碼來源:MessageServiceTest.java

示例8: assertEqualsMD

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * Asserts that an actual Message is equal to an expected Message
 * @param expected the expected Message
 * @param actual the actual Message
 */
private void assertEqualsMD(Message expected, Message actual) {
    assertEquals(expected.getId(), actual.getId());
    assertEquals(expected.getCreationDateTime(), actual.getCreationDateTime());
    assertEquals(expected.getContent(), actual.getContent());
    assertEquals(expected.getContentType(), actual.getContentType());
    assertEquals(expected.getDeliveryType(), actual.getDeliveryType());
    assertEquals(expected.getRecipient(), actual.getRecipient());
    assertEquals(expected.getTitle(), actual.getTitle());
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:15,代碼來源:MessageServiceTest.java

示例9: getMessage1

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
public static Message getMessage1() {
    Message m= new Message();
    m.setId(Long.valueOf(1));
    m.setChannel("channel1");
    m.setContent("test content 1");
    m.setContentType("test content type 1");
    m.setDeliveryType("test delivery type 1");
    m.setRecipient("test recipient 1");
    m.setTitle("test title 1");
    
    return m;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:13,代碼來源:KCBTestData.java

示例10: getMessage

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessageService#getMessage(java.lang.Long)
 */
public Message getMessage(Long id) {
    Map<String, Object> fields = new HashMap<String, Object>(1);
    fields.put(Message.ID_FIELD, id);
    Message m = (Message) dao.findByPrimaryKey(Message.class, fields);
    return m;
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:10,代碼來源:MessageServiceImpl.java

示例11: getMessageByOriginId

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
/**
 * @see org.kuali.rice.kcb.service.MessageService#getMessageByOriginId(java.lang.String)
 */
public Message getMessageByOriginId(String originId) {
    Map<String, Object> fields = new HashMap<String, Object>(1);
    fields.put(Message.ORIGINID_FIELD, originId);
    Collection<Message> messages = dao.findMatching(Message.class, fields);
    if (messages.size() == 0) {
        return null;
    }
    return messages.iterator().next();
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:13,代碼來源:MessageServiceImpl.java

示例12: testCreate

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test
@Override
public void testCreate() {
    Message m = new Message();
    m.setContent("test content 2");
    m.setChannel("channel2");
    m.setContentType("test content type 2");
    m.setDeliveryType("test delivery type 2");
    m.setRecipient("test recipient 2");
    m.setTitle("test title 2");

    messageService.saveMessage(m);
    assertNotNull(m.getId());

    Collection<Message> ms = messageService.getAllMessages();
    assertNotNull(ms);
    assertEquals(2, ms.size());
    
    Message m2 = messageService.getMessage(m.getId());
    assertNotNull(m2);

    assertEqualsMD(m, m2);
    
    Message m1 = new Message();
    m1.setContent("a");
    m1.setChannel("a");
    m1.setContentType("a");
    m1.setDeliveryType("a");
    m1.setRecipient("a");
    m1.setTitle("a");
    
    // should allow more than one record with NULL origin id
    messageService.saveMessage(m1);
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:35,代碼來源:MessageServiceTest.java

示例13: testDelete

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test
@Override
public void testDelete() {
    messageService.deleteMessage(MESSAGE);
    
    Collection<Message> ms = messageService.getAllMessages();
    assertNotNull(ms);
    assertEquals(0, ms.size());
    
    assertNull(messageService.getMessage(MESSAGE.getId()));
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:12,代碼來源:MessageServiceTest.java

示例14: testInvalidDelete

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test(expected = DataAccessException.class)
@Override
public void testInvalidDelete() {
    final Message m = new Message();
    m.setId(new Long(-1));
    // OJB yields an org.springmodules.orm.ojb.OjbOperationException/OptimisticLockException and claims the object
    // may have been deleted by somebody else
    messageService.deleteMessage(m);
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:10,代碼來源:MessageServiceTest.java

示例15: testInvalidUpdate

import org.kuali.rice.kcb.bo.Message; //導入依賴的package包/類
@Test(expected = DataAccessException.class)
@Override
public void testInvalidUpdate() {
    final Message m = messageService.getMessage(MESSAGE.getId());
    m.setChannel(null);
    messageService.saveMessage(m);
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:8,代碼來源:MessageServiceTest.java


注:本文中的org.kuali.rice.kcb.bo.Message類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。