private List<CmsWorkplaceView> initWorkplaceViews(CmsObject cms) {

        List<CmsResource> viewFolders;
        try {
            // get the subfolders of the "views" folder
            viewFolders = cms.getSubFolders(CmsWorkplace.VFS_PATH_VIEWS);
        } catch (CmsException e) {
            if ((OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) && LOG.isInfoEnabled()) {
                LOG.info(
                    Messages.get().getBundle().key(Messages.LOG_WORKPLACE_INIT_NO_VIEWS_1, CmsWorkplace.VFS_PATH_VIEWS),
                    e);
            }
            // can not throw exception here since then OpenCms would not even start in shell mode (runlevel 2)
            viewFolders = new ArrayList<CmsResource>();
        }
        m_views = new ArrayList<CmsWorkplaceView>(viewFolders.size());
        for (int i = 0; i < viewFolders.size(); i++) {
            // loop through all view folders
            CmsFolder folder = (CmsFolder)viewFolders.get(i);
            String folderPath = cms.getSitePath(folder);
            try {
                // get view information from folder properties
                String order = cms.readPropertyObject(
                    folderPath,
                    CmsPropertyDefinition.PROPERTY_NAVPOS,
                    false).getValue();
                String key = cms.readPropertyObject(
                    folderPath,
                    CmsPropertyDefinition.PROPERTY_NAVTEXT,
                    false).getValue();
                String viewUri = cms.readPropertyObject(
                    folderPath,
                    CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
                    false).getValue();
                if (viewUri == null) {
                    // no view URI found
                    viewUri = folderPath;
                } else if (!viewUri.startsWith("/")) {
                    // default file is in current view folder, create absolute path to view URI
                    viewUri = folderPath + viewUri;
                }
                if (order == null) {
                    // no valid NavPos property value found, use loop count as order value
                    order = "" + i;
                }
                Float orderValue;
                try {
                    // create Float order object
                    orderValue = Float.valueOf(order);
                } catch (NumberFormatException e) {
                    // String was not formatted correctly, use loop counter
                    orderValue = Float.valueOf(i);
                }
                if (key == null) {
                    // no language key found, use default String to avoid NullPointerException
                    key = "View " + i;
                    // if no navtext is given do not display the view
                    continue;
                }
                // create new view object
                CmsWorkplaceView view = new CmsWorkplaceView(key, viewUri, orderValue);
                m_views.add(view);
                // log the view
                if (CmsLog.INIT.isInfoEnabled()) {
                    CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_VIEW_1, view.getUri()));
                }
            } catch (CmsException e) {
                // should usually never happen
                LOG.error(Messages.get().getBundle().key(Messages.LOG_READING_VIEW_FOLDER_FAILED_1, folderPath), e);
            }
        }
        // sort the views by their order number
        Collections.sort(m_views);
        return m_views;
    }
private List < CmsWorkplaceView > initWorkplaceViews ( CmsObject cms ) { List < CmsResource > viewFolders ; try { viewFolders = cms . getSubFolders ( CmsWorkplace . VFS_PATH_VIEWS ) ; } catch ( CmsException e ) { if ( ( OpenCms . getRunLevel ( ) > OpenCms . RUNLEVEL_2_INITIALIZING ) && LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_WORKPLACE_INIT_NO_VIEWS_1 , CmsWorkplace . VFS_PATH_VIEWS ) , e ) ; } viewFolders = new ArrayList < CmsResource > ( ) ; } m_views = new ArrayList < CmsWorkplaceView > ( viewFolders . size ( ) ) ; for ( int i = 0 ; i < viewFolders . size ( ) ; i ++ ) { CmsFolder folder = ( CmsFolder ) viewFolders . get ( i ) ; String folderPath = cms . getSitePath ( folder ) ; try { String order = cms . readPropertyObject ( folderPath , CmsPropertyDefinition . PROPERTY_NAVPOS , false ) . getValue ( ) ; String key = cms . readPropertyObject ( folderPath , CmsPropertyDefinition . PROPERTY_NAVTEXT , false ) . getValue ( ) ; String viewUri = cms . readPropertyObject ( folderPath , CmsPropertyDefinition . PROPERTY_DEFAULT_FILE , false ) . getValue ( ) ; if ( viewUri == null ) { viewUri = folderPath ; } else if ( ! viewUri . startsWith ( "/" ) ) { viewUri = folderPath + viewUri ; } if ( order == null ) { order = "" + i ; } Float orderValue ; try { orderValue = Float . valueOf ( order ) ; } catch ( NumberFormatException e ) { orderValue = Float . valueOf ( i ) ; } if ( key == null ) { key = "View " + i ; continue ; } CmsWorkplaceView view = new CmsWorkplaceView ( key , viewUri , orderValue ) ; m_views . add ( view ) ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_WORKPLACE_VIEW_1 , view . getUri ( ) ) ) ; } } catch ( CmsException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_READING_VIEW_FOLDER_FAILED_1 , folderPath ) , e ) ; } } Collections . sort ( m_views ) ; return m_views ; }
Initializes the available workplace views.<p>

Currently, this is defined by iterating the subfolder of the folder
<code>/system/workplace/views/</code>.
These subfolders must have the properties NavPos, NavText and default-file set.<p>

@param cms an OpenCms context object that must have been initialized with "Admin" permissions
@return the available workplace views