List of usage examples for java.util GregorianCalendar get
public int get(int field)
From source file:org.agnitas.util.AgnUtils.java
public static List<Integer> getCalendarYearList(int startYear) { List<Integer> yearList = new ArrayList<Integer>(); GregorianCalendar calendar = new GregorianCalendar(); int currentYear = calendar.get(Calendar.YEAR); for (int year = currentYear + 1; year >= startYear; year--) { yearList.add(year);/*from www . j av a 2s .co m*/ } return yearList; }
From source file:org.agnitas.util.AgnUtils.java
/** * * @param startYear// www .ja v a2 s . co m * @return a list of years from the current year back to the start year */ public static List<Integer> getYearList(int startYear) { List<Integer> yearList = new ArrayList<Integer>(); GregorianCalendar calendar = new GregorianCalendar(); int currentYear = calendar.get(Calendar.YEAR); for (int year = currentYear; year >= startYear; year--) { yearList.add(year); } return yearList; }
From source file:org.eevolution.form.VCRP.java
public boolean checkResourceTypeAvailability(Timestamp dateTime, MResourceType t) { if (!t.isDateSlot()) { return true; }// ww w . j a va2s .c o m GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(dateTime.getTime()); boolean retValue = false; switch (gc.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: retValue = t.isOnSunday(); break; case Calendar.MONDAY: retValue = t.isOnMonday(); break; case Calendar.TUESDAY: retValue = t.isOnTuesday(); break; case Calendar.WEDNESDAY: retValue = t.isOnWednesday(); break; case Calendar.THURSDAY: retValue = t.isOnThursday(); break; case Calendar.FRIDAY: retValue = t.isOnFriday(); break; case Calendar.SATURDAY: retValue = t.isOnSaturday(); break; } return retValue; }
From source file:stg.utils.immutable.Day.java
/** * Constructs a specific date from the time. * //from ww w.j a v a 2 s . c om * @param time * long * @exception IllegalArgumentException * if not a valid date * @see System#currentTimeMillis() */ private Day(long time, TimeZone zone) { GregorianCalendar calendar = getCalendarInstance(zone); calendar.setTimeInMillis(time); tzone = zone; year = calendar.get(Calendar.YEAR); month = calendar.get(Calendar.MONTH) + 1; day = calendar.get(Calendar.DATE); hour = calendar.get(Calendar.HOUR_OF_DAY); minutes = calendar.get(Calendar.MINUTE); seconds = calendar.get(Calendar.SECOND); milliseconds = calendar.get(Calendar.MILLISECOND); }
From source file:org.oscarehr.caseload.CaseloadContentAction.java
private JSONArray generateCaseloadDataForDemographics(HttpServletRequest request, HttpServletResponse response, String caseloadProv, List<Integer> demoSearchResult) { JSONArray entry;/*w w w. j a v a2 s . c o m*/ String buttons; JSONArray data = new JSONArray(); if (demoSearchResult == null || demoSearchResult.size() < 1) return data; CaseloadDao caseloadDao = (CaseloadDao) SpringUtils.getBean("caseloadDao"); HttpSession session = request.getSession(); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(session.getServletContext()); String roleName$ = (String) session.getAttribute("userrole") + "," + (String) session.getAttribute("user"); String curUser_no = (String) session.getAttribute("user"); String userfirstname = (String) session.getAttribute("userfirstname"); String userlastname = (String) session.getAttribute("userlastname"); GregorianCalendar cal = new GregorianCalendar(); int curYear = cal.get(Calendar.YEAR); int curMonth = (cal.get(Calendar.MONTH) + 1); int curDay = cal.get(Calendar.DAY_OF_MONTH); int year = Integer.parseInt(request.getParameter("year")); int month = Integer.parseInt(request.getParameter("month")); int day = Integer.parseInt(request.getParameter("day")); java.util.Date apptime = new java.util.Date(); OscarProperties oscarProperties = OscarProperties.getInstance(); boolean bShortcutForm = oscarProperties.getProperty("appt_formview", "").equalsIgnoreCase("on") ? true : false; String formName = bShortcutForm ? oscarProperties.getProperty("appt_formview_name") : ""; String formNameShort = formName.length() > 3 ? (formName.substring(0, 2) + ".") : formName; String formName2 = bShortcutForm ? oscarProperties.getProperty("appt_formview_name2", "") : ""; String formName2Short = formName2.length() > 3 ? (formName2.substring(0, 2) + ".") : formName2; boolean bShortcutForm2 = bShortcutForm && !formName2.equals(""); boolean bShortcutIntakeForm = oscarProperties.getProperty("appt_intake_form", "").equalsIgnoreCase("on") ? true : false; String monthDay = String.format("%02d", month) + "-" + String.format("%02d", day); String prov = oscarProperties.getProperty("billregion", "").trim().toUpperCase(); for (Integer result : demoSearchResult) { if (result == null) continue; String demographic_no = result.toString(); entry = new JSONArray(); // name String demographicQuery = "cl_demographic_query"; String[] demographicParam = new String[1]; demographicParam[0] = demographic_no; List<Map<String, Object>> demographicResult = caseloadDao.getCaseloadDemographicData(demographicQuery, demographicParam); String clLastName = demographicResult.get(0).get("last_name").toString(); String clFirstName = demographicResult.get(0).get("first_name").toString(); String clFullName = StringEscapeUtils.escapeJavaScript(clLastName + ", " + clFirstName).toUpperCase(); entry.add(clFullName); // add E button to string buttons = ""; if (hasPrivilege("_eChart", roleName$)) { String encType = ""; try { encType = URLEncoder.encode("face to face encounter with client", "UTF-8"); } catch (UnsupportedEncodingException e) { MiscUtils.getLogger().error("Couldn't encode string", e); } String eURL = "../oscarEncounter/IncomingEncounter.do?providerNo=" + curUser_no + "&appointmentNo=0&demographicNo=" + demographic_no + "&curProviderNo=" + caseloadProv + "&reason=&encType=" + encType + "&userName=" + URLEncoder.encode(userfirstname + " " + userlastname) + "&curDate=" + curYear + "-" + curMonth + "-" + curDay + "&appointmentDate=" + year + "-" + month + "-" + day + "&startTime=" + apptime.getHours() + ":" + apptime.getMinutes() + "&status=T" + "&apptProvider_no=" + caseloadProv + "&providerview=" + caseloadProv; buttons += "<a href='#' onClick=\"popupPage(710, 1024,'../oscarSurveillance/CheckSurveillance.do?demographicNo=" + demographic_no + "&proceed=" + URLEncoder.encode(eURL) + "');return false;\" title='Encounter'>E</a> "; } // add form links to string if (hasPrivilege("_billing", roleName$)) { buttons += bShortcutForm ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName + "&demographic_no=" + demographic_no + "\")' title='form'>" + formNameShort + "</a> " : ""; buttons += bShortcutForm2 ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName2 + "&demographic_no=" + demographic_no + "\")' title='form'>" + formName2Short + "</a> " : ""; buttons += (bShortcutIntakeForm) ? "| <a href='#' onClick='popupPage(700, 1024, \"formIntake.jsp?demographic_no=" + demographic_no + "\")'>In</a> " : ""; } // add B button to string if (hasPrivilege("_billing", roleName$)) { buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing.do?skipReload=true&billRegion=" + URLEncoder.encode(prov) + "&billForm=" + URLEncoder.encode(oscarProperties.getProperty("default_view")) + "&hotclick=&appointment_no=0&demographic_name=" + URLEncoder.encode(clLastName) + "%2C" + URLEncoder.encode(clFirstName) + "&demographic_no=" + demographic_no + "&providerview=1&user_no=" + curUser_no + "&apptProvider_no=none&appointment_date=" + year + "-" + month + "-" + day + "&start_time=0:00&bNewForm=1&status=t');return false;\" title='Billing'>B</a> "; buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing/CA/ON/billinghistory.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appointment_date&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=10');return false;\" title='Billing'>BHx</a> "; } // add M button to string if (hasPrivilege("_masterLink", roleName$)) { buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&displaymode=edit&dboperation=search_detail');return false;\" title='Master File'>M</a> "; } // add Rx button to string if (isModuleLoaded(request, "TORONTO_RFQ", true) && hasPrivilege("_appointment.doctorLink", roleName$)) { buttons += "| <a href='#' onClick=\"popupOscarRx(700,1027,'../oscarRx/choosePatient.do?providerNo=" + curUser_no + "&demographicNo=" + demographic_no + "');return false;\">Rx</a> "; } // add Tickler button to string buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerAdd.jsp?name=" + URLEncoder.encode(clLastName) + "%2C" + URLEncoder.encode(clFirstName) + "&chart_no=&bFirstDisp=false&demographic_no=" + demographic_no + "&messageID=null&doctor_no=" + curUser_no + "'); return false;\">T</a> "; // add Msg button to string buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/SendDemoMessage.do?demographic_no=" + demographic_no + "'); return false;\">Msg</a> "; entry.add(buttons); // age String clAge = demographicResult.get(0).get("age") != null ? demographicResult.get(0).get("age").toString() : ""; String clBDay = demographicResult.get(0).get("month_of_birth").toString() + "-" + demographicResult.get(0).get("date_of_birth").toString(); if (isBirthday(monthDay, clBDay)) { clAge += " <img src='../images/cake.gif' height='20' />"; } entry.add(clAge); // sex String clSex = demographicResult.get(0).get("sex").toString(); entry.add(clSex); // last appt String lapptQuery = "cl_last_appt"; List<Map<String, Object>> lapptResult = caseloadDao.getCaseloadDemographicData(lapptQuery, demographicParam); if ((!lapptResult.isEmpty()) && lapptResult.get(0).get("max(appointment_date)") != null && !lapptResult.get(0).get("max(appointment_date)").toString().equals("")) { String clLappt = lapptResult.get(0).get("max(appointment_date)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">" + clLappt + "</a>"); } else { entry.add(" "); } // next appt String napptQuery = "cl_next_appt"; List<Map<String, Object>> napptResult = caseloadDao.getCaseloadDemographicData(napptQuery, demographicParam); if (!napptResult.isEmpty() && napptResult.get(0).get("min(appointment_date)") != null && !napptResult.get(0).get("min(appointment_date)").toString().equals("")) { String clNappt = napptResult.get(0).get("min(appointment_date)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">" + clNappt + "</a>"); } else { entry.add(" "); } // num appts in last year String numApptsQuery = "cl_num_appts"; List<Map<String, Object>> numApptsResult = caseloadDao.getCaseloadDemographicData(numApptsQuery, demographicParam); if (!numApptsResult.isEmpty() && numApptsResult.get(0).get("count(*)") != null && !numApptsResult.get(0).get("count(*)").toString().equals("") && !numApptsResult.get(0).get("count(*)").toString().equals("0")) { String clNumAppts = numApptsResult.get(0).get("count(*)").toString(); entry.add(clNumAppts); } else { entry.add(" "); } // new labs String[] userDemoParam = new String[2]; userDemoParam[0] = curUser_no; userDemoParam[1] = demographic_no; String newLabQuery = "cl_new_labs"; List<Map<String, Object>> newLabResult = caseloadDao.getCaseloadDemographicData(newLabQuery, userDemoParam); if (!newLabResult.isEmpty() && newLabResult.get(0).get("count(*)") != null && !newLabResult.get(0).get("count(*)").toString().equals("") && !newLabResult.get(0).get("count(*)").toString().equals("0")) { String clNewLab = newLabResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo=" + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient=" + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_HL7'); return false;\">" + clNewLab + "</a>"); } else { entry.add(" "); } // new docs String newDocQuery = "cl_new_docs"; List<Map<String, Object>> newDocResult = caseloadDao.getCaseloadDemographicData(newDocQuery, userDemoParam); if (!newDocResult.isEmpty() && newDocResult.get(0).get("count(*)") != null && !newDocResult.get(0).get("count(*)").toString().equals("") && !newDocResult.get(0).get("count(*)").toString().equals("0")) { String clNewDoc = newDocResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo=" + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient=" + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_DOC'); return false;\">" + clNewDoc + "</a>"); } else { entry.add(" "); } // new ticklers String newTicklerQuery = "cl_new_ticklers"; List<Map<String, Object>> newTicklerResult = caseloadDao.getCaseloadDemographicData(newTicklerQuery, demographicParam); if (!newTicklerResult.isEmpty() && newTicklerResult.get(0).get("count(*)") != null && !newTicklerResult.get(0).get("count(*)").toString().equals("") && !newTicklerResult.get(0).get("count(*)").toString().equals("0")) { String clNewTickler = newTicklerResult.get(0).get("count(*)").toString(); entry.add("<a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerDemoMain.jsp?demoview=" + demographic_no + "'); return false;\">" + clNewTickler + "</a>"); } else { entry.add(" "); } // new messages String newMsgQuery = "cl_new_msgs"; List<Map<String, Object>> newMsgResult = caseloadDao.getCaseloadDemographicData(newMsgQuery, demographicParam); if (!newMsgResult.isEmpty() && newMsgResult.get(0).get("count(*)") != null && !newMsgResult.get(0).get("count(*)").toString().equals("") && !newMsgResult.get(0).get("count(*)").toString().equals("0")) { String clNewMsg = newMsgResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/DisplayDemographicMessages.do?orderby=date&boxType=3&demographic_no=" + demographic_no + "&providerNo=" + curUser_no + "&userName=" + URLEncoder.encode(userfirstname + " " + userlastname) + "'); return false;\">" + clNewMsg + "</a>"); } else { entry.add(" "); } // measurements String msmtQuery = "cl_measurement"; String[] msmtParam = new String[2]; msmtParam[1] = demographic_no; // BMI msmtParam[0] = "BMI"; List<Map<String, Object>> msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clBmi = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=BMI'); return false;\">" + clBmi + "</a>"); } else { entry.add(" "); } // BP msmtParam[0] = "BP"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clBp = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=BP'); return false;\">" + clBp + "</a>"); } else { entry.add(" "); } // WT msmtParam[0] = "WT"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clWt = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=WT'); return false;\">" + clWt + "</a>"); } else { entry.add(" "); } // SMK msmtParam[0] = "SMK"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clSmk = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=SMK'); return false;\">" + clSmk + "</a>"); } else { entry.add(" "); } // A1C msmtParam[0] = "A1C"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clA1c = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=A1C'); return false;\">" + clA1c + "</a>"); } else { entry.add(" "); } // ACR msmtParam[0] = "ACR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clAcr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=ACR'); return false;\">" + clAcr + "</a>"); } else { entry.add(" "); } // SCR msmtParam[0] = "SCR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clScr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=SCR'); return false;\">" + clScr + "</a>"); } else { entry.add(" "); } // LDL msmtParam[0] = "LDL"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clLdl = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=LDL'); return false;\">" + clLdl + "</a>"); } else { entry.add(" "); } // HDL msmtParam[0] = "HDL"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clHdl = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=HDL'); return false;\">" + clHdl + "</a>"); } else { entry.add(" "); } // TCHD msmtParam[0] = "TCHD"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clTchd = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=TCHD'); return false;\">" + clTchd + "</a>"); } else { entry.add(" "); } // EGFR msmtParam[0] = "EGFR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clEgfr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=EGFR'); return false;\">" + clEgfr + "</a>"); } else { entry.add(" "); } // EYEE msmtParam[0] = "EYEE"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clEyee = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=EYEE'); return false;\">" + clEyee + "</a>"); } else { entry.add(" "); } data.add(entry); } return data; }
From source file:org.mitre.eren.model.ModelManager.java
public void reportResourceStatus(String resourceID, String resourceName, String status, double quantity) { log.info("reportResourceStatus " + resourceID + " resourceName " + resourceName + " status " + status + " quantity " + quantity); EDXLDistribution edxl = client.makeEdxl(sender); ReportResourceDeploymentStatus rrds = client.attachElement(edxl, RM_REPORTRESOURCEDEPLOYMENTSTATUS); rrds.setMessageID("urn:au-qld-eoc:997967"); // date/*from w w w. j av a 2 s .com*/ java.util.GregorianCalendar today = new java.util.GregorianCalendar();// temp XMLGregorianCalendar dateTime = ERENDatatypeFactory.factory.newXMLGregorianCalendar( today.get(java.util.GregorianCalendar.YEAR), today.get(java.util.GregorianCalendar.MONTH) + 1, today.get(java.util.GregorianCalendar.DAY_OF_MONTH), 0, 0, 0, 0, 0); // rrds.setSentDateTime(dateTime); rrds.setOriginatingMessageID("urn:au-qld-eoc:12332");// FIXME: need to get from request rrds.setPrecedingMessageID("urn:au-qld-eoc:997958");// not sure where this comes from IncidentInformationType ii = rrds.addIncidentInformation(); ii.setIncidentDescription("Anthrax Release");// FIXME: need to get from request ContactInformationType ci = rrds.addContactInformation();// may get this etc. from model do we need this? ci.setContactRole(ContactRoleType.SENDER); PartyType pt = ci.addAdditionalContactInformation(); PartyNameType ptname = pt.addPartyName(); PersonName pname = ptname.addPersonName(); NameElement ne = pname.addNameElement(); ne.setElementType(PersonNameElementList.FIRST_NAME); ne.setText("Charlotte"); ne = pname.addNameElement(); ne.setElementType(PersonNameElementList.LAST_NAME); ne.setText("Ryan"); OrganisationName org = ptname.addOrganisationName(); ne = org.addNameElement(); ne.setElementType(PersonNameElementList.LAST_NAME); ne.setText("Norfolk EOC"); Occupations occs = pt.addOccupations(); Occupation occ = occs.addOccupation(); OccupationElement occe = occ.addOccupationElement(); occe.setType(OccupationElementList.ROLE); occe.setText("POD Manager"); ci = rrds.addContactInformation();// requester FIXME: Get From Request ci.setContactRole(ContactRoleType.REQUESTER); pt = ci.addAdditionalContactInformation(); ptname = pt.addPartyName(); pname = ptname.addPersonName(); ne = pname.addNameElement(); ne.setElementType(PersonNameElementList.FIRST_NAME); ne.setText("John"); // FIXME: Get From Request ne = pname.addNameElement(); ne.setElementType(PersonNameElementList.LAST_NAME); ne.setText("Smith"); // FIXME: Get From Request org = ptname.addOrganisationName(); ne = org.addNameElement(); ne.setElementType(PersonNameElementList.LAST_NAME); ne.setText("Norfolk EOC"); // FIXME: Get From Request occs = pt.addOccupations(); occ = occs.addOccupation(); occe = occ.addOccupationElement(); occe.setType(OccupationElementList.ROLE); occe.setText("Unified Commander"); // FIXME: Get From Request // Resource Information ResourceInformation ri = rrds.addResourceInformation(); ri.setResourceInfoElementID("001"); Resource r = ri.addResource(); r.setResourceID(resourceID); r.setName("resourceName"); ValueListType vlt = r.addTypeStructure(); vlt.setValueListURN(RM_RESOURCETYPES); vlt.addValue("Point of Distribution");// is this correct? r.setDescription("A facility to be used to distribute medications to the population"); ResourceStatus rs = r.addResourceStatus(); vlt = rs.addDeploymentStatus(); vlt.setValueListURN(RM_DEPLOYMENTSTATUSTYPES); vlt.addValue(status); // is this correct? AssignmentInformation assgn = ri.addAssignmentInformation(); QuantityType qt = assgn.addQuantity(); MeasuredQuantity mq = qt.addMeasuredQuantity(); mq.setAmount(quantity); ScheduleInformation si = ri.addScheduleInformation(); si.setScheduleType(ScheduleTypeType.BEGIN_AVAILABLE); // now date FIXME: from model time dateTime = ERENDatatypeFactory.factory.newXMLGregorianCalendar(today.get(java.util.GregorianCalendar.YEAR), today.get(java.util.GregorianCalendar.MONTH) + 1, today.get(java.util.GregorianCalendar.DAY_OF_MONTH), 0, 0, 0, 0, 0); si.setDateTime(dateTime); LocationType lt = si.addLocation();//LocationType.RM_TARGETAREA WhereType wt = lt.addTargetArea(); PointType point = wt.addPoint(); DirectPositionType dpt = point.addPos(); ArrayList<Double> myArr = new ArrayList<Double>(); myArr.add(36.815278); myArr.add(-76.297222); dpt.setValue(myArr); client.send(edxl); }
From source file:org.i4change.app.remote.UserService.java
public Long checkUserStatus(String SID) { try {/*w ww . j ava2 s .c o m*/ Long users_id = this.sessionmanagement.checkSession(SID); Long user_level = this.userDaoImpl.getUserLevelByID(users_id); if (AuthLevelmanagement.checkUserLevel(user_level)) { Users user = this.userDaoImpl.getUserById(users_id); //Check if the User-Account has expired if (user.getExpireDate() != null) { Date now = new Date(); if (user.getExpireDate().getTime() < now.getTime()) { return new Long(-44); } } //check if the user has reached his maxFreeWorkdays => only do that in case the user is pending if (user.getIsPending()) { if (user.getMaxWorkDays() != null && user.getUsedWorkDays() != null && user.getUsedWorkDays() >= user.getMaxWorkDays()) { return new Long(-45); } else { //check if today is already a new WorkDay if (user.getLastWorkDay() == null || user.getUsedWorkDays() == null) { user.setUsedWorkDays(new Long(1)); //int year, int month, int dayOfMonth, int hourOfDay,int minute GregorianCalendar cal = new GregorianCalendar(); long dt = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0).getTimeInMillis(); Date todayMidnight = new Date(dt); user.setLastWorkDay(todayMidnight); this.userDaoImpl.updateUser(user); } else { Date now = new Date(); Long timeDifferenceInMilliSeconds = now.getTime() - user.getLastWorkDay().getTime(); //log.debug("timeDifferenceInMilliSeconds: "+timeDifferenceInMilliSeconds); //log.debug("must########################: "+86400000); if (timeDifferenceInMilliSeconds >= 86400000) { //new Workdays user.setUsedWorkDays(user.getUsedWorkDays() + 1); //int year, int month, int dayOfMonth, int hourOfDay,int minute GregorianCalendar cal = new GregorianCalendar(); long dt = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0).getTimeInMillis(); Date todayMidnight = new Date(dt); user.setLastWorkDay(todayMidnight); this.userDaoImpl.updateUser(user); } } } } return new Long(2); } } catch (Exception err) { log.error("[checkUserStatus]", err); } return new Long(-1); }
From source file:org.tolven.web.MenuAction.java
/** * Creates a dataset from menuData.// w ww. jav a2s .com * * @return An XY dataset */ public XYDataset createDataset(String path) { // Adjust the path to make this work MenuStructure msLab = getMenuLocal().findMenuStructure(getAccountId(), path); if (msLab == null) throw new IllegalArgumentException("Path not valid for this account"); // Create a new path based on the matching id(s) from the called path // for example, if patient were specified in the input nodeValues and the new path has a patient node, then // it's pulled. MenuPath mdPath = new MenuPath(msLab.getPath(), getTargetMenuPath()); // TolvenLogger.info("dataset: Query from " + msLab.getPath() + " for requested path: " + getTargetMenuPath(), MenuAction.class); MenuQueryControl ctrl = new MenuQueryControl(); ctrl.setLimit(5000); // TODO: This is a hard coded hard query limit that should be in a property or something ctrl.setMenuStructure(msLab); ctrl.setAccountUser(TolvenRequest.getInstance().getAccountUser()); ctrl.setNow(getNow()); ctrl.setOffset(0); ctrl.setOriginalTargetPath(mdPath); ctrl.setRequestedPath(mdPath); List<MenuData> menuData = getMenuLocal().findMenuData(ctrl); TimeSeries s1 = new TimeSeries("triglycerides (mg/dL)", Month.class); TimeSeries s2 = new TimeSeries("low-density lipoprotein - LDL (mg/dL)", Month.class); for (MenuData md : menuData) { TimeSeries sx; // TolvenLogger.info("MD Item: " + md.getId(), MenuAction.class); String result = md.getString02(); if ("triglycerides".equals(result)) { sx = s1; } else if (result != null && result.startsWith("low-density")) { sx = s2; } else continue; GregorianCalendar cal = new GregorianCalendar(); cal.setTime(md.getDate01()); Month m = new Month(cal.get(GregorianCalendar.MONTH) + 1, cal.get(GregorianCalendar.YEAR)); // TolvenLogger.info( "Graph Data: " + m.getMonth() + "/" + m.getYear() + "=" + md.getPqValue01(), MenuAction.class); sx.addOrUpdate(m, md.getPqValue01()); } TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); dataset.setDomainIsPointsInTime(true); TolvenLogger.info("Done preparing Dataset", MenuAction.class); return dataset; }
From source file:org.motechproject.mobile.omp.manager.intellivr.IntellIVRBean.java
@Transactional public int getCountIVRCallSessionsInLastDays(int days) { days = days < 0 ? 0 : days;//from w w w . j a va 2 s. c om GregorianCalendar end = new GregorianCalendar(); GregorianCalendar lastMidnight = new GregorianCalendar(end.get(GregorianCalendar.YEAR), end.get(GregorianCalendar.MONTH), end.get(GregorianCalendar.DAY_OF_MONTH)); Date start = addToDate(lastMidnight.getTime(), GregorianCalendar.DAY_OF_MONTH, (int) (days - 1) * (-1)); return ivrDao.countIVRCallSessionsCreatedBetweenDates(start, end.getTime()); }
From source file:org.motechproject.mobile.omp.manager.intellivr.IntellIVRBean.java
@Transactional public int getCountIVRCallsInLastDays(int days) { days = days < 0 ? 0 : days;//from w w w. j a va2 s . c o m GregorianCalendar end = new GregorianCalendar(); GregorianCalendar lastMidnight = new GregorianCalendar(end.get(GregorianCalendar.YEAR), end.get(GregorianCalendar.MONTH), end.get(GregorianCalendar.DAY_OF_MONTH)); Date start = addToDate(lastMidnight.getTime(), GregorianCalendar.DAY_OF_MONTH, (int) (days - 1) * (-1)); return ivrDao.countIVRCallsCreatedBetweenDates(start, end.getTime()); }