List of usage examples for org.apache.commons.lang.time DateUtils MILLIS_PER_DAY
long MILLIS_PER_DAY
To view the source code for org.apache.commons.lang.time DateUtils MILLIS_PER_DAY.
Click Source Link
From source file:com.pureinfo.srmcenter.datasync.client.domain.impl.SyncConfigInfoMgrImplTest.java
public void testLookupSchoolCode() throws PureException { String sSchoolCode = "8888"; SyncConfigInfo expected = new SyncConfigInfo(); expected.setSchoolCode(sSchoolCode); expected.setActiveInterval(DateUtils.MILLIS_PER_HOUR); expected.setSyncInterval(DateUtils.MILLIS_PER_DAY); m_mgr.save(expected);//from ww w . j a v a2s . c o m SyncConfigInfo actual = m_mgr.lookupBySchoolCode(sSchoolCode); assertEquals(expected, actual); }
From source file:net.firejack.platform.web.statistics.engine.BufferScheduleSwitcher.java
/***/ public void scheduleTasks() { executorService = new ScheduledThreadPoolExecutor(2); executorService.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); // Calendar calendar = DateTimeUtils.getSynchTime(synchTime); // if (calendar.before(Calendar.getInstance())) { // calendar.add(Calendar.DAY_OF_MONTH, 1); // }// www . ja v a 2 s .co m // long delay = calendar.getTimeInMillis() - System.currentTimeMillis(); long delay = 0; executorService.scheduleAtFixedRate(new ImportTask(), delay, DateUtils.MILLIS_PER_DAY, TimeUnit.MILLISECONDS); }
From source file:com.alibaba.ims.platform.util.DateUtil.java
/** * /*from ww w . j a v a 2 s .c om*/ * * @param date1 * @param date2 * @return */ public static long minus(Date date1, Date date2) { if (date1 == null || date2 == null) { return Long.MAX_VALUE; } return ((date1.getTime() - date2.getTime() - 1) / DateUtils.MILLIS_PER_DAY) + 1; }
From source file:com.pureinfo.srm.config.notice.domain.MailNoticeDataBuilderImpl.java
public IObjects getHonorData(int _nAdvenceDay) throws PureException { int nMaxDay = AffirmHelper.getActualHonorMaxDay(); if (nMaxDay == 0 || _nAdvenceDay > nMaxDay) return null; IHonorMgr honorMgr = (IHonorMgr) ArkContentHelper.getContentMgrOf(Honor.class); String sSql = "select {this.*} from " + honorMgr.getTempTable(true) + " as this , {usr} " // + "where {this.inputUserId} = {usr.id} " // + "and {usr.email} is not null and {usr.email} != '' " // + "and {this.docSubmitted} = 0 " // + "and {this.hurriedByMail} = 0 " // + "and {this.createTime} < ? ";// IStatement query = null;/*from ww w. jav a2 s. c o m*/ try { IContentMgr mgr = ArkContentHelper.getContentMgrOf(Honor.class); query = mgr.createQuery(sSql, DolphinConstants.MAXSIZE_UNLIMITED); query.registerAlias("usr", SRMUser.class); query.setDate(0, new Date(System.currentTimeMillis() - DateUtils.MILLIS_PER_DAY * (nMaxDay - _nAdvenceDay))); return query.executeQuery(); } finally { if (query != null) query.clear(); } }
From source file:com.pureinfo.srm.config.notice.domain.SmsNoticeDataBuilderImpl.java
/** * @see com.pureinfo.srm.config.notice.domain.INoticeDataBuilder#getHonorData(int) *///from w ww. jav a 2 s . co m public IObjects getHonorData(int _nAdvenceDay) throws PureException { int nMaxDay = AffirmHelper.getActualHonorMaxDay(); if (nMaxDay == 0 || _nAdvenceDay > nMaxDay) return null; IHonorMgr honorMgr = (IHonorMgr) ArkContentHelper.getContentMgrOf(Honor.class); String sSql = "select {this.*} from " + honorMgr.getTempTable(true) + " as this , {usr} " // + "where {this.inputUserId} = {usr.id} " // + "and {usr.mobile} is not null and {usr.mobile} != '' " // + "and {this.docSubmitted} = 0 " // + "and {this.hurriedBySMS} = 0 " // + "and {this.createTime} < ? ";// IStatement query = null; try { IContentMgr mgr = ArkContentHelper.getContentMgrOf(Honor.class); query = mgr.createQuery(sSql, DolphinConstants.MAXSIZE_UNLIMITED); query.registerAlias("usr", SRMUser.class); query.setDate(0, new Date(System.currentTimeMillis() - DateUtils.MILLIS_PER_DAY * (nMaxDay - _nAdvenceDay))); return query.executeQuery(); } finally { if (query != null) query.clear(); } }
From source file:com.pureinfo.srm.config.affirm.ProductAffirmHelper.java
public static int deleteHonorData() throws PureException { int nMaxDay = AffirmHelper.getActualHonorMaxDay(); if (nMaxDay == 0) return 0; IHonorMgr honorMgr = (IHonorMgr) ArkContentHelper.getContentMgrOf(Honor.class); String sSql = "delete from " + honorMgr.getTempTable(true) + " " // + "where {this.docSubmitted} = 0 " // + "and {this.docHurryTime} is null " // + "and {this.createTime} < ? ";// IStatement statement = null;/*from w w w .j a v a 2 s.co m*/ try { IContentMgr mgr = ArkContentHelper.getContentMgrOf(Honor.class); statement = mgr.createStatement(sSql); statement.setDate(0, new Date(System.currentTimeMillis() - DateUtils.MILLIS_PER_DAY * nMaxDay)); return statement.executeUpdate(); } finally { if (statement != null) statement.clear(); } }
From source file:eagle.ml.impl.MLModelDAOImpl.java
@Override public List<MLModelAPIEntity> findMLModelByContext(String user, String algorithm) { try {/*from www . j av a 2s . c om*/ IEagleServiceClient client = new EagleServiceClientImpl(eagleServiceHost, eagleServicePort, eagleServiceUserName, eagleServicePassword); String query = MLConstants.ML_MODEL_SERVICE_NAME + "[@user=\"" + user + "\" AND @algorithm=\"" + algorithm + "\"]{*}"; GenericServiceAPIResponseEntity<MLModelAPIEntity> response = client.search().startTime(0) .endTime(10 * DateUtils.MILLIS_PER_DAY).pageSize(Integer.MAX_VALUE).query(query).send(); if (!response.isSuccess()) { LOG.error(String.format("Failed to get model for user: %s, algorithm: %s, due to: %s", user, algorithm, response.getException())); } client.close(); return response.getObj(); } catch (Exception ex) { LOG.info("Got an exception when query machinelearning model service ", ex); throw new IllegalStateException(ex); } }
From source file:mitm.common.util.DateTimeUtils.java
public static long diffDays(Date date1, Date date2) { return (date1.getTime() - date2.getTime()) / DateUtils.MILLIS_PER_DAY; }
From source file:eagle.alert.dao.AlertStreamDAOImpl.java
public List<AlertStreamEntity> findAlertStreamByDataSource(String dataSource) throws Exception { try {//from w w w .j a va 2 s . c o m IEagleServiceClient client = new EagleServiceClientImpl(eagleServiceHost, eagleServicePort, username, password); String query = AlertConstants.ALERT_STREAM_SERVICE_ENDPOINT_NAME + "[@dataSource=\"" + dataSource + "\"]{*}"; GenericServiceAPIResponseEntity<AlertStreamEntity> response = client.search().startTime(0) .endTime(10 * DateUtils.MILLIS_PER_DAY).pageSize(Integer.MAX_VALUE).query(query).send(); client.close(); if (response.getException() != null) { throw new Exception("Got an exception when query eagle service: " + response.getException()); } return response.getObj(); } catch (Exception ex) { LOG.error("Got an exception when query stream metadata service ", ex); throw new IllegalStateException(ex); } }
From source file:eagle.alert.dao.AlertDataSourceDAOImpl.java
@Override public List<AlertDataSourceEntity> findAlertDataSourceBySite(String site) throws Exception { try {/* w w w . j a va 2s . com*/ IEagleServiceClient client = new EagleServiceClientImpl(eagleServiceHost, eagleServicePort, username, password); String query = AlertConstants.ALERT_STREAM_SERVICE_ENDPOINT_NAME + "[@site=\"" + site + "\"]{*}"; GenericServiceAPIResponseEntity<AlertDataSourceEntity> response = client.search().startTime(0) .endTime(10 * DateUtils.MILLIS_PER_DAY).pageSize(Integer.MAX_VALUE).query(query).send(); client.close(); if (response.getException() != null) { throw new Exception("Got an exception when query eagle service: " + response.getException()); } return response.getObj(); } catch (Exception ex) { LOG.error("Got an exception when query stream metadata service ", ex); throw new IllegalStateException(ex); } }