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/forms/business/FormDAO.java 78
fr/paris/lutece/plugins/forms/business/FormDAO.java 162
            daoUtil.setString( nIndex++, form.getTitle( ) );
            daoUtil.setString( nIndex++, form.getDescription( ) );
            Timestamp tsUpdateDate = new Timestamp( Calendar.getInstance( ).getTimeInMillis( ) );
            daoUtil.setTimestamp( nIndex++, tsUpdateDate );
            daoUtil.setTimestamp( nIndex++, form.getAvailabilityStartDate( ) );
            daoUtil.setTimestamp( nIndex++, form.getAvailabilityEndDate( ) );
            daoUtil.setString( nIndex++, form.getWorkgroup( ) );
            daoUtil.setInt( nIndex++, form.getIdWorkflow( ) );
            daoUtil.setBoolean( nIndex++, form.isAuthentificationNeeded( ) );
            daoUtil.setBoolean( nIndex++, form.isOneResponseByUser( ) );
            daoUtil.setString( nIndex++, form.getBreadcrumbName( ) );
            daoUtil.setBoolean( nIndex++, form.isDisplaySummary( ) );
            daoUtil.setString( nIndex++, form.getReturnUrl( ) );
            daoUtil.setInt( nIndex++, form.getMaxNumberResponse( ) );
            daoUtil.setBoolean( nIndex++, form.isCaptchaStepInitial( ) );
            daoUtil.setBoolean( nIndex++, form.isCaptchaStepFinal( ) );
            daoUtil.setBoolean( nIndex++, form.isCaptchaRecap( ) );
            daoUtil.setBoolean( nIndex++, form.isCountResponses( ) );
            daoUtil.setString( nIndex++, form.getLabelFinalButton( ) );
            daoUtil.setString( nIndex++, form.getUnavailableMessage( ) );
            if ( form.getLogo( ) != null )
            {
                daoUtil.setInt( nIndex++, form.getLogo( ).getIdFile( ) );
            }
            else
            {
                daoUtil.setInt( nIndex++, 0 );
            }
            daoUtil.setInt( nIndex++, form.getIdCategory( ) );
            daoUtil.setBoolean( nIndex++, form.isBackupEnabled( ) );
            daoUtil.setBoolean( nIndex++, form.isAccessToResponsesByRole( ) );

            daoUtil.executeUpdate( );
File Line
fr/paris/lutece/plugins/forms/export/pdf/AbstractPdfFileGenerator.java 294
fr/paris/lutece/plugins/forms/export/pdf/FormResponsePdfExport.java 198
                return cell;
            }
        }
        return null;
    }
    
    /**
     * Gets the response value.
     *
     * @param formQuestionResponse
     *            the form question response
     * @param iteration
     *            the iteration
     * @return the response value
     */
    private List<String> getResponseValue( FormQuestionResponse formQuestionResponse, int iteration )
    {
        Entry entry = formQuestionResponse.getQuestion( ).getEntry( );

        IEntryTypeService entryTypeService = EntryTypeServiceManager.getEntryTypeService( entry );
        List<String> listResponseValue = new ArrayList<>( );
        if ( entryTypeService instanceof AbstractEntryTypeComment )
        {
            return listResponseValue;
        }

        if ( entryTypeService instanceof EntryTypeTermsOfService )
        {
            boolean aggrement = formQuestionResponse.getEntryResponse( ).stream( )
                    .filter( response -> response.getField( ).getCode( ).equals( EntryTypeTermsOfService.FIELD_AGREEMENT_CODE ) )
                    .map( Response::getResponseValue ).map( Boolean::valueOf ).findFirst( ).orElse( false );

            if ( aggrement )
            {
                listResponseValue.add( I18nService.getLocalizedString( KEY_LABEL_YES, I18nService.getDefaultLocale( ) ) );
            }
            else
            {
                listResponseValue.add( I18nService.getLocalizedString( KEY_LABEL_NO, I18nService.getDefaultLocale( ) ) );
            }
            return listResponseValue;

        }
        for ( Response response : formQuestionResponse.getEntryResponse( ) )
        {
            if ( response.getIterationNumber( ) != -1 && response.getIterationNumber( ) != iteration )
            {
                continue;
            }
File Line
fr/paris/lutece/plugins/forms/web/entrytype/EntryTypeDefaultDisplayService.java 65
fr/paris/lutece/plugins/forms/web/entrytype/EntryTypeGeolocDisplayService.java 65
    public EntryTypeDefaultDisplayService( String strEntryServiceName )
    {
        _strEntryServiceName = strEntryServiceName;
    }

    /**
     * Return the completed model
     * 
     * @param entry
     *            The given entry
     * @param model
     *            The given model
     * @return the completed model
     */
    private Map<String, Object> setModel( Entry entry, Map<String, Object> model )
    {
        model.put( FormsConstants.QUESTION_ENTRY_MARKER, entry );

        return model;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDisplayServiceName( )
    {
        return _strEntryServiceName;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getEntryTemplateDisplay( HttpServletRequest request, Entry entry, Locale locale, Map<String, Object> model, DisplayType displayType )
    {
        String strEntryHtml = StringUtils.EMPTY;
        IEntryTypeService service = EntryTypeServiceManager.getEntryTypeService( entry );

        switch( displayType.getMode( ) )
        {
            case EDITION:
                strEntryHtml = AppTemplateService.getTemplate( service.getTemplateHtmlForm( entry, displayType.isFront( ) ), locale, setModel( entry, model ) )
                        .getHtml( );
                break;
            case READONLY:
                model.put( MARK_ENTRY_TYPE_SERVICE, service );
                strEntryHtml = AppTemplateService.getTemplate( service.getTemplateEntryReadOnly( displayType.isFront( ) ), locale, setModel( entry, model ) )
                        .getHtml( );
                break;
            default: // Nothing to do
        }

        return strEntryHtml;
    }

    /**
     * Get the form column
     * 
     * @param nFormColumnPosition
     * @param strColumnTitle
     * @param listEntryTitle
     * @return The form column
     */
    @Override
    public IFormColumn getFormColumn( int nFormColumnPosition, String strColumnTitle )
    {
        return new FormColumnEntry( nFormColumnPosition, strColumnTitle );
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeCartography.java 80
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeGeolocation.java 85
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }

        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        if ( listResponseReference.size( ) != listResponseNew.size( ) )
        {
            return true;
        }

        boolean bAllResponsesEquals = true;

        for ( Response responseNew : listResponseNew )
        {
            Response responseReference = findReferenceResponseAssociatedToNewResponse( responseNew, listResponseReference );

            if ( responseReference == null || responseReference.getResponseValue( ) == null
                    || !responseReference.getResponseValue( ).equals( responseNew.getResponseValue( ) ) )
            {
                bAllResponsesEquals = false;
                break;
            }
        }

        return !bAllResponsesEquals;
    }

    /**
     * Finds the reference response associated to the new response
     * 
     * @param responseNew
     *            the new response
     * @param listResponseReference
     *            the list of reference responses
     * @return the found response or {@code null} if not found
     */
    private Response findReferenceResponseAssociatedToNewResponse( Response responseNew, List<Response> listResponseReference )
    {
        Response response = null;

        for ( Response responseReference : listResponseReference )
        {
            if ( responseReference.getField( ).getCode( ).equals( responseNew.getField( ).getCode( ) ) )
            {
                response = responseReference;
                break;
            }
        }

        return response;
    }
}
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeAutomaticFileReading.java 84
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeFile.java 65
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {

        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AbstractGenAttUploadHandler getAsynchronousUploadHandler( )
    {
        return FormsAsynchronousUploadHandler.getHandler( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getUrlDownloadFile( int nResponseId, String strBaseUrl )
    {
        UrlItem url = new UrlItem( strBaseUrl + JSP_DOWNLOAD_FILE );
        url.addParameter( PARAMETER_ID_RESPONSE, nResponseId );

        return url.getUrl( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected boolean checkForImages( )
    {
        return false;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }

        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        return CollectionUtils.isNotEmpty( listResponseNew );
    }
File Line
fr/paris/lutece/plugins/forms/export/pdf/AbstractPdfFileGenerator.java 278
fr/paris/lutece/plugins/forms/export/pdf/FormResponsePdfExport.java 172
    private PdfCell createPdfCell( FormResponseStep formResponseStep, FormDisplay formDisplay, int iterationNumber )
    {
        FormQuestionResponse formQuestionResponse = formResponseStep.getQuestions( ).stream( )
                .filter( fqr -> fqr.getQuestion( ).getEntry( ).isExportablePdf( ) )
                .filter( fqr -> fqr.getQuestion( ).getId( ) == formDisplay.getCompositeId( ) )
                .filter( fqr -> fqr.getQuestion( ).getIterationNumber( ) == iterationNumber ).findFirst( ).orElse( null );

        if ( formQuestionResponse != null )
        {
            String key = formQuestionResponse.getQuestion( ).getTitle( );
            List<String> listResponseValue = getResponseValue( formQuestionResponse, iterationNumber );
            if ( CollectionUtils.isNotEmpty( listResponseValue ) )
            {
                PdfCell cell = new PdfCell( );
                cell.setTitle( key );
                cell.setValue( listResponseValue.stream( ).filter( StringUtils::isNotEmpty ).collect( Collectors.joining( ";" ) ) );
File Line
fr/paris/lutece/plugins/forms/business/QuestionDAO.java 77
fr/paris/lutece/plugins/forms/business/QuestionDAO.java 191
            daoUtil.setString( nIndex++, question.getTitle( ) );
            daoUtil.setString( nIndex++, question.getCode( ) );
            daoUtil.setString( nIndex++, question.getDescription( ) );
            daoUtil.setInt( nIndex++, question.getIdEntry( ) );
            daoUtil.setInt( nIndex++, question.getIdStep( ) );
            daoUtil.setBoolean( nIndex++, question.isVisibleMultiviewGlobal( ) );
            daoUtil.setBoolean( nIndex++, question.isVisibleMultiviewFormSelected( ) );
            daoUtil.setString( nIndex++, question.getColumnTitle( ) );
            daoUtil.setBoolean( nIndex++, question.isFiltrableMultiviewGlobal( ) );
            daoUtil.setBoolean( nIndex++, question.isFiltrableMultiviewFormSelected( ) );
            daoUtil.setInt( nIndex++, question.getMultiviewColumnOrder( ) );
            daoUtil.setInt( nIndex++, question.getExportDisplayOrder() );

            daoUtil.executeUpdate( );
File Line
fr/paris/lutece/plugins/forms/service/json/FormJsonData.java 147
fr/paris/lutece/plugins/forms/service/json/StepJsonData.java 88
    }

    /**
     * @return the formDisplayList
     */
    public List<FormDisplay> getFormDisplayList( )
    {
        return new ArrayList<>( _formDisplayList );
    }

    /**
     * @param formDisplayList
     *            the formDisplayList to set
     */
    public void setFormDisplayList( List<FormDisplay> formDisplayList )
    {
        _formDisplayList = new ArrayList<>( formDisplayList );
    }

    /**
     * @return the groupList
     */
    public List<Group> getGroupList( )
    {
        return new ArrayList<>( _groupList );
    }

    /**
     * @param groupList
     *            the groupList to set
     */
    public void setGroupList( List<Group> groupList )
    {
        _groupList = new ArrayList<>( groupList );
    }

    /**
     * @return the controlList
     */
    public List<Control> getControlList( )
    {
        return new ArrayList<>( _controlList );
    }

    /**
     * @param controlList
     *            the controlQuestionList to set
     */
    public void setControlList( List<Control> controlList )
    {
        _controlList = new ArrayList<>( controlList );
    }

    /**
     * @return the controlMappingList
     */
    public List<ControlMapping> getControlMappingList( )
    {
        return new ArrayList<>( _controlMappingList );
    }

    /**
     * @param controlMappingList
     *            the controlMappingList to set
     */
    public void setControlMappingList( List<ControlMapping> controlMappingList )
    {
        _controlMappingList = new ArrayList<>( controlMappingList );
    }
File Line
fr/paris/lutece/plugins/forms/business/QuestionDAO.java 399
fr/paris/lutece/plugins/forms/business/QuestionDAO.java 453
    private Question dataToObject( DAOUtil daoUtil )
    {
        Question question = new Question( );

        question.setId( daoUtil.getInt( "id_question" ) );
        question.setTitle( daoUtil.getString( "title" ) );
        question.setCode( daoUtil.getString( "code" ) );
        question.setDescription( daoUtil.getString( "description" ) );
        question.setIdEntry( daoUtil.getInt( "id_entry" ) );
        question.setIdStep( daoUtil.getInt( "id_step" ) );
        question.setVisibleMultiviewGlobal( daoUtil.getBoolean( "is_visible_multiview_global" ) );
        question.setVisibleMultiviewFormSelected( daoUtil.getBoolean( "is_visible_multiview_form_selected" ) );
        question.setColumnTitle( daoUtil.getString( "column_title" ) );
        question.setFiltrableMultiviewGlobal( daoUtil.getBoolean( "is_filterable_multiview_global" ) );
        question.setFiltrableMultiviewFormSelected( daoUtil.getBoolean( "is_filterable_multiview_form_selected" ) );
        question.setMultiviewColumnOrder( daoUtil.getInt( "multiview_column_order" ) );
        question.setExportDisplayOrder( daoUtil.getInt( "export_display_order" ) );
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumber.java 61
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumbering.java 63
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeRadioButton.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelect.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelectOrder.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeText.java 61
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }
        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        String strResponseReference = listResponseReference.get( 0 ).getResponseValue( );
        String strResponseNew = listResponseNew.get( 0 ).getResponseValue( );

        if ( strResponseReference == null )
        {
            return strResponseNew != null;
        }

        return !strResponseReference.equals( strResponseNew );
    }
}
File Line
fr/paris/lutece/plugins/forms/business/FormQuestionResponseDAO.java 369
fr/paris/lutece/plugins/forms/business/FormResponseDAO.java 323
        List<FormQuestionResponse> list = new ArrayList<>( );
        int nlistIdFormResponseSize = listIdFormResponse.size( );

        if ( nlistIdFormResponseSize > 0 )
        {
            StringBuilder sbSQL = new StringBuilder( SQL_QUERY_SELECT_BY_LIST_FORM_RESPONSE );

            for ( int i = 1; i < nlistIdFormResponseSize; i++ )
            {
                sbSQL.append( SQL_ADITIONAL_PARAMETER );
            }

            sbSQL.append( SQL_CLOSE_PARENTHESIS );

            try ( DAOUtil daoUtil = new DAOUtil( sbSQL.toString( ), plugin ) )
            {

                for ( int i = 0; i < nlistIdFormResponseSize; i++ )
                {
                    daoUtil.setInt( i + 1, listIdFormResponse.get( i ) );
                }

                daoUtil.executeQuery( );

                while ( daoUtil.next( ) )
                {
                    list.add( dataToObject( daoUtil ) );
                }
            }
        }
        return list;
    }
File Line
fr/paris/lutece/plugins/forms/util/FormsResponseUtils.java 118
fr/paris/lutece/plugins/forms/util/FormsResponseUtils.java 147
        List<FormResponse> formResponseResult= new ArrayList<>( );
        if( CollectionUtils.isNotEmpty( formResponseList) ) 
        {
        	List<Form> listForm=FormHome.getFormByPrimaryKeyList( formResponseList.stream()
        			.map( FormResponse::getFormId )
        			.collect(ArrayList<Integer>::new, ArrayList::add, ArrayList::addAll));
        	
        	List<Integer>  listIdFormByRole=listForm.stream()
        					 .filter(Form::isAccessToResponsesByRole )
        					 .map(Form::getId )
        					 .collect(ArrayList<Integer>::new, ArrayList::add, ArrayList::addAll);
        	
        	formResponseList.forEach(( FormResponse frmRsp ) -> {
        		if( isAuthorized( listIdFormByRole,  frmRsp,  user ))
        		{
        			formResponseResult.add( frmRsp );
File Line
fr/paris/lutece/plugins/forms/web/breadcrumb/HorizontalBreadcrumb.java 64
fr/paris/lutece/plugins/forms/web/breadcrumb/VerticalBreadcrumb.java 67
    public HorizontalBreadcrumb( String strBreadcrumbName, String strBreadcrumbDisplayName )
    {
        _strBreadcrumbBeanName = strBreadcrumbName;
        _strBreadcrumbDisplayBeanName = I18nService.getLocalizedString( strBreadcrumbDisplayName, I18nService.getDefaultLocale( ) );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getBreadcrumbBeanName( )
    {
        return _strBreadcrumbBeanName;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getBreadcrumbDisplayName( )
    {
        return _strBreadcrumbDisplayBeanName;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTopHtml( HttpServletRequest request, FormResponseManager formResponseManager )
    {
        Map<String, Object> model = new HashMap<>( );
        model.put( FormsConstants.MARK_LIST_STEPS, formResponseManager.getValidatedSteps( ) );
        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_BREADCRUMB_HTML, I18nService.getDefaultLocale( ), model );

        return template.getHtml( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getBottomHtml( HttpServletRequest request, FormResponseManager formResponseManager )
    {
        return null;
    }
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeDate.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumber.java 61
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumbering.java 63
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeRadioButton.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelect.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelectOrder.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeText.java 61
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }

        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        String strResponseReference = listResponseReference.get( 0 ).getResponseValue( );
        String strResponseNew = listResponseNew.get( 0 ).getResponseValue( );

        if ( strResponseReference == null && strResponseNew == null )
File Line
fr/paris/lutece/plugins/forms/business/FormAction.java 75
fr/paris/lutece/plugins/forms/business/action/GlobalFormsAction.java 82
    }

    /**
     * Returns the Url
     *
     * @return The Url
     */
    public String getUrl( )
    {
        return _strUrl;
    }

    /**
     * Sets the Url
     *
     * @param strUrl
     *            The Url
     */
    public void setUrl( String strUrl )
    {
        _strUrl = strUrl;
    }

    /**
     * Returns the NameKey
     *
     * @return The NameKey
     */
    public String getNameKey( )
    {
        return _strNameKey;
    }

    /**
     * Returns the Name
     *
     * @return The Name
     */
    public String getName( )
    {
        return I18nService.getLocalizedString( _strNameKey, _locale );
    }

    /**
     * Sets the NameKey
     *
     * @param strNameKey
     *            The NameKey
     */
    public void setNameKey( String strNameKey )
    {
        _strNameKey = strNameKey;
    }

    /**
     * Returns the DescriptionKey
     *
     * @return The DescriptionKey
     */
    public String getDescriptionKey( )
    {
        return _strDescriptionKey;
    }

    /**
     * Returns the Description
     *
     * @return The Description
     */
    public String getDescription( )
    {
        return I18nService.getLocalizedString( _strDescriptionKey, _locale );
    }

    /**
     * Sets the DescriptionKey
     *
     * @param strDescriptionKey
     *            The DescriptionKey
     */
    public void setDescriptionKey( String strDescriptionKey )
    {
        _strDescriptionKey = strDescriptionKey;
    }

    /**
     * Returns the IconUrl
     *
     * @return The IconUrl
     */
    public String getIconUrl( )
    {
        return _strIconUrl;
    }

    /**
     * Sets the IconUrl
     *
     * @param strIconUrl
     *            The IconUrl
     */
    public void setIconUrl( String strIconUrl )
    {
        _strIconUrl = strIconUrl;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getPermission( )
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeAutomaticFileReading.java 84
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeFile.java 65
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeImage.java 71
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {

        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AbstractGenAttUploadHandler getAsynchronousUploadHandler( )
    {
        return FormsAsynchronousUploadHandler.getHandler( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getUrlDownloadFile( int nResponseId, String strBaseUrl )
    {
        UrlItem url = new UrlItem( strBaseUrl + JSP_DOWNLOAD_FILE );
        url.addParameter( PARAMETER_ID_RESPONSE, nResponseId );

        return url.getUrl( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected boolean checkForImages( )
    {
        return false;
File Line
fr/paris/lutece/plugins/forms/export/pdf/AbstractPdfFileGenerator.java 191
fr/paris/lutece/plugins/forms/export/pdf/FormResponsePdfExport.java 127
        listContent.add(stepCell);
        
        for ( FormDisplay formDisplay : listStepFormDisplay )
        {
            if ( CompositeDisplayType.GROUP.getLabel( ).equals( formDisplay.getCompositeType( ) ) )
            {
                List<PdfCell> listContentGroup = createCellsForGroup( formResponseStep, formDisplay );
                listContent.addAll( listContentGroup );
            }
            else
            {
                PdfCell cell = createPdfCellNoGroup( formResponseStep, formDisplay );
                if ( cell != null )
                {
                    listContent.add( cell );
                }
            }
        }
        return listContent;
    }
    
    /**
     * Creates the cells for group.
     *
     * @param formResponseStep
     *            the form response step
     * @param formDisplay
     *            the form display
     * @return the list
     */
    private List<PdfCell> createCellsForGroup( FormResponseStep formResponseStep, FormDisplay formDisplay )
    {
        List<PdfCell> listContent = new ArrayList<>( );
        
        Group group = GroupHome.findByPrimaryKey( formDisplay.getCompositeId( ) );
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeArray.java 111
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeCheckBox.java 135
        }

        boolean bAllResponsesEquals = true;

        for ( Response responseNew : listResponseNew )
        {
            Response responseReference = findReferenceResponseAssociatedToNewResponse( responseNew, listResponseReference );

            if ( responseReference == null || !responseReference.getResponseValue( ).equals( responseNew.getResponseValue( ) ) )
            {
                bAllResponsesEquals = false;
                break;
            }
        }

        return !bAllResponsesEquals;
    }

    /**
     * Finds the reference response associated to the new response
     * 
     * @param responseNew
     *            the new response
     * @param listResponseReference
     *            the list of reference responses
     * @return the found response or {@code null} if not found
     */
    private Response findReferenceResponseAssociatedToNewResponse( Response responseNew, List<Response> listResponseReference )
    {
        Response response = null;

        for ( Response responseReference : listResponseReference )
        {
            if ( responseReference.getField( ).getValue( ).equals( responseNew.getField( ).getValue( ) ) )
            {
                response = responseReference;
                break;
            }
        }

        return response;
    }
}
File Line
fr/paris/lutece/plugins/forms/web/form/column/display/impl/FormColumnDisplayEntryCartography.java 70
fr/paris/lutece/plugins/forms/web/form/column/display/impl/FormColumnDisplayEntryGeolocation.java 72
    @Override
    public String buildFormColumnHeaderTemplate( String strSortUrl, Locale locale )
    {
        Map<String, Object> model = new LinkedHashMap<>( );
        model.put( MARK_ENTRY_VALUE_COLUMN_TITLE, getFormColumnTitle( locale ) );
        model.put( MARK_ENTRY_VALUE_COLUMN_POSITION, getPosition( ) );

        model.put( MARK_COLUMN_SORT_ATTRIBUTE, String.format( FormEntryNameConstants.COLUMN_ENTRY_GEOLOC_VALUE_PATTERN_ADDR, getPosition( ) ) );
        model.put( MARK_SORT_URL, buildCompleteSortUrl( strSortUrl ) );

        String strColumnHeaderTemplate = AppTemplateService.getTemplate( FORM_COLUMN_HEADER_TEMPLATE, locale, model ).getHtml( );
        setFormColumnHeaderTemplate( strColumnHeaderTemplate );

        return strColumnHeaderTemplate;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String buildFormColumnCellTemplate( FormColumnCell formColumnCell, Locale locale )
    {
        String strEntryGeoJSON = StringUtils.EMPTY;
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeArray.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeCheckBox.java 60
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }

        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        if ( listResponseReference.size( ) != listResponseNew.size( ) )
        {
            return true;
        }
File Line
fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java 155
fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java 192
    public String modifyFilterableQuestions( HttpServletRequest request ) throws AccessDeniedException
    {
        int nId = NumberUtils.toInt( request.getParameter( FormsConstants.PARAMETER_ID_FORM ), FormsConstants.DEFAULT_ID_VALUE );
        
        if ( nId == FormsConstants.DEFAULT_ID_VALUE )
        {
            return redirect( request, VIEW_MANAGE_FORMS );
        }
        checkUserPermission( Form.RESOURCE_TYPE, String.valueOf( nId ), FormsResourceIdService.PERMISSION_MODIFY, request, ACTION_MANAGE_MULTIVIEW );

        Form formToBeModified = FormHome.findByPrimaryKey( nId );

        if ( formToBeModified == null )
        {
            return redirect( request, VIEW_MANAGE_FORMS );
        }
        
        List<Question> questionList = QuestionHome.getListQuestionByIdForm( formToBeModified.getId( ) );

        for ( Question question : questionList )
        {
File Line
fr/paris/lutece/plugins/forms/service/MultiviewFormService.java 182
fr/paris/lutece/plugins/forms/service/MultiviewFormService.java 248
        if ( nIdForm == null || nIdForm == FormsConstants.DEFAULT_ID_VALUE )
        {
            List<Form> listForm = FormHome.getFormList( );
            listForm.removeIf( f -> !RBACService.isAuthorized( Form.RESOURCE_TYPE, String.valueOf( f.getId( ) ),
                    FormsResourceIdService.PERMISSION_VIEW_FORM_RESPONSE, user ) );

            if ( listForm.size( ) == 1 )
            {
                nIdForm = listForm.get( 0 ).getId( );
            }
        }

        // Then add global columns from config questions
        List<Question> listQuestions = ( nIdForm == null || nIdForm == FormsConstants.DEFAULT_ID_VALUE ) ? QuestionHome.getQuestionsListUncomplete( )
                : QuestionHome.getListQuestionByIdFormUncomplete( nIdForm );
File Line
fr/paris/lutece/plugins/forms/business/form/column/querypart/impl/FormColumnEntryCartographyQueryPart.java 65
fr/paris/lutece/plugins/forms/business/form/column/querypart/impl/FormColumnEntryGeolocationQueryPart.java 69
        String strGeoJSONValue = String.format( FormEntryNameConstants.COLUMN_ENTRY_CARTO_VALUE_PATTERN_GEOJSON, getFormColumn( ).getFormColumnPosition( ) );

        for ( String strFormColumnEntryCode : getListEntryCode( getFormColumn( ) ) )
        {
            Map<String, String> listFields = getEntryCodeFields( strFormColumnEntryCode, formResponseSearchItem );
            for ( Map.Entry<String, String> field : listFields.entrySet( ) )
            {
                String [ ] splits = field.getKey( ).split( "_" );
                String strIdField = splits [splits.length - 1];
                int nIdField = Integer.parseInt( strIdField );
                Field fieldGenatt = FieldHome.findByPrimaryKey( nIdField );
                switch( fieldGenatt.getValue( ) )
                {
                    case CONSTANT_FIELD_GEOJSON:
File Line
fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java 108
fr/paris/lutece/plugins/forms/web/admin/FormWorkflowConfigJspBean.java 84
    @View( VIEW_MANAGE_MULTIVIEW )
    public String getManageMultiview( HttpServletRequest request ) throws AccessDeniedException
    {
        int nId = NumberUtils.toInt( request.getParameter( FormsConstants.PARAMETER_ID_FORM ), FormsConstants.DEFAULT_ID_VALUE );

        if ( nId == FormsConstants.DEFAULT_ID_VALUE )
        {
            return redirect( request, VIEW_MANAGE_FORMS );
        }

        checkUserPermission( Form.RESOURCE_TYPE, String.valueOf( nId ), FormsResourceIdService.PERMISSION_MODIFY_PARAMS, request, null );

        Form formToBeModified = FormHome.findByPrimaryKey( nId );

        if ( formToBeModified == null )
        {
            return redirect( request, VIEW_MANAGE_FORMS );
        }
        
        List<Question> questionList = QuestionHome.getListQuestionByIdForm( formToBeModified.getId( ) );
File Line
fr/paris/lutece/plugins/forms/web/entrytype/EntryTypeDateDisplayService.java 70
fr/paris/lutece/plugins/forms/web/entrytype/EntryTypeTelephoneDisplayService.java 66
    public EntryTypeDateDisplayService( String strEntryServiceName )
    {
        _strEntryServiceName = strEntryServiceName;
    }

    /**
     * Return the completed model
     * 
     * @param entry
     *            The given entry
     * @param locale
     *            The given locale
     * @param model
     *            The given model
     * @return the completed model
     */
    private Map<String, Object> setModel( Entry entry, Locale locale, Map<String, Object> model )
    {
        model.put( FormsConstants.QUESTION_ENTRY_MARKER, entry );
        model.put( LOCALE_MARKER, locale );

        return model;
    }

    @Override
    public String getDisplayServiceName( )
    {
        return _strEntryServiceName;
    }

    @Override
    public String getEntryTemplateDisplay( HttpServletRequest request, Entry entry, Locale locale, Map<String, Object> model, DisplayType displayType )
    {
        String strEntryHtml = StringUtils.EMPTY;
        IEntryTypeService service = EntryTypeServiceManager.getEntryTypeService( entry );
File Line
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeDate.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumber.java 61
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeNumbering.java 63
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeRadioButton.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelect.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeSelectOrder.java 59
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeText.java 61
fr/paris/lutece/plugins/forms/service/entrytype/EntryTypeTextArea.java 59
    @Override
    public String getTemplateHtmlForm( Entry entry, boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_EDITION_FRONTOFFICE;
        }

        return TEMPLATE_EDITION_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateCreate( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_CREATE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateModify( Entry entry, boolean bDisplayFront )
    {
        return TEMPLATE_MODIFY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTemplateEntryReadOnly( boolean bDisplayFront )
    {
        if ( bDisplayFront )
        {
            return TEMPLATE_READONLY_FRONTOFFICE;
        }

        return TEMPLATE_READONLY_BACKOFFICE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isResponseChanged( List<Response> listResponseReference, List<Response> listResponseNew )
    {
        String strResponseReference = listResponseReference.get( 0 ).getResponseValue( );
File Line
fr/paris/lutece/plugins/forms/web/FormXPage.java 558
fr/paris/lutece/plugins/forms/web/FormXPage.java 658
        Form form = null;
        try
        {
            boolean bSessionLost = isSessionLost( );
            form = findFormFrom( request );
            if ( bSessionLost )
            {
                addWarning( MESSAGE_WARNING_LOST_SESSION, getLocale( request ) );
                return getStepView(  request );
            }
            FormsResponseUtils.fillResponseManagerWithResponses( request, true, _formResponseManager, _stepDisplayTree.getQuestions( ), false );
            boolean needValidation = form.isCaptchaStepFinal( );
            if ( isCaptchaKO( request, needValidation ) )
            {
                addWarning( MESSAGE_WARNING_CAPTCHA, getLocale( request ) );
                return getStepView(  request );
            }
        }
        catch( FormNotFoundException | QuestionValidationException exception )
        {
            return  getStepView(  request );
        }

        return getFormResponseSummaryPage( request, form );
File Line
fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java 324
fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java 362
    public String doMoveUpExportConfig( HttpServletRequest request )
    {
        int idConfig = NumberUtils.toInt( request.getParameter( PARAMETER_ID_CONFIG ), FormsConstants.DEFAULT_ID_VALUE );
        int idForm = NumberUtils.toInt( request.getParameter( FormsConstants.PARAMETER_ID_FORM ), FormsConstants.DEFAULT_ID_VALUE );

        if ( idConfig == FormsConstants.DEFAULT_ID_VALUE )
        {
            Map<String, String> mapParameters = new LinkedHashMap<>( );
            mapParameters.put( FormsConstants.PARAMETER_ID_FORM, String.valueOf( idForm ) );

            return redirect( request, VIEW_MANAGE_EXPORT, mapParameters );
        }

        List<FormExportConfig> existingConfigList = FormExportConfigHome.findByForm( idForm );

        FormExportConfig configMovedUp = FormExportConfigHome.findByPrimaryKey( idConfig );
File Line
fr/paris/lutece/plugins/forms/web/admin/FormJspBean.java 804
fr/paris/lutece/plugins/forms/web/admin/MultiviewFormsJspBean.java 669
        for ( FileItem fileItem : listUploadedFileItems )
        {
        	if (fileItem != null)
            {
            	File file = new File( );
                file.setTitle( fileItem.getName( ) );
                file.setSize( ( fileItem.getSize( ) < Integer.MAX_VALUE ) ? (int) fileItem.getSize( ) : Integer.MAX_VALUE );
                file.setMimeType( FileSystemUtil.getMIMEType( file.getTitle( ) ) );

                PhysicalFile physicalFile = new PhysicalFile( );
                physicalFile.setValue( fileItem.get( ) );
                file.setPhysicalFile( physicalFile );
                return file;
            }
        }
File Line
fr/paris/lutece/plugins/forms/web/admin/ModifyEntryJspBean.java 289
fr/paris/lutece/plugins/forms/web/admin/ModifyEntryJspBean.java 356
        field.setParentEntry( entry );

        String strError = getFieldData( request, field );

        if ( strError != null )
        {
            return redirect( request, strError );
        }
        
        if ( imageFileItem != null && imageFileItem.getSize( ) > 0 )
        {
            try
            {
                String strFileStoreKey = ImageResourceManager.addImageResource( FileImagePublicService.IMAGE_RESOURCE_TYPE_ID, imageFileItem );
                File fileImage = new File( );
                fileImage.setFileKey( strFileStoreKey );
                field.setFileImage( fileImage );
            }
            catch ( Exception e ) 
            {
            	AppLogService.error( MESSAGE_ERROR_FILE_IMAGE, e );
                throw new AppException( MESSAGE_ERROR_FILE_IMAGE, e );
            }
        }

        FieldHome.create( field );