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/quicklinks/web/QuicklinksJspBean.java 807
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 905
    public String getModifyEntry( HttpServletRequest request ) throws AccessDeniedException
    {
        Plugin plugin = getPlugin( );
        String strIdEntry = request.getParameter( PARAMETER_ENTRY_ID );

        if ( ( strIdEntry == null ) || !strIdEntry.matches( REGEX_ID ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        int nIdEntry = Integer.parseInt( strIdEntry );
        IEntry entry = EntryHome.findByPrimaryKey( nIdEntry, plugin );

        if ( ( entry == null ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        if ( !RBACService.isAuthorized( Quicklinks.RESOURCE_TYPE, String.valueOf( entry.getIdQuicklinks( ) ), QuicklinksResourceIdService.PERMISSION_MODIFY,
                getUser( ) ) )
        {
            throw new AccessDeniedException( UNAUTHORIZED );
        }

        HashMap<String, Object> model = new HashMap<>( );
File Line
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 301
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 417
        String strTitle = request.getParameter( PARAMETER_TITLE );
        String strType = request.getParameter( PARAMETER_TYPE );
        String strWorkgroupKey = request.getParameter( PARAMETER_WORKGROUP_KEY );
        String strRoleKey = request.getParameter( PARAMETER_ROLE_KEY );
        String strState = request.getParameter( PARAMETER_STATE );
        String strCssStyle = request.getParameter( PARAMETER_CSS_STYLE );

        // Check mandatory fields
        if ( StringUtils.isAnyEmpty( strTitle, strWorkgroupKey, strRoleKey, strState ) || ( strType == null ) || !strType.matches( REGEX_ID ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        QuicklinksType quicklinksType = QuicklinksType.getByValue( Integer.parseInt( strType ) );

        // Check if quicklinks type exists
        if ( quicklinksType == null )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        // Set quicklinks and create it
        Quicklinks quicklinks = new Quicklinks( );
File Line
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 807
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 905
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 944
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 1131
    public String getModifyEntry( HttpServletRequest request ) throws AccessDeniedException
    {
        Plugin plugin = getPlugin( );
        String strIdEntry = request.getParameter( PARAMETER_ENTRY_ID );

        if ( ( strIdEntry == null ) || !strIdEntry.matches( REGEX_ID ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        int nIdEntry = Integer.parseInt( strIdEntry );
        IEntry entry = EntryHome.findByPrimaryKey( nIdEntry, plugin );

        if ( ( entry == null ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        if ( !RBACService.isAuthorized( Quicklinks.RESOURCE_TYPE, String.valueOf( entry.getIdQuicklinks( ) ), QuicklinksResourceIdService.PERMISSION_MODIFY,
                getUser( ) ) )
        {
            throw new AccessDeniedException( UNAUTHORIZED );
        }
File Line
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 985
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 1024
fr/paris/lutece/plugins/quicklinks/web/QuicklinksJspBean.java 1073
    public String doConfirmDisableQuicklinks( HttpServletRequest request ) throws AccessDeniedException
    {
        Plugin plugin = getPlugin( );
        String strIdQuicklinks = request.getParameter( PARAMETER_QUICKLINKS_ID );

        if ( ( strIdQuicklinks == null ) || !strIdQuicklinks.matches( REGEX_ID ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        int nIdQuicklinks = Integer.parseInt( strIdQuicklinks );
        Quicklinks quicklinks = QuicklinksHome.findByPrimaryKey( nIdQuicklinks, plugin );

        if ( ( quicklinks == null ) )
        {
            return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
        }

        if ( !RBACService.isAuthorized( Quicklinks.RESOURCE_TYPE, String.valueOf( quicklinks.getId( ) ), QuicklinksResourceIdService.PERMISSION_CHANGE_STATE,
                getUser( ) ) )
        {
            throw new AccessDeniedException( UNAUTHORIZED );
        }
File Line
fr/paris/lutece/plugins/quicklinks/business/EntryUrlDAO.java 146
fr/paris/lutece/plugins/quicklinks/business/EntryUrlDAO.java 189
            daoUtil.setString( nParam++, entryUrl.getTitle( ) );
            daoUtil.setString( nParam++, entryUrl.getTarget( ) );
            daoUtil.setString( nParam++, entryUrl.getDescription( ) );
            daoUtil.setString( nParam++, entryUrl.getUrl( ) );
            daoUtil.setBytes( nParam++, entryUrl.getImage( ) );
            daoUtil.setString( nParam++, entryUrl.getImageMimeType( ) );
            daoUtil.setInt( nParam++, entryUrl.getEntryUrlDisplayProperties( ).getValue( ) );
            daoUtil.setInt( nParam++, entryUrl.getEntryUrlLinkProperties( ).getValue( ) );

            daoUtil.executeUpdate( );
File Line
fr/paris/lutece/plugins/quicklinks/business/QuicklinksDAO.java 202
fr/paris/lutece/plugins/quicklinks/business/QuicklinksDAO.java 236
        try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin ) )
        {
            daoUtil.executeQuery( );

            while ( daoUtil.next( ) )
            {
                Quicklinks quicklinks = null;
                quicklinks = new Quicklinks( );
                quicklinks.setId( daoUtil.getInt( 1 ) );
                quicklinks.setTitle( daoUtil.getString( 2 ) );
                quicklinks.setType( QuicklinksType.getByValue( daoUtil.getInt( 3 ) ) );
                quicklinks.setRoleKey( daoUtil.getString( 4 ) );
                quicklinks.setWorkgroup( daoUtil.getString( 5 ) );
                quicklinks.setEnabled( daoUtil.getBoolean( 6 ) );
                quicklinks.setCssStyle( daoUtil.getString( 7 ) );