Examples of IUserLayoutNodeDescription


Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

      Element userPrefParamsE = doc.createElement("userPrefParams");

      if (previousState instanceof NewChannelState)
          userPrefParamsE.appendChild(channelDesc.getXML(doc));
      else if (previousState instanceof DefaultState) {
        IUserLayoutNodeDescription node=ulm.getNode(elementID);
        userPrefParamsE.appendChild(node.getXML(doc));
      }

      // CPD
      Document cpd = ChannelRegistryManager.getCPD(channelDesc.getChannelTypeId());
      if (cpd != null)
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

        final IUserPreferencesManager userPreferencesManager = this.portcs.getUserPreferencesManager();
        if (channelSubscribeId != null) {
            try {
                final IUserLayoutManager userLayoutManager = userPreferencesManager.getUserLayoutManager();
                final IUserLayoutNodeDescription channelNode = userLayoutManager.getNode(channelSubscribeId);
                this.errorDocument.setChannelName(channelNode.getName());
            }
            catch (Throwable t) {
                log.error("Error determining name of channel with subscribe id [" + channelSubscribeId + "]", t);
            }
        }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

          String siblingId=null;
          if(method.equals("insertBefore")) {
              siblingId=destinationElementId;
          }
          // Returns the node that was just added containing the default width of 100%
          IUserLayoutNodeDescription ulnd = ulm.addNode(newColumn,ulm.getParentId(destinationElementId),siblingId);
          // Get the current users layout
          Document doc = this.ulm.getUserLayoutDOM();
          // Keep track of the new column id incase the user clicks on cancel button
          this.newColumnId = ulnd.getId();
          Element nE = (Element)doc.getElementById(ulnd.getId());
          // Find out how many siblings this node contains
          NodeList list = nE.getParentNode().getChildNodes();
          if (list != null && list.getLength() > 0)
              this.setEvenlyAssignedColumnWidths(list);
      }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

   */
  private final void moveChannel(String sourceChannelSubscribeId, String method, String destinationElementId) throws PortalException
  {
      if(isTab(destinationElementId)) {
          // create a new column and move channel there
          IUserLayoutNodeDescription newColumn=ulm.addNode(createFolder("Column"),destinationElementId,null);
          ulm.moveNode(sourceChannelSubscribeId,newColumn.getId(),null);
      } else if(isColumn(destinationElementId)) {
          // move the channel into the column
          ulm.moveNode(sourceChannelSubscribeId,destinationElementId,null);
      } else {
          // assume that destinationElementId is that of a sibling channel
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

  private final void addChannel(Element newChannel, String position, String destinationElementId) throws PortalException
  {
      IUserLayoutChannelDescription channel=new UserLayoutChannelDescription(newChannel);
      if(isTab(destinationElementId)) {
          // create a new column and move channel there
          IUserLayoutNodeDescription newColumn=ulm.addNode(createFolder("Column"),destinationElementId,null);
          ulm.addNode(channel,newColumn.getId(),null);
      } else if(isColumn(destinationElementId)) {
          // move the channel into the column
          ulm.addNode(channel,destinationElementId,null);
      } else {
          // assume that destinationElementId is that of a sibling channel
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

                                           String editAllowed,
                                           String addChildAllowed,
                                           String deleteAllowed )
        throws Exception
    {
        IUserLayoutNodeDescription node = ulm.getNode(id);

        node.setDeleteAllowed( getRestriction( deleteAllowed ) );
        node.setMoveAllowed( getRestriction( moveAllowed ) );

        if( node instanceof UserLayoutFolderDescription )
        {
            UserLayoutFolderDescription fldr = null;
            fldr = (UserLayoutFolderDescription) node;
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

   */
  private final void moveChannel(String sourceChannelSubscribeId, String method, String destinationElementId) throws PortalException
  {
      if(isTab(destinationElementId)) {
          // create a new column and move channel there
          IUserLayoutNodeDescription newColumn=ulm.addNode(createFolder("Column"),destinationElementId,null);
          ulm.moveNode(sourceChannelSubscribeId,newColumn.getId(),null);
      } else if(isColumn(destinationElementId)) {
          // move the channel into the column
          ulm.moveNode(sourceChannelSubscribeId,destinationElementId,null);
      } else {
          // assume that destinationElementId is that of a sibling channel
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

  private final void addChannel(IUserLayoutChannelDescription channel,
          String position, String destinationElementId) throws PortalException
    {
      if(isTab(destinationElementId)) {
          // create a new column and move channel there
          IUserLayoutNodeDescription newColumn=ulm.addNode(createFolder("Column"),destinationElementId,null);
          ulm.addNode(channel,newColumn.getId(),null);
      } else if(isColumn(destinationElementId)) {
          // move the channel into the column
          ulm.addNode(channel,destinationElementId,null);
      } else {
          // assume that destinationElementId is that of a sibling channel
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

      Element userPrefParamsE = doc.createElement("userPrefParams");

      if (previousState instanceof NewChannelState)
        userPrefParamsE.appendChild(doc.importNode(registryChannel, true));
      else if (previousState instanceof DefaultState) {
        IUserLayoutNodeDescription node=ulm.getNode(elementID);
        userPrefParamsE.appendChild(node.getXML(doc));
      }

      // CPD
      Document cpd = ChannelRegistryManager.getCPD(registryChannel.getAttribute("typeID"));
      if (cpd != null)
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

                // to Privileged channels. We assume that Privileged channels are smart enough not to delete
                // themselves in the detach mode !

                // In general transformations will start at the userLayoutRoot node, unless
                // we are rendering something in a detach mode.
                IUserLayoutNodeDescription rElement = null;
                // see if an old detach target exists in the servlet path

                // give channels the current locale manager
                channelManager.setLocaleManager(localeManager);

                IUserLayoutManager ulm = uPreferencesManager.getUserLayoutManager();

                // determine uPElement (optimistic prediction) --end

                // set up the channel manager

                channelManager.startRenderingCycle(req, res, uPElement);

                // after this point the layout is determined

                UserPreferences userPreferences = uPreferencesManager.getUserPreferences();
                StructureStylesheetDescription ssd = uPreferencesManager.getStructureStylesheetDescription();
                ThemeStylesheetDescription tsd = uPreferencesManager.getThemeStylesheetDescription();

                // verify upElement and determine rendering root --begin
                if (newRootNodeId != null && (!newRootNodeId.equals(rootNodeId))) {
                    // see if the new detach traget is valid
                    try {
                        rElement = ulm.getNode(newRootNodeId);
                    }
                    catch (PortalException e) {
                        rElement = null;
                    }

                    if (rElement != null) {
                        // valid new root id was specified. need to redirect
                        // peterk: should we worry about forwarding
                        // parameters here ? or those passed with detach
                        // always get sacked ?
                        // Andreas: Forwarding parameters with detach
                        // are not lost anymore with the URLUtil class.

                        // Skip the uP_detach_target parameter since
                        // it has already been processed
                        String[] skipParams = new String[] { "uP_detach_target" };

                        try {
                            URLUtil.redirect(req, res, newRootNodeId, true, skipParams, CHARACTER_SET);
                        }
                        catch (PortalException pe) {
                            log.error("PortalException occurred while redirecting",
                                    pe);
                        }
                        return;
                    }
                }

                // LogService.log(LogService.DEBUG,"uP_detach_target=\""+rootNodeId+"\".");
                try {
                    rElement = ulm.getNode(rootNodeId);
                }
                catch (PortalException e) {
                    rElement = null;
                }
                // if we haven't found root node so far, set it to the userLayoutRoot
                if (rElement == null) {
                    rootNodeId = UPFileSpec.USER_LAYOUT_ROOT_NODE;
                }

                // update the render target
                uPElement.setMethodNodeId(rootNodeId);

                // inform channel manager about the new uPElement value
                channelManager.setUPElement(uPElement);
                // verify upElement and determine rendering root --begin
               
                // Increase output buffer size, buffer will be flushed before and after every <channel>
                res.setBufferSize(16 * 1024);

                // Disable page caching
                res.setHeader("pragma", "no-cache");
                res.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate");
                res.setDateHeader("Expires", 0);
                // set the response mime type
                res.setContentType(tsd.getMimeType() + "; charset=" + CHARACTER_SET);
                // obtain the writer - res.getWriter() must occur after res.setContentType()
                Writer out = new BufferedWriter(res.getWriter(), 1024);
                // get a serializer appropriate for the target media
                BaseMarkupSerializer markupSerializer =
                    MEDIA_MANAGER.getSerializerByName(tsd.getSerializerName(),
                        new ChannelTitleIncorporationWiterFilter(out, channelManager, ulm));
                // set up the serializer
                markupSerializer.asContentHandler();
                // see if we can use character caching
                boolean ccaching = (CHARACTER_CACHE_ENABLED && (markupSerializer instanceof CachingSerializer));
                channelManager.setCharacterCaching(ccaching);
                // pass along the serializer name
                channelManager.setSerializerName(tsd.getSerializerName());
                // initialize ChannelIncorporationFilter
                CharacterCachingChannelIncorporationFilter cif = new CharacterCachingChannelIncorporationFilter(markupSerializer, channelManager, CACHE_ENABLED && CHARACTER_CACHE_ENABLED, req, res);

                String cacheKey = null;
                boolean output_produced = false;
                if (CACHE_ENABLED) {
                    boolean ccache_exists = false;
                    // obtain the cache key
                    cacheKey = constructCacheKey(uPreferencesManager, rootNodeId);
                    if (ccaching) {
                        // obtain character cache
                        List<CacheEntry> cacheEntries = systemCharacterCache.get(cacheKey);
                        if(cacheEntries!=null && cacheEntries.size()>0) {
                            ccache_exists = true;
                            if (log.isDebugEnabled())
                                log
                                        .debug("retreived transformation character block cache for a key \""
                                                + cacheKey + "\"");
                            // start channel threads
                            for(int i=0;i<cacheEntries.size();i++) {
                                CacheEntry ce = cacheEntries.get(i);
                                if (ce.getCacheType().equals(CacheType.CHANNEL_CONTENT)) {
                                    String channelSubscribeId = ((ChannelContentCacheEntry)ce).getChannelId();
                                    if(channelSubscribeId!=null) {
                                        try {
                                            channelManager.startChannelRendering(req, res, channelSubscribeId);
                                        } catch (PortalException e) {
                                            log.error("UserInstance::renderState() : unable to start rendering channel (subscribeId=\""+channelSubscribeId+"\", user="+person.getID()+" layoutId="+uPreferencesManager.getCurrentProfile().getLayoutId(),e);
                                        }
                                    } else {
                                        log.error("channel entry " + Integer.toString(i)
                                            + " in character cache is invalid (user=" + person.getID() + ")!");
                                    }
                                }
                            }
                            channelManager.commitToRenderingChannelSet();

                            // go through the output loop
                            CachingSerializer cSerializer = (CachingSerializer) markupSerializer;
                            cSerializer.setDocumentStarted(true);

                            for(int sb=0; sb<cacheEntries.size();sb++) {
                                CacheEntry ce = cacheEntries.get(sb);
                                if (log.isDebugEnabled()) {
                                    DebugCachingSerializer dcs = new DebugCachingSerializer();
                                    log.debug("----------printing " + ce.getCacheType() + " cache block "+Integer.toString(sb));
                                    ce.replayCache(dcs, channelManager, req, res);
                                    log.debug(dcs.getCache());
                                }

                                // get cache block output
                                ce.replayCache(cSerializer, channelManager, req, res);
                            }

                            cSerializer.flush();
                            output_produced = true;
                        }
                    }
                    // if this failed, try XSLT cache
                    if ((!ccaching) || (!ccache_exists)) {
                        // obtain XSLT cache

                        SAX2BufferImpl cachedBuffer = systemCache.get(cacheKey);
                        if (cachedBuffer != null) {
                            // replay the buffer to channel incorporation filter
                            if (log.isDebugEnabled()) {
                                log.debug("retreived XSLT transformation cache for a key '" + cacheKey + "'");
                            }
                           
                            // attach rendering buffer downstream of the cached buffer
                            ChannelRenderingBuffer crb = new ChannelRenderingBuffer(cachedBuffer, channelManager, ccaching, req, res);
                           
                            // attach channel incorporation filter downstream of the channel rendering buffer
                            cif.setParent(crb);
                            crb.setOutputAtDocumentEnd(true);
                            cachedBuffer.outputBuffer(crb);

                            output_produced = true;
                        }
                    }
                }
                // fallback on the regular rendering procedure
                if (!output_produced) {

                    // obtain transformer handlers for both structure and theme stylesheets
                    TransformerHandler ssth = XSLT.getTransformerHandler(ResourceLoader.getResourceAsURL(this.getClass(), ssd.getStylesheetURI()).toString());
                    TransformerHandler tsth = XSLT.getTransformerHandler(tsd.getStylesheetURI(), localeManager
                            .getLocales(), this);

                    // obtain transformer references from the handlers
                    Transformer sst = ssth.getTransformer();
                    sst.setErrorListener(cErrListener);
                    Transformer tst = tsth.getTransformer();
                    tst.setErrorListener(cErrListener);
                   
                    // pass resourcesDao into transformer
                    tst.setParameter(ResourcesXalanElements.SKIN_RESOURCESDAO_PARAMETER_NAME, resourcesElementsProvider);
                    tst.setParameter(ResourcesXalanElements.CURRENT_REQUEST, req);

                    // initialize ChannelRenderingBuffer and attach it downstream of the structure transformer
                    ChannelRenderingBuffer crb = new ChannelRenderingBuffer(channelManager, ccaching, req, res);
                    ssth.setResult(new SAXResult(crb));

                    // determine and set the stylesheet params
                    // prepare .uP element and detach flag to be passed to the stylesheets
                    // Including the context path in front of uPElement is necessary for phone.com browsers to work
                    sst.setParameter("baseActionURL", uPElement.getUPFile());
                    // construct idempotent version of the uPElement
                    UPFileSpec uPIdempotentElement = new UPFileSpec(uPElement);
                    sst.setParameter("baseIdempotentActionURL", uPElement.getUPFile());

                    Hashtable<String, String> supTable = userPreferences.getStructureStylesheetUserPreferences()
                            .getParameterValues();
                    for (Map.Entry<String, String> param : supTable.entrySet()) {
                        String pName = param.getKey();
                        String pValue = param.getValue();
                        if (log.isDebugEnabled())
                            log.debug("setting sparam \"" + pName + "\"=\"" + pValue
                                    + "\".");
                        sst.setParameter(pName, pValue);
                    }

                    // all the parameters are set up, fire up structure transformation

                    // filter to fill in channel/folder attributes for the "structure" transformation.
                    StructureAttributesIncorporationFilter saif = new StructureAttributesIncorporationFilter(ssth,
                            userPreferences.getStructureStylesheetUserPreferences());

                    // This is a debug statement that will print out XML incoming to the
                    // structure transformation to a log file serializer to a printstream
                    StringWriter dbwr1 = null;
                    OutputFormat outputFormat = null;
                    if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
                        dbwr1 = new StringWriter();
                        outputFormat = new OutputFormat();
                        outputFormat.setIndenting(true);
                        XMLSerializer dbser1 = new XMLSerializer(dbwr1, outputFormat);
                        SAX2DuplicatingFilterImpl dupl1 = new SAX2DuplicatingFilterImpl(ssth, dbser1);
                        dupl1.setParent(saif);
                    }

                    // if operating in the detach mode, need wrap everything
                    // in a document node and a <layout_fragment> node
                    boolean detachMode = !rootNodeId.equals(UPFileSpec.USER_LAYOUT_ROOT_NODE);
                    if (detachMode) {
                        saif.startDocument();
                        saif.startElement("",
                                "layout_fragment",
                                "layout_fragment",
                                new org.xml.sax.helpers.AttributesImpl());

                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult(new ChannelSAXStreamFilter((ContentHandler)saif)));
                        if (rElement == null) {
                            ulm.getUserLayout(new ChannelSAXStreamFilter((ContentHandler) saif));
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), new ChannelSAXStreamFilter((ContentHandler) saif));
                        }

                        saif.endElement("", "layout_fragment", "layout_fragment");
                        saif.endDocument();
                    }
                    else {
                        if (rElement == null) {
                            ulm.getUserLayout(saif);
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), saif);
                        }
                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult((ContentHandler)saif));
                    }
                    // all channels should be rendering now

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.