Package org.jasig.portal

Examples of org.jasig.portal.ChannelRuntimeData


        final IPortletEntityId portletEntityId3 = new MockPortletEntityId("eId3");
        final IPortletWindowId portletWindowId3 = new MockPortletWindowId("wId3");
        final MockPortletWindow portletWindow3 = new MockPortletWindow(portletWindowId3, portletEntityId3, "portletAppC", "portletNameC");

       
        final ChannelRuntimeData channelRuntimeData = new ChannelRuntimeData();
        channelRuntimeData.setBaseActionURL("base/action.url");
       
        request.setAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA, channelRuntimeData);
       
        final MockPortletEntity portletEntity1 = new MockPortletEntity();
        portletEntity1.setPortletEntityId(portletEntityId1);
View Full Code Here


        // create Http Connection
        HttpURLConnection conn =  new MockHttpConn();
       
        // create runtime data
        ChannelRuntimeData rd = new ChannelRuntimeData();
       
        // call method to test
        context.sendLocalData(conn,rd);

        // verify that request property was set right
View Full Code Here

    public void testGetRuntimeData() {

        MockXSLTChannel instance = new MockXSLTChannel();
        assertNull(instance.getRuntimeData());
       
        ChannelRuntimeData runtimeDataA = new ChannelRuntimeData();
        instance.setRuntimeData(runtimeDataA);
        assertSame(runtimeDataA, instance.getRuntimeData());
       
        ChannelRuntimeData runtimeDataB = new ChannelRuntimeData();
        instance.setRuntimeData(runtimeDataB);
       
    }
View Full Code Here

     */
    public void testRenderXMLNullDocument() throws PortalException {
        try {
            MockXSLTChannel instance = new MockXSLTChannel();
            instance.setStaticData(new ChannelStaticData());
            instance.setRuntimeData(new ChannelRuntimeData());
            instance.renderXML(new DummyContentHandler());
        } catch (IllegalStateException ise) {
            // expected
            return;
        }
View Full Code Here

    public void testRenderXMLGetXmlThrowsRuntimeException() throws PortalException {
        RuntimeException runtimeException = new RuntimeException();
       
        MockXSLTChannel mock = new MockXSLTChannel();
        mock.setStaticData(new ChannelStaticData());
        mock.setRuntimeData(new ChannelRuntimeData());
        mock.setThrownFromGetXml(runtimeException);
       
        try {
            mock.renderXML(new DummyContentHandler());
        } catch (RuntimeException rte) {
View Full Code Here

    public void testRenderXMLGetXsltUriThrowsPortalException() throws ParserConfigurationException {
        PortalException portalException = new PortalException();
       
        MockXSLTChannel mock = new MockXSLTChannel();
        mock.setStaticData(new ChannelStaticData());
        mock.setRuntimeData(new ChannelRuntimeData());
        Document blankDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        mock.setDocument(blankDoc);
        mock.setThrownFromGetXsltUri(portalException);
       
        try {
View Full Code Here

    public void testRenderXMLGetStylesheetParamsThrowsSqlException() throws ParserConfigurationException {
        SQLException sqlException = new SQLException();
       
        MockXSLTChannel mock = new MockXSLTChannel();
        mock.setStaticData(new ChannelStaticData());
        mock.setRuntimeData(new ChannelRuntimeData());
        Document blankDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        mock.setDocument(blankDoc);
        mock.setXsltUriString("anxslt.xsl");
        mock.setThrownFromGetStylesheetParams(sqlException);
       
View Full Code Here

    public void testSetStaticData() {
        this.cThrower.setStaticData(new ChannelStaticData());
    }

    public void testSetRuntimeData() {
        this.cThrower.setRuntimeData(new ChannelRuntimeData());
    }
View Full Code Here

        // create Http Connection
        HttpURLConnection conn =  new MockHttpConn();
       
        // create runtime data
        ChannelRuntimeData rd = new ChannelRuntimeData();
       
        // call method to test
        context.sendLocalData(conn,rd);

        // verify that request property was set right
View Full Code Here

   */
  public void renderXML (ContentHandler out, String uid) throws PortalException
  {
    ChannelState channelState = (ChannelState)channelStateMap.get(uid);
    ChannelStaticData staticData = channelState.getStaticData();
    ChannelRuntimeData runtimeData = channelState.getRuntimeData();

    // Get the static data
    String sImageUri = staticData.getParameter ("img-uri");
    String sImageWidth = staticData.getParameter ("img-width");
    String sImageHeight = staticData.getParameter ("img-height");
    String sImageBorder = staticData.getParameter ("img-border");
    String sImageLink = staticData.getParameter ("img-link");
    String sCaption = staticData.getParameter ("caption");
    String sSubCaption = staticData.getParameter ("subcaption");

    Document doc = null;
    try {
      doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    } catch (ParserConfigurationException pce) {
      log.error("Error getting a Document", pce);
      throw new GeneralRenderingException(pce);
    }

    // Create XML doc
    Element contentE = doc.createElement("content");

    // Add image tag src, width, height, border, and link
    Element imageE = doc.createElement("image");
    imageE.setAttribute("src", sImageUri);
    if (exists(sImageWidth))
      imageE.setAttribute("width", sImageWidth);
    if (exists(sImageWidth))
      imageE.setAttribute("height", sImageHeight);
    if (exists(sImageWidth))
      imageE.setAttribute("border", sImageBorder);
    if (exists(sImageWidth))
      imageE.setAttribute("link", sImageLink);
    contentE.appendChild(imageE);

    // Add a caption if it is specified
    if (exists(sCaption)) {
      Element captionE = doc.createElement("caption");
      captionE.appendChild(doc.createTextNode(sCaption));
      contentE.appendChild(captionE);
    }

    // Add a subcaption if it is specified
    if (exists(sSubCaption)) {
      Element subcaptionE = doc.createElement("subcaption");
      subcaptionE.appendChild(doc.createTextNode(sSubCaption));
      contentE.appendChild(subcaptionE);
    }

    doc.appendChild(contentE);

    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setXML(doc);
    xslt.setXSL(sslLocation, runtimeData.getBrowserInfo());
    xslt.setTarget(out);
    xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
    xslt.transform();
  }
View Full Code Here

TOP

Related Classes of org.jasig.portal.ChannelRuntimeData

Copyright © 2018 www.massapicom. 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.