CPD Results
The following document contains the results of PMD's CPD 5.5.1.
Duplications
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1445 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1517 |
daoUtil.setString( 2, strUserLogin );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
SimpleEvent event = new SimpleEvent( );
event.setId( daoUtil.getInt( 1 ) );
event.setIdCalendar( daoUtil.getInt( 2 ) );
event.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
event.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
event.setDateTimeStart( daoUtil.getString( 5 ) );
event.setDateTimeEnd( daoUtil.getString( 6 ) );
event.setTitle( daoUtil.getString( 7 ) );
event.setOccurrence( daoUtil.getInt( 8 ) );
event.setPeriodicity( daoUtil.getInt( 9 ) );
event.setDateCreation( daoUtil.getTimestamp( 10 ) );
getFeature( plugin, event.getId( ), event );
event.setListCategories( CategoryHome.findByEvent( event.getId( ), plugin ) );
eventList.add( event );
}
daoUtil.free( );
return eventList;
}
/**
* Delete the link between event and user
* @param nEventId ID event
* @param plugin plugin
*/
public void deleteEventUser( int nEventId, Plugin plugin ) |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
489 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1445 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1517 |
daoUtil.setInt( 1, nAgendaId );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
SimpleEvent event = new SimpleEvent( );
event.setId( daoUtil.getInt( 1 ) );
event.setIdCalendar( daoUtil.getInt( 2 ) );
event.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
event.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
event.setDateTimeStart( daoUtil.getString( 5 ) );
event.setDateTimeEnd( daoUtil.getString( 6 ) );
event.setTitle( daoUtil.getString( 7 ) );
event.setOccurrence( daoUtil.getInt( 8 ) );
event.setPeriodicity( daoUtil.getInt( 9 ) );
event.setDateCreation( daoUtil.getTimestamp( 10 ) );
getFeature( plugin, event.getId( ), event );
event.setListCategories( CategoryHome.findByEvent( event.getId( ), plugin ) );
eventList.add( event );
}
daoUtil.free( );
return eventList;
} |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1199 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1370 |
DAOUtil daoUtil = getDaoFromFilter( SQL_QUERY_SELECT_BY_FILTER, filter, plugin );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
SimpleEvent event = new SimpleEvent( );
event.setId( daoUtil.getInt( 1 ) );
event.setIdCalendar( daoUtil.getInt( 2 ) );
event.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
event.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
event.setDateTimeStart( daoUtil.getString( 5 ) );
event.setDateTimeEnd( daoUtil.getString( 6 ) );
event.setTitle( daoUtil.getString( 7 ) );
event.setOccurrence( daoUtil.getInt( 8 ) );
event.setPeriodicity( daoUtil.getInt( 9 ) );
event.setDateCreation( daoUtil.getTimestamp( 10 ) );
getFeature( plugin, event.getId( ), event );
eventList.add( event );
}
daoUtil.free( );
return eventList;
} |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
642 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
689 |
daoUtil.setInt( 2, nEventId );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
OccurrenceEvent occurrence = new OccurrenceEvent( );
occurrence.setId( daoUtil.getInt( 1 ) );
occurrence.setEventId( daoUtil.getInt( 2 ) );
occurrence.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
occurrence.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
occurrence.setDateTimeStart( daoUtil.getString( 5 ) );
occurrence.setDateTimeEnd( daoUtil.getString( 6 ) );
occurrence.setTitle( daoUtil.getString( 7 ) );
occurrence.setStatus( daoUtil.getString( 8 ) );
getFeature( plugin, occurrence.getEventId( ), occurrence );
occurrence.setListCategories( CategoryHome.findByEvent( occurrence.getEventId( ), plugin ) );
occurrenceList.add( occurrence );
}
daoUtil.free( );
return occurrenceList;
}
/**
* Load the list of all Occurrences
* @return The Collection of the Occurrences
* @param nSortEvents An integer used for sorting issues
* @param plugin The plugin
* @param nAgendaId The identifier of the agenda
*
*/
public List<OccurrenceEvent> selectOccurrencesList( int nAgendaId, int nSortEvents, Plugin plugin ) |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
489 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1199 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1370 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1445 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
1517 |
daoUtil.setInt( 1, nAgendaId );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
SimpleEvent event = new SimpleEvent( );
event.setId( daoUtil.getInt( 1 ) );
event.setIdCalendar( daoUtil.getInt( 2 ) );
event.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
event.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
event.setDateTimeStart( daoUtil.getString( 5 ) );
event.setDateTimeEnd( daoUtil.getString( 6 ) );
event.setTitle( daoUtil.getString( 7 ) );
event.setOccurrence( daoUtil.getInt( 8 ) );
event.setPeriodicity( daoUtil.getInt( 9 ) );
event.setDateCreation( daoUtil.getTimestamp( 10 ) );
getFeature( plugin, event.getId( ), event ); |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
688 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
724 |
DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_ALL_OCCURRENCES + strSortEvents, plugin );
daoUtil.setInt( 1, nAgendaId );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
OccurrenceEvent occurrence = new OccurrenceEvent( );
occurrence.setId( daoUtil.getInt( 1 ) );
occurrence.setEventId( daoUtil.getInt( 2 ) );
occurrence.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
occurrence.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
occurrence.setDateTimeStart( daoUtil.getString( 5 ) );
occurrence.setDateTimeEnd( daoUtil.getString( 6 ) );
occurrence.setTitle( daoUtil.getString( 7 ) );
occurrence.setStatus( daoUtil.getString( 8 ) );
getFeature( plugin, occurrence.getEventId( ), occurrence ); |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
642 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
725 |
daoUtil.setInt( 2, nEventId );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
OccurrenceEvent occurrence = new OccurrenceEvent( );
occurrence.setId( daoUtil.getInt( 1 ) );
occurrence.setEventId( daoUtil.getInt( 2 ) );
occurrence.setDate( new java.util.Date( daoUtil.getDate( 3 ).getTime( ) ) );
occurrence.setDateEnd( new java.util.Date( daoUtil.getDate( 4 ).getTime( ) ) );
occurrence.setDateTimeStart( daoUtil.getString( 5 ) );
occurrence.setDateTimeEnd( daoUtil.getString( 6 ) );
occurrence.setTitle( daoUtil.getString( 7 ) );
occurrence.setStatus( daoUtil.getString( 8 ) );
getFeature( plugin, occurrence.getEventId( ), occurrence ); |
File |
Line |
fr/paris/lutece/plugins/calendar/service/Utils.java |
757 |
fr/paris/lutece/plugins/calendar/service/Utils.java |
807 |
for ( AgendaResource agendaResource : getAgendaResourcesWithOccurrences( ) )
{
if ( agendaResource.getAgenda( ).getKeyName( ).equals( strAgenda ) )
{
Agenda a = agendaResource.getAgenda( );
if ( a != null )
{
// Check security access
String strRole = agendaResource.getRole( );
if ( StringUtils.isNotBlank( strRole ) && ( request != null )
&& ( !Constants.PROPERTY_ROLE_NONE.equals( strRole ) ) )
{
if ( SecurityService.isAuthenticationEnable( ) )
{
if ( SecurityService.getInstance( ).isUserInRole( request, strRole ) )
{
agenda = a;
}
}
}
else
{
agenda = a;
}
}
}
}
}
else
{
agenda = new SimpleAgenda( );
}
return agenda;
}
/**
* Get a specified agenda from database with occurrences
* @param strAgenda The agenda to get
* @param request The HTTP request
* @return An agenda object
*/
public static Agenda getAgendaWithOccurrencesOrderedbyId( String strAgenda, HttpServletRequest request ) |
File |
Line |
fr/paris/lutece/plugins/calendar/web/portlet/CalendarPortletJspBean.java |
130 |
fr/paris/lutece/plugins/calendar/web/portlet/MiniCalendarPortletJspBean.java |
105 |
CalendarPortlet portlet = new CalendarPortlet( );
// Standard controls on the creation form
String strIdPage = request.getParameter( PARAMETER_PAGE_ID );
int nIdPage = Integer.parseInt( strIdPage );
String strStyleId = request.getParameter( Parameters.STYLE );
if ( ( strStyleId == null ) || strStyleId.trim( ).equals( "" ) )
{
return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
}
setPortletCommonData( request, portlet );
// mandatory field
String strName = portlet.getName( );
if ( strName.trim( ).equals( "" ) )
{
return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
}
portlet.setPageId( nIdPage ); |
File |
Line |
fr/paris/lutece/plugins/calendar/business/category/CategoryDAO.java |
80 |
fr/paris/lutece/plugins/calendar/business/category/CategoryDAO.java |
188 |
DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
nParam = 0;
Category category = new Category( );
category.setId( daoUtil.getInt( ++nParam ) );
category.setName( daoUtil.getString( ++nParam ) );
category.setDescription( daoUtil.getString( ++nParam ) );
category.setIconContent( daoUtil.getBytes( ++nParam ) );
category.setIconMimeType( daoUtil.getString( ++nParam ) );
category.setWorkgroup( daoUtil.getString( ++nParam ) );
listCategory.add( category );
}
daoUtil.free( );
return listCategory;
}
/**
* Insert a new Category
* @param category The object category to insert
* @param plugin Plugin
*/
public void insert( Category category, Plugin plugin ) |
File |
Line |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
362 |
fr/paris/lutece/plugins/calendar/business/CalendarDAO.java |
393 |
agenda = new AgendaResource( );
agenda.setId( String.valueOf( daoUtil.getInt( 1 ) ) );
agenda.setName( daoUtil.getString( 2 ) );
agenda.setEventImage( daoUtil.getString( 3 ) );
agenda.setEventPrefix( daoUtil.getString( 4 ) );
agenda.setRole( daoUtil.getString( 5 ) );
agenda.setRoleManager( daoUtil.getString( 6 ) );
agenda.setWorkgroup( daoUtil.getString( 7 ) );
agenda.setNotify( daoUtil.getBoolean( 8 ) );
agenda.setPeriodValidity( daoUtil.getInt( 9 ) ); |
File |
Line |
fr/paris/lutece/plugins/calendar/service/CategoryService.java |
122 |
fr/paris/lutece/plugins/calendar/service/CategoryService.java |
150 |
public static Collection<CategoryDisplay> getAllCategoriesDisplay( AdminUser user )
{
Plugin plugin = PluginService.getPlugin( Constants.PLUGIN_NAME );
Collection<Category> listCategory = CategoryHome.findAll( plugin );
listCategory = AdminWorkgroupService.getAuthorizedCollection( listCategory, user );
Collection<CategoryDisplay> listCategoryDisplay = new ArrayList<CategoryDisplay>( );
for ( Category category : listCategory )
{
CategoryDisplay categoryDisplay = _singleton.new CategoryDisplay( );
categoryDisplay.setCategory( category );
categoryDisplay.setIconUrl( getResourceImageCategory( category.getId( ) ) );
categoryDisplay.setCountLinkedDocuments( CategoryHome.findCountIdEvents( category.getId( ), plugin ) );
categoryDisplay.setAssigned( false ); |
File |
Line |
fr/paris/lutece/plugins/calendar/web/portlet/CalendarPortletJspBean.java |
317 |
fr/paris/lutece/plugins/calendar/web/portlet/MiniCalendarPortletJspBean.java |
209 |
modifyCalendar( request, nPortletId, strDateBegin, strDateEnd, nDays, bIntervalPeriodicity );
return getPageUrl( portlet.getPageId( ) );
}
/**
* Return the list of time intervals declared in properties file
* @return A ReferenceList of time interval
* @param request The HttpRequest
*/
public static ReferenceList getIntervalList( HttpServletRequest request )
{
StringTokenizer st = new StringTokenizer( AppPropertiesService.getProperty( PROPERTY_TIME_INTERVAL_LIST ), "," );
ReferenceList timeIntervalList = new ReferenceList( );
while ( st.hasMoreElements( ) )
{
String strIntervalName = st.nextToken( ).trim( );
String strDescription = I18nService.getLocalizedString( "calendar.interval." + strIntervalName
+ ".description", request.getLocale( ) );
int nDays = AppPropertiesService.getPropertyInt( "calendar.interval." + strIntervalName + ".value", 7 );
timeIntervalList.addItem( nDays, strDescription );
}
return timeIntervalList;
} |
File |
Line |
fr/paris/lutece/plugins/calendar/web/MonthCalendarView.java |
154 |
fr/paris/lutece/plugins/calendar/web/WeekCalendarView.java |
108 |
StringBuffer sbEvents = new StringBuffer( );
String strDate = Utils.getDate( calendar );
if ( agenda.hasEvents( strDate ) )
{
Date date = Utils.getDate( Utils.getDate( calendar ) );
Plugin plugin = PluginService.getPlugin( CalendarPlugin.PLUGIN_NAME );
List<Event> listIndexedEvents = CalendarSearchService.getInstance( ).getSearchResults(
agenda.getAgendaIds( ), null, "", date, date, plugin );
for ( Event event : listIndexedEvents )
{
MultiAgendaEvent multiAgendaEvent = new MultiAgendaEvent( event,
String.valueOf( event.getIdCalendar( ) ) ); |
File |
Line |
fr/paris/lutece/plugins/calendar/web/MonthCalendarView.java |
196 |
fr/paris/lutece/plugins/calendar/web/WeekCalendarView.java |
141 |
HtmlTemplate tDay = AppTemplateService.getTemplate( TEMPLATE_VIEW_DAY, options.getLocale( ), dayModel );
return tDay.getHtml( );
}
/**
* Calculate the style class to render the day
* @param calendar A calendar object positionned on the day to render
* @return A CSS style
*/
private String getDayClass( Calendar calendar )
{
String strClass = Constants.STYLE_CLASS_VIEW_MONTH_DAY;
String strDate = Utils.getDate( calendar );
String strToday = Utils.getDateToday( );
if ( Utils.isDayOff( calendar ) )
{
strClass += Constants.STYLE_CLASS_SUFFIX_OFF;
}
else if ( strDate.compareTo( strToday ) < 0 )
{
strClass += Constants.STYLE_CLASS_SUFFIX_OLD;
}
else if ( strDate.equals( strToday ) )
{
strClass += Constants.STYLE_CLASS_SUFFIX_TODAY;
}
return strClass;
}
/**
* Returns the next code date corresponding to the current view and the
* current date
* @param strDate The current date code
* @return The next code date
*/
public String getNext( String strDate )
{
return Utils.getNextMonth( strDate ); |
File |
Line |
fr/paris/lutece/plugins/calendar/web/CalendarCategoryJspBean.java |
337 |
fr/paris/lutece/plugins/calendar/web/CalendarCategoryJspBean.java |
373 |
public String getConfirmRemoveCategory( HttpServletRequest request ) throws AccessDeniedException
{
if ( !RBACService.isAuthorized( CalendarResourceIdService.RESOURCE_TYPE, RBAC.WILDCARD_RESOURCES_ID,
CalendarResourceIdService.PERMISSION_MANAGE, getUser( ) ) )
{
throw new AccessDeniedException( );
}
int nIdCategory = checkCategoryId( request );
if ( nIdCategory == ERROR_ID_CATEGORY )
{
return AdminMessageService.getMessageUrl( request, MESSAGE_CATEGORY_ERROR, AdminMessage.TYPE_ERROR );
}
Plugin plugin = PluginService.getPlugin( Constants.PLUGIN_NAME );
// Test if the category is assigned
if ( CategoryHome.findCountIdEvents( nIdCategory, plugin ) > 0 )
{
return AdminMessageService.getMessageUrl( request, MESSAGE_CATEGORY_IS_LINKED, AdminMessage.TYPE_STOP );
} |
File |
Line |
fr/paris/lutece/plugins/calendar/web/portlet/CalendarPortletJspBean.java |
265 |
fr/paris/lutece/plugins/calendar/web/portlet/MiniCalendarPortletJspBean.java |
179 |
CalendarPortlet portlet = (CalendarPortlet) PortletHome.findByPrimaryKey( nPortletId );
// Standard controls on the creation form
String strStyleId = request.getParameter( Parameters.STYLE );
if ( ( strStyleId == null ) || strStyleId.trim( ).equals( "" ) )
{
return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
}
setPortletCommonData( request, portlet );
// mandatory field
String strName = portlet.getName( );
if ( strName.trim( ).equals( "" ) )
{
return AdminMessageService.getMessageUrl( request, Messages.MANDATORY_FIELDS, AdminMessage.TYPE_STOP );
}
portlet.update( );
String strDateBegin = request.getParameter( PARAMETER_DATE_BEGIN ); |
File |
Line |
fr/paris/lutece/plugins/calendar/business/SimpleAgenda.java |
62 |
fr/paris/lutece/plugins/calendar/modules/ical/ICalAgenda.java |
72 |
public SimpleAgenda( )
{
}
/**
* Returns the name of the Agenda
* @return The agenda's name
*/
public String getName( )
{
return _strName;
}
/**
* Defines the name of the Agenda
* @param strName The agenda's name
*/
public void setName( String strName )
{
_strName = strName;
}
/**
* Returns the KeyName
*
* @return The KeyName
*/
public String getKeyName( )
{
return _strKeyName;
}
/**
* Sets the KeyName
*
* @param strKeyName The KeyName
*/
public void setKeyName( String strKeyName )
{
_strKeyName = strKeyName;
}
/**
* Indicates if the agenda gets events for a given date
* @param strDate A date code
* @return True if there is events, otherwise false
*/
public boolean hasEvents( String strDate )
{
return _mapDays.containsKey( strDate );
}
/**
* Retrieves events for a given date
* @param strDate A date code
* @return A list of events
*/
public List<Event> getEventsByDate( String strDate )
{
List<Event> listEvents = null;
if ( hasEvents( strDate ) )
{
listEvents = _mapDays.get( strDate );
}
return listEvents;
}
/**
* Add an event to the agenda
* @param event The event to add
*/
public void addEvent( Event event ) |