Examples of UserLayoutChannelDescription


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

   * @param destinationElementId the ID of the channel to insert the new channel before or append after
   * @throws PortalException
   */
  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
          String siblingId=null;
          if(position.equals("before")) {
              siblingId=destinationElementId;
          }
          ulm.addNode(channel,ulm.getParentId(destinationElementId),siblingId);
      }

      // Make sure ChannelManager knows about the new channel
      final ChannelManager channelManager = pcs.getChannelManager();
      channelManager.instantiateChannel(pcs.getHttpServletRequest(), pcs.getHttpServletResponse(), channel.getId());
     
      ulm.saveUserLayout();
  }
View Full Code Here

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

   * @param destinationElementId the ID of the channel to insert the new channel before or append after
   * @throws PortalException
   */
  private final void addChannel(Element newChannel, String position, String destinationElementId) throws PortalException
    {
      IUserLayoutChannelDescription channel=new UserLayoutChannelDescription(newChannel);
      addChannel(channel, position, destinationElementId);
  }
View Full Code Here

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

    public IUserLayoutNodeDescription createNodeDescription( int nodeType ) throws PortalException {
            switch ( nodeType ) {
              case IUserLayoutNodeDescription.FOLDER:
                return new UserLayoutFolderDescription();
              case IUserLayoutNodeDescription.CHANNEL:
                return new UserLayoutChannelDescription();
              default:
                return null;
            }
    }
View Full Code Here

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

        String fname = getFname(nodeId);
        if ( null == fname || fname.equals("") )
            throw new PortalException( "Could not find a transient node " +
                                       "for id: " + nodeId );

        IUserLayoutChannelDescription ulnd = new UserLayoutChannelDescription();
        try
        {
            // check cache first
            IChannelDefinition chanDef = (IChannelDefinition)mChanMap.get(nodeId);

            if ( null == chanDef ) {
                chanDef = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl().getChannelDefinition(fname);
                mChanMap.put(nodeId,chanDef);
            }

            ulnd.setId(nodeId);
            ulnd.setName(chanDef.getName());
            ulnd.setUnremovable(true);
            ulnd.setImmutable(true);
            ulnd.setHidden(false);
            ulnd.setTitle(chanDef.getTitle());
            ulnd.setDescription(chanDef.getDescription());
            ulnd.setClassName(chanDef.getJavaClass());
            ulnd.setChannelPublishId("" + chanDef.getId());
            ulnd.setChannelTypeId("" + chanDef.getTypeId());
            ulnd.setFunctionalName(chanDef.getFName());
            ulnd.setTimeout(chanDef.getTimeout());
            ulnd.setEditable(chanDef.isEditable());
            ulnd.setHasHelp(chanDef.hasHelp());
            ulnd.setHasAbout(chanDef.hasAbout());

            Set<IChannelParameter> parms = chanDef.getParameters();
            for ( IChannelParameter parm : parms )
            {
                ulnd.setParameterValue(parm.getName(),parm.getValue());
                ulnd.setParameterOverride(parm.getName(),parm.getOverride());
            }

        }
        catch( Exception e )
        {
View Full Code Here

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

    String method = request.getParameter("position");

    IChannelRegistryStore channelRegistryStore = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl();
    IChannelDefinition definition = channelRegistryStore.getChannelDefinition(sourceId);
   
        IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(definition);
    for (IChannelParameter param : definition.getParameters()) {
        if (param.getOverride()) {
                String paramValue = request.getParameter(param.getName());
                if (paramValue != null) {
                    channel.setParameterValue(param.getName(), param.getValue());
                }
        }
    }

    IUserLayoutNodeDescription node = null;
    if (isTab(ulm, destinationId)) {
      Enumeration columns = ulm.getChildIds(destinationId);
      if (columns.hasMoreElements()) {
        while (columns.hasMoreElements()) {
          // attempt to add this channel to the column
          node = ulm.addNode(channel, (String) columns.nextElement(),
              null);
          // if it couldn't be added to this column, go on and try the next
          // one.  otherwise, we're set.
          if (node != null)
            break;
        }
      } else {

        IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription();
        newColumn.setName("Column");
        newColumn.setId("tbd");
        newColumn
            .setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE);
        newColumn.setHidden(false);
        newColumn.setUnremovable(false);
        newColumn.setImmutable(false);

        // add the column to our layout
        IUserLayoutNodeDescription col = ulm.addNode(newColumn,
            destinationId, null);

        // add the channel
        node = ulm.addNode(channel, col.getId(), null);
      }

    } else if (isColumn(ulm, destinationId)) {
      // move the channel into the column
      node = ulm.addNode(channel, destinationId, null);
    } else {
      // If we're moving this element before another one, we need
      // to know what the target is. If there's no target, just
      // assume we're moving it to the very end of the column.
      String siblingId = null;
      if (method.equals("insertBefore"))
        siblingId = destinationId;

      // move the node as requested and save the layout
      node = ulm.addNode(channel, ulm.getParentId(destinationId),
          siblingId);
    }

    String nodeId = node.getId();

    // instantiate the channel in the user's layout
    final HttpSession session = request.getSession(false);
        ChannelManager cm = new ChannelManager(upm, session);
    cm.instantiateChannel(new PortalHttpServletRequestWrapper(request, response, userInstanceManager), response, channel.getId());

    try {
      // save the user's layout
      saveUserLayoutPreservingTab(ulm, upm, per);
    } catch (Exception e) {
View Full Code Here

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

            String id="n6";
            IUserLayoutNodeDescription node=man.getNode(id);
            assertTrue(node!=null);
            if(node!=null) {
                // make up a fake node, with the same id
                UserLayoutChannelDescription ts=new UserLayoutChannelDescription();
                ts.setId(node.getId());
                ts.setName("uPortal-Powered Sites");
                ts.setTitle("uPortal-Powered Sites");
                ts.setHidden(false);
                ts.setImmutable(true);
                ts.setUnremovable(true);
                ts.setClassName("org.jasig.portal.channels.CGenericXSLT");
                ts.setFunctionalName("");
                ts.setChannelPublishId("5");
                ts.setChannelTypeId("0");
                ts.setDescription("uPortal Demos channel");
                ts.setEditable(false);
                ts.setHasAbout(false);
                ts.setHasHelp(false);
                ts.setTimeout(10000);

                ts.setParameterValue("xmlUri","http://www.interactivebusiness.com/publish/jasigPortalDemos.rss");
                ts.setParameterValue("sslUri","CGenericXSLT/RSS/RSS-0_9x.ssl");

                assertEquals(ts,node);
            }
        }
    }
View Full Code Here

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

    public void testAddChannel() throws Exception {
        // testing by doing add and subsequent get

        // add a channel
        UserLayoutChannelDescription nchan=new UserLayoutChannelDescription();
        nchan.setName("Newly added channel");
        nchan.setTitle("Newly added channel");
        nchan.setHidden(false);
        nchan.setImmutable(true);
        nchan.setUnremovable(true);
        nchan.setClassName("org.jasig.portal.channels.CGenericXSLT");
        nchan.setFunctionalName("");
        nchan.setChannelPublishId("5");
        nchan.setChannelTypeId("0");
        nchan.setDescription("some example channel");
        nchan.setEditable(false);
        nchan.setHasAbout(false);
        nchan.setHasHelp(false);
        nchan.setTimeout(10000);

        nchan.setParameterValue("xmlUri","http://www.interactivebusiness.com/publish/jasigPortalDemos.rss");
        nchan.setParameterValue("sslUri","CGenericXSLT/RSS/RSS-0_9x.ssl");
       
        String parentId="s7";
        String siblingId="n8";
        assertTrue("can a node be added ?",man.canAddNode(nchan,parentId,siblingId));

        UserLayoutChannelDescription rchan=(UserLayoutChannelDescription) man.addNode(nchan,parentId,siblingId);
        // System.out.println("Layout\n"+XML.serializeNode(man.getUserLayoutDOM()));
        assertTrue("addNode() returned null",rchan!=null);
        nchan.setId(rchan.getId());
        assertEquals("comparing the original and addNode() result: ",nchan,rchan);

        // do a get
        IUserLayoutNodeDescription gnode=man.getNode(nchan.getId());
        assertEquals("comparing the original and getNode() result: ",nchan,gnode);
View Full Code Here

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

    }

    public void testUpdateChannel() throws Exception {
        String channelId="n8";
        UserLayoutChannelDescription chan=(UserLayoutChannelDescription) man.getNode(channelId);
        chan.setName("uPortal other page");
        chan.setTimeout(10);
        chan.setTitle("uPortal other title");
        chan.setHidden(true);
        chan.setParameterValue("newParameter","newValue");
        man.updateNode(chan);
        //        System.out.println("Layout\n"+XML.serializeNode(man.getUserLayoutDOM()));

        UserLayoutChannelDescription rchan=(UserLayoutChannelDescription) man.getNode(channelId);
        assertEquals("Comparing node used to update with the update result: ",chan,rchan);

        assertTrue("nodeUpdated event received",nodeUpdated);
        assertTrue("LayoutEvent is not null",lastEvent!=null);
        assertEquals("LayoutEvent nodeId",channelId,lastEvent.getNodeDescription().getId());
View Full Code Here

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

   * @param destinationElementId the ID of the channel to insert the new channel before or append after
   * @throws PortalException
   */
  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
          String siblingId=null;
          if(position.equals("before")) {
              siblingId=destinationElementId;
    }
          ulm.addNode(channel,ulm.getParentId(destinationElementId),siblingId);
    }

      // Make sure ChannelManager knows about the new channel
      pcs.getChannelManager().instantiateChannel(channel.getId());
      saveLayout(true);
  }
View Full Code Here

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

        String fname = getFname(nodeId);
        if ( null == fname || fname.equals("") )
            throw new PortalException( "Could not find a transient node " +
                                       "for id: " + nodeId );

        IUserLayoutChannelDescription ulnd = new UserLayoutChannelDescription();
        try
        {
            // check cache first
            ChannelDefinition chanDef = (ChannelDefinition)mChanMap.get(nodeId);

            if ( null == chanDef ) {
                chanDef = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl().getChannelDefinition(fname);
                mChanMap.put(nodeId,chanDef);
            }

            ulnd.setId(nodeId);
            ulnd.setName(chanDef.getName());
            ulnd.setUnremovable(true);
            ulnd.setImmutable(true);
            ulnd.setHidden(false);
            ulnd.setTitle(chanDef.getTitle());
            ulnd.setDescription(chanDef.getDescription());
            ulnd.setClassName(chanDef.getJavaClass());
            ulnd.setChannelPublishId("" + chanDef.getId());
            ulnd.setChannelTypeId("" + chanDef.getTypeId());
            ulnd.setFunctionalName(chanDef.getFName());
            ulnd.setTimeout(chanDef.getTimeout());
            ulnd.setEditable(chanDef.isEditable());
            ulnd.setHasHelp(chanDef.hasHelp());
            ulnd.setHasAbout(chanDef.hasAbout());

            ChannelParameter[] parms = chanDef.getParameters();
            for ( int i=0; i<parms.length; i++ )
            {
                ChannelParameter parm = (ChannelParameter)parms[i];
                ulnd.setParameterValue(parm.getName(),parm.getValue());
                ulnd.setParameterOverride(parm.getName(),parm.getOverride());
            }

        }
        catch( Exception e )
        {
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.