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


Java UserChannelSubscriptionBo類代碼示例

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


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

示例1: displayUserPreferences

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * This method handles displaying the user preferences UI.
 * @param request
 * @param response
 * @return
 * @throws ServletException
 * @throws IOException
 */
public ModelAndView displayUserPreferences(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

   view = "UserPreferencesForm";
   String userid = request.getRemoteUser();
   LOG.debug("remoteUser: "+userid);
   // get subscribable channels
   Collection<NotificationChannelBo> channels = this.notificationChannelService.getSubscribableChannels();
   // get current subscriptions for this user
   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());
   }
   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,代碼行數:32,代碼來源:UserPreferencesController.java

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

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

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

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

示例6: unsubscribeFromChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * Unsubscribe from Channel
 * @param request
 * @param response
 * @return
 * @throws ServletException
 * @throws IOException
 */
public ModelAndView unsubscribeFromChannel(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("getting channel (id, user): "+channelid+","+userid); 
    UserChannelSubscriptionBo oldsub = this.userPreferenceService.getSubscription(channelid, userid);
    oldsub.setChannel(newChannel);
    
    LOG.debug("Calling service to unsubscribe: "+newChannel.getName());
    this.userPreferenceService.unsubscribeFromChannel(oldsub);
    LOG.debug("Finished unsubscribe service: "+newChannel.getName());
    
    // 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,代碼行數:44,代碼來源:UserPreferencesController.java

示例7: getCurrentSubscriptions

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#getCurrentSubscriptions(java.lang.String)
 */
@Override
public Collection<UserChannelSubscriptionBo> getCurrentSubscriptions(String userid) {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal("userId", userid));

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

示例8: getSubscription

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#getSubscription(java.lang.String, java.lang.String)
 */
@Override
public UserChannelSubscriptionBo getSubscription(String channelid, String userid) {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal(NotificationConstants.BO_PROPERTY_NAMES.CHANNEL_ID, channelid),
            equal(NotificationConstants.BO_PROPERTY_NAMES.USER_ID, userid));

    List<UserChannelSubscriptionBo> subscriptions = dataObjectService.findMatching(UserChannelSubscriptionBo.class,criteria.build()).getResults();

    if (!subscriptions.isEmpty() && subscriptions.size() == 1) {
        return subscriptions.get(0);
    } else {
        return null;
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:18,代碼來源:UserPreferenceServiceImpl.java

示例9: subscribeToChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#subscribeToChannel(org.kuali.rice.ken.bo.UserChannelSubscriptionBo)
 */
@Override
public void subscribeToChannel(UserChannelSubscriptionBo userChannelSubscription) {
    LOG.info("Saving channel subscription");
    try {
        dataObjectService.save(userChannelSubscription);
    } catch(Exception e) {
        LOG.error("Exception when saving userChannelSubscription");		    
    }
    LOG.debug("Channel subscription saved");
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:14,代碼來源:UserPreferenceServiceImpl.java

示例10: unsubscribeFromChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#unsubscribeFromChannel(org.kuali.rice.ken.bo.UserChannelSubscriptionBo)
 */
@Override
public void unsubscribeFromChannel(UserChannelSubscriptionBo userChannelSubscription) {
    LOG.info("unsubscribing from channel"); 
    try {
        dataObjectService.delete(userChannelSubscription);
    } catch(Exception e) {
        LOG.error("Exception when deleting userChannelSubscription");		    
    }

}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:14,代碼來源:UserPreferenceServiceImpl.java

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

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

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

示例14: getSubscription

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#getSubscription(java.lang.String, java.lang.String)
 */
public UserChannelSubscriptionBo getSubscription(String channelid, String userid) {
    HashMap<String, String> uniqueKeys = new HashMap<String,String>();

    uniqueKeys.put(NotificationConstants.BO_PROPERTY_NAMES.CHANNEL_ID, channelid);
    uniqueKeys.put(NotificationConstants.BO_PROPERTY_NAMES.USER_ID, userid);

    UserChannelSubscriptionBo
            subscription = (UserChannelSubscriptionBo) businessObjectDao.findByUniqueKey(UserChannelSubscriptionBo.class, uniqueKeys);

    return subscription; 
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:15,代碼來源:UserPreferenceServiceImpl.java

示例15: subscribeToChannel

import org.kuali.rice.ken.bo.UserChannelSubscriptionBo; //導入依賴的package包/類
/**
 * @see org.kuali.rice.ken.service.UserPreferenceService#subscribeToChannel(org.kuali.rice.ken.bo.UserChannelSubscriptionBo)
 */
public void subscribeToChannel(UserChannelSubscriptionBo userChannelSubscription) {
    LOG.info("Saving channel subscription");
    try {
        businessObjectDao.save(userChannelSubscription);
    } catch(Exception e) {
        LOG.error("Exception when saving userChannelSubscription");		    
    }
    LOG.debug("Channel subscription saved");
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:13,代碼來源:UserPreferenceServiceImpl.java


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