CPD Results
The following document contains the results of PMD's CPD 6.13.0.
Duplications
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/AbstractManageDemandTypeJspBean.java |
57 |
| fr/paris/lutece/plugins/notificationstore/web/AbstractManageJspBean.java |
52 |
public static final String RIGHT_MANAGEDEMANDTYPE = "NOTIFICATIONSTORE_MANAGEMENT";
// Properties
private static final String PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE = "notificationstore.listItems.itemsPerPage";
// Parameters
private static final String PARAMETER_PAGE_INDEX = "page_index";
// Markers
private static final String MARK_PAGINATOR = "paginator";
private static final String MARK_NB_ITEMS_PER_PAGE = "nb_items_per_page";
// Variables
private String _strCurrentPageIndex;
private int _nItemsPerPage;
/**
* Return a model that contains the list and paginator infos
*
* @param request
* The HTTP request
* @param strBookmark
* The bookmark
* @param list
* The list of item
* @param strManageJsp
* The JSP
* @return The model
*/
protected <T> Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List<S> list, String strManageJsp )
{
int nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
_strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
_nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, nDefaultItemsPerPage );
UrlItem url = new UrlItem( strManageJsp );
String strUrl = url.getUrl( );
// PAGINATOR
LocalizedPaginator<S> paginator = new LocalizedPaginator<>( list, _nItemsPerPage, strUrl, PARAMETER_PAGE_INDEX, _strCurrentPageIndex, getLocale( ) );
Map<String, Object> model = getModel( );
model.put( MARK_NB_ITEMS_PER_PAGE, String.valueOf( _nItemsPerPage ) );
model.put( MARK_PAGINATOR, paginator );
model.put( strBookmark, getItemsFromIds( paginator.getPageItems( ) ) );
return model;
}
/**
* Get Items from Ids list
*
* @param <T>
*
* @param <S>
* the generic type of the Ids
* @param <T>
* the generic type of the items
* @param <S>
* @param listIds
* @return the populated list of items corresponding to the id List
*/
abstract List<T> getItemsFromIds( List<S> listIds );
} |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
115 |
| fr/paris/lutece/plugins/notificationstore/web/NotificationJspBean.java |
118 |
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_DEMAND_ID ) ) )
{
_currentFilter.setDemandId( request.getParameter( PARAMETER_DEMAND_ID ) );
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) ) )
{
_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_ID ) );
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_NOTIFICATION_DATE ) ) )
{
lNotificationDate = Long.parseLong( request.getParameter( PARAMETER_NOTIFICATION_DATE ) );
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
{
String strStartDate = request.getParameter( PARAMETER_START_DATE );
Date dStartDate = DateUtil.parseIsoDate( strStartDate );
if ( dStartDate != null )
{
_currentFilter.setStartDate( dStartDate.getTime( ) );
}
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
{
String strEndDate = request.getParameter( PARAMETER_END_DATE );
Date dEndDate = DateUtil.parseIsoDate( strEndDate );
if ( dEndDate != null )
{
_currentFilter.setEndDate( dEndDate.getTime( ) );
}
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_STATUS ) ) ) |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/AbstractManageDemandJspBean.java |
85 |
| fr/paris/lutece/plugins/notificationstore/web/AbstractManageDemandTypeJspBean.java |
86 |
| fr/paris/lutece/plugins/notificationstore/web/AbstractManageJspBean.java |
81 |
protected Map<String, Object> getPaginatedListModel( HttpServletRequest request, String strBookmark, List<S> list, String strManageJsp )
{
int nDefaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_DEFAULT_LIST_ITEM_PER_PAGE, 50 );
_strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
_nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, nDefaultItemsPerPage );
UrlItem url = new UrlItem( strManageJsp );
String strUrl = url.getUrl( );
// PAGINATOR
LocalizedPaginator<S> paginator = new LocalizedPaginator<>( list, _nItemsPerPage, strUrl, PARAMETER_PAGE_INDEX, _strCurrentPageIndex, getLocale( ) );
Map<String, Object> model = getModel( );
model.put( MARK_NB_ITEMS_PER_PAGE, String.valueOf( _nItemsPerPage ) );
model.put( MARK_PAGINATOR, paginator );
model.put( strBookmark, getItemsFromIds( paginator.getPageItems( ) ) );
return model;
}
/**
* Get Items from Ids list
*
* @param <S>
* the generic type of the Ids
* @param <T>
* the generic type of the items
* @param listIds
* @return the populated list of items corresponding to the id List
*/
abstract List<T> getItemsFromIds( List<S> listIds );
} |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/business/DemandCategoryDAO.java |
195 |
| fr/paris/lutece/plugins/notificationstore/business/DemandTypeDAO.java |
247 |
List<DemandCategory> demandCategoryList = new ArrayList<>( );
StringBuilder builder = new StringBuilder( );
if ( !listIds.isEmpty( ) )
{
for ( int i = 0; i < listIds.size( ); i++ )
{
builder.append( "?," );
}
String placeHolders = builder.deleteCharAt( builder.length( ) - 1 ).toString( );
String stmt = SQL_QUERY_SELECTALL_BY_IDS + placeHolders + ")";
try ( DAOUtil daoUtil = new DAOUtil( stmt, NotificationStorePlugin.getPlugin( ) ) )
{
int index = 1;
for ( Integer n : listIds )
{
daoUtil.setInt( index++, n );
}
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{ |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
176 |
| fr/paris/lutece/plugins/notificationstore/web/NotificationJspBean.java |
168 |
Map<String, Object> model = getPaginatedListModel( request, MARK_EVENT_LIST, _listNotificationEventId, JSP_MANAGE_EVENTS );
model.put( MARK_DEMAND_TYPE_ID_LIST, _listDemandTypeId );
if ( !StringUtils.isEmpty( _currentFilter.getDemandId( ) ) )
{
model.put( MARK_DEMAND_ID, _currentFilter.getDemandId( ) );
}
if ( !StringUtils.isBlank( _currentFilter.getDemandTypeId( ) ) )
{
model.put( MARK_DEMAND_TYPE_ID, _currentFilter.getDemandTypeId( ) );
}
if ( _currentFilter.getStartDate( ) > 0 )
{
model.put( MARK_START_DATE, new Date( _currentFilter.getStartDate( ) ) );
}
if ( _currentFilter.getEndDate( ) > 0 )
{
model.put( MARK_END_DATE, new Date( _currentFilter.getEndDate( ) ) );
}
return getPage( PROPERTY_PAGE_TITLE_MANAGE_EVENT, TEMPLATE_MANAGE_EVENT, model ); |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/DemandJspBean.java |
128 |
| fr/paris/lutece/plugins/notificationstore/web/NotificationJspBean.java |
130 |
_currentFilter.setCustomerId( request.getParameter( PARAMETER_CUSTOMER_ID ) );
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
{
String strStartDate = request.getParameter( PARAMETER_START_DATE );
Date dStartDate = DateUtil.parseIsoDate( strStartDate );
if ( dStartDate != null )
{
_currentFilter.setStartDate( dStartDate.getTime( ) );
}
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
{
String strEndDate = request.getParameter( PARAMETER_END_DATE );
Date dEndDate = DateUtil.parseIsoDate( strEndDate );
if ( dEndDate != null )
{
_currentFilter.setEndDate( dEndDate.getTime( ) );
}
}
if ( _currentFilter.containsDemandId( ) || _currentFilter.containsDemandTypeId( ) || _currentFilter.containsStartDate( ) |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/business/DemandTypeDAO.java |
114 |
| fr/paris/lutece/plugins/notificationstore/business/DemandTypeDAO.java |
143 |
daoUtil.setInt( 1, nKey );
daoUtil.executeQuery( );
DemandType demandType = null;
if ( daoUtil.next( ) )
{
demandType = new DemandType( );
int nIndex = 1;
demandType.setId( daoUtil.getInt( nIndex++ ) );
demandType.setIdDemandType( daoUtil.getInt( nIndex++ ) );
demandType.setLabel( daoUtil.getString( nIndex++ ) );
demandType.setCategory( daoUtil.getString( nIndex++ ) );
demandType.setUrl( daoUtil.getString( nIndex++ ) );
demandType.setAppCode( daoUtil.getString( nIndex++ ) );
}
return Optional.ofNullable( demandType );
}
}
/**
* {@inheritDoc }
*/
@Override
public Optional<DemandType> selectByTypeId( String sKey ) |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/DemandJspBean.java |
128 |
| fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
127 |
_currentFilter.setCustomerId( request.getParameter( PARAMETER_CUSTOMER_ID ) );
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_START_DATE ) ) )
{
String strStartDate = request.getParameter( PARAMETER_START_DATE );
Date dStartDate = DateUtil.parseIsoDate( strStartDate );
if ( dStartDate != null )
{
_currentFilter.setStartDate( dStartDate.getTime( ) );
}
}
if ( !StringUtils.isEmpty( request.getParameter( PARAMETER_END_DATE ) ) )
{
String strEndDate = request.getParameter( PARAMETER_END_DATE );
Date dEndDate = DateUtil.parseIsoDate( strEndDate );
if ( dEndDate != null )
{
_currentFilter.setEndDate( dEndDate.getTime( ) );
}
}
if ( _currentFilter.containsDemandId( ) || _currentFilter.containsDemandTypeId( ) || _currentFilter.containsStartDate( ) |
| File |
Line |
| fr/paris/lutece/plugins/notificationstore/web/rs/DemandRestService.java |
111 |
| fr/paris/lutece/plugins/notificationstore/web/rs/DemandRestService.java |
160 |
public Response getListDemand(
@ApiParam( name = NotificationStoreConstants.QUERY_PARAM_ID_DEMAND_TYPE, value = SwaggerConstants.QUERY_PARAM_ID_DEMAND_TYPE_DESCRIPTION ) @QueryParam( NotificationStoreConstants.QUERY_PARAM_ID_DEMAND_TYPE ) String strIdDemandType,
@ApiParam( name = NotificationStoreConstants.QUERY_PARAM_INDEX, value = SwaggerConstants.QUERY_PARAM_INDEX_DESCRIPTION ) @QueryParam( NotificationStoreConstants.QUERY_PARAM_INDEX ) String strIndex,
@ApiParam( name = NotificationStoreConstants.QUERY_PARAM_LIMIT, value = SwaggerConstants.QUERY_PARAM_LIMIT_DESCRIPTION ) @QueryParam( NotificationStoreConstants.QUERY_PARAM_LIMIT ) String strLimitResult,
@ApiParam( name = NotificationStoreConstants.QUERY_PARAM_CUSTOMER_ID, value = SwaggerConstants.QUERY_PARAM_CUSTOMER_ID_DESCRIPTION ) @QueryParam( NotificationStoreConstants.QUERY_PARAM_CUSTOMER_ID ) String strCustomerId,
@ApiParam( name = NotificationStoreConstants.QUERY_PARAM_NOTIFICATION_TYPE, value = SwaggerConstants.QUERY_PARAM_NOTIFICATION_TYPE_DESCRIPTION ) @QueryParam( NotificationStoreConstants.QUERY_PARAM_NOTIFICATION_TYPE ) String strNotificationType, |