Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 6.13.0.

Duplications

File Line
fr/paris/lutece/plugins/grustoragedb/web/AbstractManageDemandTypeJspBean.java 58
fr/paris/lutece/plugins/grustoragedb/web/AbstractManageJspBean.java 53
    public static final String RIGHT_MANAGEDEMANDTYPE = "GRUSTORAGEDB_MANAGEMENT";
    
    // Properties
    private static final String PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE = "grustoragedb.listItems.itemsPerPage";
    
    // Parameters
    private static final String PARAMETER_PAGE_INDEX = "page_index";
    
    // Markers
    private static final String MARK_PAGINATOR = "paginator";
    private static final String MARK_NB_ITEMS_PER_PAGE = "nb_items_per_page";

    //Variables
    private String _strCurrentPageIndex;
    private int _nItemsPerPage;

    /**
     * Return a model that contains the list and paginator infos
     * @param request The HTTP request
     * @param strBookmark The bookmark
     * @param list The list of item
     * @param strManageJsp The JSP
     * @return The model
     */
    protected <T> Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List<S> list,
        String strManageJsp )
    {
        int nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
        _strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
        _nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, nDefaultItemsPerPage );

        UrlItem url = new UrlItem( strManageJsp );
        String strUrl = url.getUrl(  );

        // PAGINATOR
        LocalizedPaginator<S> paginator = new LocalizedPaginator<>( list, _nItemsPerPage, strUrl, PARAMETER_PAGE_INDEX, _strCurrentPageIndex, getLocale(  ) );

        Map<String, Object> model = getModel(  );

        model.put( MARK_NB_ITEMS_PER_PAGE, String.valueOf( _nItemsPerPage ) );
        model.put( MARK_PAGINATOR, paginator );
        model.put( strBookmark, getItemsFromIds ( paginator.getPageItems( ) ) );

        return model;
    }
    
    /**
     * Get Items from Ids list
     * @param <T>
     *
     * @param <S> the generic type of the Ids
     * @param <T> the generic type of the items
     * @param <S>
     * @param listIds
     * @return the populated list of items corresponding to the id List
     */
     abstract  List<T> getItemsFromIds ( List<S> listIds ) ;
}
File Line
fr/paris/lutece/plugins/grustoragedb/web/NotificationEventJspBean.java 84
fr/paris/lutece/plugins/grustoragedb/web/NotificationJspBean.java 117
	    	if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_DEMAND_ID ) ) )
	        {
	    		_currentFilter.setDemandId( request.getParameter( PARAMETER_DEMAND_ID ) );
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) ) )
	        {
	        	_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) );
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_NOTIFICATION_DATE ) ) )
	        {
	            lNotificationDate = Long.parseLong( request.getParameter( PARAMETER_NOTIFICATION_DATE ) );
	        }
	        
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
	        {
	            String strStartDate = request.getParameter( PARAMETER_START_DATE );
	            Date dStartDate = DateUtil.parseIsoDate( strStartDate );
	            if ( dStartDate != null )
	            {
	            	_currentFilter.setStartDate( dStartDate.getTime( ) );
	            }
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
	        {
	            String strEndDate = request.getParameter( PARAMETER_END_DATE );
	            Date dEndDate = DateUtil.parseIsoDate( strEndDate );            
	            if ( dEndDate != null )
	            {
	            	_currentFilter.setEndDate( dEndDate.getTime( ) );
	            }
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_STATUS ) ) )
File Line
fr/paris/lutece/plugins/grustoragedb/web/AbstractManageDemandJspBean.java 81
fr/paris/lutece/plugins/grustoragedb/web/AbstractManageDemandTypeJspBean.java 82
fr/paris/lutece/plugins/grustoragedb/web/AbstractManageJspBean.java 77
    protected Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List<S> list,
        String strManageJsp )
    {
        int nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
        _strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
        _nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, nDefaultItemsPerPage );

        UrlItem url = new UrlItem( strManageJsp );
        String strUrl = url.getUrl(  );

        // PAGINATOR
        LocalizedPaginator<S> paginator = new LocalizedPaginator<>( list, _nItemsPerPage, strUrl, PARAMETER_PAGE_INDEX, _strCurrentPageIndex, getLocale(  ) );

        Map<String, Object> model = getModel( );

        model.put( MARK_NB_ITEMS_PER_PAGE, String.valueOf( _nItemsPerPage ) );
        model.put( MARK_PAGINATOR, paginator );
        model.put( strBookmark, getItemsFromIds ( paginator.getPageItems( ) ) );

        return model;
    }
    
    /**
     * Get Items from Ids list
     * 
     * @param <S> the generic type of the Ids
     * @param <T> the generic type of the items
     * @param listIds
     * @return the populated list of items corresponding to the id List
     */
    abstract  List<T> getItemsFromIds ( List<S> listIds ) ;
}
File Line
fr/paris/lutece/plugins/grustoragedb/business/DemandCategoryDAO.java 211
fr/paris/lutece/plugins/grustoragedb/business/DemandTypeDAO.java 215
fr/paris/lutece/plugins/grustoragedb/business/StatusDAO.java 221
		List<DemandCategory> demandCategoryList = new ArrayList<>(  );
		
		StringBuilder builder = new StringBuilder( );

		if ( !listIds.isEmpty( ) )
		{
			for( int i = 0 ; i < listIds.size(); i++ ) {
			    builder.append( "?," );
			}
	
			String placeHolders =  builder.deleteCharAt( builder.length( ) -1 ).toString( );
			String stmt = SQL_QUERY_SELECTALL_BY_IDS + placeHolders + ")";
			
			
	        try ( DAOUtil daoUtil = new DAOUtil( stmt, plugin ) )
	        {
	        	int index = 1;
				for( Integer n : listIds ) {
					daoUtil.setInt(  index++, n ); 
				}
	        	
	        	daoUtil.executeQuery(  );
	        	while ( daoUtil.next(  ) )
		        {
File Line
fr/paris/lutece/plugins/grustoragedb/web/DemandJspBean.java 118
fr/paris/lutece/plugins/grustoragedb/web/NotificationEventJspBean.java 146
fr/paris/lutece/plugins/grustoragedb/web/NotificationJspBean.java 165
    	Map<String, Object> model = getPaginatedListModel(request, MARK_DEMAND_LIST, _listDemanId, JSP_MANAGE_DEMANDS );
        
        model.put( MARK_DEMAND_TYPE_ID_LIST, _listDemandTypeId );
        if ( !StringUtils.isEmpty( _currentFilter.getDemandId( ) ) )
        {
        	model.put( MARK_DEMAND_ID, _currentFilter.getDemandId( ) );
        }
        if ( !StringUtils.isBlank( _currentFilter.getDemandTypeId( ) ) )
        {
        	model.put( MARK_DEMAND_TYPE_ID, _currentFilter.getDemandTypeId( ) );
        }
        if ( _currentFilter.getStartDate( ) > 0 ) 
        {
        	model.put( MARK_START_DATE, new Date( _currentFilter.getStartDate( ) ) );
        }
        if ( _currentFilter.getEndDate( ) > 0 ) 
        {
        	model.put( MARK_END_DATE, new Date( _currentFilter.getEndDate( ) ) );
        }
        
        return getPage( PROPERTY_PAGE_TITLE_MANAGE_DEMAND, TEMPLATE_MANAGE_DEMAND, model );
File Line
fr/paris/lutece/plugins/grustoragedb/web/DemandJspBean.java 88
fr/paris/lutece/plugins/grustoragedb/web/NotificationJspBean.java 129
	        	_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) );
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
	        {
	            String strStartDate = request.getParameter( PARAMETER_START_DATE );
	            Date dStartDate = DateUtil.parseIsoDate( strStartDate );
	            if ( dStartDate != null )
	            {
	            	_currentFilter.setStartDate( dStartDate.getTime( ) );
	            }
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
	        {
	            String strEndDate = request.getParameter( PARAMETER_END_DATE );
	            Date dEndDate = DateUtil.parseIsoDate( strEndDate );            
	            if ( dEndDate != null )
	            {
	            	_currentFilter.setEndDate( dEndDate.getTime( ) );
	            }
	        }
	        
	        if ( _currentFilter.containsDemandId( ) || _currentFilter.containsDemandTypeId( ) || _currentFilter.containsStartDate( ) || _currentFilter.containsEndDate( ) )
File Line
fr/paris/lutece/plugins/grustoragedb/web/DemandJspBean.java 88
fr/paris/lutece/plugins/grustoragedb/web/NotificationEventJspBean.java 96
	        	_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) );
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
	        {
	            String strStartDate = request.getParameter( PARAMETER_START_DATE );
	            Date dStartDate = DateUtil.parseIsoDate( strStartDate );
	            if ( dStartDate != null )
	            {
	            	_currentFilter.setStartDate( dStartDate.getTime( ) );
	            }
	        }
	        
	        if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
	        {
	            String strEndDate = request.getParameter( PARAMETER_END_DATE );
	            Date dEndDate = DateUtil.parseIsoDate( strEndDate );            
	            if ( dEndDate != null )
	            {
	            	_currentFilter.setEndDate( dEndDate.getTime( ) );
	            }
	        }
	        
	        if ( _currentFilter.containsDemandId( ) || _currentFilter.containsDemandTypeId( ) || _currentFilter.containsStartDate( ) || _currentFilter.containsEndDate( ) )