Fork me on GitHub

Résultats CPD

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

Duplicatas

Fichier Ligne
fr/paris/lutece/plugins/directory/modules/gismap/web/portlet/GismapDirectoryPortletJspBean.java 244
fr/paris/lutece/plugins/directory/modules/gismap/web/portlet/GismapDirectoryPortletJspBean.java 349
        GismapDirectoryPortlet portlet = new GismapDirectoryPortlet( );
        String strPageId = request.getParameter( PARAMETER_PAGE_ID );        
        
        //String strView = AppPropertiesService.getProperty( GismapDirectoryPortlet.GISMAP_DEFAULT_VIEW_PROPERTIES );
        String strView = request.getParameter( PARAMETER_MAP_VIEW_ID );
        
        int nPageId = -1;
        int nView = -1;
        List<DirectoryGismapSourceQuery> listDirectoryGismapSource = new ArrayList<DirectoryGismapSourceQuery>( );

        // get portlet common attributes
        String strErrorUrl = setPortletCommonData( request, portlet );

        
        if ( ( strErrorUrl == null ) && ( StringUtils.isEmpty( strView ) ) )
        {
            strErrorUrl = AdminMessageService.getMessageUrl( request, MESSAGE_YOU_MUST_ENTER_VIEW, AdminMessage.TYPE_STOP );
        }

        if ( strErrorUrl != null )
        {
            return strErrorUrl;
        }

        try
        {
            nPageId = Integer.parseInt( strPageId );
            nView = Integer.parseInt( strView );
        } catch ( NumberFormatException ne )
        {
            AppLogService.error( ne );
        }
        
        /*
        if (!CheckGeolocationParams( nDirectoryId ) )
        {
        	return AdminMessageService.getMessageUrl( request, MESSAGE_DIRECTORY_GEOLOCATION_MISCONFIG, AdminMessage.TYPE_STOP );
        }
        */
        
        portlet.setPageId( nPageId );
        //portlet.setDirectoryId( nDirectoryId );
        portlet.setView(nView);

        
        String strMaxLayerGeojson = AppPropertiesService.getProperty( GismapDirectoryPortlet.MAX_LAYER_GEOJSON_PROPERTY, "1" );
        int nMaxLayerGeojson = Integer.parseInt( strMaxLayerGeojson );
        
        for (int i =0; i<=nMaxLayerGeojson; i++ )
        {  
        	String directoryMapSourceToAdd = request.getParameter( PARAMETER_GEOJSON + String.valueOf( i ) );
	        if ( StringUtils.isNotEmpty( directoryMapSourceToAdd ) && !directoryMapSourceToAdd.equals( "0" ) )
	        {
	        	try
	        	{
	        	String strDirectoryId = directoryMapSourceToAdd.split("-")[0];
	        	int nDirectoryId = Integer.parseInt( strDirectoryId );
	        	String strGeolocationEntryId = directoryMapSourceToAdd.split("-")[1];
	        	int nGeolocationEntryId = Integer.parseInt( strGeolocationEntryId );
	        	
	        	DirectoryGismapSourceQuery directoryGismapSource = new DirectoryGismapSourceQuery( );
	        	directoryGismapSource.setIdDirectory( nDirectoryId );
	        	directoryGismapSource.setIdGeolocationEntry( nGeolocationEntryId );
	        	directoryGismapSource.setGeoJsonIndex( i );
	        	
	        	listDirectoryGismapSource.add( directoryGismapSource );
	        	}
	        	catch (NumberFormatException e)
	        	{
	        		AppLogService.error("An error occured while reading geojson"+i+" source parameters in GismapDirectoryPortlet creation.", e);
	        	}
	        }
        }
        
        portlet.setListMapSource( listDirectoryGismapSource );