List of usage examples for java.text ParseException printStackTrace
public void printStackTrace()
From source file:com.fxforbiz.softphone.core.managers.UpdateManager.java
/** * This methods checks in the properties of the application if an update is needed. * @return Either an update is needed or not. *///from ww w . j a va 2 s . c o m public boolean checkForUpdate() { String dateStr = Application.getInstance().getPropertyManger().getProperty("END_DATE_LICENCE"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date end = null; try { end = sdf.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); } Date now = new Date(); return !now.before(end); }
From source file:com.hortonworks.pso.data.generator.fields.DateField.java
public DateField(JsonNode node) { super(node);/*from w w w. j av a 2s .co m*/ if (node.has("format")) { format = node.get("format").asText(); System.out.println("Date Format Set: " + format); } if (df == null) { df = new SimpleDateFormat(format); } try { if (node.has("range")) { JsonNode rangeNode = node.get("range"); if (rangeNode.has("min")) { String minDtStr = rangeNode.get("min").asText(); minDt = df.parse(minDtStr); System.out.println("Min Date: " + minDt.toString()); min = minDt.getTime(); } if (rangeNode.has("max")) { String maxDtStr = rangeNode.get("max").asText(); maxDt = df.parse(maxDtStr); System.out.println("Max Date: " + maxDt.toString()); max = maxDt.getTime(); } } } catch (ParseException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } // if (node.has("pool")) { // // size is required // poolSize = node.get("pool").get("size").asInt(); // fillPool(); // } }
From source file:org.openmrs.module.OT.web.controller.majorOT.queue.SearchProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {/*ww w .j a v a 2 s . c o m*/ OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMajorOT(); else { procedures.clear(); procedures = ots.getProceduresMajorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<OpdTestOrder> schedules = ots.getSchedulesMajorOT(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil_Major.generateModelsFromSchedules(schedules); int total = ots.countScheduleMajorOT(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing schedule date!"); return null; } return "/module/OT/majorOT/search"; }
From source file:org.openmrs.module.OT.web.controller.minorOT.queue.SearchProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {// w w w .j av a 2 s.co m OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMinorOT(); else { procedures.clear(); procedures = ots.getProceduresMinorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<OpdTestOrder> schedules = ots.getSchedulesMinorOT(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil.generateModelsFromSchedules(schedules); int total = ots.countScheduleMinorOT(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing schedule date!"); return null; } return "/module/OT/minorOT/search"; }
From source file:org.hil.core.dao.hibernate.GeneralReportDataDaoHibernate.java
public List<GeneralReportData> createGeneralReportDataInCommunesByDistrict(String time, Long communeId, District district) {//from w ww . j ava 2 s. c o m List<Commune> communes = communeDaoExt.findByDistrictId(district.getId()); List<GeneralReportData> listCommunes = new ArrayList<GeneralReportData>(); for (Commune c : communes) { GeneralReportData rv = new GeneralReportData(); rv.setCommune(c); SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); try { Date rdate = format.parse("01/" + time); rv.setTime(rdate); } catch (ParseException e) { e.printStackTrace(); } rv = generalReportDataDao.save(rv); if (communeId != null) { if (rv.getCommune().getId().compareTo(communeId) == 0) listCommunes.add(rv); } else listCommunes.add(rv); } return listCommunes; }
From source file:org.openmrs.module.OT.web.controller.minorOT.observation.searchObsProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {//from w ww . j a v a 2 s . c o m OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMinorOT(); else { procedures.clear(); procedures = ots.getProceduresMinorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<MinorOTProcedure> otSchedules = ots.getMinorOTSchedules(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil.generateObsModelsFromSchedules(otSchedules); int total = ots.countMinorOTSchedule(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing Accepted schedule date!"); return null; } return "/module/OT/minorOT/searchObs"; }
From source file:com.dare2date.externeservice.lastfm.LastfmAPI.java
/** * Adds date data to an event./*from w w w .j ava 2s . c om*/ * @param eventdata * @param event */ private void addDateToEventFromJSONData(JSONObject eventdata, LastfmEvent event) { try { Calendar date = Calendar.getInstance(); Date _date = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.ENGLISH) .parse(eventdata.get("startDate").toString()); date.set(_date.getYear(), _date.getMonth(), _date.getDay(), _date.getHours(), _date.getMinutes(), _date.getSeconds()); event.setStartDate(date); } catch (ParseException e) { e.printStackTrace(); } }
From source file:org.openmrs.module.OT.web.controller.majorOT.observation.searchObsProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {/*from w w w . j a va 2 s . co m*/ OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMajorOT(); else { procedures.clear(); procedures = ots.getProceduresMajorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<MajorOTProcedure> otSchedules = ots.getMajorOTSchedules(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil_Major .generateObsModelsFromSchedules(otSchedules); int total = ots.countMajorOTSchedule(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing Accepted schedule date!"); return null; } return "/module/OT/majorOT/searchObs"; }
From source file:com.huateng.ebank.framework.util.DateUtil.java
/** * ?yyyyMMddhhmmss???YYYY-mm-dd HH:MM:SS ? * * @return/*from w ww . j ava 2 s . c o m*/ * @author lizh */ public static String get19Date(String dtime) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); Calendar calendar = Calendar.getInstance(); try { Date dateTime = simpleDateFormat.parse(dtime); calendar.setTime(dateTime); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return String.format("%1$4tY-%1$2tm-%1$td %1$2TH:%1$2TM:%1$2TS", calendar); }