Example usage for java.util Calendar equals

List of usage examples for java.util Calendar equals

Introduction

In this page you can find the example usage for java.util Calendar equals.

Prototype

@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
public boolean equals(Object obj) 

Source Link

Document

Compares this Calendar to the specified Object.

Usage

From source file:paarmann.physikprofil.TimePreference.java

public void setValue(Calendar newValue) {
    final boolean wasChanged = !newValue.equals(_value);

    if (wasChanged || !_isValueSet) {
        _value = newValue;//w w w . j av  a2 s .c om
        _isValueSet = true;

        this.persistLong(_value.getTimeInMillis());

        if (wasChanged) {
            this.notifyChanged();
        }
    }
}

From source file:nl.strohalm.cyclos.services.alerts.AlertServiceImpl.java

private void populate(final Alert alert, final String key, final Object... arguments) {
    String[] args = null;/*from w  ww  . j a  va  2s. c  om*/
    if (arguments != null) {
        // Convert each argument to string
        args = new String[arguments.length];
        final LocalSettings localSettings = settingsService.getLocalSettings();
        for (int i = 0; i < args.length; i++) {
            final Object argument = arguments[i];
            String arg;
            if (argument == null) {
                arg = "";
            } else if (argument instanceof BigDecimal) {
                arg = localSettings.getNumberConverter().toString((BigDecimal) argument);
            } else if (argument instanceof Calendar) {
                final Calendar cal = (Calendar) argument;
                final Calendar trunc = DateHelper.truncate(cal);
                if (cal.equals(trunc)) {
                    arg = localSettings.getDateConverter().toString(cal);
                } else {
                    arg = localSettings.getDateTimeConverter().toString(cal);
                }
            } else {
                arg = StringUtils.trimToEmpty(argument.toString());
            }
            args[i] = arg;
        }
    }
    alert.setDate(Calendar.getInstance());
    alert.setDescription(key, args);
}

From source file:org.kuali.kra.award.paymentreports.awardreports.reporting.service.ReportTrackingNotificationServiceImpl.java

/**
 * Is date1 after from and before until?
 * @param date1/*from  w  ww. jav a2  s.co  m*/
 * @param from
 * @param until
 * @return
 */
protected boolean doDatesMatch(Date date1, Calendar from, Calendar until) {
    Calendar cal1 = Calendar.getInstance();
    cal1.setTime(date1);
    clearTimeFields(cal1);
    return cal1.after(from) && (cal1.equals(until) || cal1.before(until));
}

From source file:org.openmrs.module.metadatasharing.resolver.ResolverEngine.java

private boolean ignoreTimezoneEquals(Date date1, Date date2) {
    if (date1 == null || date2 == null) {
        return false;
    }//www .  j  a  v  a  2  s .  c o  m

    Calendar calendar1 = Calendar.getInstance();
    calendar1.setTime(date1);
    Calendar calendar2 = Calendar.getInstance();
    calendar2.setTime(date2);

    calendar1.set(Calendar.HOUR, 0);
    calendar2.set(Calendar.HOUR, 0);

    return calendar1.equals(calendar2);
}

From source file:org.egov.tl.web.actions.search.SearchTradeAction.java

public boolean checkForRenewalNotice(final Date dateOfExpiry) {
    boolean readyForRenewal = false;
    final Calendar currentDate = Calendar.getInstance();
    final Calendar renewalDate = Calendar.getInstance();
    renewalDate.setTime(dateOfExpiry);/*from  w w  w.  jav  a  2s. co  m*/
    renewalDate.add(Calendar.DATE, Constants.RENEWALTIMEPERIOD);

    if (renewalDate.before(currentDate) || renewalDate.equals(currentDate))
        readyForRenewal = true;
    return readyForRenewal;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.CFCrmHPKey.java

public boolean equals(Object obj) {
    if (obj == null) {
        return (false);
    } else if (obj instanceof CFCrmHPKey) {
        CFCrmHPKey rhs = (CFCrmHPKey) obj;
        {// www .  j  ava2 s .c  om
            long lhsClusterId = getAuditClusterId();
            long rhsClusterId = rhs.getAuditClusterId();
            if (lhsClusterId != rhsClusterId) {
                return (false);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp != null) {
                if (rhsAuditStamp != null) {
                    if (!lhsAuditStamp.equals(rhsAuditStamp)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        {
            short lhsActionId = getAuditActionId();
            short rhsActionId = rhs.getAuditActionId();
            if (lhsActionId != rhsActionId) {
                return (false);
            }
        }
        {
            int lhsRevision = getRequiredRevision();
            int rhsRevision = rhs.getRequiredRevision();
            if (lhsRevision != rhsRevision) {
                return (false);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId != null) {
                if (rhsAuditSessionId != null) {
                    if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        return (true);
    } else {
        return (false);
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternet.CFInternetHPKey.java

public boolean equals(Object obj) {
    if (obj == null) {
        return (false);
    } else if (obj instanceof CFInternetHPKey) {
        CFInternetHPKey rhs = (CFInternetHPKey) obj;
        {/*from   w  w w.  ja  va2s. c om*/
            long lhsClusterId = getAuditClusterId();
            long rhsClusterId = rhs.getAuditClusterId();
            if (lhsClusterId != rhsClusterId) {
                return (false);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp != null) {
                if (rhsAuditStamp != null) {
                    if (!lhsAuditStamp.equals(rhsAuditStamp)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        {
            short lhsActionId = getAuditActionId();
            short rhsActionId = rhs.getAuditActionId();
            if (lhsActionId != rhsActionId) {
                return (false);
            }
        }
        {
            int lhsRevision = getRequiredRevision();
            int rhsRevision = rhs.getRequiredRevision();
            if (lhsRevision != rhsRevision) {
                return (false);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId != null) {
                if (rhsAuditSessionId != null) {
                    if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        return (true);
    } else {
        return (false);
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurity.CFSecurityHPKey.java

public boolean equals(Object obj) {
    if (obj == null) {
        return (false);
    } else if (obj instanceof CFSecurityHPKey) {
        CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
        {/*from   ww w  .j a va 2  s .  c  om*/
            long lhsClusterId = getAuditClusterId();
            long rhsClusterId = rhs.getAuditClusterId();
            if (lhsClusterId != rhsClusterId) {
                return (false);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp != null) {
                if (rhsAuditStamp != null) {
                    if (!lhsAuditStamp.equals(rhsAuditStamp)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        {
            short lhsActionId = getAuditActionId();
            short rhsActionId = rhs.getAuditActionId();
            if (lhsActionId != rhsActionId) {
                return (false);
            }
        }
        {
            int lhsRevision = getRequiredRevision();
            int rhsRevision = rhs.getRequiredRevision();
            if (lhsRevision != rhsRevision) {
                return (false);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId != null) {
                if (rhsAuditSessionId != null) {
                    if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        return (true);
    } else {
        return (false);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccHPKey.java

public boolean equals(Object obj) {
    if (obj == null) {
        return (false);
    } else if (obj instanceof CFAccHPKey) {
        CFAccHPKey rhs = (CFAccHPKey) obj;
        {/*from w w w.  j a  v a  2 s .c om*/
            long lhsClusterId = getAuditClusterId();
            long rhsClusterId = rhs.getAuditClusterId();
            if (lhsClusterId != rhsClusterId) {
                return (false);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp != null) {
                if (rhsAuditStamp != null) {
                    if (!lhsAuditStamp.equals(rhsAuditStamp)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        {
            short lhsActionId = getAuditActionId();
            short rhsActionId = rhs.getAuditActionId();
            if (lhsActionId != rhsActionId) {
                return (false);
            }
        }
        {
            int lhsRevision = getRequiredRevision();
            int rhsRevision = rhs.getRequiredRevision();
            if (lhsRevision != rhsRevision) {
                return (false);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId != null) {
                if (rhsAuditSessionId != null) {
                    if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        return (true);
    } else {
        return (false);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.CFAstHPKey.java

public boolean equals(Object obj) {
    if (obj == null) {
        return (false);
    } else if (obj instanceof CFAstHPKey) {
        CFAstHPKey rhs = (CFAstHPKey) obj;
        {//from w  w w  . j  a va2 s  . com
            long lhsClusterId = getAuditClusterId();
            long rhsClusterId = rhs.getAuditClusterId();
            if (lhsClusterId != rhsClusterId) {
                return (false);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp != null) {
                if (rhsAuditStamp != null) {
                    if (!lhsAuditStamp.equals(rhsAuditStamp)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        {
            short lhsActionId = getAuditActionId();
            short rhsActionId = rhs.getAuditActionId();
            if (lhsActionId != rhsActionId) {
                return (false);
            }
        }
        {
            int lhsRevision = getRequiredRevision();
            int rhsRevision = rhs.getRequiredRevision();
            if (lhsRevision != rhsRevision) {
                return (false);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId != null) {
                if (rhsAuditSessionId != null) {
                    if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
                        return (false);
                    }
                } else {
                    return (false);
                }
            } else {
                return (false);
            }
        }
        return (true);
    } else {
        return (false);
    }
}