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/participatoryideation/web/ManageIdeationJspBean.java 58
fr/paris/lutece/plugins/participatoryideation/web/ManageProposalLinksJspBean.java 55
    private static final String PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE = "participatoryideation.listItems.itemsPerPage";
    private static final String PARAMETER_PAGE_INDEX = "page_index";
    private static final String MARK_PAGINATOR = "paginator";
    private static final String MARK_NB_ITEMS_PER_PAGE = "nb_items_per_page";

    // Variables
    private int _nDefaultItemsPerPage;
    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 Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List list, String strManageJsp )
    {
        _strCurrentPageIndex = Paginator.getPageIndex( request, Paginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
        _nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
        _nItemsPerPage = Paginator.getItemsPerPage( request, Paginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, _nDefaultItemsPerPage );

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

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

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

        model.put( MARK_NB_ITEMS_PER_PAGE, "" + _nItemsPerPage );
        model.put( MARK_PAGINATOR, paginator );
        model.put( strBookmark, paginator.getPageItems( ) );

        return model;
    }
}
File Line
fr/paris/lutece/plugins/participatoryideation/web/ManageIdeationJspBean.java 64
fr/paris/lutece/plugins/participatoryideation/web/ManageIdeationProposalsJspBean.java 71
fr/paris/lutece/plugins/participatoryideation/web/ManageProposalLinksJspBean.java 61
    private int _nDefaultItemsPerPage;
    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 Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List list, String strManageJsp )
    {
        _strCurrentPageIndex = Paginator.getPageIndex( request, Paginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
        _nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
        _nItemsPerPage = Paginator.getItemsPerPage( request, Paginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, _nDefaultItemsPerPage );

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

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

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

        model.put( MARK_NB_ITEMS_PER_PAGE, "" + _nItemsPerPage );
        model.put( MARK_PAGINATOR, paginator );
        model.put( strBookmark, paginator.getPageItems( ) );
File Line
fr/paris/lutece/plugins/participatoryideation/web/ProposalSubscriberXPage.java 279
fr/paris/lutece/plugins/participatoryideation/web/include/HeaderInclude.java 180
    private Collection<Proposal> getProposalsCommentedByUser( Collection<Comment> listComments )
    {

        Collection<Proposal> proposalsList = new ArrayList<Proposal>( );
        List<Integer> IdExtendableResourceList = new ArrayList<Integer>( );
        for ( Comment comment : listComments )
        {

            String idRessource = comment.getIdExtendableResource( );

            if ( idRessource != null && StringUtils.isNotEmpty( idRessource ) && StringUtils.isNumeric( idRessource ) )
            {
                int nIdProposal = Integer.parseInt( idRessource );
                Proposal proposal = ProposalHome.findByPrimaryKey( nIdProposal );
                if ( proposal != null && ProposalService.getInstance( ).isPublished( proposal ) && !IdExtendableResourceList.contains( nIdProposal ) )
                {
                    proposalsList.add( proposal );
                    IdExtendableResourceList.add( nIdProposal );
                }
            }
        }

        return proposalsList;
    }

    /**
     * get the proposals List
     * 
     * @param listFollow
     * @return
     */
    private Collection<Proposal> getProposalsParticipatedByUser( Collection<ResourceExtenderHistory> listFollow )
File Line
fr/paris/lutece/plugins/participatoryideation/business/notify/TaskNotifyIdeationConfigDAO.java 60
fr/paris/lutece/plugins/participatoryideation/business/notify/TaskNotifyIdeationConfigDAO.java 84
        try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT ) )
        {
            int nPos = 0;

            daoUtil.setInt( ++nPos, config.getIdTask( ) );
            daoUtil.setString( ++nPos, config.getSenderName( ) );
            daoUtil.setString( ++nPos, config.getSenderEmail( ) );
            daoUtil.setString( ++nPos, config.getSubject( ) );
            daoUtil.setString( ++nPos, config.getMessage( ) );
            daoUtil.setString( ++nPos, config.getRecipientsCc( ) );
            daoUtil.setString( ++nPos, config.getRecipientsBcc( ) );
            daoUtil.setBoolean( ++nPos, config.isFollowers( ) );
            daoUtil.setBoolean( ++nPos, config.isSubmitter( ) );

            daoUtil.executeUpdate( );
File Line
fr/paris/lutece/plugins/participatoryideation/service/notify/TaskNotifyIdeation.java 233
fr/paris/lutece/plugins/participatoryideation/service/notify/TaskNotifyIdeation.java 255
                            && subscriberComment.contains( followerHistory.getUserGuid( ) ) )
                    {

                        strNickNameDestinataire = UserPreferencesService.instance( ).getNickname( followerHistory.getUserGuid( ) );
                        model.put( MARK_PSEUDO_DESTINATAIRE, strNickNameDestinataire );

                        strMessage = AppTemplateService
                                .getTemplateFromStringFtl( "[#ftl]\n[#setting date_format=\"dd/MM/yyyy\"]\n" + config.getMessage( ), locale, model ).getHtml( );
                        try
                        {
                            strEmail = UserPreferencesService.instance( ).get( followerHistory.getUserGuid( ), PARAM_BP_EMAIL, StringUtils.EMPTY );

                        }
                        catch( Exception e )
                        {
                            throw new RuntimeException( ERROR_GET_EMAIL, e );
                        }

                        MailService.sendMailHtml( strEmail, strRecipientCc, strRecipientBcc, strSenderName, strSenderEmail, strSubject, strMessage );

                    }
File Line
fr/paris/lutece/plugins/participatoryideation/web/ProposalSubscriberXPage.java 310
fr/paris/lutece/plugins/participatoryideation/web/include/HeaderInclude.java 211
    private Collection<Proposal> getProposalsParticipatedByUser( Collection<ResourceExtenderHistory> listFollow )
    {

        Collection<Proposal> proposalsList = new ArrayList<Proposal>( );
        for ( ResourceExtenderHistory follow : listFollow )
        {

            String idRessource = follow.getIdExtendableResource( );

            if ( idRessource != null && StringUtils.isNotEmpty( idRessource ) && StringUtils.isNumeric( idRessource ) )
            {
                int nIdProposal = Integer.parseInt( idRessource );
                Proposal proposal = ProposalHome.findByPrimaryKey( nIdProposal );
                if ( proposal != null && ProposalService.getInstance( ).isPublished( proposal ) )
                {
                    proposalsList.add( proposal );
                }
            }
        }

        return proposalsList;
    }

}
File Line
fr/paris/lutece/plugins/participatoryideation/web/ProposalJspBean.java 778
fr/paris/lutece/plugins/participatoryideation/web/ProposalJspBean.java 812
    {
        int nIdProposal = Integer.parseInt( request.getParameter( PARAMETER_ID_PROPOSAL ) );

        if ( ( _proposal == null ) || ( _proposal.getId( ) != nIdProposal ) )
        {
            _proposal = ProposalHome.findByPrimaryKey( nIdProposal );
        }

        if ( _proposal.getStatusIsRemoved( ) )
        {
            Map<String, Object> requestParameters = new HashMap<String, Object>( );
            requestParameters.put( PARAMETER_PLUGIN_NAME, "participatoryideation" );

            String strMessageUrl = AdminMessageService.getMessageUrl( request, MESSAGE_ERROR_PROPOSAL_REMOVED, JSP_MANAGE_PROPOSALS, AdminMessage.TYPE_ERROR,
                    requestParameters );
            return redirect( request, strMessageUrl );
        }
File Line
fr/paris/lutece/plugins/participatoryideation/service/ProposalWSService.java 284
fr/paris/lutece/plugins/participatoryideation/service/ProposalWSService.java 310
    public void processActionByName( String strWorkflowProposalActionName, int nIdProposal, HttpServletRequest request )
    {

        int nIdWorkflow = AppPropertiesService.getPropertyInt( ParticipatoryIdeationConstants.PROPERTY_WORKFLOW_ID, -1 );

        if ( nIdWorkflow != -1 && WorkflowService.getInstance( ).isAvailable( ) && !StringUtils.isEmpty( strWorkflowProposalActionName ) )
        {

            List<Action> actionsList = WorkflowService.getInstance( ).getMassActions( nIdWorkflow );

            for ( Action action : actionsList )
            {

                if ( action.getName( ).equals( strWorkflowProposalActionName ) )
                {

                    WorkflowService.getInstance( ).doProcessAction( nIdProposal, Proposal.WORKFLOW_RESOURCE_TYPE, action.getId( ), -1, request,