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/newsletter/business/NewsLetterDAO.java 255
fr/paris/lutece/plugins/newsletter/business/NewsLetterDAO.java 312
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_ALL, plugin );
        daoUtil.executeQuery( );

        ArrayList<NewsLetter> list = new ArrayList<NewsLetter>( );

        while ( daoUtil.next( ) )
        {
            int nIndex = 1;
            NewsLetter newsLetter = new NewsLetter( );
            newsLetter.setId( daoUtil.getInt( nIndex++ ) );
            newsLetter.setName( daoUtil.getString( nIndex++ ) );
            newsLetter.setDescription( daoUtil.getString( nIndex++ ) );
            newsLetter.setDateLastSending( daoUtil.getTimestamp( nIndex++ ) );
            newsLetter.setHtml( daoUtil.getString( nIndex++ ) );
            newsLetter.setNewsLetterTemplateId( daoUtil.getInt( nIndex++ ) );
            newsLetter.setWorkgroup( daoUtil.getString( nIndex++ ) );
            newsLetter.setTestRecipients( daoUtil.getString( nIndex++ ) );
            newsLetter.setNewsletterSenderMail( daoUtil.getString( nIndex++ ) );
            newsLetter.setNewsletterSenderName( daoUtil.getString( nIndex++ ) );
            newsLetter.setTestSubject( daoUtil.getString( nIndex++ ) );
            newsLetter.setNbSections( daoUtil.getInt( nIndex ) );
            list.add( newsLetter );
        }

        daoUtil.free( );

        return list;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ReferenceList selectAllId( Plugin plugin )
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/NewsLetterDAO.java 90
fr/paris/lutece/plugins/newsletter/business/NewsLetterDAO.java 163
        daoUtil.setString( nIndex++, newsLetter.getName( ) );
        daoUtil.setString( nIndex++, newsLetter.getDescription( ) );
        daoUtil.setTimestamp( nIndex++, newsLetter.getDateLastSending( ) );
        daoUtil.setString( nIndex++, newsLetter.getHtml( ) );
        daoUtil.setInt( nIndex++, newsLetter.getNewsLetterTemplateId( ) );
        daoUtil.setString( nIndex++, newsLetter.getWorkgroup( ) );
        daoUtil.setString( nIndex++, newsLetter.getUnsubscribe( ) );
        daoUtil.setString( nIndex++, newsLetter.getNewsletterSenderMail( ) );
        daoUtil.setString( nIndex++, newsLetter.getNewsletterSenderName( ) );
        daoUtil.setString( nIndex++, newsLetter.getTestRecipients( ) );
        daoUtil.setString( nIndex++, newsLetter.getTestSubject( ) );
        daoUtil.setInt( nIndex, newsLetter.getNbSections( ) );
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/SubscriberDAO.java 291
fr/paris/lutece/plugins/newsletter/business/SubscriberDAO.java 335
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_SUBSCRIBERS, plugin );

        daoUtil.setInt( 1, nNewsLetterId );
        daoUtil.setString( 2, "%" + strSearchString + "%" );
        daoUtil.setInt( 3, nEnd );
        daoUtil.setInt( 4, nBegin );

        daoUtil.executeQuery( );

        ArrayList<Subscriber> list = new ArrayList<Subscriber>( );

        while ( daoUtil.next( ) )
        {
            Subscriber subscriber = new Subscriber( );
            subscriber.setId( daoUtil.getInt( 1 ) );
            subscriber.setEmail( daoUtil.getString( 2 ) );
            subscriber.setConfirmed( daoUtil.getBoolean( 3 ) );
            subscriber.setDateSubscription( daoUtil.getTimestamp( 4 ) );

            list.add( subscriber );
        }

        daoUtil.free( );

        return list;
    }

    /**
     * loads the list of subscribers for a newsletter
     *
     * @param nNewsLetterId
     *            the newsletter identifier
     * @param strSearchString
     *            gets all the subscribers if null or empty and gets the subscribers whith an email containing this string otherwise
     * @param nBegin
     *            the rank of the first subscriber to return
     * @param nEnd
     *            the maximum number of suscribers to return
     * @param plugin
     *            the Plugin
     * @return a collection of subscribers
     */
    public Collection<Subscriber> selectSubscribersForSending( int nNewsLetterId, String strSearchString, int nBegin, int nEnd, Plugin plugin )
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 70
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 271
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_ALL, plugin );
        daoUtil.executeQuery( );

        ArrayList<NewsLetterTemplate> list = new ArrayList<NewsLetterTemplate>( );

        while ( daoUtil.next( ) )
        {
            NewsLetterTemplate template = new NewsLetterTemplate( );

            template.setId( daoUtil.getInt( 1 ) );
            template.setDescription( daoUtil.getString( 2 ) );
            template.setFileKey( daoUtil.getString( 3 ) );
            template.setPictureKey( daoUtil.getString( 4 ) );
            template.setWorkgroup( daoUtil.getString( 5 ) );
            template.setTopicType( daoUtil.getString( 6 ) );
            template.setSectionNumber( daoUtil.getInt( 7 ) );

            list.add( template );
        }

        daoUtil.free( );

        return list;
    }
Fichier Ligne
fr/paris/lutece/plugins/newsletter/web/NewsletterTemplateJspBean.java 362
fr/paris/lutece/plugins/newsletter/web/NewsletterTemplateJspBean.java 594
        try
        {
            // create the multipart request
            if ( request instanceof MultipartHttpServletRequest )
            {
                MultipartHttpServletRequest multi = (MultipartHttpServletRequest) request;

                // creation of the NewsLetterTemplate
                NewsLetterTemplate newsletterTemplate = NewsLetterTemplateHome
                        .findByPrimaryKey( Integer.parseInt( multi.getParameter( NewsLetterConstants.PARAMETER_NEWSLETTER_TEMPLATE_ID ) ), getPlugin( ) );

                // Workgroup & RBAC permissions
                if ( !AdminWorkgroupService.isAuthorized( newsletterTemplate, getUser( ) ) || !RBACService.isAuthorized( NewsLetterTemplate.RESOURCE_TYPE,
                        Integer.toString( newsletterTemplate.getId( ) ), NewsletterTemplateResourceIdService.PERMISSION_MODIFY, getUser( ) ) )
                {
                    return AdminMessageService.getMessageUrl( request, Messages.USER_ACCESS_DENIED, AdminMessage.TYPE_ERROR );
                }

                // Mandatory fields
                String strType = multi.getParameter( NewsLetterConstants.PARAMETER_NEWSLETTER_TEMPLATE_TYPE );
                String strDescription = multi.getParameter( NewsLetterConstants.PARAMETER_NEWSLETTER_TEMPLATE_NAME );
                String strWorkgroup = multi.getParameter( NewsLetterConstants.PARAMETER_NEWSLETTER_TEMPLATE_WORKGROUP );
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 73
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 134
        ArrayList<NewsLetterTemplate> list = new ArrayList<NewsLetterTemplate>( );

        while ( daoUtil.next( ) )
        {
            NewsLetterTemplate template = new NewsLetterTemplate( );

            template.setId( daoUtil.getInt( 1 ) );
            template.setDescription( daoUtil.getString( 2 ) );
            template.setFileKey( daoUtil.getString( 3 ) );
            template.setPictureKey( daoUtil.getString( 4 ) );
            template.setWorkgroup( daoUtil.getString( 5 ) );
            template.setTopicType( daoUtil.getString( 6 ) );
            template.setSectionNumber( daoUtil.getInt( 7 ) );

            list.add( template );
        }

        daoUtil.free( );

        return list;
    }

    ///////////////////////////////////////////////////////////////////////////////////////
    // Access methods to data

    /**
     * {@inheritDoc}
     */
    @Override
    public ReferenceList selectTemplatesListByType( String strTopicType, Plugin plugin )
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 134
fr/paris/lutece/plugins/newsletter/business/NewsLetterTemplateDAO.java 274
        List<NewsLetterTemplate> list = new ArrayList<NewsLetterTemplate>( );

        while ( daoUtil.next( ) )
        {
            NewsLetterTemplate template = new NewsLetterTemplate( );

            template.setId( daoUtil.getInt( 1 ) );
            template.setDescription( daoUtil.getString( 2 ) );
            template.setFileKey( daoUtil.getString( 3 ) );
            template.setPictureKey( daoUtil.getString( 4 ) );
            template.setWorkgroup( daoUtil.getString( 5 ) );
            template.setTopicType( daoUtil.getString( 6 ) );
            template.setSectionNumber( daoUtil.getInt( 7 ) );

            list.add( template );
        }

        daoUtil.free( );

        return list;
    }
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/SendingNewsLetterDAO.java 150
fr/paris/lutece/plugins/newsletter/business/SubscriberDAO.java 128
    }

    /**
     * Check the unicity of a primary key
     * 
     * @param nKey
     *            the identifier to check
     * @param plugin
     *            the Plugin
     * @return true if the identifier exist and false if not
     */
    boolean checkPrimaryKey( int nKey, Plugin plugin )
    {
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_CHECK_PRIMARY_KEY, plugin );
        daoUtil.setInt( 1, nKey );
        daoUtil.executeQuery( );

        if ( !daoUtil.next( ) )
        {
            daoUtil.free( );

            return false;
        }

        daoUtil.free( );

        return true;
    }

    /**
     * Generate a new primary key to add a new sending
     * 
     * @param plugin
     *            the Plugin
     * @return the primary key
     */
    int newPrimaryKey( Plugin plugin )
    {
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_NEW_PRIMARY_KEY, plugin );
        int nKey;

        daoUtil.executeQuery( );

        if ( !daoUtil.next( ) )
        {
            // If the table is empty
            nKey = 1;
        }

        nKey = daoUtil.getInt( 1 ) + 1;

        daoUtil.free( );

        return nKey;
    }

    /**
     * Returns the last sending performed for the newsletter of given id
     * 
     * @param newsletterId
     *            the newsletter id for wich we need the last sending
     * @param plugin
     *            the plugin
     * @return the last sending for the given newsletter id - null if no sending found
     */
    public SendingNewsLetter selectLastSendingForNewsletterId( int newsletterId, Plugin plugin )
Fichier Ligne
fr/paris/lutece/plugins/newsletter/business/topic/NewsletterTopicDao.java 140
fr/paris/lutece/plugins/newsletter/business/topic/NewsletterTopicDao.java 181
        daoUtil.setInt( 1, nIdNewsletter );
        daoUtil.executeQuery( );
        while ( daoUtil.next( ) )
        {
            int nIndex = 1;
            NewsletterTopic topic = new NewsletterTopic( );
            topic.setId( daoUtil.getInt( nIndex++ ) );
            topic.setIdNewsletter( daoUtil.getInt( nIndex++ ) );
            topic.setTopicTypeCode( daoUtil.getString( nIndex++ ) );
            topic.setTitle( daoUtil.getString( nIndex++ ) );
            topic.setOrder( daoUtil.getInt( nIndex++ ) );
            topic.setSection( daoUtil.getInt( nIndex ) );
            listNewsletterTopics.add( topic );
        }
        daoUtil.free( );
        return listNewsletterTopics;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void updateNewsletterTopicOrder( int nIdNewsletterTopic, int nNewOrder, Plugin plugin )