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/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 );
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
116 |
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 ) ) ) |
Fichier |
Ligne |
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 );
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/business/DemandCategoryDAO.java |
191 |
fr/paris/lutece/plugins/notificationstore/business/DemandTypeDAO.java |
197 |
fr/paris/lutece/plugins/notificationstore/business/StatusDAO.java |
182 |
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( ) )
{ |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/web/DemandJspBean.java |
152 |
fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
178 |
fr/paris/lutece/plugins/notificationstore/web/NotificationJspBean.java |
169 |
Map<String, Object> model = getPaginatedListModel( request, MARK_DEMAND_LIST, _listDemanId, JSP_MANAGE_DEMANDS );
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_DEMAND, TEMPLATE_MANAGE_DEMAND, model ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/web/rs/DemandTypeRestService.java |
114 |
fr/paris/lutece/plugins/notificationstore/web/rs/DemandTypeRestService.java |
171 |
public Response createDemandType( @FormParam( NotificationStoreConstants.DEMANDTYPE_ATTRIBUTE_ID_DEMAND_TYPE ) String strIdDemandType,
@FormParam( NotificationStoreConstants.DEMANDTYPE_ATTRIBUTE_LABEL ) String strLabel,
@FormParam( NotificationStoreConstants.DEMANDTYPE_ATTRIBUTE_URL ) String strUrl,
@FormParam( NotificationStoreConstants.DEMANDTYPE_ATTRIBUTE_APP_CODE ) String strAppCode,
@FormParam( NotificationStoreConstants.DEMANDTYPE_ATTRIBUTE_CATEGORY ) String strCategory )
{
if ( StringUtils.isEmpty( strIdDemandType ) || StringUtils.isEmpty( strLabel )
|| StringUtils.isEmpty( strUrl ) || StringUtils.isEmpty( strAppCode ) )
{
return Response.status( Response.Status.BAD_REQUEST )
.entity( JsonUtil.buildJsonResponse( new ErrorJsonResponse( Response.Status.BAD_REQUEST.name( ), NotificationStoreConstants.MESSAGE_ERROR_BAD_REQUEST_EMPTY_PARAMETER ) ) )
.build( );
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/web/DemandJspBean.java |
121 |
fr/paris/lutece/plugins/notificationstore/web/NotificationJspBean.java |
130 |
_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_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( ) |
Fichier |
Ligne |
fr/paris/lutece/plugins/notificationstore/web/DemandJspBean.java |
121 |
fr/paris/lutece/plugins/notificationstore/web/NotificationEventJspBean.java |
128 |
_currentFilter.setDemandTypeId( request.getParameter( PARAMETER_DEMAND_TYPE_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( ) |