List of usage examples for java.sql Date getTime
public long getTime()
From source file:org.kuali.ole.pdp.dataaccess.impl.PaymentDetailDaoOjb.java
/** * @see org.kuali.ole.pdp.dataaccess.PaymentDetailDao#getDisbursementNumberRanges(java.lang.String) *//* w w w . j a v a 2 s . c o m*/ public List<DisbursementNumberRange> getDisbursementNumberRanges(String campus) { LOG.debug("getDisbursementNumberRanges() started"); java.util.Date now = new java.util.Date(); Timestamp nowTs = new Timestamp(now.getTime()); Criteria criteria = new Criteria(); criteria.addLessOrEqualThan(PdpPropertyConstants.DISBURSEMENT_NUMBER_RANGE_START_DATE, nowTs); criteria.addEqualTo(PdpPropertyConstants.PHYS_CAMPUS_PROC_CODE, campus); criteria.addEqualTo(OLEPropertyConstants.ACTIVE, true); QueryByCriteria qbc = new QueryByCriteria(DisbursementNumberRange.class, criteria); qbc.addOrderBy(OLEPropertyConstants.BANK_CODE, true); return (List<DisbursementNumberRange>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); }
From source file:org.kuali.kfs.module.ar.report.service.impl.ContractsGrantsAgingReportBuilderServiceImpl.java
/** * @param cgInvoiceReportEntry// www . j a va2s . c om * @param reportDetail */ protected void setReportData(ContractsGrantsInvoiceDocument cgInvoiceReportEntry, ContractsGrantsAgingReportDetailDataHolder reportDetail) { java.util.Date today = new java.util.Date(); Date sqlToday = new java.sql.Date(today.getTime()); reportDetail.setAgencyNumber( cgInvoiceReportEntry.getInvoiceGeneralDetail().getAward().getAgency().getAgencyNumber()); reportDetail.setAgencyName( cgInvoiceReportEntry.getInvoiceGeneralDetail().getAward().getAgency().getReportingName()); reportDetail.setCustomerNumber(cgInvoiceReportEntry.getCustomerNumber()); reportDetail .setProposalNumber(cgInvoiceReportEntry.getInvoiceGeneralDetail().getProposalNumber().toString()); reportDetail .setAwardEndDate(cgInvoiceReportEntry.getInvoiceGeneralDetail().getAward().getAwardEndingDate()); reportDetail.setDocumentNumber(cgInvoiceReportEntry.getDocumentNumber()); WorkflowDocument workflowDocument = cgInvoiceReportEntry.getDocumentHeader().getWorkflowDocument(); Date docCreateDate = new Date(workflowDocument.getDateCreated().toDate().getTime()); reportDetail.setInvoiceDate(docCreateDate); // last event date List<CollectionEvent> events = cgInvoiceReportEntry.getCollectionEvents(); if (ObjectUtils.isNotNull(events) && CollectionUtils.isNotEmpty(events)) { Collections.sort(events, new Comparator<CollectionEvent>() { @Override public int compare(CollectionEvent o1, CollectionEvent o2) { if (KfsDateUtils.isSameDay(o1.getActivityDate(), o2.getActivityDate())) { return 0; } return o2.getActivityDate().compareTo(o1.getActivityDate()); } }); reportDetail.setLastEventDate(events.get(0).getActivityDate()); } // calculate ageInDays : current date - created date final long MILLSECS_PER_DAY = 24 * 60 * 60 * 1000; reportDetail.setAgeInDays((sqlToday.getTime() - docCreateDate.getTime()) / MILLSECS_PER_DAY); BigDecimal invoiceAmount = cgInvoiceReportEntry.getTotalDollarAmount().bigDecimalValue(); reportDetail.setInvoiceAmount(invoiceAmount); BigDecimal paymentAmount = cgInvoiceReportEntry.getPaymentAmount().bigDecimalValue(); reportDetail.setPaymentAmount(paymentAmount); BigDecimal remainingAmount = invoiceAmount.subtract(paymentAmount); reportDetail.setRemainingAmount(remainingAmount); }
From source file:org.kuali.kfs.pdp.service.impl.PaymentGroupServiceImpl.java
/** * @see org.kuali.kfs.pdp.service.PaymentGroupService#processPaidGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup, java.sql.Date) *//*from ww w .j av a 2 s .co m*/ public void processPaidGroup(PaymentGroup group, Date processDate) { LOG.debug("processPaidGroup() started"); Timestamp ts = new Timestamp(processDate.getTime()); group.setEpicPaymentPaidExtractedDate(ts); group.setLastUpdate(ts); this.businessObjectService.save(group); }
From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java
@Test(groups = { "find" }) public void testFindById01() { try {// w w w.j a v a 2 s. c o m SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); java.util.Date start_util_date = formatter.parse("20020701"); Job_History result = job_HistoryMapper.findByIdRaw(200L, new Date(start_util_date.getTime())); assertNotNull(result); } catch (ParseException ex) { assertTrue(false); } }
From source file:org.kuali.kfs.pdp.service.impl.PaymentGroupServiceImpl.java
/** * @see org.kuali.kfs.pdp.service.PaymentGroupService#processCancelledGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup, * java.sql.Date)// w ww. ja v a2 s . com */ public void processCancelledGroup(PaymentGroup group, Date processDate) { LOG.debug("processCancelledGroup() started"); Timestamp ts = new Timestamp(processDate.getTime()); group.setEpicPaymentCancelledExtractedDate(ts); group.setLastUpdate(ts); this.businessObjectService.save(group); }
From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java
@Test(groups = { "find" }) public void testFindById02() { try {/*from w w w. jav a 2s. c o m*/ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); Employee searchemp = new Employee(); searchemp.setId(200L); java.util.Date start_util_date = formatter.parse("20020701"); Job_History result = job_HistoryMapper.findByIdObj(searchemp, new Date(start_util_date.getTime())); assertNotNull(result); } catch (ParseException ex) { assertTrue(false); } }
From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java
@Test(groups = { "find" }) public void testFindByRawProperties01() { try {//www. ja va 2 s . c o m SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); java.util.Date start_util_date = formatter.parse("20020701"); Job_History search = job_HistoryMapper.findByIdRaw(200L, new Date(start_util_date.getTime())); List<Job_History> result = job_HistoryMapper.findByRawProperties(search); assertEquals(result.size(), 1); assertNotNull(result.get(0)); assertNotNull(result.get(0).getEmployee()); assertNotNull(result.get(0).getJob()); assertNotNull(result.get(0).getDepartment()); } catch (ParseException ex) { assertTrue(false); } }
From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java
@Test(groups = { "find" }) public void testFindByRawType() { try {/* w w w.j av a 2 s .c o m*/ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); java.util.Date start_util_date = formatter.parse("20020701"); Job_History search = job_HistoryMapper.findByIdRaw(200L, new Date(start_util_date.getTime())); List<Job_History> result = job_HistoryMapper.findByRawType(search); assertEquals(result.size(), 1); assertNotNull(result.get(0)); assertNotNull(result.get(0).getEmployee()); assertNotNull(result.get(0).getJob()); assertNotNull(result.get(0).getDepartment()); } catch (ParseException ex) { assertTrue(false); } }
From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java
@Test(groups = { "delete" }, dependsOnGroups = { "update", "insert" }, enabled = false) public void testDelete() { Employee emp = employeesMapper.findById(167L); try {/*from www .j ava 2 s . c om*/ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); java.util.Date start_util_date = formatter.parse("19900101071010"); Job_History.Key thekey = new Job_History.Key(emp, new Date(start_util_date.getTime())); job_HistoryMapper.deleteById(thekey); assertNull(job_HistoryMapper.findById(thekey)); } catch (ParseException ex) { assertTrue(false); } }
From source file:org.psystems.dicom.browser.server.stat.StatClientRequestsChartServlet2.java
/** * @param connection/* w w w . jav a 2 s . c o m*/ * @param series * @param metrica * @param timeBegin * @param timeEnd * @param dataset * @throws SQLException */ private void getMetrics(Connection connection, String series, String metrica, Calendar calendarBegin, Calendar calendarEnd, DefaultCategoryDataset dataset) throws SQLException { PreparedStatement stmt = null; try { SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy"); Calendar calendar1 = (Calendar) calendarBegin.clone(); String dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); for (int i = 0; i < 6; i++) { calendar1.add(Calendar.DAY_OF_MONTH, 1); dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); } stmt = connection.prepareStatement("SELECT METRIC_VALUE_LONG, METRIC_DATE" + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ? and " + " METRIC_DATE BETWEEN ? AND ? "); stmt.setString(1, metrica); stmt.setDate(2, new java.sql.Date(calendarBegin.getTimeInMillis())); stmt.setDate(3, new java.sql.Date(calendarEnd.getTimeInMillis())); ResultSet rs = stmt.executeQuery(); while (rs.next()) { long value = rs.getLong("METRIC_VALUE_LONG"); Date date = rs.getDate("METRIC_DATE"); dateStr = format.format(date.getTime()); String category = dateStr; dataset.addValue(value, series, category); // System.out.println(value + " = " + series + " = "+ category); } rs.close(); } finally { if (stmt != null) stmt.close(); } }