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/broadcastproxy/business/providers/dolist/DolistHttpAccess.java 111
fr/paris/lutece/plugins/broadcastproxy/business/providers/dolist/DolistHttpAccess.java 166
        HttpPost method = new HttpPost( strUrl );

        try
        {
            // Add headershttpPost
            if ( headers != null )
            {
                for ( String headerType : headers.keySet( ) )
                {
                    method.setHeader( headerType, headers.get( headerType ) );
                }
            }

            StringEntity entity = new StringEntity( jsonParams );
            method.setEntity( entity );

            // add proxy
            if( StringUtils.isNotEmpty( PROXY_ADR ) )
            {
                HttpHost proxy = new HttpHost( PROXY_ADR, PROXY_PORT );
                RequestConfig config = RequestConfig.custom( ).setProxy( proxy ).build( );
                method.setConfig( config );
            }
            httpResponse = client.execute( method );

            // If error
            if ( httpResponse != null && httpResponse.getStatusLine( ).getStatusCode( ) < 200 
            		&& httpResponse.getStatusLine( ).getStatusCode( ) >= 300 )
            {
                AppLogService.error( "Returned Dolist error code : " + httpResponse.getStatusLine( ).getStatusCode( ) );
            }

            // Get response in String
            strResponse = httpToStrResponse( httpResponse );
        }
        catch( IOException e )
        {
            String strError = "HttpPost - Error connecting to '" + strUrl + "' : ";
File Line
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 99
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 295
	        daoUtil.setInt( 1 , nKey );
	        daoUtil.executeQuery( );
	        SubscriptionLink subscriptionLink = null;
	
	        if ( daoUtil.next( ) )
	        {
	            subscriptionLink = new SubscriptionLink();
	            int nIndex = 1;
	            
	            subscriptionLink.setId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setLabel( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setPictogramme( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setDescription( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setFrequency( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setGroup( daoUtil.getString( nIndex++ ) );
	            subscriptionLink.setGroupId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setSubscriptionId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setInterestId( daoUtil.getInt( nIndex++ ) );
	            subscriptionLink.setEnabled( daoUtil.getBoolean( nIndex ) );
	        }
	
	        return Optional.ofNullable( subscriptionLink );
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void delete( int nKey, Plugin plugin )
File Line
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 171
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 262
	        daoUtil.executeQuery(  );
	
	        while ( daoUtil.next(  ) )
	        {
	            SubscriptionLink subscriptionLink = new SubscriptionLink(  );
	            int nIndex = 1;
	            
	            subscriptionLink.setId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setLabel( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setPictogramme( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setDescription( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setFrequency( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setGroup( daoUtil.getString( nIndex++ ) );
                subscriptionLink.setGroupId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setSubscriptionId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setInterestId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setEnabled( daoUtil.getBoolean( nIndex ) );
			    
	            subscriptionLinkList.add( subscriptionLink );
	        }
File Line
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 105
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 175
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 265
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 301
	            subscriptionLink = new SubscriptionLink();
	            int nIndex = 1;
	            
	            subscriptionLink.setId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setLabel( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setPictogramme( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setDescription( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setFrequency( daoUtil.getString( nIndex++ ) );
			    subscriptionLink.setGroup( daoUtil.getString( nIndex++ ) );
	            subscriptionLink.setGroupId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setSubscriptionId( daoUtil.getInt( nIndex++ ) );
			    subscriptionLink.setInterestId( daoUtil.getInt( nIndex++ ) );
	            subscriptionLink.setEnabled( daoUtil.getBoolean( nIndex ) );
File Line
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 69
fr/paris/lutece/plugins/broadcastproxy/business/SubscriptionLinkDAO.java 143
        try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, Statement.RETURN_GENERATED_KEYS, plugin ) )
        {
            int nIndex = 1;
            daoUtil.setString( nIndex++ , subscriptionLink.getLabel( ) );
            daoUtil.setString( nIndex++ , subscriptionLink.getPictogramme( ) );
            daoUtil.setString( nIndex++ , subscriptionLink.getDescription( ) );
            daoUtil.setString( nIndex++ , subscriptionLink.getFrequency( ) );
            daoUtil.setString( nIndex++ , subscriptionLink.getGroup( ) );
            daoUtil.setInt( nIndex++ , subscriptionLink.getGroupId( ) );
            daoUtil.setInt( nIndex++ , subscriptionLink.getSubscriptionId( ) );
            daoUtil.setInt( nIndex++ , subscriptionLink.getInterestId( ) );
            daoUtil.setBoolean( nIndex++, subscriptionLink.isEnabled( ) );
            
            daoUtil.executeUpdate( );
File Line
fr/paris/lutece/plugins/broadcastproxy/business/providers/dolist/DolistProvider.java 280
fr/paris/lutece/plugins/broadcastproxy/business/providers/dolist/DolistProvider.java 357
        ObjectMapper mapper = new ObjectMapper( );

        String subscriptionsInJson = _dolistAPI.getAllSubscriptions( DolistConstants.TYPE_SUBSCRIPTION, strAccountId );
        String interestsInJson = _dolistAPI.getAllSubscriptions( DolistConstants.TYPE_INTEREST, strAccountId );

        try
        {
            // Get subscriptions data (id and name)
            JsonNode nodes = mapper.readTree( subscriptionsInJson );

            JsonNode itemListNode = nodes.get( JSON_NODE_ITEMLIST );

            for ( JsonNode node : itemListNode )
            {
                if ( node.get( "IsEnabled" ).asBoolean( ) )
                {
                    _subscriptionsMapIdName.put( node.get( "ID" ).asText( ), node.get( JSON_NODE_SUB_NAME ).asText( ) );
                }
            }

            // Get interests data (id and name)
            nodes = null;