private void processDays ( ProjectCalendar calendar ) throws Exception { // Default all days to non-working for ( Day day : Day . values ( ) ) { calendar . setWorkingDay ( day , false ) ; } List < Row > rows = getRows ( "select * from zcalendarrule where zcalendar1=? and z_ent=?" , calendar . getUniqueID ( ) , m_entityMap . get ( "CalendarWeekDayRule" ) ) ; for ( Row row : rows ) { Day day = row . getDay ( "ZWEEKDAY" ) ; String timeIntervals = row . getString ( "ZTIMEINTERVALS" ) ; if ( timeIntervals == null ) { calendar . setWorkingDay ( day , false ) ; } else { ProjectCalendarHours hours = calendar . addCalendarHours ( day ) ; NodeList nodes = getNodeList ( timeIntervals , m_dayTimeIntervals ) ; calendar . setWorkingDay ( day , nodes . getLength ( ) > 0 ) ; for ( int loop = 0 ; loop < nodes . getLength ( ) ; loop ++ ) { NamedNodeMap attributes = nodes . item ( loop ) . getAttributes ( ) ; Date startTime = m_calendarTimeFormat . parse ( attributes . getNamedItem ( "startTime" ) . getTextContent ( ) ) ; Date endTime = m_calendarTimeFormat . parse ( attributes . getNamedItem ( "endTime" ) . getTextContent ( ) ) ; if ( startTime . getTime ( ) >= endTime . getTime ( ) ) { endTime = DateHelper . addDays ( endTime , 1 ) ; } hours . addRange ( new DateRange ( startTime , endTime ) ) ; } } } }
Process normal calendar working and non - working days .