CPD Results
The following document contains the results of PMD's CPD 6.13.0.
Duplications
File |
Line |
fr/paris/lutece/plugins/appointment/business/comment/Comment.java |
68 |
fr/paris/lutece/plugins/appointment/web/dto/CommentDTO.java |
63 |
private String _strCreatorUserConnectId;
/**
* Returns the Id
*
* @return The Id
*/
public int getId( )
{
return _nId;
}
/**
* Sets the Id
*
* @param nId
* The Id
*/
public void setId( int nId )
{
_nId = nId;
}
/**
* Returns the IdForm
*
* @return The IdForm
*/
public int getIdForm( )
{
return _nIdForm;
}
/**
* Sets the IdForm
*
* @param nIdForm
* The IdForm
*/
public void setIdForm( int nIdForm )
{
_nIdForm = nIdForm;
}
/**
* Returns the StartingValidityDate
*
* @return The StartingValidityDate
*/
public LocalDate getStartingValidityDate( )
{
return _dateStartingValidityDate;
}
/**
* Sets the StartingValidityDate
*
* @param dateStartingValidityDate
* The StartingValidityDate
*/
public void setStartingValidityDate( LocalDate dateStartingValidityDate )
{
_dateStartingValidityDate = dateStartingValidityDate;
}
/**
* Returns the EndingValidityDate
*
* @return The EndingValidityDate
*/
public LocalDate getEndingValidityDate( )
{
return _dateEndingValidityDate;
}
/**
* Sets the EndingValidityDate
*
* @param dateEndingValidityDate
* The EndingValidityDate
*/
public void setEndingValidityDate( LocalDate dateEndingValidityDate )
{
_dateEndingValidityDate = dateEndingValidityDate;
}
/**
* Returns the Comment
*
* @return The Comment
*/
public String getComment( )
{
return _strComment;
}
/**
* Sets the Comment
*
* @param strComment
* The Comment
*/
public void setComment( String strComment )
{
_strComment = strComment;
}
/**
* Returns the CreationDate
*
* @return The CreationDate
*/
public LocalDate getCreationDate( )
{
return _dateCreationDate;
}
/**
* Sets the CreationDate
*
* @param dateCreationDate
* The CreationDate
*/
public void setCreationDate( LocalDate dateCreationDate )
{
_dateCreationDate = dateCreationDate;
}
/**
* UserConnectId
*
* @return The _strCreatorUserConnectId
*/
public String getCreatorUserName( )
{
return _strCreatorUserConnectId;
}
/**
* Sets the strCreatorUserConnectId
*
* @param creatorUserConnectId
* The creatorUserConnectId
*/
public void setCreatorUserName( String creatorUserConnectId )
{
_strCreatorUserConnectId = creatorUserConnectId;
}
/**
* Returns the StartingValidityTime
*
* @return The StartingValidityTime
*/
public LocalTime getStartingValidityTime( )
{
return _timeStartingValidityTime;
}
/**
* Sets the StartingValidityTime
*
* @param timeStartingValidityTime
* The StartingValidityTime
*/
public void setStartingValidityTime( LocalTime timeStartingValidityTime )
{
_timeStartingValidityTime = timeStartingValidityTime;
}
/**
* Returns the EndingValidityTime
*
* @return The EndingValidityTime
*/
public LocalTime getEndingValidityTime( )
{
return _timeEndingValidityTime;
}
/**
* Sets the EndingValidityTime
*
* @param timeEndingValidityTime
* The EndingValidityTime
*/
public void setEndingValidityTime( LocalTime timeEndingValidityTime )
{
_timeEndingValidityTime = timeEndingValidityTime;
}
/**
* Gets the DateCalendarAllDaySlotEnd
*
* @return The DateCalendarAllDaySlotEnd
*/
public LocalDate getCalendarAllDaySlotEnd( )
{
return _dateEndingValidityDate.plusDays( 1 );
} |
File |
Line |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
245 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
290 |
daoUtil.setDate( 2, startingDate );
daoUtil.setInt( 3, nIdForm );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
Comment comment = new Comment( );
int nIndex = 1;
comment.setId( daoUtil.getInt( nIndex++ ) );
comment.setIdForm( daoUtil.getInt( nIndex++ ) );
comment.setStartingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time startingTime = daoUtil.getTime( nIndex++ );
if ( startingTime != null )
{
comment.setStartingValidityTime( startingTime.toLocalTime( ) );
}
comment.setEndingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time endingTime = daoUtil.getTime( nIndex++ );
if ( endingTime != null )
{
comment.setEndingValidityTime( endingTime.toLocalTime( ) );
}
comment.setComment( daoUtil.getString( nIndex++ ) );
comment.setCreationDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
comment.setCreatorUserName( daoUtil.getString( nIndex++ ) );
commentList.add( comment );
}
return commentList;
}
}
/**
* {@inheritDoc }
*/
@Override
public List<Comment> selectCommentsListInclusive( Plugin plugin, Date startingDate, Date endingDate, int nIdForm ) |
File |
Line |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
203 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
248 |
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
Comment comment = new Comment( );
int nIndex = 1;
comment.setId( daoUtil.getInt( nIndex++ ) );
comment.setIdForm( daoUtil.getInt( nIndex++ ) );
comment.setStartingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time startingTime = daoUtil.getTime( nIndex++ );
if ( startingTime != null )
{
comment.setStartingValidityTime( startingTime.toLocalTime( ) );
}
comment.setEndingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time endingTime = daoUtil.getTime( nIndex++ );
if ( endingTime != null )
{
comment.setEndingValidityTime( endingTime.toLocalTime( ) );
}
comment.setComment( daoUtil.getString( nIndex++ ) );
comment.setCreationDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
comment.setCreatorUserName( daoUtil.getString( nIndex++ ) );
commentList.add( comment );
}
return commentList;
}
}
/**
* {@inheritDoc }
*/
@Override
public List<Comment> selectCommentsList( Plugin plugin, Date startingDate, Date endingDate, int nIdForm ) |
File |
Line |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
203 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
293 |
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
Comment comment = new Comment( );
int nIndex = 1;
comment.setId( daoUtil.getInt( nIndex++ ) );
comment.setIdForm( daoUtil.getInt( nIndex++ ) );
comment.setStartingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time startingTime = daoUtil.getTime( nIndex++ );
if ( startingTime != null )
{
comment.setStartingValidityTime( startingTime.toLocalTime( ) );
}
comment.setEndingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time endingTime = daoUtil.getTime( nIndex++ );
if ( endingTime != null )
{
comment.setEndingValidityTime( endingTime.toLocalTime( ) );
}
comment.setComment( daoUtil.getString( nIndex++ ) );
comment.setCreationDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
comment.setCreatorUserName( daoUtil.getString( nIndex++ ) );
commentList.add( comment );
}
return commentList;
}
}
/**
* {@inheritDoc }
*/
@Override
public List<Comment> selectCommentsList( Plugin plugin, Date startingDate, Date endingDate, int nIdForm ) |
File |
Line |
fr/paris/lutece/plugins/appointment/web/AppointmentApp.java |
1464 |
fr/paris/lutece/plugins/appointment/web/AppointmentApp.java |
1509 |
if ( luteceUser == null )
{
throw new UserNotSignedException( );
}
AppointmentFilterDTO appointmentFilter = new AppointmentFilterDTO( );
appointmentFilter.setGuid( luteceUser.getName( ) );
List<AppointmentDTO> listAppointmentDTO = AppointmentService.findListAppointmentsDTOByFilter( appointmentFilter );
for ( AppointmentDTO apptDto : listAppointmentDTO )
{
Form form = FormService.findFormLightByPrimaryKey( apptDto.getIdForm( ) );
if ( form.getIdWorkflow( ) > 0 && WorkflowService.getInstance( ).isAvailable( ) )
{
apptDto.setListWorkflowActions( WorkflowService.getInstance( ).getActions( apptDto.getIdAppointment( ), Appointment.APPOINTMENT_RESOURCE_TYPE,
form.getIdWorkflow( ), luteceUser ) );
}
}
model = ( model == null ) ? new HashMap<>( ) : model;
model.put( MARK_LIST_APPOINTMENTS, listAppointmentDTO );
model.put( MARK_FORM_LIST, FormService.findAllInReferenceList( ) );
model.put( MARK_LOCALE_DATE_TIME, LocalDateTime.now( ) );
HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MY_APPOINTMENTS, locale, model );
return template.getHtml( );
}
/**
* Get the HTML content of a user's "My appointments" page
*
* @param request
* The request
* @param locale
* The locale
* @return The HTML content, or null if the user is not logged in
* @throws UserNotSignedException
* If the user has not signed in
*/
public static String getMyAppointmentsHtml( HttpServletRequest request, Locale locale, Map<String, Object> model ) throws UserNotSignedException |
File |
Line |
fr/paris/lutece/plugins/appointment/web/CommentJspBean.java |
212 |
fr/paris/lutece/plugins/appointment/web/CommentJspBean.java |
304 |
_comment.setComment( request.getParameter( PARAMETER_COMMENT ) );
_comment.setStartingValidityDate( DateUtil.formatDate( request.getParameter( PARAMETER_STARTING_VALIDITY_DATE ), getLocale( ) ).toInstant( )
.atZone( ZoneId.systemDefault( ) ).toLocalDate( ) );
_comment.setEndingValidityDate( DateUtil.formatDate( request.getParameter( PARAMETER_ENDING_VALIDITY_DATE ), getLocale( ) ).toInstant( )
.atZone( ZoneId.systemDefault( ) ).toLocalDate( ) );
if ( !request.getParameter( PARAMETER_STARTING_VALIDITY_TIME ).isEmpty( ) )
{
_comment.setStartingValidityTime( LocalTime.parse( request.getParameter( PARAMETER_STARTING_VALIDITY_TIME ) ) );
}
if ( !request.getParameter( PARAMETER_ENDING_VALIDITY_TIME ).isEmpty( ) )
{
_comment.setEndingValidityTime( LocalTime.parse( request.getParameter( PARAMETER_ENDING_VALIDITY_TIME ) ) );
}
// Check constraints
if ( !validateBean( _comment, VALIDATION_ATTRIBUTES_PREFIX ) || !validateDateStartEndValidity( _comment ) )
{
addError( INFO_COMMENT_ERROR, getLocale( ) );
}
else
{
CommentService.createAndNotifyMailingList( _comment, nIdMailingList, getLocale( ) ); |
File |
Line |
fr/paris/lutece/plugins/appointment/service/CalendarBuilder.java |
88 |
fr/paris/lutece/plugins/appointment/service/CalendarBuilder.java |
263 |
Slot slotToAdd;
TimeSlot timeSlot;
LocalDate dateToCompare;
// Need to check if this date is not before the form date creation
WeekDefinition firsWeek = listDateReservationRule.stream( ).sorted( ( week1, week2 ) -> week1.getDateOfApply( ).compareTo( week2.getDateOfApply( ) ) )
.findFirst( ).orElse( null );
final LocalDate firstDateOfReservationRule = firsWeek.getDateOfApply( );
LocalDate startingDateToUse = startingDate;
if ( firstDateOfReservationRule != null && startingDate.isBefore( firstDateOfReservationRule ) )
{
startingDateToUse = firstDateOfReservationRule;
}
// Get all the closing day of this period
List<LocalDate> listDateOfClosingDay = ClosingDayService.findListDateOfClosingDayByIdFormAndDateRange( nIdForm, startingDateToUse, endingDate );
// Get all the slot between these two dates
Map<LocalDateTime, Slot> mapSlot = SlotService.buildMapSlotsByIdFormAndDateRangeWithDateForKey( nIdForm, startingDateToUse.atStartOfDay( ),
endingDate.atTime( LocalTime.MAX ) );
// Get or build all the event for the period
while ( !dateTemp.isAfter( endingDate ) )
{
dateToCompare = dateTemp;
// Find the closest date of apply of reservation rule with the given
// date
reservationRuleToApply = null;
closestweeDef = Utilities.getClosestWeekDefinitionInPast( listDateReservationRule, dateToCompare );
if ( closestweeDef != null )
{
reservationRuleToApply = mapReservationRule.get( closestweeDef );
} |
File |
Line |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
117 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
207 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
252 |
fr/paris/lutece/plugins/appointment/business/comment/CommentDAO.java |
297 |
comment = new Comment( );
int nIndex = 1;
comment.setId( daoUtil.getInt( nIndex++ ) );
comment.setIdForm( daoUtil.getInt( nIndex++ ) );
comment.setStartingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time startingTime = daoUtil.getTime( nIndex++ );
if ( startingTime != null )
{
comment.setStartingValidityTime( startingTime.toLocalTime( ) );
}
comment.setEndingValidityDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
Time endingTime = daoUtil.getTime( nIndex++ );
if ( endingTime != null )
{
comment.setEndingValidityTime( endingTime.toLocalTime( ) );
}
comment.setComment( daoUtil.getString( nIndex++ ) );
comment.setCreationDate( daoUtil.getDate( nIndex++ ).toLocalDate( ) );
comment.setCreatorUserName( daoUtil.getString( nIndex ) ); |
File |
Line |
fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java |
378 |
fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java |
449 |
addFilterParametersToDAOUtil( appointmentFilter, daoUtil );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
Appointment appt = buildAppointment( daoUtil );
Slot slot = builSlot( daoUtil, 18 );
User user = buildUser( daoUtil, 12 );
if ( isFirst || daoUtil.isLast( ) )
{
appt.setSlot( SlotHome.findByIdAppointment( appt.getIdAppointment( ) ) );
}
else
{
appt.addSlot( slot );
}
appt.setUser( user );
Appointment apptAdded = mapAppointment.get( appt.getIdAppointment( ) );
if ( apptAdded == null )
{
mapAppointment.put( appt.getIdAppointment( ), appt );
}
else
{
apptAdded.addSlot( slot );
}
isFirst = false;
}
}
return new ArrayList<>( mapAppointment.values( ) );
} |
File |
Line |
fr/paris/lutece/plugins/appointment/web/AppointmentApp.java |
895 |
fr/paris/lutece/plugins/appointment/web/AppointmentJspBean.java |
1128 |
}
List<AppointmentDTO> listAppointments = new ArrayList<>( );
if ( _appointmentForm.getEnableMandatoryEmail( )
&& !AppointmentUtilities.checkNbMaxAppointmentsDefinedOnCategory( _notValidatedAppointment, strEmail, _appointmentForm, listAppointments ) )
{
StringJoiner builder = new StringJoiner( StringUtils.SPACE );
String lf = System.getProperty( "line.separator" );
for ( AppointmentDTO appt : listAppointments )
{
builder.add( appt.getLastName( ) );
builder.add( appt.getFirstName( ) );
builder.add( appt.getDateOfTheAppointment( ) );
builder.add( appt.getStartingTime( ).toString( ) );
builder.add( lf );
}
Object [ ] tabAppointment = {
builder.toString( )
};
String strErrorMessageDateWithAppointments = I18nService.getLocalizedString( ERROR_MESSAGE_NB_MAX_APPOINTMENTS_ON_A_CATEGORY, tabAppointment,
locale ); |
File |
Line |
fr/paris/lutece/plugins/appointment/business/appointment/AppointmentDAO.java |
748 |
fr/paris/lutece/plugins/appointment/business/slot/SlotDAO.java |
294 |
Slot slot = new Slot( );
slot.setIdSlot( daoUtil.getInt( nIndex++ ) );
slot.setStartingTimeStampDate( daoUtil.getTimestamp( nIndex++ ) );
slot.setEndingTimeStampDate( daoUtil.getTimestamp( nIndex++ ) );
slot.setIsOpen( daoUtil.getBoolean( nIndex++ ) );
slot.setIsSpecific( daoUtil.getBoolean( nIndex++ ) );
slot.setMaxCapacity( daoUtil.getInt( nIndex++ ) );
slot.setNbRemainingPlaces( daoUtil.getInt( nIndex++ ) );
slot.setNbPotentialRemainingPlaces( daoUtil.getInt( nIndex++ ) );
slot.setNbPlacestaken( daoUtil.getInt( nIndex++ ) );
slot.setIdForm( daoUtil.getInt( nIndex ) );
return slot;
}
/**
* Build a User business object from the resultset
*
* @param daoUtil
* the prepare statement util object
* @return a new User with all its attributes assigned
*/
private User buildUser( DAOUtil daoUtil, int nIndex ) |
File |
Line |
fr/paris/lutece/plugins/appointment/web/TypicalWeekJspBean.java |
587 |
fr/paris/lutece/plugins/appointment/web/TypicalWeekJspBean.java |
775 |
listSlotsImpactedByDate.addAll( SlotService.findSlotWithAppointmentByDateRange( nIdForm, week.getDateOfApply( ).atStartOfDay( ),
week.getEndingDateOfApply( ).atTime( LocalTime.MAX ) ) );
}
// If there are slots impacted
if ( CollectionUtils.isNotEmpty( listSlotsImpacted ) )
{
List<Integer> listIdSlotsImpacted = listSlotsImpacted.stream( ).map( Slot::getIdSlot ).collect( Collectors.toList( ) );
List<Slot> listSlotsImpactedWithAppointment = listSlotsImpactedByDate.stream( ).filter( slot -> listIdSlotsImpacted.contains( slot.getIdSlot( ) ) )
.collect( Collectors.toList( ) );
// if there are appointments impacted
if ( CollectionUtils.isNotEmpty( listSlotsImpactedWithAppointment ) )
{
// If the ending time of the time slot has changed or if the max
// capacity has decreased
if ( bEndingTimeHasChanged || nMaxCapacity < oldTimeSlot.getMaxCapacity( ) ) |
File |
Line |
fr/paris/lutece/plugins/appointment/business/rule/ReservationRule.java |
95 |
fr/paris/lutece/plugins/appointment/web/dto/ReservationRuleDTO.java |
113 |
private int _nIdForm;
/**
* List of the working days that define the week definition
*/
private List<WorkingDay> _listWorkingDays;
/**
* Get the id of the rule of the reservation
*
* @return the id of the rule of the reservation
*/
public int getIdReservationRule( )
{
return _nIdReservationRule;
}
/**
* Set the id of the rule of the reservation
*
* @param nIdReservationRule
* the id to set
*/
public void setIdReservationRule( int nIdReservationRule )
{
this._nIdReservationRule = nIdReservationRule;
}
/**
* Returns the Name
*
* @return The Name
*/
public String getName( )
{
return _strName;
}
/**
* Sets the Name
*
* @param strName
* The Name
*/
public void setName( String strName )
{
_strName = strName;
}
/**
* Returns the Description
*
* @return The Description
*/
public String getDescriptionRule( )
{
return _strDescriptionRule;
}
/**
* Sets the Description
*
* @param strDescription
* The Description
*/
public void setDescriptionRule( String strDescription )
{
_strDescriptionRule = strDescription;
}
/**
* Returns the Color
*
* @return The Color
*/
public String getColor( )
{
return _strColor;
}
/**
* Sets the Color
*
* @param strColor
* The Color
*/
public void setColor( String strColor )
{
_strColor = strColor;
}
/**
* Returns the Enable
*
* @return The Enable
*/
public boolean getEnable( )
{
return _bEnable;
}
/**
* Sets the Enable
*
* @param bEnable
* The Enable
*/
public void setEnable( boolean bEnable )
{
_bEnable = bEnable;
}
/**
* Get the maximum capacity for a slot
*
* @return the maximum capacity for a slot
*/
public int getMaxCapacityPerSlot( ) |
File |
Line |
fr/paris/lutece/plugins/appointment/web/AppointmentApp.java |
1230 |
fr/paris/lutece/plugins/appointment/web/AppointmentJspBean.java |
1252 |
return redirect( request, VIEW_APPOINTMENT_CALENDAR, PARAMETER_ID_FORM, nIdForm, PARAMETER_NB_PLACE_TO_TAKE, _nNbPlacesToTake );
}
for ( Response response : _validatedAppointment.getListResponse( ) )
{
if ( response.getFile( ) != null )
{
IFileStoreServiceProvider fileStoreService = FileService.getInstance( ).getFileStoreServiceProvider( );
File file = null;
try
{
file = fileStoreService.getFile( response.getFile( ).getFileKey( ) );
}
catch( FileServiceException e )
{
AppLogService.error( "Error get file: " + response.getFile( ).getFileKey( ), e );
}
response.setFile( file );
}
}
Map<String, String> additionalParameters = new HashMap<>( );
additionalParameters.put( PARAMETER_MODIF_DATE, "true" ); |
File |
Line |
fr/paris/lutece/plugins/appointment/web/TypicalWeekJspBean.java |
542 |
fr/paris/lutece/plugins/appointment/web/TypicalWeekJspBean.java |
712 |
List<WeekDefinition> listWeekDefinition = WeekDefinitionService.findByReservationRule( nIdReservationRule );
if ( listWeekDefinition.stream( ).anyMatch( week -> week.getDateOfApply( ).isBefore( dateNow ) ) )
{
addError( MESSAGE_ERROR_MODIFICATION_WEEK_ASSIGNED_IN_PAST, getLocale( ) );
return redirect( request, VIEW_MANAGE_TYPICAL_WEEK, PARAMETER_ID_FORM, nIdForm, PARAMETER_ID_RULE, nIdReservationRule );
}
if ( AppointmentUtilities.weekIsOpenInFO( _appointmentForm, listWeekDefinition, getLocale( ) ) )
{
addError( ERROR_MESSAGE_WEEK_IS_OPEN_FO, getLocale( ) );
return redirect( request, VIEW_MANAGE_TYPICAL_WEEK, PARAMETER_ID_FORM, nIdForm, PARAMETER_ID_RULE, nIdReservationRule );
} |