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/identityimport/web/BatchJspBean.java 310
fr/paris/lutece/plugins/identityimport/web/BatchJspBean.java 371
            final ServiceContractDto clientServiceContract = ServiceContractService.instance( )
                    .getActiveServiceContract( _candidateidentity.getClientAppCode( ) );
            model.put( MARK_SERVICE_CONTRACT, clientServiceContract );
        }
        catch( IdentityStoreException e )
        {
            this.addInfo( e.getLocalizedMessage( ) );
        }

        final Optional<String> returnUrlOpt = Optional.ofNullable( request.getParameter( PARAMETER_RETURN_URL ) );
        returnUrlOpt.ifPresent( url -> {
            final String idState = request.getParameter( PARAMETER_ID_BATCH_STATE );
            final String idBatch = request.getParameter( PARAMETER_ID_BATCH );
            final String batchPage = request.getParameter( PARAMETER_BATCH_PAGE );
            final String applicationCode = request.getParameter( PARAMETER_FILTER_APP_CODE );
            final String returnUrl = String.format( "%s&%s=%s&%s=%s&%s=%s&%s=%s", url, PARAMETER_ID_BATCH_STATE, idState, PARAMETER_ID_BATCH, idBatch,
                    PARAMETER_BATCH_PAGE, batchPage, PARAMETER_FILTER_APP_CODE, applicationCode );
            model.put( MARK_RETURN_URL, returnUrl );
        } );

        model.put( MARK_CANDIDATE_IDENTITY_WORKFLOW, _wfCandidateIdentityBean );
        model.put( MARK_CANDIDATE_IDENTITY, CandidateIdentityService.instance( ).getIdentityDto( _wfCandidateIdentityBean.getResource( ) ) );
        model.put( MARK_ATTRIBUTE_KEY_LIST, keyList.stream( ).distinct( ).collect( Collectors.toList( ) ) );

        return getPage( PROPERTY_PAGE_TITLE_IMPORT_CANDIDATEIDENTITY, TEMPLATE_IMPORT_CANDIDATE_IDENTITY, model );
Fichier Ligne
fr/paris/lutece/plugins/identityimport/web/request/IdentityBatchImportRequest.java 76
fr/paris/lutece/plugins/identityimport/web/request/IdentityBatchStatusRequest.java 74
        final BatchImportResponse response = new BatchImportResponse( );
        if ( StringUtils.isAllBlank( _strClientCode, _strHeaderClientToken ) )
        {
            response.setStatus( ResponseStatusFactory.badRequest( ).setMessage( "You must provide a client_code or a client_token." )
                    .setMessageKey( Constants.PROPERTY_REST_ERROR_MUST_PROVIDE_CLIENT_CODE_OR_TOKEN ) );
            return response;
        }
        final String clientAppCode;
        if ( StringUtils.isBlank( _strClientCode ) )
        {
            final Optional<Client> client = ClientHome.findByToken( _strHeaderClientToken );
            if ( client.isPresent( ) )
            {
                clientAppCode = client.get( ).getAppCode( );
            }
            else
            {
                response.setStatus( ResponseStatusFactory.notFound( ).setMessage( "No client found with provided token" )
                        .setMessageKey( Constants.PROPERTY_REST_ERROR_NO_CLIENT_FOUND_WITH_TOKEN ) );
                return response;
            }
        }
        else
        {
            clientAppCode = _strClientCode;
        }
        final ServiceContractDto activeServiceContract = ServiceContractService.instance( ).getActiveServiceContract( clientAppCode );
        if ( activeServiceContract == null )
        {
            response.setStatus( ResponseStatusFactory.unauthorized( ).setMessageKey( Constants.PROPERTY_REST_ERROR_SERVICE_CONTRACT_NOT_FOUND ) );
Fichier Ligne
fr/paris/lutece/plugins/identityimport/business/CandidateIdentityDAO.java 115
fr/paris/lutece/plugins/identityimport/business/CandidateIdentityHistoryDAO.java 128
            return Optional.ofNullable( candidateIdentity );
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void delete( int nKey, Plugin plugin )
    {
        try ( final DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE, plugin ) )
        {
            daoUtil.setInt( 1, nKey );
            daoUtil.executeUpdate( );
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void deleteList( final List<Integer> idList, Plugin plugin )
    {
        if ( CollectionUtils.isNotEmpty( idList ) )
        {
            final String query = SQL_QUERY_DELETE_LISTS.replace( ID_LIST, idList.stream( ).map( String::valueOf ).collect( Collectors.joining( "," ) ) );
            try ( final DAOUtil daoUtil = new DAOUtil( query, plugin ) )
            {
                daoUtil.executeUpdate( );
            }
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public void store( CandidateIdentity candidateIdentity, Plugin plugin )
Fichier Ligne
fr/paris/lutece/plugins/identityimport/web/BatchJspBean.java 280
fr/paris/lutece/plugins/identityimport/web/BatchJspBean.java 345
    public String getImportCandidateIdentity( final HttpServletRequest request )
    {
        final Optional<String> idIdentityOpt = Optional.ofNullable( request.getParameter( PARAMETER_ID_CANDIDATEIDENTITY ) );
        idIdentityOpt.ifPresent( idIdentity -> {
            _currentIdentityId = Integer.parseInt( idIdentity );
            final Optional<CandidateIdentity> optCandidateIdentity = CandidateIdentityHome.findByPrimaryKey( _currentIdentityId );
            _candidateidentity = optCandidateIdentity.orElseThrow( ( ) -> new AppException( ERROR_RESOURCE_NOT_FOUND ) );
            _candidateidentity.setAttributes( CandidateIdentityAttributeHome.getCandidateIdentityAttributesList( _currentIdentityId ) );
            _wfCandidateIdentityBean = _wfIdentitiesBeanService.createWorkflowBean( _candidateidentity, _candidateidentity.getId( ),
                    _candidateidentity.getIdBatch( ), getUser( ) );
            _wfIdentitiesBeanService.addHistory( _wfCandidateIdentityBean, request, getLocale( ) );
        } );

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

        // Appel API Recherche
        final DuplicateSearchRequest searchRequest = new DuplicateSearchRequest( );
Fichier Ligne
fr/paris/lutece/plugins/identityimport/business/BatchDAO.java 407
fr/paris/lutece/plugins/identityimport/business/ClientDAO.java 207
        StringBuilder builder = new StringBuilder( );

        if ( !listIds.isEmpty( ) )
        {
            for ( int i = 0; i < listIds.size( ); i++ )
            {
                builder.append( "?," );
            }

            final String placeHolders = builder.deleteCharAt( builder.length( ) - 1 ).toString( );
            final String stmt = SQL_QUERY_SELECTALL_BY_IDS + placeHolders + ")";

            try ( final DAOUtil daoUtil = new DAOUtil( stmt, plugin ) )
            {
                int index = 1;
                for ( Integer n : listIds )
                {
                    daoUtil.setInt( index++, n );
                }

                daoUtil.executeQuery( );
                while ( daoUtil.next( ) )
                {