public Order( User user, LocalDate createdAtDate, LocalTime createdAtTime, LocalDate serveAtDate, LocalTime serveAtTime, String orderNumber, String desc) throws NullPointerException { this.createdDate = createdAtDate; this.createdTime = createdAtTime; this.user = user; createdTime = LocalTime.now(); this.serveAtDate = serveAtDate; this.serveAtTime = serveAtTime; this.description = desc; orderedMeals = new ArrayList<>(); number = orderNumber; sspCreatedDate = new SimpleStringProperty(createdDate.toString()); sspCreatedTime = new SimpleStringProperty(createdTime.toString()); sspOrderedMeals = new SimpleStringProperty(); sspUserName = new SimpleStringProperty(this.user.getUserName().get()); sspNumber = new SimpleStringProperty(number.toString()); sspServeAtDate = new SimpleStringProperty(serveAtDate.toString()); sspServeAtTime = new SimpleStringProperty(serveAtTime.toString()); sspPrice = new SimpleStringProperty(); sspDescription = new SimpleStringProperty(description); sspCreatedAtCompact = new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString()); sspServeAtCompact = new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString()); }
@SuppressWarnings("unchecked") @Override public void readExternal(ObjectInput arg0) throws IOException, ClassNotFoundException { createdDate = (LocalDate) arg0.readObject(); createdTime = (LocalTime) arg0.readObject(); user = (User) arg0.readObject(); serveAtDate = (LocalDate) arg0.readObject(); serveAtTime = (LocalTime) arg0.readObject(); active = (boolean) arg0.readObject(); number = (String) arg0.readObject(); orderedMeals = (ArrayList<MealAndQuantity>) arg0.readObject(); sspCreatedDate = new SimpleStringProperty(createdDate.toString()); sspCreatedTime = new SimpleStringProperty(createdTime.toString()); sspOrderedMeals = new SimpleStringProperty(); sspUserName = new SimpleStringProperty(user.getUserName().get()); sspNumber = new SimpleStringProperty(number.toString()); sspServeAtDate = new SimpleStringProperty(serveAtDate.toString()); sspServeAtTime = new SimpleStringProperty(serveAtTime.toString()); sspPrice = new SimpleStringProperty(); sspCreatedAtCompact = new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString()); sspServeAtCompact = new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString()); }
/** * Initialises the collection of entity information from the ICAT into the Dashboard. */ private void initialiseEntityCollection() { LocalDate today = LocalDate.now(); LOG.info("Data Collection initiated for " + today.toString()); LocalDate earliestEntityImport = getNextImportDate("entity"); LocalDate earliestInstrumentImport = getNextImportDate("instrument"); LocalDate earliestInvestigationImport = getNextImportDate("investigation"); // Import data into Dashboard even if the import script has never been run if (earliestEntityImport == null && earliestInstrumentImport == null && earliestInvestigationImport == null) { LocalDate past = LocalDate.now().minusWeeks(1); counter.performEntityCountCollection(past, today); counter.performInstrumentMetaCollection(past, today); counter.performInvestigationMetaCollection(past, today); } // An actual import has happened. if (earliestEntityImport != null) { counter.performEntityCountCollection(earliestEntityImport, today); } if (earliestInstrumentImport != null) { counter.performInstrumentMetaCollection(earliestInstrumentImport, today); } if (earliestInvestigationImport != null) { counter.performInvestigationMetaCollection(earliestInvestigationImport, today); } LOG.info("Data collection completed for " + today.toString()); }
@Test public void testPack() { LocalDate date = LocalDate.now(); LocalTime time = LocalTime.now(); long packed = pack(date, time); LocalDate d1 = PackedLocalDate.asLocalDate(date(packed)); LocalTime t1 = PackedLocalTime.asLocalTime(time(packed)); assertNotNull(d1); assertNotNull(t1); assertEquals(date.toString(), d1.toString()); }
@Override protected boolean encodeNonNullObject(Object object, JsonGenerator out) throws IOException { LocalDate date = (LocalDate) object; String formatted = date.toString(); out.writeObject(formatted); return true; }
void saveNewJobsByDate(String folderPath, String printerName) throws ClientProtocolException, IOException, ParseJobException { List<JobDetail> toSave = new ArrayList<JobDetail>(); int getJobsFrom; String latestLog = LogFiles.getMostRecentLogFileName(folderPath, printerName); if (latestLog != null) { JobDetailCSV l2csv = new JobDetailCSV(latestLog); // We'll be resaving the latest csv as it may have new jobs toSave = l2csv.readCSV(); getJobsFrom = LogFiles.getLastSavedJob(folderPath, printerName).getJobNumber(); } else { getJobsFrom = 0; } List<JobDetail> newJobs = printer.getJobsSinceJobNumber(getJobsFrom); toSave.addAll(newJobs); LogFiles.sortJobsByNumber(toSave); TreeMap<LocalDate, List<JobDetail>> sorted = LogFiles.splitJobsByDate(toSave); for (LocalDate day : sorted.keySet()) { JobDetailCSV jd = new JobDetailCSV(csvFolder + "/" + printer.getPrinterName() + day.toString()); jd.write(sorted.get(day)); } }
/** * Checks to see if there have been any failed imports. If any are found then they are sent to be * re-done. */ public void checkForFailedImports() { LOG.info("Check for missed data collections."); TypedQuery<ImportCheck> failedImportQuery = manager.createQuery("SELECT ic FROM ImportCheck ic WHERE ic.passed = 0", ImportCheck.class); List<ImportCheck> failedImports = failedImportQuery.getResultList(); if (!failedImports.isEmpty()) { for (ImportCheck ic : failedImports) { String type = ic.getType(); LocalDate failedDate = convertToLocalDate(ic.getCheckDate()); LOG.info("Found a failed import for " + type + " on the " + failedDate.toString()); if ("instrument".equals(type)) { counter.performInstrumentMetaCollection(failedDate, failedDate.plusDays(1)); } else if ("investigation".equals(type)) { counter.performInvestigationMetaCollection(failedDate, failedDate.plusDays(1)); } else if ("entity".equals(type)) { counter.performEntityCountCollection(failedDate, failedDate.plusDays(1)); } } } LOG.info("Finished checking for missed data collections."); }
@Test @Transactional public void getOs_type() throws Exception { // Initialize the database os_typeRepository.saveAndFlush(os_type); // Get the os_type restOs_typeMockMvc .perform(get("/api/os_types/{id}", os_type.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(os_type.getId().intValue())) .andExpect(jsonPath("$.os_type_name").value(DEFAULT_OS_TYPE_NAME.toString())) .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString())) .andExpect(jsonPath("$.status_id").value(DEFAULT_STATUS_ID)) .andExpect(jsonPath("$.created_by").value(DEFAULT_CREATED_BY.toString())) .andExpect(jsonPath("$.created_date").value(DEFAULT_CREATED_DATE.toString())) .andExpect(jsonPath("$.modified_by").value(DEFAULT_MODIFIED_BY.toString())) .andExpect(jsonPath("$.modified_date").value(DEFAULT_MODIFIED_DATE.toString())); }
@Test @Transactional public void getRegister_info() throws Exception { // Initialize the database register_infoRepository.saveAndFlush(register_info); // Get the register_info restRegister_infoMockMvc .perform(get("/api/register_infos/{id}", register_info.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(register_info.getId().intValue())) .andExpect(jsonPath("$.date_checkin").value(DEFAULT_DATE_CHECKIN.toString())) .andExpect(jsonPath("$.date_checkout").value(DEFAULT_DATE_CHECKOUT.toString())) .andExpect(jsonPath("$.number_of_adult").value(DEFAULT_NUMBER_OF_ADULT)) .andExpect(jsonPath("$.number_of_kid").value(DEFAULT_NUMBER_OF_KID)) .andExpect(jsonPath("$.other_request").value(DEFAULT_OTHER_REQUEST.toString())) .andExpect(jsonPath("$.deposit_value").value(DEFAULT_DEPOSIT_VALUE.intValue())) .andExpect(jsonPath("$.create_date").value(DEFAULT_CREATE_DATE_STR)) .andExpect(jsonPath("$.last_modified_date").value(DEFAULT_LAST_MODIFIED_DATE_STR)); }
public Order(User user, LocalDate serveAtDate, LocalTime serveAtTime) { createdDate = LocalDate.now(); createdTime = LocalTime.now(); this.user = user; this.serveAtDate = serveAtDate; this.serveAtTime = serveAtTime; orderedMeals = new ArrayList<>(); number = new String(createdDate + "-" + createdTime + "-" + (++user.orderCount)); sspCreatedDate = new SimpleStringProperty(createdDate.toString()); sspCreatedTime = new SimpleStringProperty(createdTime.toString()); sspOrderedMeals = new SimpleStringProperty(); sspUserName = new SimpleStringProperty(user.getUserName().get()); sspNumber = new SimpleStringProperty(number.toString()); sspServeAtDate = new SimpleStringProperty(serveAtDate.toString()); sspServeAtTime = new SimpleStringProperty(serveAtTime.toString()); sspPrice = new SimpleStringProperty(); sspCreatedAtCompact = new SimpleStringProperty(createdDate.toString() + " " + createdTime.toString()); sspServeAtCompact = new SimpleStringProperty(serveAtDate.toString() + " " + serveAtTime.toString()); }
@Test @Transactional public void getClasseType() throws Exception { // Initialize the database classeTypeRepository.saveAndFlush(classeType); // Get the classeType restClasseTypeMockMvc .perform(get("/api/classeTypes/{id}", classeType.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(classeType.getId().intValue())) .andExpect(jsonPath("$.intitule").value(DEFAULT_INTITULE.toString())) .andExpect(jsonPath("$.dateCreation").value(DEFAULT_DATE_CREATION.toString())); }
private static Birthday toBirthday(final ResultSet rs, final int rowNum) throws SQLException { final Birthday birthday = new Birthday(); birthday.setId(rs.getString("MIG_ID").trim()); birthday.setName(String.join(" ", rs.getString("MIG_VORNAME"), rs.getString("MIG_NACHNAME"))); final LocalDate birthdate = asLocalDate(rs.getDate("MIG_GEB_DAT")); if (birthdate != null) { birthday.setDateOfBirth(birthdate.toString()); birthday.setMonth(birthdate.getMonth().getValue()); birthday.setDay(birthdate.getDayOfMonth()); birthday.setAge(ageOf(birthdate)); } return birthday; }
@Test public void getBook() throws Exception { // Initialize the database bookRepository.save(book); // Get the book restBookMockMvc .perform(get("/api/books/{id}", book.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(book.getId())) .andExpect(jsonPath("$.title").value(DEFAULT_TITLE.toString())) .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString())) .andExpect(jsonPath("$.publisher").value(DEFAULT_PUBLISHER.toString())) .andExpect(jsonPath("$.publicationDate").value(DEFAULT_PUBLICATION_DATE.toString())) .andExpect(jsonPath("$.price").value(DEFAULT_PRICE.intValue())); }
@Test @Transactional public void getEntry() throws Exception { // Initialize the database entryRepository.saveAndFlush(entry); // Get the entry restEntryMockMvc .perform(get("/api/entrys/{id}", entry.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(entry.getId().intValue())) .andExpect(jsonPath("$.date").value(DEFAULT_DATE.toString())) .andExpect(jsonPath("$.exercise").value(DEFAULT_EXERCISE)) .andExpect(jsonPath("$.meals").value(DEFAULT_MEALS)) .andExpect(jsonPath("$.alcohol").value(DEFAULT_ALCOHOL)) .andExpect(jsonPath("$.notes").value(DEFAULT_NOTES.toString())); }
@Test @Transactional public void getJugadores() throws Exception { // Initialize the database jugadoresRepository.saveAndFlush(jugadores); // Get the jugadores restJugadoresMockMvc .perform(get("/api/jugadoress/{id}", jugadores.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(jugadores.getId().intValue())) .andExpect(jsonPath("$.nombreJugador").value(DEFAULT_NOMBRE_JUGADOR.toString())) .andExpect(jsonPath("$.fechaNacimiento").value(DEFAULT_FECHA_NACIMIENTO.toString())) .andExpect(jsonPath("$.numCanastas").value(DEFAULT_NUM_CANASTAS)) .andExpect(jsonPath("$.numAsistencias").value(DEFAULT_NUM_ASISTENCIAS)) .andExpect(jsonPath("$.numRebotes").value(DEFAULT_NUM_REBOTES)) .andExpect(jsonPath("$.posicion").value(DEFAULT_POSICION.toString())); }
private boolean checkPI(Model ob) { boolean flag = true; flag &= check_button(bEmail, ob.getP().getEmail(), 0); flag &= check_button(bName, ob.getP().getName(), 0); flag &= check_button(bENum, ob.getEnrollment_number(), 0); flag &= check_button(bCategory, ob.getP().getCategory(), 1); flag &= check_button(bGender, changegender(ob.getP().getGender()), 0); flag &= check_button(bPhyDisabled, changedis(ob.getP().getPhysically_disabled()), 0); if (bDOB.getFlag()) { LocalDate temp = ob.getP().getDate_of_birth(); int res = temp.toString() .replace("/", "-") .replace("\\", "-") .compareTo(bDOB.getField().replaceAll("/", "-").replace("\\", "-")); String option = bDOB.getOption(); if (option.equals("On") && res != 0) flag &= false; if (option.equals("After") && res <= 0) flag &= false; if (option.equals("Before") && res >= 0) flag &= false; } return flag; }
@JsonProperty("@date") private String strValue() { return value.toString(); }
public static String getYahooURL(Earning.EARNINGS_TYPE earningType, LocalDate date) { String localDate = date.toString().replace("-", ""); return earningType.getUrl() + localDate + POST_FIX; }
@FXML private void buttonListenerCreatePaycheck(ActionEvent event) { tabPayCheck.setDisable(false); try { LocalDate d = dpPayDate.getValue(); lblCheckDate.setText(d.toString()); lblPayStubName.setText("Pay Stub for " + tfInfoName.getText()); double netPay = 0; if (rbHourly.isSelected()) { HourlyEmployee emp = new HourlyEmployee(); emp.setId(Integer.parseInt(tfInfoId.getText())); emp.setName(tfInfoName.getText()); emp.setPosition(tfInfoPos.getText()); emp.setStreet(tfInfoStreet.getText()); emp.setCity(Environment.getEmployeeStrInfo(emp.getId(), "city")); emp.setState(Environment.getEmployeeStrInfo(emp.getId(), "state")); emp.setZip(Environment.getEmployeeStrInfo(emp.getId(), "zip")); emp.setPayRate(Double.parseDouble(tfInfoPayRate.getText())); emp.setHours(Double.parseDouble(tfHours.getText())); if (emp.getHours() > 70) { lbOvtHrs.setText(String.format("%.2f", emp.getHours() - 70)); } lbHours.setText(emp.getHours() + ""); lbPayRate.setText(String.format("%.2f", emp.getPayRate())); lbgrsPay.setText(String.format("%.2f", emp.getGrossPay())); lblNetPayPayStub.setText(String.format("%.2f", emp.getNetPay())); lbTaxes.setText(String.format("%.2f", emp.getTaxes())); lblCheckDatePayStub.setText(d.toString()); lblPosition.setText(tfInfoPos.getText()); netPay = emp.getNetPay(); } else if (rbSalary.isSelected()) { SalaryEmployee emp = new SalaryEmployee(); emp.setId(Integer.parseInt(tfInfoId.getText())); emp.setName(tfInfoName.getText()); emp.setPosition(tfInfoPos.getText()); emp.setStreet(tfInfoStreet.getText()); emp.setCity(Environment.getEmployeeStrInfo(emp.getId(), "city")); emp.setState(Environment.getEmployeeStrInfo(emp.getId(), "state")); emp.setZip(Environment.getEmployeeStrInfo(emp.getId(), "zip")); emp.setPayRate(Double.parseDouble(tfInfoPayRate.getText())); emp.setHours(Double.parseDouble(tfHours.getText())); if (emp.getHours() > 100) { lbOvtHrs.setText(String.format("%.2f", emp.getHours() - 100)); } lbHours.setText(emp.getHours() + ""); lbPayRate.setText(String.format("%.2f", emp.getPayRate())); lbgrsPay.setText(String.format("%.2f", emp.getGrossPay())); lblNetPayPayStub.setText(String.format("%.2f", emp.getNetPay())); lbTaxes.setText(String.format("%.2f", emp.getTaxes())); lblCheckDatePayStub.setText(d.toString()); lblPosition.setText(tfInfoPos.getText()); netPay = emp.getNetPay(); } lblName.setText(tfInfoName.getText()); lblStreet.setText(tfInfoStreet.getText()); lblCSZ.setText(tfInfoCSZ.getText()); lblNetPay.setText(String.format("%.2f", netPay)); lblCheckAmountString.setText(CheckWriter.main(String.format("%.2f", netPay))); } catch (Exception e) { } }
public String getEndDateTimeAsString() { return endDate.toString() + " " + endTime; }
public String getStartDateTimeAsString() { return startDate.toString() + " " + startTime; }
@Override public String marshal(LocalDate v) throws Exception { return v.toString(); }
@Override public String marshal(LocalDate v) throws Exception { if (v != null) return v.toString(); return null; }
public MakeReservation() { new BorderLayout(); standardRoom.setMnemonic(KeyEvent.VK_K); standardRoom.setActionCommand("Standard Room"); standardRoom.setSelected(true); familyRoom.setMnemonic(KeyEvent.VK_F); familyRoom.setActionCommand("Family Room"); suiteRoom.setMnemonic(KeyEvent.VK_S); suiteRoom.setActionCommand("Suite"); // Add Booking Button ImageIcon bookRoomIcon = createImageIcon("images/book.png"); bookRoom = new JButton("Book Room", bookRoomIcon); bookRoom.setVerticalTextPosition(AbstractButton.BOTTOM); bookRoom.setHorizontalTextPosition(AbstractButton.CENTER); bookRoom.setMnemonic(KeyEvent.VK_M); bookRoom.addActionListener(this); bookRoom.setActionCommand("book"); // Group the radio buttons. group.add(standardRoom); group.add(familyRoom); group.add(suiteRoom); // Create the labels. nameLabel = new JLabel("Name: "); amountroomsLabel = new JLabel("How many rooms? "); checkoutdateLabel = new JLabel("Check-Out Date: "); checkindateLabel = new JLabel("Check-In Date: "); // Create the text fields and set them up. nameField = new JFormattedTextField(); nameField.setColumns(10); amountroomsField = new JFormattedTextField(new Integer(1)); amountroomsField.setValue(new Integer(1)); amountroomsField.setColumns(10); // java.util.Date dt_checkin = new java.util.Date(); LocalDate today = LocalDate.now(); // java.text.SimpleDateFormat sdf_checkin = new java.text.SimpleDateFormat("MM/dd/yyyy"); currentDate_checkin = today.toString(); checkindateField = new JFormattedTextField(currentDate_checkin); checkindateField.setColumns(10); // java.util.Date dt_checkout = new java.util.Date(); LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS); // java.text.SimpleDateFormat sdf_checkout = new java.text.SimpleDateFormat("MM/dd/yyyy"); currentDate_checkout = tomorrow.toString(); checkoutdateField = new JFormattedTextField(currentDate_checkout); checkoutdateField.setColumns(10); // Tell accessibility tools about label/textfield pairs. nameLabel.setLabelFor(nameField); amountroomsLabel.setLabelFor(amountroomsField); checkoutdateLabel.setLabelFor(checkoutdateField); checkindateLabel.setLabelFor(checkindateField); // Lay out the labels in a panel. JPanel labelPane1 = new JPanel(new GridLayout(0, 1)); labelPane1.add(amountroomsLabel); JPanel labelPane3 = new JPanel(new GridLayout(0, 1)); labelPane3.add(checkindateLabel); JPanel labelPane2 = new JPanel(new GridLayout(0, 1)); labelPane2.add(checkoutdateLabel); JPanel labelPane4 = new JPanel(new GridLayout(0, 1)); labelPane4.add(nameLabel); // Layout the text fields in a panel. JPanel fieldPane1 = new JPanel(new GridLayout(0, 1)); fieldPane1.add(amountroomsField); JPanel fieldPane3 = new JPanel(new GridLayout(0, 1)); fieldPane3.add(checkindateField); JPanel fieldPane2 = new JPanel(new GridLayout(0, 1)); fieldPane2.add(checkoutdateField); JPanel fieldPane4 = new JPanel(new GridLayout(0, 1)); fieldPane4.add(nameField); // Put the radio buttons in a column in a panel. JPanel radioPanel = new JPanel(new GridLayout(0, 1)); radioPanel.add(standardRoom); radioPanel.add(familyRoom); radioPanel.add(suiteRoom); // Put the panels in this panel, labels on left, // text fields on right. setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); add(labelPane1, BorderLayout.LINE_START); add(fieldPane1, BorderLayout.LINE_END); add(labelPane3, BorderLayout.LINE_START); add(fieldPane3, BorderLayout.LINE_END); add(labelPane2, BorderLayout.LINE_START); add(fieldPane2, BorderLayout.LINE_END); add(labelPane4, BorderLayout.LINE_START); add(fieldPane4, BorderLayout.LINE_END); add(radioPanel, BorderLayout.LINE_END); add(bookRoom); }
@Override public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeString(value.toString()); }