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/extend/modules/rating/service/facade/RatingFacadeFactory.java 40
fr/paris/lutece/plugins/extend/modules/rating/service/facade/RatingFacadeFactory.java 74
		 if ( !_ratingSecurityService.canVote( rating.getUser(), rating.getIdExtendableResource( ), rating.getExtendableResourceType( ) ) )
	        {
	        	throw new RatingException( I18nService.getLocalizedString(RatingConstants.MESSAGE_CANNOT_VOTE, LocaleService.getDefault( ) ));
	        }
		 
		 if ( _ratingSecurityService.canAccess( rating.getUser( ) ) )
         {
            try
            {
                 _listRatingType.stream().filter( rat ->  rat.getType( ).equals( rating.getClass( ) ) )
                 .findAny().orElseThrow( RatingTypeException::new ).doRating( rating );
            }
            finally
            {
                _ratingSecurityService.freeAccess( rating.getUser( ) );
            }
         }
		 else
         {
             throw new RatingException( I18nService.getLocalizedString( RatingConstants.MESSAGE_CANNOT_VOTE, LocaleService.getDefault( ) ) );
         }
	}
	
	/**
	 * Do Rating
	 * @param config the configuration of the rating extender
	 * @param rating the rating object
	 * @throws UserNotSignedException the UserNotSignedException
	 * @throws RatingException the RatingException
	 */
	public static void doRating(RatingExtenderConfig config,  Rating rating  ) throws UserNotSignedException, RatingException
File Line
fr/paris/lutece/plugins/extend/modules/rating/business/RatingDAO.java 261
fr/paris/lutece/plugins/extend/modules/rating/business/RatingDAO.java 295
		StringBuilder sbSql = new StringBuilder( SQL_QUERY_FIND_BY_EXTENDER_RESOURCE_ID_LIST_AND_TYPE );
	    if ( CollectionUtils.isNotEmpty( listIdResource ) )
	    {
	        sbSql.append( listIdResource.stream( ).map( s -> "?" ).collect( Collectors.joining( "," ) ) );
	        sbSql.append( ")" );
	    }
		       
	   try ( DAOUtil daoUtil = new DAOUtil( sbSql.toString() , plugin ))
	   {
	   	int nIndex= 0;
	       daoUtil.setString( ++nIndex, strRatingType );	
	       daoUtil.setString( ++nIndex, strExtendableResourceType );
	       for ( String id : listIdResource )
	       {
	           daoUtil.setString( ++nIndex, id );
	       }
	       daoUtil.executeQuery(  );
	
	       while ( daoUtil.next(  ) )
	       {