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.force.util.TimerUtil.java
/** * @param _sTime// ww w. ja v a 2 s. c om * must be "HH:mm" format */ public static Timer scheduleEverydayAt(String _sTime, TimerTask _task) { return scheduleFrom(_sTime, DateUtils.MILLIS_PER_DAY, _task); }
From source file:com.pureinfo.srm.config.affirm.ProductAffirmHelper.java
public static int deleteProductWithoutPaperData(String _sProductForm) throws PureException { if (SRMConstants.PRODUCT_FORM_PAPER.equals(_sProductForm)) return 0; int nMaxDay = AffirmHelper.getActualProductMaxDay(_sProductForm, "all"); if (nMaxDay == 0) return 0; IProductMgr frutiMgr = (IProductMgr) ArkContentHelper.getContentMgrOf(Product.class); String sSql = "delete from " + frutiMgr.getTempTable(true) + " " // + "where {this.docSubmitted} = 0 " // + "and {this.createTime} < ? " // + "and {this.productForm} = ?"; IStatement statement = null;// w w w. j a v a 2 s. co m try { IContentMgr mgr = ArkContentHelper.getContentMgrOf(Product.class); statement = mgr.createStatement(sSql); statement.setDate(0, new Date(System.currentTimeMillis() - DateUtils.MILLIS_PER_DAY * nMaxDay)); statement.setString(1, _sProductForm); return statement.executeUpdate(); } finally { if (statement != null) statement.clear(); } }
From source file:com.pureinfo.srmcenter.datasync.client.model.SyncConfigInfo.java
public long getSyncInterval() { return getLongProperty("syncInterval", DateUtils.MILLIS_PER_DAY); }
From source file:de.tor.tribes.util.report.AgeFilter.java
@Override public void setup(Object pFilterComponent) throws ReportRuleConfigurationException { try {//from w w w . ja v a 2 s . co m maxAge = (Long) pFilterComponent * DateUtils.MILLIS_PER_DAY * 365; } catch (Throwable t) { throw new ReportRuleConfigurationException(t); } }
From source file:com.ms.commons.test.math.expression.impl.DateOperatorMathExpression.java
public Object evaluate(Object param) { Object leftValue = left.evaluate(param); Object rightValue = right.evaluate(param); if ((leftValue instanceof Date) && (rightValue instanceof Double)) { long rv = (long) (DateUtils.MILLIS_PER_DAY * ((Double) rightValue).doubleValue()); Date lv = (Date) leftValue; switch (operator) { case '+': return new Date(lv.getTime() + rv); case '-': return new Date(lv.getTime() - rv); default:// ww w .jav a 2s . c om throw new RuntimeException("Unsupported operator between Date and Double: " + operator); } } else if ((leftValue instanceof Double) && (rightValue instanceof Double)) { double l = ((Double) leftValue).doubleValue(); double r = ((Double) rightValue).doubleValue(); switch (operator) { case '+': return Double.valueOf(l + r); case '-': return Double.valueOf(l - r); case '*': return Double.valueOf(l * r); case '/': return Double.valueOf(l / r); default: throw new RuntimeException("Unknow operator: " + operator); } } else { throw new RuntimeException("Error type of: " + leftValue.getClass() + " and " + rightValue.getClass()); } }
From source file:com.pureinfo.srmcenter.datasync.client.domain.impl.SyncConfigInfoMgrImplTest.java
public void testLookupBySchoolCodeFromNull() throws PureException { String sSchoolCode = "8888"; SyncConfigInfo expected = new SyncConfigInfo(); expected.setSchoolCode(sSchoolCode); expected.setActiveInterval(DateUtils.MILLIS_PER_HOUR); expected.setSyncInterval(DateUtils.MILLIS_PER_DAY); SyncConfigInfo actual = m_mgr.lookupBySchoolCode(sSchoolCode); assertEquals(expected, actual);//from w w w . j a v a 2 s. c o m SyncConfigInfo actual2 = m_mgr.lookupBySchoolCode(sSchoolCode); assertEquals(actual.getId(), actual2.getId()); }
From source file:com.pureinfo.srmcenter.datasync.client.domain.impl.SyncConfigInfoMgrImpl.java
public SyncConfigInfo lookupBySchoolCode(String _sSchoolCode) throws PureException { IStatement query = null;/* ww w.ja va 2 s .co m*/ IObjects objects = null; try { String Sql = "select * from {this} where {this.schoolCode} = ?"; query = createQuery(Sql, 1); query.setString(0, _sSchoolCode); objects = query.executeQuery(); SyncConfigInfo syncConfig = (SyncConfigInfo) objects.next(); if (syncConfig == null) { syncConfig = new SyncConfigInfo(); syncConfig.setSchoolCode(_sSchoolCode); syncConfig.setActiveInterval(DateUtils.MILLIS_PER_HOUR); syncConfig.setSyncInterval(DateUtils.MILLIS_PER_DAY); save(syncConfig); } return syncConfig; } finally { if (query != null) query.clear(); if (objects != null) objects.clear(); } }
From source file:com.alibaba.ims.platform.util.DateUtil.java
/** * ?/* ww w .j av a2 s .com*/ * * @param date * @return */ public static long minus(Date date) { if (date == null) { return Long.MAX_VALUE; } return ((date.getTime() - System.currentTimeMillis() - 1) / DateUtils.MILLIS_PER_DAY) + 1; }
From source file:eagle.alert.dedup.DefaultDeduplicator.java
public void clearOldCache() { List<EntityTagsUniq> removedkeys = new ArrayList<EntityTagsUniq>(); for (Entry<EntityTagsUniq, Long> entry : entites.entrySet()) { EntityTagsUniq entity = entry.getKey(); if (System.currentTimeMillis() - 7 * DateUtils.MILLIS_PER_DAY > entity.createdTime) { removedkeys.add(entry.getKey()); }//from w w w . j a v a 2 s. co m } for (EntityTagsUniq alertKey : removedkeys) { entites.remove(alertKey); } }
From source file:com.pureinfo.srm.config.affirm.ProductAffirmHelper.java
public static int deletePaperData(String _sPubLevel) throws PureException { int nMaxDay = AffirmHelper.getActualProductMaxDay("all", _sPubLevel); if (nMaxDay == 0) return 0; IProductMgr frutiMgr = (IProductMgr) ArkContentHelper.getContentMgrOf(Product.class); String sSql = "delete from " + frutiMgr.getTempTable(true) + " " // + "where {this.docSubmitted} = 0 " // + "and {this.createTime} < ? " // + "and {this.productForm} = '6'" // + "and {this.publicationLevel} = ?"; IStatement statement = null;//from w w w .j a va 2s. c om try { IContentMgr mgr = ArkContentHelper.getContentMgrOf(Product.class); statement = mgr.createStatement(sSql); statement.setDate(0, new Date(System.currentTimeMillis() - DateUtils.MILLIS_PER_DAY * nMaxDay)); statement.setString(1, _sPubLevel); return statement.executeUpdate(); } finally { if (statement != null) statement.clear(); } }