Fork me on GitHub

Résultats CPD

Le document suivant contient les résultats de l'inspection CPD CPD 6.13.0.

Duplicatas

Fichier Ligne
fr/paris/lutece/plugins/menus/service/MainTreeMenuAllPagesService.java 114
fr/paris/lutece/plugins/menus/service/MainTreeMenuService.java 133
            _cacheService.putInCache( strCacheKey, root );
        }

        return root;
    }

    /**
     * Define the root tree id of a page
     * 
     * @param nPageId
     *            The page identifier
     * @return The parent page identifier or root tree
     */
    public int getRootParentTree( int nPageId )
    {
        Page page = PageHome.getPage( nPageId );
        int nParentPageId = page.getParentPageId( );

        if ( nParentPageId == 0 )
        {
            return nPageId;
        }

        int nParentTree = nParentPageId;

        int nPageRootId = PortalService.getRootPageId( );

        while ( nParentPageId != nPageRootId )
        {
            nParentTree = nParentPageId;

            Page parentPage = PageHome.getPage( nParentPageId );
            nParentPageId = parentPage.getParentPageId( );
        }

        return nParentTree;
    }

    /**
     * Build the menu tree from nPageId, the number of levels defined by nDepth
     * 
     * @param item
     *            The MenunItem object
     * @param nPageId
     *            The page identifier
     * @param nDepth
     *            The page level
     */
    private void buildMenuTree( MenuItem item, int nPageId, int nDepth )
    {
        if ( nDepth > 0 )
        {
            Collection<Page> listPages = PageHome.getChildPages( nPageId );

            for ( Page page : listPages )
            {
                MenuItem menuItem = new MenuItem( );
                menuItem.setPage( PageHome.findByPrimaryKey( page.getId( ) ) );
                item.addChild( menuItem );
                buildMenuTree( menuItem, page.getId( ), nDepth - 1 );
            }
        }
    }

    /**
     * Get the cacheService
     * 
     * @return the MainTreeMenuAllPagesCacheService
     */
    public MainTreeMenuAllPagesCacheService getCacheService( )
Fichier Ligne
fr/paris/lutece/plugins/menus/web/MainTreeMenuInclude.java 133
fr/paris/lutece/plugins/menus/web/MainTreeMenuIncludeAllPages.java 133
        MenuItem root = MainTreeMenuService.getInstance( ).getMainMenuItems( );

        modelList.put( MARK_MENU, root );
        modelList.put( MARK_ROOT_PAGE_ID, nRootParentTree );
        modelList.put( MARK_CURRENT_PAGE_ID, Integer.toString( nCurrentPageId ) );

        // Define the site path from url, by mode
        modelList.put( MenusService.MARKER_SITE_PATH, MenusService.getInstance( ).getSitePath( nMode ) );

        HtmlTemplate templateList = AppTemplateService.getTemplate( TEMPLATE_MENU_PAGES, locale, modelList );

        return templateList.getHtml( );
    }

    /**
     * Display the list of childpages pages for other levels
     * 
     * @param nCurrentPageId
     *            The current page id
     * @param nMode
     *            The current mode
     * @param request
     *            The HTTP request
     * @return the list of chilpages
     */
    private String getTreePageList( int nCurrentPageId, int nMode, HttpServletRequest request )
    {
        HashMap<String, Object> modelList = new HashMap<String, Object>( );
        Locale locale = null;
        if ( request != null )
        {
            locale = request.getLocale( );
        }

        // Define the root tree for each childpages of root page
        int nRootParentTree = MainTreeMenuService.getInstance( ).getRootParentTree( nCurrentPageId );
Fichier Ligne
fr/paris/lutece/plugins/menus/web/MainTreeMenuInclude.java 86
fr/paris/lutece/plugins/menus/web/MainTreeMenuIncludeAllPages.java 86
    public void fillTemplate( Map<String, Object> rootModel, PageData data, int nMode, HttpServletRequest request )
    {
        if ( request != null )
        {
            int nCurrentPageId;

            /* test parameter name: page_id parameter for a PageContentService, current_page_id for a DocumentContentService */
            String strParameterPageId = ( request.getParameter( PARAMETER_CURRENT_PAGE_ID ) == null ) ? Parameters.PAGE_ID : PARAMETER_CURRENT_PAGE_ID;

            try
            {
                nCurrentPageId = ( request.getParameter( strParameterPageId ) == null ) ? 0 : Integer.parseInt( request.getParameter( strParameterPageId ) );
            }
            catch( NumberFormatException nfe )
            {
                AppLogService.info( "MainMenuInclude.fillTemplate() : " + nfe.getLocalizedMessage( ) );
                nCurrentPageId = 0;
            }

            rootModel.put( MARK_PAGE_MENU_MAIN, getMainPageList( nCurrentPageId, nMode, request ) );