Examples of IPortletEntityId


Examples of org.jasig.portal.portlet.om.IPortletEntityId

        final Set<IPortletWindow> allLayoutWindows = new LinkedHashSet<IPortletWindow>(allSubscribedChannels.size());

        for (final String channelSubscribeId : allSubscribedChannels) {
            final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(request, userInstance, channelSubscribeId);
           
            final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
            final Set<IPortletWindow> portletWindows = this.getAllPortletWindowsForEntity(request, portletEntityId);
            allLayoutWindows.addAll(portletWindows);
        }
       
        return allLayoutWindows;
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

       
        return this.getPortletWindowId(request, portletWindowId.getStringId());
    }

    protected IPortletWindow wrapPortletWindowData(HttpServletRequest request, PortletWindowData portletWindowData) {
        final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId();
        final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId);
        if (portletEntity == null) {
            return null;
        }
       
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

     * Initializes a newly created {@link PortletWindow}, the default implementation sets up the appropriate
     * {@link WindowState} and {@link javax.portlet.PortletMode}
     */
    protected void initializePortletWindowData(HttpServletRequest request, PortletWindowData portletWindowData) {
        final IStylesheetDescriptor stylesheetDescriptor = getThemeStylesheetDescriptor(request);
        final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId();
        final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId);
        final WindowState entityWindowState = portletEntity.getWindowState(stylesheetDescriptor);
        if (persistentWindowStates.contains(entityWindowState)) {
            portletWindowData.setWindowState(entityWindowState);
        }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

    @Override
    protected boolean storeInternal() throws IOException, ValidatorException {
        final HttpServletRequest containerRequest = portletRequestContext.getContainerRequest();
       
        final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(containerRequest, portletEntityId);
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
        final Lock portletEntityLock = this.portletEntityRegistry.getPortletEntityLock(containerRequest, portletEntityId);
       
        //Do a tryLock first so that we can warn about concurrent preference modification if it fails
        boolean locked = portletEntityLock.tryLock();
        try {
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

            writeLock.unlock();
        }
    }
   
    public T storeIfAbsentEntity(T entity) {
        final IPortletEntityId portletEntityId = entity.getPortletEntityId();
       
        //Check if the entity already exists (uses a read lock)
        T existingEntity = this.getEntity(portletEntityId);
        if (existingEntity != null) {
            return existingEntity;
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

    /* (non-Javadoc)
     * @see org.jasig.portal.portlet.registry.IPortletEntityRegistry#getPortletEntity(java.lang.String)
     */
    @Override
    public IPortletEntity getPortletEntity(HttpServletRequest request, String portletEntityIdString) {
        final IPortletEntityId portletEntityId = this.parseConsistentPortletEntityId(request, portletEntityIdString);
        return this.getPortletEntity(request, portletEntityId);
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

       
       
        //Create the entity data object and store it in the session map (if not already there)
        final PortletEntityCache<PortletEntityData> portletEntityDataMap = this.getPortletEntityDataMap(request);
       
        final IPortletEntityId portletEntityId = this.createConsistentPortletEntityId(portletDefinitionId, layoutNodeId, userId);
        PortletEntityData portletEntityData = new PortletEntityData(portletEntityId, portletDefinitionId, layoutNodeId, userId);
        portletEntityData = portletEntityDataMap.storeIfAbsentEntity(portletEntityData);
       
        portletEntity = wrapPortletEntityData(portletEntityData);
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

        if (person.isGuest()) {
            //Never persist things for the guest user, just rely on in-memory storage
            return;
        }

        final IPortletEntityId wrapperPortletEntityId = portletEntity.getPortletEntityId();
        final Lock portletEntityLock = this.getPortletEntityLock(request, wrapperPortletEntityId);
        portletEntityLock.lock();
        try {
            final boolean shouldBePersisted = this.shouldBePersisted(portletEntity);
           
            if (portletEntity instanceof PersistentPortletEntityWrapper) {
                //Unwrap the persistent entity
                final IPortletEntity persistentEntity = ((PersistentPortletEntityWrapper)portletEntity).getPersistentEntity();
               
                //Already persistent entity that still has prefs
                if (shouldBePersisted) {
                    try {
                        this.portletEntityDao.updatePortletEntity(persistentEntity);
                    }
                    catch (HibernateOptimisticLockingFailureException e) {
                        //Check if this exception is from the entity being deleted from under us.
                        final boolean exists = this.portletEntityDao.portletEntityExists(persistentEntity.getPortletEntityId());
                        if (!exists) {
                            this.logger.warn("The persistent portlet has already been deleted: " + persistentEntity + ". The passed entity should be persistent so a new persistent entity will be created");
                            this.deletePortletEntity(request, portletEntity, true);
                            this.createPersistentEntity(persistentEntity, wrapperPortletEntityId);
                        }
                        else {
                            throw e;
                        }
                    }
                }
                //Already persistent entity that should not be, DELETE!
                else {
                    //Capture identifiers needed to recreate the entity as session persistent
                    final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId();
                    final String layoutNodeId = portletEntity.getLayoutNodeId();
                    final int userId = portletEntity.getUserId();
                   
                    //Delete the persistent entity
                    this.deletePortletEntity(request, portletEntity, false);

                    //Create a new entity and stick it in the cache
                    this.getOrCreatePortletEntity(request, portletDefinitionId, layoutNodeId, userId);
                }
            }
            else if (portletEntity instanceof SessionPortletEntityImpl) {
                //There are preferences on the interim entity, create an store it
                if (shouldBePersisted) {
                    //Remove the session scoped entity from the request and session caches
                    this.deletePortletEntity(request, portletEntity, false);
                   
                    final IPortletEntity persistentEntity = createPersistentEntity(portletEntity, wrapperPortletEntityId);
                   
                    if (this.logger.isTraceEnabled()) {
                        this.logger.trace("Session scoped entity " + wrapperPortletEntityId + " should now be persistent. Deleted it from session cache and created persistent portlet entity " + persistentEntity.getPortletEntityId());
                    }
                }
                //Session scoped entity that is still session scoped,
                else {
                    //Look for a persistent entity and delete it
                    final String channelSubscribeId = portletEntity.getLayoutNodeId();
                    final int userId = portletEntity.getUserId();
                    IPortletEntity existingPersistentEntity = this.portletEntityDao.getPortletEntity(channelSubscribeId, userId);
                    if (existingPersistentEntity != null) {
                        final IPortletEntityId consistentPortletEntityId = this.createConsistentPortletEntityId(existingPersistentEntity);
                        existingPersistentEntity = new PersistentPortletEntityWrapper(existingPersistentEntity, consistentPortletEntityId);
                       
                        this.logger.warn("A persistent portlet entity already exists: " + existingPersistentEntity + ". The passed entity has no preferences so the persistent version will be deleted");
                        this.deletePortletEntity(request, existingPersistentEntity, false);
                       
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

   
    /**
     * Delete a portlet entity, removes it from the request, session and persistent stores
     */
    protected void deletePortletEntity(HttpServletRequest request, IPortletEntity portletEntity, boolean cacheOnly) {
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
       
        //Remove from request cache
        final PortletEntityCache<IPortletEntity> portletEntityMap = this.getPortletEntityMap(request);
        portletEntityMap.removeEntity(portletEntityId);
       
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletEntityId

            portletEntity = this.portletEntityDao.getPortletEntity(layoutNodeId, userId);
        }
       
        //Found a persistent entity, wrap it to make the id consistent between the persistent and session stored entities
        if (portletEntity != null) {
            final IPortletEntityId consistentPortletEntityId = this.createConsistentPortletEntityId(portletEntity);
           
            final IPortletEntity anonPortletEntity = portletEntity;
           
            //Stick the entity wrapper in the request map (if it wasn't already added by another thread)
            portletEntity = portletEntityCache.storeIfAbsentEntity(consistentPortletEntityId, new Function<IPortletEntityId, IPortletEntity>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.