Package org.jasig.portal

Examples of org.jasig.portal.StructureStylesheetDescription


    @Override
    public StructureStylesheetDescription getStructureStylesheetDescription(
            int stylesheetId) throws Exception
    {
        // See if it's in the cache
        StructureStylesheetDescription ssd = null;
        ssd = (StructureStylesheetDescription) ssdCache.get(new Integer(
                stylesheetId));

        if (ssd != null)
            return ssd;
View Full Code Here


    private StructureStylesheetUserPreferences _getStructureStylesheetUserPreferences (IPerson person, int profileId, int stylesheetId) throws Exception {
        int userId = person.getID();
        StructureStylesheetUserPreferences ssup;
       
        // get stylesheet description
        StructureStylesheetDescription ssd = getStructureStylesheetDescription(stylesheetId);
       
        Connection con = RDBMServices.getConnection();
        try {
            int origId;
            int origProfileId;
            String sQuery = "SELECT USER_DFLT_USR_ID FROM UP_USER WHERE USER_ID = ?";
            final PreparedStatement pstmt1 = con.prepareStatement(sQuery);
            try {
                // now look to see if this user has a layout or not. This is
                // important because preference values are stored by layout
                // element and if the user doesn't have a layout yet then the
                // default user's preferences need to be loaded.
                int layoutId = this.getLayoutID(userId, profileId);

                // if no layout then get the default user id for this user

                origId = userId;
                origProfileId = profileId;
                if (layoutId == 0) {
                   
                    pstmt1.setInt(1,userId);
                    if (LOG.isDebugEnabled())
                        LOG.debug(sQuery + " VALUE " + userId);
                    final ResultSet rs = pstmt1.executeQuery();
                    try {
                        rs.next();
                        userId = rs.getInt(1);
                       
                        // get the profile ID for the default user
                        UserProfile profile = getUserProfileById(person, profileId);
                    IPerson defaultProfilePerson = new PersonImpl();
                    defaultProfilePerson.setID(userId);
                        profileId = getUserProfileByFname(defaultProfilePerson, profile.getProfileFname()).getProfileId();

                    } finally {
                        close(rs);
                    }
                }
            } finally {
                close(pstmt1);
            }

            // create the stylesheet user prefs object then fill
            // it with defaults from the stylesheet definition object

            ssup = new StructureStylesheetUserPreferences();
            ssup.setStylesheetId(stylesheetId);

            // fill stylesheet description with defaults
            for (Enumeration e = ssd.getStylesheetParameterNames(); e.hasMoreElements();) {
                String pName = (String)e.nextElement();
                ssup.putParameterValue(pName, ssd.getStylesheetParameterDefaultValue(pName));
            }
            for (Enumeration e = ssd.getChannelAttributeNames(); e.hasMoreElements();) {
                String pName = (String)e.nextElement();
                ssup.addChannelAttribute(pName, ssd.getChannelAttributeDefaultValue(pName));
            }
            for (Enumeration e = ssd.getFolderAttributeNames(); e.hasMoreElements();) {
                String pName = (String)e.nextElement();
                ssup.addFolderAttribute(pName, ssd.getFolderAttributeDefaultValue(pName));
            }

            // Now load in the stylesheet parameter preferences
            // from the up_ss_user_param but only if they are defined
            // parameters in the stylesheet's .sdf file.
            //
            // First, get the parameters for the effective user ID,
            // then for the original user ID.  These will differ if
            // the user has no layout in the database and is using
            // the default user layout.  The params from the original
            // user ID take precedence.

            String pstmtQuery =
                "SELECT PARAM_NAME, PARAM_VAL " +
                "FROM UP_SS_USER_PARM " +
                "WHERE USER_ID=?" +
                " AND PROFILE_ID=?"+
                " AND SS_ID=?" +
                " AND SS_TYPE=1";

            final PreparedStatement pstmt2 = con.prepareStatement(pstmtQuery);

            try {
                pstmt2.setInt(1, userId);
                pstmt2.setInt(2,profileId);
                pstmt2.setInt(3,stylesheetId);
                final ResultSet rs1 = pstmt2.executeQuery();
                try {
                    while (rs1.next()) {
                        String pName = rs1.getString(1);
                        if (ssd.containsParameterName(pName))
                            ssup.putParameterValue(pName, rs1.getString(2));
                    }
                }
                finally {
                    close(rs1);
                }

                if (userId != origId) {
                    pstmt2.setInt(1, origId);
                    pstmt2.setInt(2,origProfileId);
                    final ResultSet rs2 = pstmt2.executeQuery();
                    try {
                        while (rs2.next()) {
                            String pName = rs2.getString(1);
                            if (ssd.containsParameterName(pName))
                                ssup.putParameterValue(pName, rs2.getString(2));
                        }
                    }
                    finally {
                        close(rs2);
                    }
                }
            }
            finally {
                close(pstmt2);
            }

           
            Map<Integer, String> originIds = getOriginIds(con, userId, profileId, 1, stylesheetId);

            /*
             * now go get the overridden values and compare them against the
             * map for their origin ids.
             */
                    sQuery = "SELECT PARAM_NAME, PARAM_VAL, PARAM_TYPE," +
            " ULS.STRUCT_ID, CHAN_ID " +
                            "FROM UP_LAYOUT_STRUCT ULS, " +
            " UP_SS_USER_ATTS UUSA " +
                            "WHERE UUSA.USER_ID=?"+
                            " AND PROFILE_ID=?" +
                            " AND SS_ID=?" +
                            " AND SS_TYPE=1" +
                            " AND UUSA.STRUCT_ID = ULS.STRUCT_ID" +
                            " AND UUSA.USER_ID = ULS.USER_ID";

            if (LOG.isDebugEnabled())
                LOG.debug(sQuery + "VALUES ");

            final PreparedStatement pstmt4 = con.prepareStatement(sQuery);
            try {
                pstmt4.setInt(1,userId);
                pstmt4.setInt(2,profileId);
                pstmt4.setInt(3,stylesheetId);
                final ResultSet rs = pstmt4.executeQuery();
                try {
                    while (rs.next()) {
                        // get the LONG column first so Oracle doesn't toss a
                        // java.sql.SQLException: Stream has already been closed
                        String param_val = rs.getString(2);
                        int structId = rs.getInt(4);
                        String originId = null;
                        if (originIds != null)
                            originId = originIds.get(new Integer(structId));

                        int param_type = rs.getInt(3);
                        if (rs.wasNull()) {
                            structId = 0;
                        }
                        String pName = rs.getString(1);
                        int chanId = rs.getInt(5);
                        if (rs.wasNull()) {
                            chanId = 0;
                        }
                        /*
                         * ignore unexpected param_types since persisting
                         * removes all entries in table and it will get resolved
                         * without a log entry to point out the error.
                         */
                        if (param_type == 2) {
                            // folder attribute
                            String folderStructId = null;
                            if ( originId != null )
                                folderStructId = originId;
                            else
                                folderStructId = getStructId(structId,chanId);
                            if (ssd.containsFolderAttribute(pName))
                                ssup.setFolderAttributeValue(folderStructId, pName, param_val);
                        }
                        else if (param_type == 3) {
                            // channel attribute
                            String channelStructId = null;
                            if ( originId != null )
                                channelStructId = originId;
                            else
                                channelStructId = getStructId(structId,chanId);
                            if (ssd.containsChannelAttribute(pName))
                                ssup.setChannelAttributeValue(channelStructId, pName, param_val);
                        }
                    }
                } finally {
                    close(rs);
View Full Code Here

        Document PLF = (Document) person.getAttribute( Constants.PLF );
        if ( PLF == null )
            throw new Exception( "Unable to obtain user's PLF to translate" +
                                 " incorporated ids to plfIds." );
        int stylesheetId = ssup.getStylesheetId();
        StructureStylesheetDescription ssDesc =
            getStructureStylesheetDescription(stylesheetId);

        Connection con = RDBMServices.getConnection();
        try
        {
            // Set autocommit false for the connection
            con.setAutoCommit(false);
            try
            {
                // before writing out params clean out old values
                deleteFromUpSsUserParm(con, userId, profileId, stylesheetId,1);

                // write out params only if specified in stylesheet's .sdf file
                for (Enumeration e = ssup.getParameterValues().keys(); e.hasMoreElements();) {
                    String pName = (String)e.nextElement();
                    if (ssDesc.containsParameterName(pName) &&
                        ! ssDesc.getStylesheetParameterDefaultValue(pName)
                            .equals(ssup.getParameterValue(pName)))
                    {
                        //String pNameEscaped = RDBMServices.sqlEscape(pName);
                        String sQuery = "INSERT INTO UP_SS_USER_PARM (USER_ID,PROFILE_ID,SS_ID,SS_TYPE,PARAM_NAME,PARAM_VAL) VALUES (?,?,?,1,?,?)";
                        final PreparedStatement pstmt2 = con.prepareStatement(sQuery);
                        try {
                            pstmt2.setInt(1,userId);
                            pstmt2.setInt(2,profileId);
                            pstmt2.setInt(3,stylesheetId);
                            pstmt2.setString(4,pName);
                            pstmt2.setString(5,ssup.getParameterValue(pName));
                            if (LOG.isDebugEnabled())
                                LOG.debug(sQuery);
                            pstmt2.executeUpdate();
                        }
                        finally {
                            close(pstmt2);
                        }
                    }
                }

             
                // now before writing out folders and channels clean out old values
                deleteFromUpSsUserAtts(con, userId, profileId, stylesheetId,1);

                // write out folder attributes
                for (Enumeration e = ssup.getFolders(); e.hasMoreElements();) {
                    String folderId = (String)e.nextElement();
                    String plfId = folderId;

                    if ( folderId.startsWith( Constants.FRAGMENT_ID_USER_PREFIX ) ) // icorporated node
                        plfId = getPlfId( PLF, folderId );
                    if ( plfId == null ) {
                        //couldn't translate, skip
                        log.warn("Unable to translate the specified folderId " +
                                "to a folder on the PLF:  " + folderId);
                        continue;
                    }

                    for (Enumeration attre = ssup.getFolderAttributeNames(); attre.hasMoreElements();) {
                        String pName = (String)attre.nextElement();
                        String pValue = ssup.getDefinedFolderAttributeValue(folderId, pName);

                        /*
                         * Persist folder attributes defined in the stylesheet
                         * description only if the user value is non null and
                         * there is no default or the user value
                         * differs from the default.
                         */
                        if (ssDesc.containsFolderAttribute(pName))
                        {
                            String deflt = dssup
                            .getDefaultFolderAttributeValue(folderId, pName);
                            if(pValue != null && (deflt == null ||
                                    ! pValue.equals(deflt)))
                                insertIntoUpSsUserAtts(con, userId,
                                        profileId, stylesheetId, 1,
                                        plfId, 2, pName, pValue);
                        }
                    }
                }
                // write out channel attributes
                for (Enumeration e = ssup.getChannels(); e.hasMoreElements();) {
                    String channelId = (String)e.nextElement();
                    String plfId = channelId;

                    if ( plfId.startsWith( Constants.FRAGMENT_ID_USER_PREFIX ) ) // icorporated node
                        plfId = getPlfId( PLF, channelId );
                    if ( plfId == null ) //couldn't translate, skip
                        continue;

                    for (Enumeration attre = ssup.getChannelAttributeNames(); attre.hasMoreElements();) {
                        String pName = (String)attre.nextElement();
                        String pValue = ssup.getDefinedChannelAttributeValue(channelId, pName);

                        /*
                         * Persist channel attributes defined in the stylesheet
                         * description only if the user value is non null and
                         * there is no default or the user value
                         * differs from the default.
                         */
                        if (ssDesc.containsChannelAttribute(pName))
                        {
                            String deflt = dssup
                            .getDefaultChannelAttributeValue(channelId, pName);
                            if(pValue != null && (deflt == null ||
                                    ! pValue.equals(deflt)))
View Full Code Here

   * @return true if update succeeded, otherwise false
   */
  public boolean updateStructureStylesheetDescription (String stylesheetDescriptionURI, String stylesheetURI, int stylesheetId) {
    try {
      Document stylesheetDescriptionXML = getDOM(stylesheetDescriptionURI);
      StructureStylesheetDescription fssd = new StructureStylesheetDescription();
      String xmlStylesheetName = this.getName(stylesheetDescriptionXML);
      String xmlStylesheetDescriptionText = this.getDescription(stylesheetDescriptionXML);
      fssd.setId(stylesheetId);
      fssd.setStylesheetName(xmlStylesheetName);
      fssd.setStylesheetURI(stylesheetURI);
      fssd.setStylesheetDescriptionURI(stylesheetDescriptionURI);
      fssd.setStylesheetWordDescription(xmlStylesheetDescriptionText);

      // populate parameter and attriute tables
      this.populateParameterTable(stylesheetDescriptionXML, fssd);
      this.populateFolderAttributeTable(stylesheetDescriptionXML, fssd);
      this.populateChannelAttributeTable(stylesheetDescriptionXML, fssd);
View Full Code Here

   */
  public Integer addStructureStylesheetDescription (String stylesheetDescriptionURI, String stylesheetURI) {
    // need to read in the description file to obtain information such as name, word description and media list
    try {
      Document stylesheetDescriptionXML = getDOM(stylesheetDescriptionURI);
      StructureStylesheetDescription fssd = new StructureStylesheetDescription();
      String xmlStylesheetName = this.getName(stylesheetDescriptionXML);
      String xmlStylesheetDescriptionText = this.getDescription(stylesheetDescriptionXML);
      fssd.setStylesheetName(xmlStylesheetName);
      fssd.setStylesheetURI(stylesheetURI);
      fssd.setStylesheetDescriptionURI(stylesheetDescriptionURI);
      fssd.setStylesheetWordDescription(xmlStylesheetDescriptionText);

      // populate parameter and attriute tables
      this.populateParameterTable(stylesheetDescriptionXML, fssd);
      this.populateFolderAttributeTable(stylesheetDescriptionXML, fssd);
      this.populateChannelAttributeTable(stylesheetDescriptionXML, fssd);
View Full Code Here

   * Obtain structure stylesheet description object for a given structure stylesheet id.
   * @param stylesheetId the id of the structure stylesheet
   * @return structure stylesheet description
   */
  public StructureStylesheetDescription getStructureStylesheetDescription (int stylesheetId) throws Exception {
    StructureStylesheetDescription ssd = null;
    Connection con = null;
    try {
      con = RDBMServices.getConnection();
      Statement stmt = con.createStatement();
      int dbOffset = 0;
      String sQuery = "SELECT SS_NAME,SS_URI,SS_DESCRIPTION_URI,SS_DESCRIPTION_TEXT";
      if (this.databaseMetadata.supportsOuterJoins()) {
        sQuery += ",TYPE,PARAM_NAME,PARAM_DEFAULT_VAL,PARAM_DESCRIPT FROM " + this.databaseMetadata.getJoinQuery().getQuery("ss_struct");
        dbOffset = 4;
      } else {
        sQuery += " FROM UP_SS_STRUCT USS WHERE";
      }
      sQuery += " USS.SS_ID=" + stylesheetId;

      if (log.isDebugEnabled())
          log.debug("RDBMUserLayoutStore::getStructureStylesheetDescription(): " + sQuery);
      ResultSet rs = stmt.executeQuery(sQuery);
      try {
        if (rs.next()) {
          ssd = new StructureStylesheetDescription();
          ssd.setId(stylesheetId);
          ssd.setStylesheetName(rs.getString(1));
          ssd.setStylesheetURI(rs.getString(2));
          ssd.setStylesheetDescriptionURI(rs.getString(3));
          ssd.setStylesheetWordDescription(rs.getString(4));
        }

        if (!this.databaseMetadata.supportsOuterJoins()) {
          rs.close();
          // retrieve stylesheet params and attributes
          sQuery = "SELECT TYPE,PARAM_NAME,PARAM_DEFAULT_VAL,PARAM_DESCRIPT FROM UP_SS_STRUCT_PAR WHERE SS_ID=" + stylesheetId;
          if (log.isDebugEnabled())
              log.debug("RDBMUserLayoutStore::getStructureStylesheetDescription(): " + sQuery);
          rs = stmt.executeQuery(sQuery);
        }

        while (true) {
          if (!this.databaseMetadata.supportsOuterJoins() && !rs.next()) {
            break;
          }

          int type = rs.getInt(dbOffset + 1);
          if (rs.wasNull()){
            break;
          }
          if (type == 1) {
            // param
            ssd.addStylesheetParameter(rs.getString(dbOffset + 2), rs.getString(dbOffset + 3), rs.getString(dbOffset + 4));
          }
          else if (type == 2) {
            // folder attribute
            ssd.addFolderAttribute(rs.getString(dbOffset + 2), rs.getString(dbOffset + 3), rs.getString(dbOffset + 4));
          }
          else if (type == 3) {
            // channel attribute
            ssd.addChannelAttribute(rs.getString(dbOffset + 2), rs.getString(dbOffset + 3), rs.getString(dbOffset + 4));
          }
          else {
              if (log.isDebugEnabled())
                  log.debug("RDBMUserLayoutStore::getStructureStylesheetDescription() : encountered param of unknown type! (stylesheetId="
                          + stylesheetId + " param_name=\"" + rs.getString(dbOffset + 2) + "\" type=" + type + ").");
View Full Code Here

        if (log.isDebugEnabled())
            log.debug("RDBMUserLayoutStore::getStructureStylesheetList() : " + sQuery);
        ResultSet rs = stmt.executeQuery(sQuery);
        try {
          while (rs.next()) {
            StructureStylesheetDescription ssd = getStructureStylesheetDescription(rs.getInt("SS_ID"));
            if (ssd != null)
              list.put(new Integer(ssd.getId()), ssd);
          }
        } finally {
          rs.close();
        }
      } finally {
View Full Code Here

              if (log.isDebugEnabled())
                  log.debug("RDBMUserLayoutStore::getStructureStylesheetList() : " + sQuery);
              ResultSet rs = stmt.executeQuery(sQuery);
              try {
                  while (rs.next()) {
                      StructureStylesheetDescription ssd = getStructureStylesheetDescription(rs.getInt("SS_ID"));
                      if (ssd != null)
                          list.put(new Integer(ssd.getId()), ssd);
                  }
              } finally {
                  rs.close();
              }
          } finally {
View Full Code Here

                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();
View Full Code Here

                }
                // verify
                if (isTheme) {
                    ThemeStylesheetDescription tsd = UserLayoutStoreFactory.getUserLayoutStoreImpl().getThemeStylesheetDescription(stylesheetId);
                } else {
                    StructureStylesheetDescription ssd = UserLayoutStoreFactory.getUserLayoutStoreImpl().getStructureStylesheetDescription(stylesheetId);
                }
            } else if (delete) {
                if (isTheme) {
                    ulsdb.removeThemeStylesheetDescription(stylesheetId);
                } else {
                    ulsdb.removeStructureStylesheetDescription(stylesheetId);
                }
            } else {
                Integer id = null;
                if (isTheme) {
                    id = ulsdb.addThemeStylesheetDescription(stylesheetDescriptionURI, stylesheetURI);
                } else {
                    id = ulsdb.addStructureStylesheetDescription(stylesheetDescriptionURI, stylesheetURI);
                }

                if (id == null) {
                    System.out.println("Save failed!");
                    return;
                } else {
                    stylesheetId = id.intValue();
                    System.out.println("Save successfull! The new stylehseet was assigned Id="+id);
                }

                // verify
                if (isTheme) {
                    ThemeStylesheetDescription tsd = UserLayoutStoreFactory.getUserLayoutStoreImpl().getThemeStylesheetDescription(stylesheetId);
                } else {
                    StructureStylesheetDescription ssd = UserLayoutStoreFactory.getUserLayoutStoreImpl().getStructureStylesheetDescription(stylesheetId);
                }
            }

        } catch (Exception e) {
            System.out.println("An error has been encountered:");
View Full Code Here

TOP

Related Classes of org.jasig.portal.StructureStylesheetDescription

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.