Search in sources :

Example 1 with IUserFragmentSubscriptionDao

use of org.apereo.portal.fragment.subscribe.dao.IUserFragmentSubscriptionDao in project uPortal by Jasig.

the class UserFragmentSubscriptionDaoLocator method getUserIdentityStore.

public static IUserFragmentSubscriptionDao getUserIdentityStore() {
    AbstractBeanLocator<IUserFragmentSubscriptionDao> locator = locatorInstance;
    if (locator == null) {
        LOG.info("Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized");
        final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext();
        applicationContext.getBean(UserFragmentSubscriptionDaoLocator.class.getName());
        locator = locatorInstance;
        if (locator == null) {
            LOG.warn("Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized");
            return applicationContext.getBean(BEAN_NAME, IUserFragmentSubscriptionDao.class);
        }
    }
    return locator.getInstance();
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) IUserFragmentSubscriptionDao(org.apereo.portal.fragment.subscribe.dao.IUserFragmentSubscriptionDao)

Example 2 with IUserFragmentSubscriptionDao

use of org.apereo.portal.fragment.subscribe.dao.IUserFragmentSubscriptionDao in project uPortal by Jasig.

the class SubscribedTabEvaluator method isApplicable.

@Override
public boolean isApplicable(IPerson person) {
    IUserFragmentSubscriptionDao userFragmentInfoDao = UserFragmentSubscriptionDaoLocator.getUserIdentityStore();
    // get the list of current fragment subscriptions for this person
    List<IUserFragmentSubscription> fragments = userFragmentInfoDao.getUserFragmentInfo(person);
    // with this evaluator instance
    for (IUserFragmentSubscription fragment : fragments) {
        if (fragment.isActive() && fragment.getFragmentOwner().equals(ownerId)) {
            return true;
        }
    }
    return false;
}
Also used : IUserFragmentSubscriptionDao(org.apereo.portal.fragment.subscribe.dao.IUserFragmentSubscriptionDao) IUserFragmentSubscription(org.apereo.portal.fragment.subscribe.IUserFragmentSubscription)

Aggregations

IUserFragmentSubscriptionDao (org.apereo.portal.fragment.subscribe.dao.IUserFragmentSubscriptionDao)2 IUserFragmentSubscription (org.apereo.portal.fragment.subscribe.IUserFragmentSubscription)1 ApplicationContext (org.springframework.context.ApplicationContext)1