List of usage examples for java.util Date setTime
public void setTime(long time)
From source file:com.sogeti.droidnetworking.NetworkOperation.java
private void setCacheHeaders(final HttpResponse response) { String lastModified = null;// w w w . j a va 2 s. c o m String eTag = null; String expiresOn = null; if (response.getFirstHeader(LAST_MODIFIED) != null) { lastModified = response.getFirstHeader(LAST_MODIFIED).getValue(); } if (response.getFirstHeader(ETAG) != null) { eTag = response.getFirstHeader(ETAG).getValue(); } if (response.getFirstHeader(EXPIRES) != null) { expiresOn = response.getFirstHeader(EXPIRES).getValue(); } Header cacheControl = response.getFirstHeader("Cache-Control"); if (cacheControl != null) { String[] cacheControlEntities = cacheControl.getValue().split(","); Date expiresOnDate = null; for (String subString : cacheControlEntities) { if (subString.contains("max-age")) { String maxAge = null; String[] array = subString.split("="); if (array.length > 1) { maxAge = array[1]; } expiresOnDate = new Date(); expiresOnDate.setTime(expiresOnDate.getTime() + Integer.valueOf(maxAge) * ONE_SECOND_IN_MS); } if (subString.contains("no-cache")) { expiresOnDate = new Date(); } } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); expiresOn = simpleDateFormat.format(expiresOnDate); } if (lastModified != null) { cacheHeaders.put(LAST_MODIFIED, lastModified); } if (eTag != null) { cacheHeaders.put(ETAG, eTag); } if (expiresOn != null) { cacheHeaders.put(EXPIRES, expiresOn); } }
From source file:eu.trentorise.smartcampus.jp.MonitorJourneyFragment.java
@Override protected void setUpTimingControls() { fromTime = (EditText) getView().findViewById(R.id.recur_time_from); toTime = (EditText) getView().findViewById(R.id.recur_time_to); fromDate = (EditText) getView().findViewById(R.id.recur_date_from); toDate = (EditText) getView().findViewById(R.id.recur_date_to); alwaysCheckbox = (CheckBox) getView().findViewById(R.id.always_checkbox); Date newDate = new Date(); if (params.getData().getParameters().getTime() != null) { try {//from ww w . j a v a2 s . c o m Date d = Config.FORMAT_TIME_SMARTPLANNER.parse(params.getData().getParameters().getTime()); fromTime.setText(Config.FORMAT_TIME_UI.format(d)); d.setTime(d.getTime() + params.getData().getParameters().getInterval()); toTime.setText(Config.FORMAT_TIME_UI.format(d)); } catch (ParseException e) { } } else { fromTime.setTag(newDate); fromTime.setText(Config.FORMAT_TIME_UI.format(newDate)); // toTime is set to now + intervalhour Calendar cal = Calendar.getInstance(); cal.setTime(newDate); cal.add(Calendar.HOUR_OF_DAY, INTERVALHOUR); Date interval = cal.getTime(); toTime.setTag(interval); toTime.setText(Config.FORMAT_TIME_UI.format(interval)); } Date d = params.getData().getParameters().getFromDate() > 0 ? new Date(params.getData().getParameters().getFromDate()) : newDate; Date today = new Date(); if (d.before(today)) d = today; fromDate.setText(Config.FORMAT_DATE_UI.format(d)); Calendar cal = Calendar.getInstance(); cal.setTime(today); cal.add(Calendar.DATE, INTERVALDAY); newDate = cal.getTime(); d = params.getData().getParameters().getToDate() > 0 ? new Date(params.getData().getParameters().getToDate()) : newDate; if (params.getData().getParameters().getToDate() != Config.ALWAYS_DATE) toDate.setText(Config.FORMAT_DATE_UI.format(d)); else { // mettilo a domani e always mettilo a true alwaysCheckbox.setChecked(true); d = newDate; toDate.setEnabled(false); } fromTime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = TimePickerDialogFragment.newInstance((EditText) v); newFragment.setArguments(TimePickerDialogFragment.prepareData(fromTime.getText().toString())); newFragment.show(getSherlockActivity().getSupportFragmentManager(), "timePicker"); } }); toTime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = TimePickerDialogFragment.newInstance((EditText) v); newFragment.setArguments(TimePickerDialogFragment.prepareData(toTime.getText().toString())); newFragment.show(getSherlockActivity().getSupportFragmentManager(), "timePicker"); } }); fromDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = DatePickerDialogFragment.newInstance((EditText) v); newFragment.setArguments(DatePickerDialogFragment.prepareData(fromDate.toString())); newFragment.show(getSherlockActivity().getSupportFragmentManager(), "datePicker"); } }); toDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = DatePickerDialogFragment.newInstance((EditText) v); newFragment.setArguments(DatePickerDialogFragment.prepareData(toDate.toString())); newFragment.show(getSherlockActivity().getSupportFragmentManager(), "datePicker"); } }); /* set the toggle buttons */ days.clear(); ToggleButton tmpToggle = (ToggleButton) getView().findViewById(R.id.monday_toggle); days.put(2, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.tuesday_toggle); days.put(3, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.wednesday_toggle); days.put(4, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.thursday_toggle); days.put(5, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.friday_toggle); days.put(6, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.saturday_toggle); days.put(7, tmpToggle); tmpToggle = (ToggleButton) getView().findViewById(R.id.sunday_toggle); days.put(1, tmpToggle); setToggleDays(params.getData().getParameters().getRecurrence()); }
From source file:com.fluidops.iwb.widget.SemWiki.java
/** * Save the given wiki content using the underlying wikistorage. * If the wiki page contains semantic links, these are stored as * well. In case an error occurs while saving semantic links * (e.g. due to read only repositories) the wiki page is not * saved and an appropriate error message is thrown wrapped * in a exception.//from w ww. j av a 2 s .c om * * @param comment * @param content */ public void saveWiki(String comment, String content) { // just to make sure not to write based on old versions if (version != null) throw new RuntimeException("Editing of non-latest version is not allowed. Aborting Save."); if (content == null) return; ValueAccessLevel al = userManager.getValueAccessLevel(subject); if (al == null || al.compareTo(ValueAccessLevel.READ) <= 0) { logger.warn("Illegal access: wiki for resource " + subject + " cannot be saved."); return; // no action } // now we can be sure the reader has at least WRITE_LIMITED access (i.e., al>=WRITE_LIMITED) WikiStorage ws = Wikimedia.getWikiStorage(); WikiRevision latestRev = ws.getLatestRevision(subject); // assert limited write access if (violatesWriteLimited(al, content)) { addClientUpdate(new FClientUpdate("alert('You do not have permission to include new widgets.')")); return; } if (latestRev != null && renderTimestamp != null) { Date now = new Date(); now.setTime(System.currentTimeMillis()); if (latestRev.date.after(now)) throw new RuntimeException("The Wiki modification date lies in the future, " + "overriding would have no effect. Please fix your system " + "clock settings or contact technical support"); if (latestRev.date.after(renderTimestamp)) { String user = latestRev.user; if (user != null) user = user.replace("\\", "\\\\"); throw new RuntimeException("The Wiki has been modified by user " + user + " in the meantime. " + "Please save your edits in an external application, " + "reload the page and apply the edits again."); } } // Bug 5812 - XSS in revision comment comment = StringEscapeUtils.escapeHtml(comment); if (comment == null || isEmpty(comment.trim())) comment = "(no comment)"; try { ws.storeWikiContent(subject, content, comment, new Date()); } catch (Exception e) { logger.warn("Error while storing the wiki content: " + e.getMessage()); throw new RuntimeException(e); } try { String prev = ""; if (previouslyLoadedContent != null) prev = previouslyLoadedContent; saveSemanticLinkDiff(prev, content, subject, Context.getFreshUserContext(ContextLabel.WIKI)); } catch (RuntimeException e) { // undo the latest store operation if we cannot stor semantic links ws.deleteRevision(subject, ws.getLatestRevision(subject)); throw e; } }
From source file:org.openmrs.web.servlet.ShowGraphServlet.java
/** * The main method for this class. It will create a JFreeChart object to be written to the * response./*from w ww . j a v a 2s.c om*/ * * @param request the current request will all the parameters needed * @return JFreeChart object to be rendered * @should set value axis label to given units * @should set value axis label to concept numeric units if given units is null */ protected JFreeChart getChart(HttpServletRequest request) { // All available GET parameters String patientId = request.getParameter("patientId"); // required String conceptId1 = request.getParameter("conceptId"); // required String conceptId2 = request.getParameter("conceptId2"); String chartTitle = request.getParameter("chartTitle"); String units = request.getParameter("units"); String minRangeString = request.getParameter("minRange"); String maxRangeString = request.getParameter("maxRange"); String hideDate = request.getParameter("hideDate"); Patient patient = Context.getPatientService().getPatient(Integer.parseInt(patientId)); // Set date range to passed values, otherwise set a default date range to the last 12 months Calendar cal = Calendar.getInstance(); Date fromDate = getFromDate(request.getParameter("fromDate")); Date toDate = getToDate(request.getParameter("toDate")); // Swap if fromDate is after toDate if (fromDate.getTime() > toDate.getTime()) { Long temp = fromDate.getTime(); fromDate.setTime(toDate.getTime()); toDate.setTime(temp); } // Graph parameters Double minRange = null; Double maxRange = null; Double normalLow = null; Double normalHigh = null; Double criticalLow = null; Double criticalHigh = null; String timeAxisTitle = null; String rangeAxisTitle = null; boolean userSpecifiedMaxRange = false; boolean userSpecifiedMinRange = false; // Fetching obs List<Obs> observations1 = new ArrayList<Obs>(); List<Obs> observations2 = new ArrayList<Obs>(); Concept concept1 = null, concept2 = null; if (conceptId1 != null) { concept1 = Context.getConceptService().getConcept(Integer.parseInt(conceptId1)); } if (conceptId2 != null) { concept2 = Context.getConceptService().getConcept(Integer.parseInt(conceptId2)); } if (concept1 != null) { observations1 = Context.getObsService().getObservationsByPersonAndConcept(patient, concept1); chartTitle = concept1.getName().getName(); rangeAxisTitle = ((ConceptNumeric) concept1).getUnits(); minRange = ((ConceptNumeric) concept1).getLowAbsolute(); maxRange = ((ConceptNumeric) concept1).getHiAbsolute(); normalLow = ((ConceptNumeric) concept1).getLowNormal(); normalHigh = ((ConceptNumeric) concept1).getHiNormal(); criticalLow = ((ConceptNumeric) concept1).getLowCritical(); criticalHigh = ((ConceptNumeric) concept1).getHiCritical(); // Only get observations2 if both concepts share the same units; update chart title and ranges if (concept2 != null) { String concept2Units = ((ConceptNumeric) concept2).getUnits(); if (concept2Units != null && concept2Units.equals(rangeAxisTitle)) { observations2 = Context.getObsService().getObservationsByPersonAndConcept(patient, concept2); chartTitle += " + " + concept2.getName().getName(); if (((ConceptNumeric) concept2).getHiAbsolute() != null && ((ConceptNumeric) concept2).getHiAbsolute() > maxRange) { maxRange = ((ConceptNumeric) concept2).getHiAbsolute(); } if (((ConceptNumeric) concept2).getLowAbsolute() != null && ((ConceptNumeric) concept2).getLowAbsolute() < minRange) { minRange = ((ConceptNumeric) concept2).getLowAbsolute(); } } else { log.warn("Units for concept id: " + conceptId2 + " don't match units for concept id: " + conceptId1 + ". Only displaying " + conceptId1); concept2 = null; // nullify concept2 so that the legend isn't shown later } } } else { chartTitle = "Concept " + conceptId1 + " not found"; rangeAxisTitle = "Value"; } // Overwrite with user-specified values, otherwise use default values if (units != null && units.length() > 0) { rangeAxisTitle = units; } if (minRangeString != null) { minRange = Double.parseDouble(minRangeString); userSpecifiedMinRange = true; } if (maxRangeString != null) { maxRange = Double.parseDouble(maxRangeString); userSpecifiedMaxRange = true; } if (chartTitle == null) { chartTitle = ""; } if (rangeAxisTitle == null) { rangeAxisTitle = ""; } if (minRange == null) { minRange = 0.0; } if (maxRange == null) { maxRange = 200.0; } // Create data set TimeSeriesCollection dataset = new TimeSeriesCollection(); TimeSeries series1, series2; // Interval-dependent units Class<? extends RegularTimePeriod> timeScale = null; if (toDate.getTime() - fromDate.getTime() <= 86400000) { // Interval <= 1 day: minutely timeScale = Minute.class; timeAxisTitle = "Time"; } else if (toDate.getTime() - fromDate.getTime() <= 259200000) { // Interval <= 3 days: hourly timeScale = Hour.class; timeAxisTitle = "Time"; } else { timeScale = Day.class; timeAxisTitle = "Date"; } if (concept1 == null) { series1 = new TimeSeries("NULL", Hour.class); } else { series1 = new TimeSeries(concept1.getName().getName(), timeScale); } if (concept2 == null) { series2 = new TimeSeries("NULL", Hour.class); } else { series2 = new TimeSeries(concept2.getName().getName(), timeScale); } // Add data points for concept1 for (Obs obs : observations1) { if (obs.getValueNumeric() != null && obs.getObsDatetime().getTime() >= fromDate.getTime() && obs.getObsDatetime().getTime() < toDate.getTime()) { cal.setTime(obs.getObsDatetime()); if (timeScale == Minute.class) { Minute min = new Minute(cal.get(Calendar.MINUTE), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series1.addOrUpdate(min, obs.getValueNumeric()); } else if (timeScale == Hour.class) { Hour hour = new Hour(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series1.addOrUpdate(hour, obs.getValueNumeric()); } else { Day day = new Day(cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series1.addOrUpdate(day, obs.getValueNumeric()); } } } // Add data points for concept2 for (Obs obs : observations2) { if (obs.getValueNumeric() != null && obs.getObsDatetime().getTime() >= fromDate.getTime() && obs.getObsDatetime().getTime() < toDate.getTime()) { cal.setTime(obs.getObsDatetime()); if (timeScale == Minute.class) { Minute min = new Minute(cal.get(Calendar.MINUTE), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series2.addOrUpdate(min, obs.getValueNumeric()); } else if (timeScale == Hour.class) { Hour hour = new Hour(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series2.addOrUpdate(hour, obs.getValueNumeric()); } else { Day day = new Day(cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); series2.addOrUpdate(day, obs.getValueNumeric()); } } } // Add series to dataset dataset.addSeries(series1); if (!series2.isEmpty()) { dataset.addSeries(series2); } // As of JFreeChart 1.0.11 the default background color is dark grey instead of white. // This line restores the original white background. ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart chart = null; // Show legend only if more than one series if (concept2 == null) { chart = ChartFactory.createTimeSeriesChart(chartTitle, timeAxisTitle, rangeAxisTitle, dataset, false, false, false); } else { chart = ChartFactory.createTimeSeriesChart(chartTitle, timeAxisTitle, rangeAxisTitle, dataset, true, false, false); } // Customize title font Font font = new Font("Arial", Font.BOLD, 12); TextTitle title = chart.getTitle(); title.setFont(font); chart.setTitle(title); // Add subtitle, unless 'hideDate' has been passed if (hideDate == null) { TextTitle subtitle = new TextTitle(fromDate.toString() + " - " + toDate.toString()); subtitle.setFont(font); chart.addSubtitle(subtitle); } XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("No Data Available"); // Add abnormal/critical range background color (only for single-concept graphs) if (concept2 == null) { IntervalMarker abnormalLow, abnormalHigh, critical; if (normalHigh != null) { abnormalHigh = new IntervalMarker(normalHigh, maxRange, COLOR_ABNORMAL); plot.addRangeMarker(abnormalHigh); } if (normalLow != null) { abnormalLow = new IntervalMarker(minRange, normalLow, COLOR_ABNORMAL); plot.addRangeMarker(abnormalLow); } if (criticalHigh != null) { critical = new IntervalMarker(criticalHigh, maxRange, COLOR_CRITICAL); plot.addRangeMarker(critical); } if (criticalLow != null) { critical = new IntervalMarker(minRange, criticalLow, COLOR_CRITICAL); plot.addRangeMarker(critical); } // there is data outside of the absolute lower limits for this concept (or of what the user specified as minrange) if (plot.getRangeAxis().getLowerBound() < minRange) { IntervalMarker error = new IntervalMarker(plot.getRangeAxis().getLowerBound(), minRange, COLOR_ERROR); plot.addRangeMarker(error); } if (plot.getRangeAxis().getUpperBound() > maxRange) { IntervalMarker error = new IntervalMarker(maxRange, plot.getRangeAxis().getUpperBound(), COLOR_ERROR); plot.addRangeMarker(error); } } // Visuals XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesFilled(true); renderer.setBaseShapesVisible(true); } // Customize the plot (range and domain axes) // Modify x-axis (datetime) DateAxis timeAxis = (DateAxis) plot.getDomainAxis(); if (timeScale == Day.class) { timeAxis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy")); } timeAxis.setRange(fromDate, toDate); // Set y-axis range (values) NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (userSpecifiedMinRange) { minRange = (rangeAxis.getLowerBound() < minRange) ? rangeAxis.getLowerBound() : minRange; } if (userSpecifiedMaxRange) { // otherwise we just use default range maxRange = (rangeAxis.getUpperBound() > maxRange) ? rangeAxis.getUpperBound() : maxRange; } rangeAxis.setRange(minRange, maxRange); return chart; }
From source file:com.parse.ParseConfigTest.java
@Test public void testGetDateKeyExistValueNotDate() throws Exception { Date date = new Date(); date.setTime(20); final Map<String, Object> params = new HashMap<>(); params.put("key", 1); ParseConfig config = new ParseConfig(params); assertNull(config.getDate("key")); assertSame(date, config.getDate("key", date)); }
From source file:com.parse.ParseConfigTest.java
@Test public void testGetDateKeyExistValueNull() throws Exception { Date date = new Date(); date.setTime(20); final Map<String, Object> params = new HashMap<>(); params.put("key", JSONObject.NULL); params.put("keyAgain", null); ParseConfig config = new ParseConfig(params); assertNull(config.getDate("key")); assertNull(config.getDate("key", date)); assertNull(config.getDate("keyAgain")); assertNull(config.getDate("keyAgain", date)); }
From source file:com.parse.ParseConfigTest.java
@Test public void testGetDateKeyExist() throws Exception { final Date date = new Date(); date.setTime(10); Date dateAgain = new Date(); dateAgain.setTime(20);//from w w w. ja v a 2 s . c o m final Map<String, Object> params = new HashMap<>(); params.put("key", date); ParseConfig config = new ParseConfig(params); assertEquals(date.getTime(), config.getDate("key").getTime()); assertEquals(date.getTime(), config.getDate("key", dateAgain).getTime()); }
From source file:com.parse.ParseConfigTest.java
@Test public void testGetDateKeyNotExist() throws Exception { final Date date = new Date(); date.setTime(10); Date dateAgain = new Date(); dateAgain.setTime(10);//w ww .jav a 2 s .com final Map<String, Object> params = new HashMap<>(); params.put("key", date); ParseConfig config = new ParseConfig(params); assertNull(config.getDate("wrongKey")); assertSame(dateAgain, config.getDate("wrongKey", dateAgain)); }
From source file:info.raack.appliancelabeler.web.MainController.java
private void createDateSpan(EnergyMonitor energyMonitor, Date start, Date end, int period) { Calendar c = new GregorianCalendar(); Date tempDate = null;/*from w w w .j av a 2 s . c o m*/ if (energyMonitor != null) { tempDate = database.getLastMeasurementTimeForEnergyMonitor(energyMonitor); } if (tempDate == null) { end.setTime(System.currentTimeMillis()); } else { end.setTime(tempDate.getTime()); } c.setTime(end); c.add(period, -2); start.setTime(c.getTimeInMillis()); }
From source file:com.clustercontrol.calendar.factory.SelectCalendar.java
public ArrayList<CalendarDetailInfo> getCalendarWeek(CalendarInfo info, Integer year, Integer month, Integer day) throws CalendarNotFound { m_log.trace("calendarId:" + info.getCalendarId() + ", year:" + year + ", month:" + month + ", day:" + day); long validFrom = info.getValidTimeFrom(); long validTo = info.getValidTimeTo(); ArrayList<CalendarDetailInfo> ret = new ArrayList<CalendarDetailInfo>(); Calendar startCalendar = HinemosTime.getCalendarInstance(); startCalendar.clear();/*from w w w . j a v a2s.c o m*/ startCalendar.set(year, month - 1, day, 0, 0, 0); long startTime = startCalendar.getTimeInMillis(); Calendar endCalendar = HinemosTime.getCalendarInstance(); endCalendar.clear(); endCalendar.set(year, month - 1, day + 1, 0, 0, 0); long endTime = endCalendar.getTimeInMillis(); if (startTime <= validFrom && endTime <= validFrom) { return ret; } if (validTo <= startTime && validTo <= endTime) { return ret; } if (startTime < validFrom && validFrom < endTime) { CalendarDetailInfo detail = new CalendarDetailInfo(); detail.setTimeFrom(0 - TIMEZONE); detail.setTimeTo(validFrom - startTime - TIMEZONE); detail.setOperateFlg(false); detail.setOrderNo(-2);// ? m_log.trace("start<validfrom && validfrom<endttime add"); ret.add(detail); } if (startTime < validTo && validTo < endTime) { CalendarDetailInfo detail = new CalendarDetailInfo(); detail.setTimeFrom(validTo - startTime - TIMEZONE); detail.setTimeTo(HOUR24 - TIMEZONE); detail.setOperateFlg(false); detail.setOrderNo(-1);// ? m_log.trace("start<validto && validto<endttime add"); ret.add(detail); } // client?????CalendarDetailList??? // ????????? startCalendar.clear(); startCalendar.set(year, month - 1, day, 0, 0, 0); ArrayList<Date> checkDateList = new ArrayList<>(); int onesec = 1 * 1000; Long startLong = startCalendar.getTime().getTime(); ArrayList<CalendarDetailInfo> substituteList = new ArrayList<>(); for (CalendarDetailInfo detailInfo : info.getCalendarDetailList()) { int timezone = HinemosTime.getTimeZoneOffset(); // start_time checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() - onesec + timezone));// 1second?? checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() + onesec + timezone));// 1second? // end_time checkDateList.add(new Date(startLong + detailInfo.getTimeTo() + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeTo() - onesec + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeTo() + onesec + timezone)); if (detailInfo.isSubstituteFlg()) { // ????????? substituteList.add(detailInfo); } } // getDetail24??????? ArrayList<CalendarDetailInfo> detailList = new ArrayList<>(); for (CalendarDetailInfo detail : info.getCalendarDetailList()) { detailList.addAll(CalendarUtil.getDetail24(detail)); } for (CalendarDetailInfo detailInfo : detailList) { int timezone = HinemosTime.getTimeZoneOffset(); // start_time checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() - onesec + timezone));// 1second?? checkDateList.add(new Date(startLong + detailInfo.getTimeFrom() + onesec + timezone));// 1second? // end_time checkDateList.add(new Date(startLong + detailInfo.getTimeTo() + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeTo() - onesec + timezone)); checkDateList.add(new Date(startLong + detailInfo.getTimeTo() + onesec + timezone)); } // ????????????? ArrayList<Date> checkDateListSub = new ArrayList<>(); for (Date checkDate : checkDateList) { for (CalendarDetailInfo detailInfo : substituteList) { Long checkDateLong = checkDate.getTime(); checkDateListSub .add(new Date(checkDateLong - (CalendarUtil.parseDate(detailInfo.getSubstituteTime()) + HinemosTime.getTimeZoneOffset()))); } } checkDateList.addAll(checkDateListSub); // ?valid_time_from?valid_time_to checkDateList.add(new Date(info.getValidTimeFrom())); checkDateList.add(new Date(info.getValidTimeTo())); // list?????? checkDateList = new ArrayList<>(new HashSet<>(checkDateList)); // list? Collections.sort(checkDateList); m_log.trace("checkDateList.size:" + checkDateList.size()); ArrayList<CalendarDetailInfo> detailSubsList = new ArrayList<>(); for (Date targetDate : checkDateList) { Calendar targetCal = Calendar.getInstance(); targetCal.setTime(targetDate); // ???????????? if (startCalendar.get(Calendar.YEAR) != targetCal.get(Calendar.YEAR) || startCalendar.get(Calendar.MONTH) != targetCal.get(Calendar.MONTH) || startCalendar.get(Calendar.DATE) != targetCal.get(Calendar.DATE)) { continue; } m_log.trace("startCalendar:" + targetDate); ArrayList<CalendarDetailInfo> detailList2 = new ArrayList<>(); Date substituteDate = new Date(targetDate.getTime()); // detailList2????CalendarDetailInfo? Object[] retObjArr = CalendarUtil.getCalendarRunDetailInfo(info, targetDate, detailList2); boolean isrun = (Boolean) retObjArr[0]; // ?2?????? if (retObjArr.length == 2) { substituteDate.setTime(((Date) retObjArr[1]).getTime()); } m_log.trace("id:" + info.getCalendarId() + ", startCalendar:" + targetDate + ", detailList2.size:" + detailList2.size() + ", isrun:" + isrun + ", substituteDate:" + substituteDate.toString()); // ?CalendarDetailInfo????????????getDetail24????? for (CalendarDetailInfo detailInfo : detailList2) { ArrayList<CalendarDetailInfo> calendarDetailList = CalendarUtil.getDetail24(detailInfo); for (CalendarDetailInfo detail24 : calendarDetailList) { if (CalendarUtil.isRunByDetailDateTime(detail24, substituteDate) && !detailSubsList.contains(detail24)) { detailSubsList.add(detail24); m_log.trace("add to ret. orderNo:" + detail24.getOrderNo() + ", description:" + detail24.getDescription() + ", isOperation:" + detail24.isOperateFlg() + ", from:" + detail24.getTimeFrom() + ", to:" + detail24.getTimeTo()); } } } } ret.addAll(detailSubsList); Collections.sort(ret, new Comparator<CalendarDetailInfo>() { public int compare(CalendarDetailInfo obj0, CalendarDetailInfo obj1) { int order1 = obj0.getOrderNo(); int order2 = obj1.getOrderNo(); int ret = order1 - order2; return ret; } }); if (m_log.isDebugEnabled()) { for (CalendarDetailInfo detail : ret) { m_log.debug("detail=" + detail); } } m_log.trace("ret.size:" + ret.size()); return ret; }