Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 5.5.1.

Duplications

File Line
fr/paris/lutece/plugins/document/modules/rest/rs/DocumentRest.java 459
fr/paris/lutece/plugins/document/modules/rest/rs/DocumentRest.java 521
    public String doSubmitOrUnsubmitDocumentToValidate( @FormParam( DocumentRestConstants.PARAMETER_ID_DOCUMENT ) String strIdDocument,
            @FormParam( DocumentRestConstants.PARAMETER_ID_ACTION ) String strIdAction, @FormParam( DocumentRestConstants.PARAMETER_ID_USER ) String strIdUser,
            @Context HttpServletRequest request )
    {
        if ( StringUtils.isNotBlank( strIdUser ) && StringUtils.isNumeric( strIdUser ) && StringUtils.isNotBlank( strIdAction )
                && StringUtils.isNumeric( strIdAction ) && StringUtils.isNotBlank( strIdDocument ) && StringUtils.isNumeric( strIdDocument ) )
        {
            int nIdAction = Integer.parseInt( strIdAction );
            int nIdDocument = Integer.parseInt( strIdDocument );
            int nIdUser = Integer.parseInt( strIdUser );
            AdminUser user = AdminUserHome.findByPrimaryKey( nIdUser );

            if ( user != null )
            {
                user.setRights( AdminUserHome.getRightsListForUser( nIdUser ) );
                user.setRoles( AdminUserHome.getRolesListForUser( nIdUser ) );

                Document document = DocumentHome.findByPrimaryKeyWithoutBinaries( nIdDocument );
                DocumentAction action = DocumentActionHome.findByPrimaryKey( nIdAction );

                if ( ( action == null )
                        || ( action.getFinishDocumentState( ) == null )
                        || ( document == null )
                        || !DocumentService.getInstance( ).isAuthorizedAdminDocument( document.getSpaceId( ), document.getCodeDocumentType( ),
                                action.getPermission( ), user ) )
                {
                    return ResponseActionBuilderXml.getFailureResponseActionXML( );
                }

                try
                {
                    DocumentService.getInstance( ).changeDocumentState( document, user, action.getFinishDocumentState( ).getId( ) );
File Line
fr/paris/lutece/plugins/document/modules/rest/rs/DocumentRest.java 711
fr/paris/lutece/plugins/document/modules/rest/rs/DocumentRest.java 1028
    public String doCreateDocument( @Context HttpServletRequest request )
    {
        String strResponseXml = StringUtils.EMPTY;
        int nSizeThreshold = AppPropertiesService.getPropertyInt( DocumentRestConstants.PROPERTY_MULTIPART_SIZE_THRESHOLD, -1 );
        boolean bActivateNormalizeFileName = Boolean.getBoolean( AppPropertiesService
                .getProperty( DocumentRestConstants.PROPERTY_MULTIPART_NORMALIZE_FILE_NAME ) );
        String strRequestSizeMax = AppPropertiesService.getProperty( DocumentRestConstants.PROPERTY_MULTIPART_REQUEST_SIZE_MAX );
        long nRequestSizeMax = 0;

        if ( StringUtils.isNotBlank( strRequestSizeMax ) && StringUtils.isNumeric( strRequestSizeMax ) )
        {
            nRequestSizeMax = Long.parseLong( strRequestSizeMax );
        }

        try
        {
            MultipartHttpServletRequest multipartRequest = MultipartUtil.convert( nSizeThreshold, nRequestSizeMax, bActivateNormalizeFileName, request );

            if ( multipartRequest != null )
            {
                strResponseXml = createDocument( multipartRequest );