Example usage for org.joda.time DateTime DateTime

List of usage examples for org.joda.time DateTime DateTime

Introduction

In this page you can find the example usage for org.joda.time DateTime DateTime.

Prototype

public DateTime() 

Source Link

Document

Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.

Usage

From source file:com.alfaariss.oa.util.saml2.SAML2ConditionsWindow.java

License:Open Source License

/**
 * Verifies if the current time is within the supplied time window.
 * <br>//from  w w  w  .  j a  va  2  s . c  om
 * The time window is extended with configured offsets.
 * 
 * @param dtNB Not Before condition or NULL if not available.
 * @param dtNOA Not On Or After condition or NULL if not available.
 * @return TRUE if the current datetime is within the window.
 */
public boolean canAccept(DateTime dtNB, DateTime dtNOA) {
    DateTime dtNow = new DateTime();

    if (dtNB != null) {
        DateTime dtNotBefore = dtNB.minus(_lBeforeOffset);
        if (dtNow.getMillis() < dtNotBefore.getMillis()) {
            StringBuffer sbDebug = new StringBuffer("Condition time stamp(s) incorrect; Current time (");
            sbDebug.append(dtNow);
            sbDebug.append(") is before the Not Before time: ");
            sbDebug.append(dtNB);
            _logger.debug(sbDebug.toString());
            return false;
        }
    }

    if (dtNOA != null) {
        DateTime dtNotOnOrAfter = dtNOA.plus(_lAfterOffset);
        if (dtNow.getMillis() >= dtNotOnOrAfter.getMillis()) {
            StringBuffer sbDebug = new StringBuffer("Condition time stamp(s) incorrect; Current time (");
            sbDebug.append(dtNow);
            sbDebug.append(") is on or after the Not On Or After time: ");
            sbDebug.append(dtNOA);
            _logger.debug(sbDebug.toString());
            return false;
        }
    }

    return true;
}

From source file:com.alfaariss.oa.util.saml2.storage.artifact.ArtifactMapEntry.java

License:Open Source License

/**
 * Create empty <code>ArtifactMapEntry</code>.
 *///from ww  w  . java2 s  .  c om
public ArtifactMapEntry() {
    super();
    _artifact = null;
    _issuer = null;
    _relyingParty = null;
    _expirationTime = new DateTime();
    _message = null;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ActualPowerLimitCommand.java

License:Open Source License

@Override
public MeasurementDto translate(final NodeContainer containingNode) {
    return new MeasurementDto(1, DataAttribute.ACTUAL_POWER_LIMIT.getDescription(),
            QualityConverter.toShort(containingNode.getQuality(SubDataAttribute.SUBSTITUDE_QUALITY).getValue()),
            new DateTime(), containingNode.getChild(SubDataAttribute.SUBSTITUDE_VALUE)
                    .getFloat(SubDataAttribute.FLOAT).getFloat());
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850MaximumPowerLimitCommand.java

License:Open Source License

@Override
public MeasurementDto translate(final NodeContainer containingNode) {

    return new MeasurementDto(1, DataAttribute.MAXIMUM_POWER_LIMIT.getDescription(), 0,
            // TODO - Implement when available
            new DateTime(), 1);
}