List of usage examples for java.util Calendar MINUTE
int MINUTE
To view the source code for java.util Calendar MINUTE.
Click Source Link
get
and set
indicating the minute within the hour. From source file:com.sms.server.service.JobService.java
@Scheduled(fixedDelay = 900000) private void cleanupJobs() { List<Job> jobs = jobDao.getActiveJobs(); // If there are no jobs to process don't bother going any further if (jobs == null) { return;/* ww w . j av a 2 s.c om*/ } // Get current time minus 60 minutes Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MINUTE, -INACTIVE_PERIOD_IN_MINUTES); // Timestamp to compare to a jobs last activity Timestamp inactivePeriod = new java.sql.Timestamp(calendar.getTime().getTime()); // Check for inactive jobs which have not been ended for (Job job : jobs) { if (job.getLastActivity().before(inactivePeriod)) { if (job.getType() == JobType.ADAPTIVE_STREAM) { adaptiveStreamingService.endProcess(job.getID()); } jobDao.updateEndTime(job.getID()); } } }
From source file:org.openehealth.coala.converter.PXSDateConverterTest.java
/** * @throws java.lang.Exception/*from w ww . j av a2 s . c o m*/ */ @Before public void setUp() throws Exception { ResourceBundle properties = ResourceBundle.getBundle("coala-document"); longPattern = properties.getString("coala.consent.longdatepattern"); shortPattern = properties.getString("coala.consent.shortdatepattern"); GregorianCalendar cal = new GregorianCalendar(); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 15); cal.set(Calendar.HOUR, 3); cal.set(Calendar.MINUTE, 36); cal.set(Calendar.SECOND, 50); cal.set(Calendar.MILLISECOND, 0); referenceDateLong = cal.getTime(); cal = new GregorianCalendar(); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 15); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); referenceDateShort = cal.getTime(); }
From source file:com.aimdek.ccm.dao.impl.test.CreditCardDaoImplTest.java
/** * initialize./*ww w.j a v a2 s. c o m*/ */ @Before public void initialize() { List<CreditCard> creditcardList = new ArrayList<CreditCard>(); CreditCard creditCard = new CreditCard(); creditCard.setAvailableCreditLimit(15000); creditCard.setCardNumber("1234-1234-1234-0008"); creditCard.setCreditLimit(20000); creditCard.setCvv(420); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -1); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); creditCard.setLastStatementDate(calendar.getTime()); creditCard.setStatementDate(new Date()); creditCard.setNameOnCard("Test1 Test1"); creditCard.setCardHolderId(1); creditCard.setValidFromDate(new Date()); creditCard.setValidToDate(new Date()); creditCardRepository.saveCreditCard(creditCard); creditCardId = creditCard.getId(); CreditCard creditCard1 = new CreditCard(); creditCard1.setAvailableCreditLimit(15000); creditCard1.setCardNumber("2345-1234-2345-0009"); creditCard1.setCreditLimit(20000); creditCard1.setCvv(420); creditCard1.setLastStatementDate(calendar.getTime()); creditCard1.setStatementDate(new Date()); creditCard1.setNameOnCard("Test2 Test2"); creditCard1.setCardHolderId(2); creditCard1.setValidFromDate(new Date()); creditCard1.setValidToDate(new Date()); creditcardList.add(creditCard1); CreditCard creditCard2 = new CreditCard(); creditCard2.setAvailableCreditLimit(15000); creditCard2.setCardNumber("1234-1234-1234-0010"); creditCard2.setCreditLimit(20000); creditCard2.setCvv(420); creditCard2.setLastStatementDate(calendar.getTime()); creditCard2.setStatementDate(new Date()); creditCard2.setNameOnCard("Test3 Test3"); creditCard2.setCardHolderId(3); creditCard2.setValidFromDate(new Date()); creditCard2.setValidToDate(new Date()); creditcardList.add(creditCard2); CreditCard creditCard3 = new CreditCard(); creditCard3.setAvailableCreditLimit(15000); creditCard3.setCardNumber("2345-1234-2345-0011"); creditCard3.setCreditLimit(20000); creditCard3.setCvv(420); creditCard3.setLastStatementDate(calendar.getTime()); creditCard3.setStatementDate(new Date()); creditCard3.setNameOnCard("Test4 Test4"); creditCard3.setCardHolderId(4); creditCard3.setValidFromDate(new Date()); creditCard3.setValidToDate(new Date()); creditcardList.add(creditCard3); CreditCard creditCard5 = new CreditCard(); creditCard5.setAvailableCreditLimit(15000); creditCard5.setCardNumber("1234-1234-1234-0012"); creditCard5.setCreditLimit(20000); creditCard5.setCvv(420); creditCard5.setLastStatementDate(calendar.getTime()); creditCard5.setStatementDate(new Date()); creditCard5.setNameOnCard("Test3 Test3"); creditCard5.setCardHolderId(4); creditCard5.setValidFromDate(new Date()); creditCard5.setValidToDate(new Date()); creditcardList.add(creditCard5); creditCardRepository.save(creditcardList); }
From source file:org.openmrs.module.pharmacyapi.api.prescription.util.NewPrescriptionItemGenerator.java
private Date getExpirationDateMinus2Days(final PrescriptionItem item) { final Calendar calendar = Calendar.getInstance(); calendar.setTime(item.getDrugOrder().getEncounter().getDateCreated()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.DAY_OF_MONTH, 10); while ((calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)) { calendar.add(Calendar.DAY_OF_MONTH, 1); }// w w w . ja va 2 s . c om return calendar.getTime(); }
From source file:erpsystem.chart.Charts.java
private static Calendar copyCalendar(Calendar calendar) { Calendar result = Calendar.getInstance(); result.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); return result; }
From source file:fr.syncarnet.tasks.Task.java
/** * Builds a task object giving it a unique UUID and storing the current time as entry date. * @param description//from ww w. jav a2s. com * The description of the task * @param due * Set it to <b>null</b> if not used * @param project * Set it to <b>null</b> if not used * @param priority * Set it to <b>MEDIUM</b> if not used */ public Task(String description, Calendar due, String project, Priority priority) { this.entry = new Date().getTime(); this.uuid = UUID.randomUUID(); this.description = description; if (due != null) { due.set(Calendar.HOUR_OF_DAY, 0); due.set(Calendar.MINUTE, 0); due.set(Calendar.SECOND, 0); due.set(Calendar.MILLISECOND, 0); } this.due = due; if (project != null && !project.equals("")) { this.project = project; } this.priority = priority; }
From source file:com.ecofactor.qa.automation.drapi.DRAPI_Test_Add_location_gateway.java
/** * String value is common for all test cases. * @param url is url// w w w . j a v a2 s.co m * @param targetJson is targetJson * @return String */ public String commonJson(final String url, final String targetJson) { System.out.println("targe" + targetJson); String json = targetJson; json = apiconfig.get(DRApiConfig.TARGET_LOCATONS_JSON) .replaceFirst("<location_id>", apiconfig.get(DRApiConfig.LOCATION_ID)) .replaceFirst("<start_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 10))) .replaceFirst("<end_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 25))); setLogString("URL Values of the API \n" + url + "\n" + json, true); return json; }
From source file:churashima.action.manage.ExpensesAction.java
@Execute(validator = false) public String index() { Date date = new Date(); if (StringUtils.isEmpty(expensesForm.strDate)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); expensesForm.strDate = sdf.format(date); }//ww w . j a v a 2 s . c om Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); ExpensesDao expensesDao = SingletonS2Container.getComponent(ExpensesDao.class); List<Expenses> expensesList = expensesDao.selectForSearch(null, null, null, null, null, null, null, null, new Timestamp(cal.getTimeInMillis())); expensesForm.expensesList = expensesList; // expensesForm.subjectId = null; expensesForm.place = null; expensesForm.name = null; expensesForm.price = BigDecimal.valueOf(0); expensesForm.comment = null; expensesForm.isExcludeTax = null; SubjectDao subjectDao = SingletonS2Container.getComponent(SubjectDao.class); expensesForm.subjectList = subjectDao.selectForSearch(null, Const.STATUS_STARTING); return "expenses.jsp"; }
From source file:net.chrisrichardson.foodToGo.domain.hibernate.HibernateRestaurantRepositoryImpl.java
Object[] makeParameterValues(Address deliveryAddress, Date deliveryTime) { Calendar c = Calendar.getInstance(); c.setTime(deliveryTime);/*from ww w .j av a 2 s.c o m*/ int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); int timeOfDay = c.get(Calendar.HOUR_OF_DAY) * 100 + c.get(Calendar.MINUTE); String zipCode = deliveryAddress.getZip(); Object[] values = new Object[] { zipCode, new Integer(dayOfWeek), new Integer(timeOfDay) }; return values; }
From source file:com.lohika.alp.reporter.fe.dao.TestDAOImpl.java
private DetachedCriteria getFilteredCriteria(TestFilter filter) { DetachedCriteria criteria = DetachedCriteria.forClass(Test.class); criteria.createAlias("suite", "suite"); if (filter.getFrom() != null && filter.getTill() != null) { Calendar c = Calendar.getInstance(); c.setTime(filter.getFrom());//from www . j a v a2 s . c om c.set(Calendar.HOUR_OF_DAY, c.getActualMinimum(Calendar.HOUR_OF_DAY)); c.set(Calendar.MINUTE, c.getActualMinimum(Calendar.MINUTE)); c.set(Calendar.SECOND, c.getActualMinimum(Calendar.SECOND)); c.set(Calendar.MILLISECOND, c.getActualMinimum(Calendar.MILLISECOND)); Date from = c.getTime(); c.setTime(filter.getTill()); c.set(Calendar.HOUR_OF_DAY, c.getActualMaximum(Calendar.HOUR_OF_DAY)); c.set(Calendar.MINUTE, c.getActualMaximum(Calendar.MINUTE)); c.set(Calendar.SECOND, c.getActualMaximum(Calendar.SECOND)); c.set(Calendar.MILLISECOND, c.getActualMaximum(Calendar.MILLISECOND)); Date till = c.getTime(); criteria.add(Restrictions.between("startDate", from, till)); } if (filter.getTest() != "" && filter.getTest() != null) { try { criteria.add(querytr.translate("name", filter.getTest())); } catch (QueryTranslatorException e) { // TODO Put QueryTranslatorException into log e.printStackTrace(); } } if (filter.getSuite() != "" && filter.getSuite() != null) { try { criteria.add(querytr.translate("suite.name", filter.getSuite())); } catch (QueryTranslatorException e) { // TODO Put QueryTranslatorException into log e.printStackTrace(); } } return criteria; }