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/profiles/business/ProfileFilter.java 55
fr/paris/lutece/plugins/profiles/business/views/ViewFilter.java 55
{
    private String _strKey;
    private String _strDescription;

    /**
     * Initialize each component of the object
     */
    public void init( )
    {
        _strKey = StringUtils.EMPTY;
        _strDescription = StringUtils.EMPTY;
    }

    /**
     * Gets the profile key
     * 
     * @return Returns the Key.
     */
    public String getKey( )
    {
        return _strKey;
    }

    /**
     * Sets the profile key
     * 
     * @param strKey
     *            The Key
     */
    public void setKey( String strKey )
    {
        _strKey = strKey;
    }

    /**
     * Returns the profile's description
     * 
     * @return Returns the Description.
     */
    public String getDescription( )
    {
        return _strDescription;
    }

    /**
     * Sets the profile's description
     * 
     * @param strDescription
     *            The profile's description
     */
    public void setDescription( String strDescription )
    {
        _strDescription = strDescription;
    }

    /**
     * Set the value of the ProfileFilter
     * 
     * @param request
     *            HttpServletRequest
     * @return true if there is a search
     */
    public boolean setFilter( HttpServletRequest request )
    {
        boolean bIsSearch = false;
        String strIsSearch = request.getParameter( ProfilesConstants.PARAMETER_SEARCH_IS_SEARCH );

        if ( strIsSearch != null )
        {
            bIsSearch = true;
            _strKey = request.getParameter( ProfilesConstants.PARAMETER_SEARCH_KEY );
            _strDescription = request.getParameter( ProfilesConstants.PARAMETER_SEARCH_DESCRIPTION );
        }
        else
        {
            init( );
        }

        return bIsSearch;
    }

    /**
     * Build url attributes
     * 
     * @param url
     *            the url
     */
    public void setUrlAttributes( UrlItem url )
    {
        url.addParameter( ProfilesConstants.PARAMETER_SEARCH_IS_SEARCH, Boolean.TRUE.toString( ) );

        try
        {
            url.addParameter( ProfilesConstants.PARAMETER_SEARCH_KEY,
                    URLEncoder.encode( _strKey, AppPropertiesService.getProperty( ProfilesConstants.PROPERTY_ENCODING_URL ) ) );
            url.addParameter( ProfilesConstants.PARAMETER_SEARCH_DESCRIPTION,
                    URLEncoder.encode( _strDescription, AppPropertiesService.getProperty( ProfilesConstants.PROPERTY_ENCODING_URL ) ) );
        }
        catch( UnsupportedEncodingException e )
        {
            AppLogService.error( e );
        }
    }

    /**
     * Build url attributes
     * 
     * @return the url attributes
     */
    public String getUrlAttributes( )
    {
        StringBuilder sbUrlAttributes = new StringBuilder( );
        sbUrlAttributes.append( ProfilesConstants.PARAMETER_SEARCH_IS_SEARCH + ProfilesConstants.EQUAL + Boolean.TRUE );

        try
        {
            sbUrlAttributes.append( ProfilesConstants.AMPERSAND + ProfilesConstants.PARAMETER_SEARCH_KEY + ProfilesConstants.EQUAL
                    + URLEncoder.encode( _strKey, AppPropertiesService.getProperty( ProfilesConstants.PROPERTY_ENCODING_URL ) ) );
            sbUrlAttributes.append( ProfilesConstants.AMPERSAND + ProfilesConstants.PARAMETER_SEARCH_DESCRIPTION + ProfilesConstants.EQUAL
                    + URLEncoder.encode( _strDescription, AppPropertiesService.getProperty( ProfilesConstants.PROPERTY_ENCODING_URL ) ) );
        }
        catch( UnsupportedEncodingException e )
        {
            AppLogService.error( e );
        }

        return sbUrlAttributes.toString( );
    }
}
File Line
fr/paris/lutece/plugins/profiles/business/ProfileAction.java 45
fr/paris/lutece/plugins/profiles/business/views/ViewAction.java 45
public class ProfileAction implements RBACAction, Localizable
{
    // Variables declarations
    private String _strUrl;
    private String _strNameKey;
    private String _strDescriptionKey;
    private String _strIconUrl;
    private String _strPermission;
    private Locale _locale;

    /**
     * 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;
    }

    /**
     * Returns the permission associated to the action
     * 
     * @return The permission
     */
    public String getPermission( )
    {
        return _strPermission;
    }

    /**
     * Sets the Permission
     *
     * @param strPermission
     *            The Permission
     */
    public void setPermission( String strPermission )
    {
        _strPermission = strPermission;
    }

    /**
     * Implements Localizable
     * 
     * @param locale
     *            The current locale
     */
    public void setLocale( Locale locale )
    {
        _locale = locale;
    }
}
File Line
fr/paris/lutece/plugins/profiles/web/ProfilesJspBean.java 174
fr/paris/lutece/plugins/profiles/web/views/ViewsJspBean.java 151
            Collections.sort( filteredProfiles, new AttributeComparator( strSortedAttributeName, bIsAscSort ) );
        }

        _strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
        _nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( ProfilesConstants.PROPERTY_ITEM_PER_PAGE, 50 );
        _nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, _nDefaultItemsPerPage );

        String strURL = getHomeUrl( request );
        UrlItem url = new UrlItem( strURL );

        if ( strSortedAttributeName != null )
        {
            url.addParameter( Parameters.SORTED_ATTRIBUTE_NAME, strSortedAttributeName );
        }

        if ( strAscSort != null )
        {
            url.addParameter( Parameters.SORTED_ASC, strAscSort );
        }

        String strSortSearchAttribute = StringUtils.EMPTY;

        if ( bIsSearch )
        {