Example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_HOUR

List of usage examples for org.apache.commons.lang.time DateUtils MILLIS_PER_HOUR

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_HOUR.

Prototype

long MILLIS_PER_HOUR

To view the source code for org.apache.commons.lang.time DateUtils MILLIS_PER_HOUR.

Click Source Link

Document

Number of milliseconds in a standard hour.

Usage

From source file:com.pureinfo.srmcenter.datasync.client.model.SyncConfigInfo.java

public long getActiveInterval() {
    return getLongProperty("activeInterval", DateUtils.MILLIS_PER_HOUR);
}

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);//w  w  w . j  av  a  2  s. com

    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;//  w  w w  .  ja v a  2  s  .  c  om
    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.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  w ww  . j  av  a  2  s  .  co m

    SyncConfigInfo actual = m_mgr.lookupBySchoolCode(sSchoolCode);

    assertEquals(expected, actual);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long millisecondsToHours(long milliseconds) {
    return (long) (milliseconds / DateUtils.MILLIS_PER_HOUR);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long diffHours(Date date1, Date date2) {
    return (date1.getTime() - date2.getTime()) / DateUtils.MILLIS_PER_HOUR;
}

From source file:de.tor.tribes.ui.algo.SettingsPanel.java

public void restoreProperties() {
    try {//from w w  w  .ja va2  s.  c o m
        UserProfile profile = GlobalOptions.getSelectedProfile();
        String val = profile.getProperty("attack.frame.start");
        long start = (val != null) ? Long.parseLong(val) : System.currentTimeMillis();
        val = profile.getProperty("attack.frame.arrive");
        long arrive = (val != null) ? Long.parseLong(val) : System.currentTimeMillis();

        if (start < System.currentTimeMillis()) {
            start = System.currentTimeMillis();
        }

        if (arrive < System.currentTimeMillis()) {
            arrive = System.currentTimeMillis() + DateUtils.MILLIS_PER_HOUR;
        }

        timeSettingsPanel.setStartTime(new Date(start));
        timeSettingsPanel.setArriveTime(new Date(arrive));
        val = profile.getProperty("attack.frame.algo.type");
        jAlgoBox.setSelectedIndex((val != null) ? Integer.parseInt(val) : 0);
        jFakeOffTargetsBox
                .setSelected(Boolean.parseBoolean(profile.getProperty("attack.frame.fake.off.targets")));

        // <editor-fold defaultstate="collapsed" desc="Restore time spans">
        //restore send spans
        String spanProp = profile.getProperty("attack.frame.spans");
        if (spanProp == null) {
            spanProp = "";
        }
        String[] spans = spanProp.split(";");

        List<TimeSpan> spanList = new LinkedList<TimeSpan>();
        for (String span : spans) {
            try {
                TimeSpan s = TimeSpan.fromPropertyString(span);
                if (s != null) {
                    spanList.add(s);
                }
            } catch (Exception invalid) {
            }
        }

        timeSettingsPanel.setTimeSpans(spanList);
        // </editor-fold>
    } catch (Exception e) {
        logger.error("Failed to restore attack planer settings", e);
        timeSettingsPanel.reset();
    }
}

From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java

@Override
public long getCRLStoreUpdateInterval() throws HierarchicalPropertiesException {
    return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("cRLUpdater.interval"),
            DateUtils.MILLIS_PER_HOUR, false);
}

From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java

@Override
public long getExpirationTime() throws HierarchicalPropertiesException {
    return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("sms.gateway.expirationTime"),
            24 * DateUtils.MILLIS_PER_HOUR, false);
}

From source file:helper.util.DateHelper.java

public static long millisToNextHour() {
    return DateUtils.MILLIS_PER_HOUR - (System.currentTimeMillis() % DateUtils.MILLIS_PER_HOUR);
}