Example usage for java.text ParseException printStackTrace

List of usage examples for java.text ParseException printStackTrace

Introduction

In this page you can find the example usage for java.text ParseException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.openmrs.module.patientportaltoolkit.fragment.controller.ProfileEditFragmentController.java

public void saveProfileEditForm(FragmentModel model,
        @RequestParam(value = "personId", required = true) int personId,
        @RequestParam(value = "givenName", required = true) String givenName,
        @RequestParam(value = "familyName", required = true) String familyName,
        @RequestParam(value = "gender", required = true) String gender,
        @RequestParam(value = "birthDate", required = true) String birthDate, PageRequest pageRequest) {

    log.info(PPTLogAppender.appendLog("SAVE_PROFILEEDIT", pageRequest.getRequest(), "personId:", personId + "",
            "givenName:", givenName, "familyName", familyName, "gender", gender, "birthDate", birthDate));
    Person person = Context.getPersonService().getPerson(personId);
    PersonName personName = new PersonName();
    personName.setGivenName(givenName);//from   w  w  w.java 2  s . co m
    personName.setFamilyName(familyName);
    Set<PersonName> personNames = person.getNames();

    boolean personNameExists = false;
    for (PersonName pn : personNames) {
        if (pn.equalsContent(personName))
            personNameExists = true;
    }
    if (!personNameExists) {
        for (PersonName pn : personNames) {
            if (pn.getPreferred())
                pn.setPreferred(false);
        }
        personName.setPreferred(true);
        personNames.add(personName);
    }

    person.setNames(personNames);

    DateFormat df = new SimpleDateFormat("mm/dd/yyyy");
    try {
        person.setBirthdate(df.parse(birthDate));
    } catch (ParseException e) {
        e.printStackTrace();
    }

    if (gender != null)
        person.setGender(gender);
    Context.getPersonService().savePerson(person);
    //log.info("Profile Details saved for -" + Context.getAuthenticatedUser().getPersonName() + "(id=" + Context.getAuthenticatedUser().getPerson().getPersonId() + ",uuid=" + Context.getAuthenticatedUser().getPerson().getUuid() + ")" + " Requested by - " + Context.getAuthenticatedUser().getPersonName() + "(id=" + Context.getAuthenticatedUser().getPerson().getPersonId() + ",uuid=" + Context.getAuthenticatedUser().getPerson().getUuid() + ")");
}

From source file:org.openmrs.module.laboratory.web.controller.queue.SearchTestController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request,
        Model model) {//from w  w  w .j av a2  s  .  co  m
    LaboratoryService ls = (LaboratoryService) Context.getService(LaboratoryService.class);
    Concept investigation = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(LaboratoryConstants.SESSION_TEST_TREE_MAP);
        Set<Concept> allowableTests = new HashSet<Concept>();
        if (investigation != null) {
            allowableTests = testTreeMap.get(investigation);
        } else {
            for (Concept c : testTreeMap.keySet()) {
                allowableTests.addAll(testTreeMap.get(c));
            }
        }
        if (currentPage == null)
            currentPage = 1;
        List<Order> orders = ls.getOrders(date, phrase, allowableTests, currentPage);
        List<TestModel> tests = LaboratoryUtil.generateModelsFromOrders(orders, testTreeMap);
        int total = ls.countOrders(date, phrase, allowableTests);
        PagingUtil pagingUtil = new PagingUtil(LaboratoryConstants.PAGESIZE, currentPage, total);
        model.addAttribute("pagingUtil", pagingUtil);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }

    return "/module/laboratory/queue/search";
}

From source file:org.openmrs.module.patientportaltoolkit.fragment.controller.AppointmentsFragmentController.java

public void markScheduled(FragmentModel model,
        @RequestParam(value = "reminderId", required = true) String reminderId,
        @RequestParam(value = "markScheduledDate", required = true) String markScheduledDate,
        PageRequest pageRequest) {//from   w w  w .  j  av a 2  s  .  c  o  m

    Person person = Context.getPersonService().getPerson(
            Context.getService(ReminderService.class).getRemindersById(reminderId).getPatient().getPersonId());
    log.info(PPTLogAppender.appendLog("MARK_SCHEDULED_APPOINTMENTS", pageRequest.getRequest()));
    //log.info("~MARK_SCHEDULED_APPOINTMENTS~" + Context.getAuthenticatedUser().getUsername()+ "~REQ_FOR:"+ Context.getUserService().getUsersByPerson(person,false).get(0).getUsername());
    //System.out.println("121212121212"+markCompletedDate);
    DateFormat format = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH);
    Date date = new Date();
    try {
        date = format.parse(markScheduledDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    Context.getService(ReminderService.class).markScheduledReminder(reminderId, date);

}

From source file:org.openmrs.module.patientportaltoolkit.fragment.controller.AppointmentsFragmentController.java

public void markCompleted(FragmentModel model,
        @RequestParam(value = "reminderId", required = true) String reminderId,
        @RequestParam(value = "markCompletedDate", required = true) String markCompletedDate,
        @RequestParam(value = "doctorName", required = true) String doctorName,
        @RequestParam(value = "comments", required = true) String comments, PageRequest pageRequest) {

    Person person = Context.getPersonService().getPerson(
            Context.getService(ReminderService.class).getRemindersById(reminderId).getPatient().getPersonId());
    log.info(PPTLogAppender.appendLog("MARK_COMPLETED_APPOINTMENTS", pageRequest.getRequest()));
    // log.info("~MARK_COMPLETED_APPOINTMENTS~"+ Context.getAuthenticatedUser().getUsername()+ "~REQ_FOR:"+ Context.getUserService().getUsersByPerson(person,false).get(0).getUsername());
    //System.out.println("121212121212"+markCompletedDate);
    DateFormat format = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH);
    Date date = new Date();
    try {/* www . j  a  v a  2  s . c  om*/
        date = format.parse(markCompletedDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    Context.getService(ReminderService.class).markCompletedReminder(reminderId, date, doctorName, comments);

}

From source file:org.openmrs.module.radiology.web.controller.editresult.SearchCompletedTestsController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        HttpServletRequest request, @RequestParam(value = "currentPage", required = false) Integer currentPage,
        Model model) {//w w  w  .  j a  va2 s  .c  o  m
    RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
    Concept investigation = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(RadiologyConstants.SESSION_TEST_TREE_MAP);
        Set<Concept> allowableTests = new HashSet<Concept>();
        if (investigation != null) {
            allowableTests = testTreeMap.get(investigation);
        } else {
            for (Concept c : testTreeMap.keySet()) {
                allowableTests.addAll(testTreeMap.get(c));
            }
        }
        if (currentPage == null)
            currentPage = 1;
        List<RadiologyTest> radiologyTests = rs.getCompletedRadiologyTests(date, phrase, allowableTests,
                currentPage);
        List<TestModel> tests = RadiologyUtil.generateModelsFromTests(radiologyTests, testTreeMap);
        int total = rs.countCompletedRadiologyTests(date, phrase, allowableTests);
        PagingUtil pagingUtil = new PagingUtil(
                GlobalPropertyUtil.getInteger(RadiologyConstants.PROPERTY_PAGESIZE, 20), currentPage, total);
        model.addAttribute("pagingUtil", pagingUtil);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }
    return "/module/radiology/editresult/search";
}

From source file:org.openmrs.module.radiology.web.controller.queue.SearchTestController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request,
        Model model) {/* www . j ava  2s.c  o m*/
    RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
    Concept investigation = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(RadiologyConstants.SESSION_TEST_TREE_MAP);
        Set<Concept> allowableTests = new HashSet<Concept>();
        if (investigation != null) {
            allowableTests = testTreeMap.get(investigation);
        } else {
            for (Concept c : testTreeMap.keySet()) {
                allowableTests.addAll(testTreeMap.get(c));
            }
        }
        if (currentPage == null)
            currentPage = 1;
        List<Order> orders = rs.getOrders(date, phrase, allowableTests, currentPage);
        List<TestModel> tests = RadiologyUtil.generateModelsFromOrders(orders, testTreeMap);
        int total = rs.countOrders(date, phrase, allowableTests);
        PagingUtil pagingUtil = new PagingUtil(
                GlobalPropertyUtil.getInteger(RadiologyConstants.PROPERTY_PAGESIZE, 20), currentPage, total);
        model.addAttribute("pagingUtil", pagingUtil);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }

    return "/module/radiology/queue/search";
}

From source file:org.openmrs.module.laboratory.web.controller.printworklist.SearchPrintWorklistController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        @RequestParam(value = "showResults", required = false) String showResults, HttpServletRequest request,
        Model model) {//from  ww  w. j av  a 2  s.co  m
    LaboratoryService ls = (LaboratoryService) Context.getService(LaboratoryService.class);
    Concept investigation = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(LaboratoryConstants.SESSION_TEST_TREE_MAP);
        Set<Concept> allowableTests = new HashSet<Concept>();
        if (investigation != null) {
            allowableTests = testTreeMap.get(investigation);
        } else {
            for (Concept c : testTreeMap.keySet()) {
                allowableTests.addAll(testTreeMap.get(c));
            }
        }
        List<LabTest> laboratoryTests = ls.getAllLaboratoryTestsByDate(date, phrase, allowableTests);
        // ghanshyam 19/07/2012 New Requirement #309: [LABORATORY] Show Results in Print WorkList.introduced the column 'Lab' 'Test' 'Test name' 'Result'
        //ghanshyam 20/07/2012 New Requirement #320 [LABORATORY] Show Results as an Option.added one more parameter in method generateModelsForPrintWorkListFromTests showResults 
        List<TestModel> tests = LaboratoryUtil.generateModelsForPrintWorkListFromTests(laboratoryTests,
                testTreeMap, showResults);
        // ghanshyam 04/07/2012 New Requirement #277
        Collections.sort(tests);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }
    return "/module/laboratory/printworklist/search";
}

From source file:com.funtl.framework.smoke.core.modules.act.utils.DateConverter.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public Object convert(Class type, Object value) {
    Object result = null;/*from   ww w  .  j  av  a 2 s  .c  o m*/
    if (type == Date.class) {
        try {
            result = doConvertToDate(value);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    } else if (type == String.class) {
        result = doConvertToString(value);
    }
    return result;
}

From source file:eu.crisis_economics.configuration.StringDefinitionExpression.java

@Override
TypeDeclarationExpression getTypeExpression() {
    try {//from   www.ja va 2 s . c om
        return TypeDeclarationExpression.tryCreate("String", super.getConfigurationContext());
    } catch (ParseException neverThrows) {
        neverThrows.printStackTrace();
    }
    return null;
}

From source file:org.openmrs.module.radiology.web.controller.worklist.SearchController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        HttpServletRequest request, @RequestParam(value = "currentPage", required = false) Integer currentPage,
        Model model) {/*from   w w  w .  ja v a2  s .c o  m*/
    RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
    Concept investigation = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(RadiologyConstants.SESSION_TEST_TREE_MAP);
        Set<Concept> allowableTests = new HashSet<Concept>();
        if (investigation != null) {
            allowableTests = testTreeMap.get(investigation);
        } else {
            for (Concept c : testTreeMap.keySet()) {
                allowableTests.addAll(testTreeMap.get(c));
            }
        }
        if (currentPage == null)
            currentPage = 1;
        List<RadiologyTest> radiologyTests = rs.getAcceptedRadiologyTests(date, phrase, allowableTests,
                currentPage);
        List<TestModel> tests = RadiologyUtil.generateModelsFromTests(radiologyTests, testTreeMap);
        //ghanshyam 04/07/2012 New Requirement #274
        Collections.sort(tests);
        int total = rs.countAcceptedRadiologyTests(date, phrase, allowableTests);
        PagingUtil pagingUtil = new PagingUtil(
                GlobalPropertyUtil.getInteger(RadiologyConstants.PROPERTY_PAGESIZE, 20), currentPage, total);
        model.addAttribute("pagingUtil", pagingUtil);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }
    return "/module/radiology/worklist/search";
}