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


Java UserChannelSubscriptionBo.setUserId方法代码示例

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


在下文中一共展示了UserChannelSubscriptionBo.setUserId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUnsubscribeFromChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testUnsubscribeFromChannel() {
    UserPreferenceService impl = services.getUserPreferenceService();
    NotificationChannelBo
            channel = KRADServiceLocator.getDataObjectService().find(NotificationChannelBo.class, VALID_CHANNEL_ID_LONG);


    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);

    UserChannelSubscriptionBo userChannelSubscription = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    impl.unsubscribeFromChannel(userChannelSubscription);

    UserChannelSubscriptionBo sub = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    assertNull(sub);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:UserPreferenceServiceImplTest.java

示例2: testSubscribeToChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testSubscribeToChannel() {
    UserPreferenceService impl = services.getUserPreferenceService();
    HashMap primaryKeys = new HashMap();
    primaryKeys.put(NotificationConstants.BO_PROPERTY_NAMES.ID, VALID_CHANNEL_ID_LONG);
    NotificationChannelBo
            channel = (NotificationChannelBo) services.getGenericDao().findByPrimaryKey(NotificationChannelBo.class, primaryKeys);

    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);
    UserChannelSubscriptionBo sub = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    assertNotNull(sub);
    assertEquals(VALID_USER_ID, sub.getUserId());
    assertEquals(VALID_CHANNEL_ID_LONG, sub.getChannel().getId());

}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:19,代码来源:UserPreferenceServiceImplTest.java

示例3: testUnsubscribeFromChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testUnsubscribeFromChannel() {
    UserPreferenceService impl = services.getUserPreferenceService();
    HashMap primaryKeys = new HashMap();
    primaryKeys.put(NotificationConstants.BO_PROPERTY_NAMES.ID, VALID_CHANNEL_ID_LONG);
    NotificationChannelBo
            channel = (NotificationChannelBo) services.getGenericDao().findByPrimaryKey(NotificationChannelBo.class, primaryKeys);


    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);

    UserChannelSubscriptionBo userChannelSubscription = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    impl.unsubscribeFromChannel(userChannelSubscription);

    UserChannelSubscriptionBo sub = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    assertNull(sub);

}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:22,代码来源:UserPreferenceServiceImplTest.java

示例4: subscribeToChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
/**
 * Subscribe To a Channel
 * @param request
 * @param response
 * @return
 * @throws ServletException
 * @throws IOException
*/
public ModelAndView subscribeToChannel(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    view = "UserPreferencesForm";
    String userid = request.getRemoteUser();
    LOG.debug("remoteUser: "+userid);
    String channelid = request.getParameter("channelid");
    NotificationChannelBo newChannel = this.notificationChannelService.getNotificationChannel(channelid);
    LOG.debug("newChannel name:"+newChannel.getName());
    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(userid);
    newSub.setChannel(newChannel);
    LOG.debug("Calling service to subscribe to channel: "+newChannel.getName());
    this.userPreferenceService.subscribeToChannel(newSub);
    
    // get current subscription channel ids
    Collection<UserChannelSubscriptionBo> subscriptions = this.userPreferenceService.getCurrentSubscriptions(userid);
    Map<String, Object> currentsubs = new HashMap<String, Object>();;
    Iterator<UserChannelSubscriptionBo> i = subscriptions.iterator();
    while (i.hasNext()) {
 UserChannelSubscriptionBo sub = i.next();
 String subid = Long.toString(sub.getChannel().getId());
 currentsubs.put(subid, subid);
 LOG.debug("currently subscribed to: "+sub.getChannel().getId());
    }
    
    // get all subscribable channels       
    Collection<NotificationChannelBo> channels = this.notificationChannelService.getSubscribableChannels();
    
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("channels", channels);
    model.put("currentsubs", currentsubs);
    return new ModelAndView(view, model);       
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:UserPreferencesController.java

示例5: testSubscribeToChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testSubscribeToChannel() {
    UserPreferenceService impl = services.getUserPreferenceService();
    NotificationChannelBo channel = KRADServiceLocator.getDataObjectService().find(NotificationChannelBo.class, VALID_CHANNEL_ID_LONG);

    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);
    UserChannelSubscriptionBo sub = impl.getSubscription(VALID_CHANNEL_ID, VALID_USER_ID);
    assertNotNull(sub);
    assertEquals(VALID_USER_ID, sub.getUserId());
    assertEquals(VALID_CHANNEL_ID_LONG, sub.getChannel().getId());

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:UserPreferenceServiceImplTest.java

示例6: testGetCurrentSubscriptions

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testGetCurrentSubscriptions() {
    UserPreferenceService impl = services.getUserPreferenceService();

    NotificationChannelBo
            channel = KRADServiceLocator.getDataObjectService().find(NotificationChannelBo.class, VALID_CHANNEL_ID_LONG);

    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);
    Collection<UserChannelSubscriptionBo> subs = impl.getCurrentSubscriptions(VALID_USER_ID);
    assertEquals(1, subs.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:UserPreferenceServiceImplTest.java

示例7: getCurrentSubscriptions

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#getCurrentSubscriptions(java.lang.String)
 */
public Collection<UserChannelSubscriptionBo> getCurrentSubscriptions(String userid) {
    UserChannelSubscriptionBo userChannelSubscription = new UserChannelSubscriptionBo();
    userChannelSubscription.setUserId(userid);

    return businessObjectDao.findMatchingByExample(userChannelSubscription);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:10,代码来源:UserPreferenceServiceImpl.java

示例8: testGetCurrentSubscriptions

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //导入方法依赖的package包/类
@Test
public void testGetCurrentSubscriptions() {
    UserPreferenceService impl = services.getUserPreferenceService();
    HashMap primaryKeys = new HashMap();
    primaryKeys.put(NotificationConstants.BO_PROPERTY_NAMES.ID, VALID_CHANNEL_ID_LONG);
    NotificationChannelBo
            channel = (NotificationChannelBo) services.getGenericDao().findByPrimaryKey(NotificationChannelBo.class, primaryKeys);

    UserChannelSubscriptionBo newSub = new UserChannelSubscriptionBo();
    newSub.setUserId(VALID_USER_ID);
    newSub.setChannel(channel);
    impl.subscribeToChannel(newSub);
    Collection<UserChannelSubscriptionBo> subs = impl.getCurrentSubscriptions(VALID_USER_ID);
    assertEquals(1, subs.size());
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:16,代码来源:UserPreferenceServiceImplTest.java


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