当前位置: 首页>>代码示例>>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;未经允许,请勿转载。