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/termofservice/business/EntryDAO.java 224
fr/paris/lutece/plugins/termofservice/business/UserAcceptedDAO.java 222
		List<Entry> entryList = 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/termofservice/business/EntryDAO.java 97
fr/paris/lutece/plugins/termofservice/business/EntryDAO.java 272
	        daoUtil.executeQuery( );
	        Entry entry = null;
	
	        if ( daoUtil.next( ) )
	        {
	            entry = new Entry();
	            int nIndex = 1;
	            
	            entry.setId( daoUtil.getInt( nIndex++ ) );
	            entry.setTitle( daoUtil.getString( nIndex++ ) );
			    entry.setText( daoUtil.getString( nIndex++ ) );
			    entry.setVersion( daoUtil.getInt( nIndex++ ) );
			    entry.setPublished( daoUtil.getBoolean( nIndex ) );
	        }
	
	        return Optional.ofNullable( entry );
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void delete( int nKey, Plugin plugin )
File Line
fr/paris/lutece/plugins/termofservice/business/UserAcceptedDAO.java 94
fr/paris/lutece/plugins/termofservice/business/UserAcceptedDAO.java 270
	        daoUtil.setInt( 1 , nKey );
	        daoUtil.executeQuery( );
	        UserAccepted userAccepted = null;
	
	        if ( daoUtil.next( ) )
	        {
	            userAccepted = new UserAccepted();
	            int nIndex = 1;
	            
	            userAccepted.setId( daoUtil.getInt( nIndex++ ) );
			    userAccepted.setGuid( daoUtil.getString( nIndex++ ) );
			    userAccepted.setFkIdEntry( daoUtil.getInt( nIndex++ ) );
			    userAccepted.setDateAccepted( daoUtil.getDate( nIndex++ ) );
			    userAccepted.setVersion( daoUtil.getInt( nIndex ) );
	        }
	
	        return Optional.ofNullable( userAccepted );
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void delete( int nKey, Plugin plugin )
File Line
fr/paris/lutece/plugins/termofservice/business/EntryDAO.java 270
fr/paris/lutece/plugins/termofservice/business/EntryDAO.java 314
		try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_LAST_VERSION, _plugin ) )
        {
	        daoUtil.executeQuery( );
	        Entry entry = null;
	
	        if ( daoUtil.next( ) )
	        {
	            entry = new Entry();
	            int nIndex = 1;
	            
	            entry.setId( daoUtil.getInt( nIndex++ ) );
	            entry.setTitle( daoUtil.getString( nIndex++ ) );
			    entry.setText( daoUtil.getString( nIndex++ ) );
			    entry.setVersion( daoUtil.getInt( nIndex++ ) );
			    entry.setPublished( daoUtil.getBoolean( nIndex ) );
	        }
	
	        return Optional.ofNullable( entry );
        }
	}