Example usage for java.util Calendar compareTo

List of usage examples for java.util Calendar compareTo

Introduction

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

Prototype

private int compareTo(long t) 

Source Link

Usage

From source file:org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand.java

/**
 * Create action instances starting from "startMatdTime" to "endMatdTime" and store them into coord action table.
 *
 * @param dryrun if this is a dry run/*w ww.ja  va 2 s. c  om*/
 * @throws Exception thrown if failed to materialize actions
 */
protected String materializeActions(boolean dryrun) throws Exception {

    Configuration jobConf = null;
    try {
        jobConf = new XConfiguration(new StringReader(coordJob.getConf()));
    } catch (IOException ioe) {
        LOG.warn("Configuration parse error. read from DB :" + coordJob.getConf(), ioe);
        throw new CommandException(ErrorCode.E1005, ioe.getMessage(), ioe);
    }

    String jobXml = coordJob.getJobXml();
    Element eJob = XmlUtils.parseXml(jobXml);
    TimeZone appTz = DateUtils.getTimeZone(coordJob.getTimeZone());

    String frequency = coordJob.getFrequency();
    TimeUnit freqTU = TimeUnit.valueOf(coordJob.getTimeUnitStr());
    TimeUnit endOfFlag = TimeUnit.valueOf(eJob.getAttributeValue("end_of_duration"));
    Calendar start = Calendar.getInstance(appTz);
    start.setTime(startMatdTime);
    DateUtils.moveToEnd(start, endOfFlag);
    Calendar end = Calendar.getInstance(appTz);
    end.setTime(endMatdTime);
    lastActionNumber = coordJob.getLastActionNumber();
    //Intentionally printing dates in their own timezone, not Oozie timezone
    LOG.info("materialize actions for tz=" + appTz.getDisplayName() + ",\n start=" + start.getTime() + ", end="
            + end.getTime() + ",\n timeUnit " + freqTU.getCalendarUnit() + ",\n frequency :" + frequency + ":"
            + freqTU + ",\n lastActionNumber " + lastActionNumber);
    // Keep the actual start time
    Calendar origStart = Calendar.getInstance(appTz);
    origStart.setTime(coordJob.getStartTimestamp());
    // Move to the End of duration, if needed.
    DateUtils.moveToEnd(origStart, endOfFlag);

    StringBuilder actionStrings = new StringBuilder();
    Date jobPauseTime = coordJob.getPauseTime();
    Calendar pause = null;
    if (jobPauseTime != null) {
        pause = Calendar.getInstance(appTz);
        pause.setTime(DateUtils.convertDateToTimestamp(jobPauseTime));
    }

    String action = null;
    int numWaitingActions = dryrun ? 0
            : jpaService.execute(new CoordActionsActiveCountJPAExecutor(coordJob.getId()));
    int maxActionToBeCreated = coordJob.getMatThrottling() - numWaitingActions;
    // If LAST_ONLY and all materialization is in the past, ignore maxActionsToBeCreated
    boolean ignoreMaxActions = (coordJob.getExecutionOrder().equals(CoordinatorJob.Execution.LAST_ONLY)
            || coordJob.getExecutionOrder().equals(CoordinatorJob.Execution.NONE))
            && endMatdTime.before(new Date());
    LOG.debug("Coordinator job :" + coordJob.getId() + ", maxActionToBeCreated :" + maxActionToBeCreated
            + ", Mat_Throttle :" + coordJob.getMatThrottling() + ", numWaitingActions :" + numWaitingActions);

    boolean isCronFrequency = false;

    Calendar effStart = (Calendar) start.clone();
    try {
        int intFrequency = Integer.parseInt(coordJob.getFrequency());
        effStart = (Calendar) origStart.clone();
        effStart.add(freqTU.getCalendarUnit(), lastActionNumber * intFrequency);
    } catch (NumberFormatException e) {
        isCronFrequency = true;
    }

    boolean firstMater = true;
    while (effStart.compareTo(end) < 0 && (ignoreMaxActions || maxActionToBeCreated-- > 0)) {
        if (pause != null && effStart.compareTo(pause) >= 0) {
            break;
        }

        Date nextTime = effStart.getTime();

        if (isCronFrequency) {
            if (effStart.getTime().compareTo(startMatdTime) == 0 && firstMater) {
                effStart.add(Calendar.MINUTE, -1);
                firstMater = false;
            }

            nextTime = CoordCommandUtils.getNextValidActionTimeForCronFrequency(effStart.getTime(), coordJob);
            effStart.setTime(nextTime);
        }

        if (effStart.compareTo(end) < 0) {

            if (pause != null && effStart.compareTo(pause) >= 0) {
                break;
            }
            CoordinatorActionBean actionBean = new CoordinatorActionBean();
            lastActionNumber++;

            int timeout = coordJob.getTimeout();
            LOG.debug("Materializing action for time=" + DateUtils.formatDateOozieTZ(effStart.getTime())
                    + ", lastactionnumber=" + lastActionNumber + " timeout=" + timeout + " minutes");
            Date actualTime = new Date();
            action = CoordCommandUtils.materializeOneInstance(jobId, dryrun, (Element) eJob.clone(), nextTime,
                    actualTime, lastActionNumber, jobConf, actionBean);
            actionBean.setTimeOut(timeout);
            if (!dryrun) {
                storeToDB(actionBean, action, jobConf); // Storing to table

            } else {
                actionStrings.append("action for new instance");
                actionStrings.append(action);
            }
        } else {
            break;
        }

        if (!isCronFrequency) {
            effStart = (Calendar) origStart.clone();
            effStart.add(freqTU.getCalendarUnit(),
                    lastActionNumber * Integer.parseInt(coordJob.getFrequency()));
        }
    }

    if (isCronFrequency) {
        if (effStart.compareTo(end) < 0 && !(ignoreMaxActions || maxActionToBeCreated-- > 0)) {
            //Since we exceed the throttle, we need to move the nextMadtime forward
            //to avoid creating duplicate actions
            if (!firstMater) {
                effStart.setTime(
                        CoordCommandUtils.getNextValidActionTimeForCronFrequency(effStart.getTime(), coordJob));
            }
        }
    }

    endMatdTime = effStart.getTime();

    if (!dryrun) {
        return action;
    } else {
        return actionStrings.toString();
    }
}

From source file:com.google.enterprise.connector.filenet4.FileDocumentListTest.java

@Test
public void testLiveNextDocument() throws Exception {
    assumeTrue(TestConnection.isLiveConnection());

    Traverser traverser = getObjectUnderTest();
    boolean isTested = false;
    DocumentList docList = traverser.getDocumentList(new Checkpoint());
    assertNotNull("Document list is null", docList);
    Document doc = docList.nextDocument();
    while (doc != null && doc instanceof FileDocument) {
        Property lastModifiedProp = doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
        Value lastModifiedValue = lastModifiedProp.nextValue();
        Calendar cal = Value.iso8601ToCalendar(lastModifiedValue.toString());

        Document nextDoc = docList.nextDocument();
        if (nextDoc != null && nextDoc instanceof FileDocument) {
            Property nextDocLastModifiedProp = nextDoc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
            Value nextDocLastModifiedValue = nextDocLastModifiedProp.nextValue();
            Calendar nextCal = Value.iso8601ToCalendar(nextDocLastModifiedValue.toString());
            assertTrue(cal.compareTo(nextCal) <= 0);
            isTested = true;/*from   ww  w.j av a 2  s.c  o m*/
        }
        doc = nextDoc;
    }
    assertTrue(isTested);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_2.CFAst.CFAstSysClusterHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFAstSysClusterHBuff) {
        CFAstSysClusterHBuff rhs = (CFAstSysClusterHBuff) obj;
        int retval = 0;
        {/* w w w  .j  a v a 2 s .  c  o  m*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredSingletonId() < rhs.getRequiredSingletonId()) {
            return (-1);
        } else if (getRequiredSingletonId() > rhs.getRequiredSingletonId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFAstSysClusterHPKey) {
        CFAstSysClusterHPKey rhs = (CFAstSysClusterHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredSingletonId() < rhs.getRequiredSingletonId()) {
            return (-1);
        } else if (getRequiredSingletonId() > rhs.getRequiredSingletonId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFAstHPKey) {
        CFAstHPKey rhs = (CFAstHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else if (obj instanceof CFAstSysClusterPKey) {
        CFAstSysClusterPKey rhs = (CFAstSysClusterPKey) obj;
        if (getRequiredSingletonId() < rhs.getRequiredSingletonId()) {
            return (-1);
        } else if (getRequiredSingletonId() > rhs.getRequiredSingletonId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFAstSysClusterBuff) {
        CFAstSysClusterBuff rhs = (CFAstSysClusterBuff) obj;
        if (getRequiredSingletonId() < rhs.getRequiredSingletonId()) {
            return (-1);
        } else if (getRequiredSingletonId() > rhs.getRequiredSingletonId()) {
            return (1);
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFAstSysClusterHPKey, CFAstSysClusterPKey, CFAstSysClusterBuff");
    }
}

From source file:com.baidu.rigel.biplatform.tesseract.meta.impl.TimeDimensionMemberServiceImpl.java

/**
 * ???//w w w.ja va 2  s  . c om
 * 
 * @param level
 * @param parentMember
 * @return
 */
private List<MiniCubeMember> genMembersWithDayParentForAll(Level level, Member parentMember) {
    List<MiniCubeMember> members = Lists.newArrayList();
    Calendar calNow = Calendar.getInstance();
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.MONTH, Calendar.JANUARY);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd");
    while (cal.before(calNow) || (cal.compareTo(calNow) == 0)) {
        String day = sf.format(cal.getTime());
        MiniCubeMember dayMember = new MiniCubeMember(day);
        dayMember.setCaption(day);
        dayMember.setLevel(level);
        dayMember.setParent(parentMember);
        dayMember.setName(day);
        dayMember.setVisible(true);
        dayMember.getQueryNodes().add(day);
        members.add(dayMember);
        cal.add(Calendar.DATE, 1);
    }
    return members;
}

From source file:org.kuali.coeus.common.budget.framework.personnel.BudgetPersonnelDetails.java

public ScaleTwoDecimal getPersonMonths() {
    ScaleTwoDecimal result = null;/*from w w  w  .  j  a va 2  s.  c  om*/
    if (getStartDate() != null && getEndDate() != null) {
        Calendar startDateCalendar = Calendar.getInstance();
        startDateCalendar.setTime(getStartDate());
        int startMonth = startDateCalendar.get(MONTH);
        Calendar endDateCalendar = Calendar.getInstance();
        endDateCalendar.setTime(getEndDate());
        double personMonths = 0d;
        while (startDateCalendar.compareTo(endDateCalendar) <= 0) {
            double noOfDaysInMonth = startDateCalendar.getActualMaximum(DAY_OF_MONTH);
            double noOfActualDays = 0;
            if (startDateCalendar.get(MONTH) == endDateCalendar.get(MONTH)
                    && startDateCalendar.get(Calendar.YEAR) == endDateCalendar.get(Calendar.YEAR)) {
                noOfActualDays = endDateCalendar.get(DAY_OF_MONTH) - startDateCalendar.get(DAY_OF_MONTH) + 1;
            } else if (startDateCalendar.get(MONTH) == startMonth) {
                noOfActualDays = noOfDaysInMonth - startDateCalendar.get(DAY_OF_MONTH) + 1;
            } else {
                noOfActualDays = noOfDaysInMonth;
            }
            startDateCalendar.add(MONTH, 1);
            startDateCalendar.set(DAY_OF_MONTH, 1);
            personMonths += (noOfActualDays / noOfDaysInMonth);
        }
        result = new ScaleTwoDecimal(new BigDecimal(personMonths).setScale(2, RoundingMode.HALF_UP)
                .multiply(getPercentEffort().bigDecimalValue())
                .divide(new ScaleTwoDecimal(100).bigDecimalValue(), RoundingMode.HALF_UP));
    }
    return result;
}

From source file:org.apache.oozie.coord.CoordELFunctions.java

/**
 * Find the current instance based on effectiveTime (i.e Action_Creation_Time or Action_Start_Time)
 *
 * @return current instance i.e. current(0) returns null if effectiveTime is earlier than Initial Instance time of
 *         the dataset.//from ww w.  ja  v  a 2s.c o  m
 */
private static Calendar getCurrentInstance_old(Date effectiveTime, int instanceCount[], ELEvaluator eval) {
    Date datasetInitialInstance = getInitialInstance(eval);
    TimeUnit dsTimeUnit = getDSTimeUnit(eval);
    TimeZone dsTZ = getDatasetTZ(eval);
    int dsFreq = getDSFrequency(eval);
    // Convert Date to Calendar for corresponding TZ
    Calendar current = Calendar.getInstance();
    current.setTime(datasetInitialInstance);
    current.setTimeZone(dsTZ);

    Calendar calEffectiveTime = Calendar.getInstance();
    calEffectiveTime.setTime(effectiveTime);
    calEffectiveTime.setTimeZone(dsTZ);
    if (instanceCount == null) { // caller doesn't care about this value
        instanceCount = new int[1];
    }
    instanceCount[0] = 0;
    if (current.compareTo(calEffectiveTime) > 0) {
        return null;
    }
    Calendar origCurrent = (Calendar) current.clone();
    while (current.compareTo(calEffectiveTime) <= 0) {
        current = (Calendar) origCurrent.clone();
        instanceCount[0]++;
        current.add(dsTimeUnit.getCalendarUnit(), instanceCount[0] * dsFreq);
    }
    instanceCount[0]--;

    current = (Calendar) origCurrent.clone();
    current.add(dsTimeUnit.getCalendarUnit(), instanceCount[0] * dsFreq);
    return current;
}

From source file:com.borax12.materialdaterangepicker.single.date.DatePickerDialog.java

private void setToNearestDate(Calendar calendar) {
    if (selectableDays != null) {
        int distance = Integer.MAX_VALUE;
        for (Calendar c : selectableDays) {
            int newDistance = Math.abs(calendar.compareTo(c));
            if (newDistance < distance)
                distance = newDistance;/* w ww  .ja  v a2s . co m*/
            else {
                calendar.setTimeInMillis(c.getTimeInMillis());
                break;
            }
        }
        return;
    }

    if (isBeforeMin(calendar)) {
        calendar.setTimeInMillis(mMinDate.getTimeInMillis());
        return;
    }

    if (isAfterMax(calendar)) {
        calendar.setTimeInMillis(mMaxDate.getTimeInMillis());
        return;
    }
}

From source file:models.persistence.scheduletree.TimeSlot.java

@JsonIgnore
public Boolean isInTimeSlotCriteria(TimeSlotCriteria timeSlotCriteria) {

    int otherStartHour = timeSlotCriteria.getStartHour();
    int otherStartMinute = timeSlotCriteria.getStartMinute();
    int otherStopHour = timeSlotCriteria.getStopHour();
    int otherStopMinute = timeSlotCriteria.getStopMinute();
    int thisWeekday = ((Weekday) getParent()).getSortIndex();
    int otherWeekday = timeSlotCriteria.getWeekday().getSortIndex();

    if (thisWeekday != otherWeekday) {
        return false;
    }//from w  w  w  .  j  a  va  2 s  . c o  m

    Calendar thisStartDate = Calendar.getInstance();
    Calendar thisStopDate = Calendar.getInstance();
    Calendar thatStartDate = Calendar.getInstance();
    Calendar thatStopDate = Calendar.getInstance();

    initCalendarFields(thisStartDate, startHour, startMinute, thisWeekday);
    initCalendarFields(thisStopDate, stopHour, stopMinute, thisWeekday);
    initCalendarFields(thatStartDate, otherStartHour, otherStartMinute, otherWeekday);
    initCalendarFields(thatStopDate, otherStopHour, otherStopMinute, otherWeekday);

    return thisStartDate.compareTo(thatStartDate) >= 0 && thisStopDate.compareTo(thatStopDate) <= 0
            && (timeSlotCriteria.getDuration() == EDuration.WEEKLY
                    || timeSlotCriteria.getDuration() == getDuration());
}

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

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFInternetSecAppHBuff) {
        CFInternetSecAppHBuff rhs = (CFInternetSecAppHBuff) obj;
        int retval = 0;
        {/*www .j  a  v  a2  s  . c  om*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
            return (-1);
        } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
            return (1);
        }
        if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
            return (-1);
        } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetSecAppHPKey) {
        CFInternetSecAppHPKey rhs = (CFInternetSecAppHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
            return (-1);
        } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
            return (1);
        }
        if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
            return (-1);
        } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetHPKey) {
        CFInternetHPKey rhs = (CFInternetHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else if (obj instanceof CFInternetSecAppPKey) {
        CFInternetSecAppPKey rhs = (CFInternetSecAppPKey) obj;
        if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
            return (-1);
        } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
            return (1);
        }
        if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
            return (-1);
        } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetSecAppBuff) {
        CFInternetSecAppBuff rhs = (CFInternetSecAppBuff) obj;
        if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
            return (-1);
        } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
            return (1);
        }
        if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
            return (-1);
        } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
            return (1);
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFInternetSecAppHPKey, CFInternetSecAppPKey, CFInternetSecAppBuff");
    }
}

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

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFInternetTldHBuff) {
        CFInternetTldHBuff rhs = (CFInternetTldHBuff) obj;
        int retval = 0;
        {//from   w w w. j  a  v a2 s  .co  m
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
            return (-1);
        } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
            return (1);
        }
        if (getRequiredTldId() < rhs.getRequiredTldId()) {
            return (-1);
        } else if (getRequiredTldId() > rhs.getRequiredTldId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetTldHPKey) {
        CFInternetTldHPKey rhs = (CFInternetTldHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
            return (-1);
        } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
            return (1);
        }
        if (getRequiredTldId() < rhs.getRequiredTldId()) {
            return (-1);
        } else if (getRequiredTldId() > rhs.getRequiredTldId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetHPKey) {
        CFInternetHPKey rhs = (CFInternetHPKey) obj;
        {
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else if (obj instanceof CFInternetTldPKey) {
        CFInternetTldPKey rhs = (CFInternetTldPKey) obj;
        if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
            return (-1);
        } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
            return (1);
        }
        if (getRequiredTldId() < rhs.getRequiredTldId()) {
            return (-1);
        } else if (getRequiredTldId() > rhs.getRequiredTldId()) {
            return (1);
        }
        return (0);
    } else if (obj instanceof CFInternetTldBuff) {
        CFInternetTldBuff rhs = (CFInternetTldBuff) obj;
        if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
            return (-1);
        } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
            return (1);
        }
        if (getRequiredTldId() < rhs.getRequiredTldId()) {
            return (-1);
        } else if (getRequiredTldId() > rhs.getRequiredTldId()) {
            return (1);
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFInternetTldHPKey, CFInternetTldPKey, CFInternetTldBuff");
    }
}