Search in sources :

Example 1 with SendMessageJob

use of nl.nn.adapterframework.scheduler.job.SendMessageJob in project iaf by ibissource.

the class IbisJobDetail method compareWith.

public boolean compareWith(IJob otherJobDef) {
    IJob thisJobDef = getJobDef();
    // If the CRON expression is different in both jobs, it's not equal!
    if (!StringUtils.equals(thisJobDef.getCronExpression(), otherJobDef.getCronExpression())) {
        return false;
    }
    // If the Interval expression is different in both jobs, it's not equal!
    if (thisJobDef.getInterval() != otherJobDef.getInterval()) {
        return false;
    }
    Locker thisLocker = thisJobDef.getLocker();
    Locker otherLocker = otherJobDef.getLocker();
    // If one is NULL but the other isn't, (locker has been removed or added, it's not equal!
    if ((thisLocker == null && otherLocker != null) || (thisLocker != null && otherLocker == null)) {
        return false;
    }
    // If both contain a locker but the key is different, it's not equal!
    if (thisLocker != null && otherLocker != null && !StringUtils.equals(thisLocker.getObjectId(), otherLocker.getObjectId())) {
        return false;
    }
    // If at this point the message is equal in both jobs, the jobs are equal!
    if (thisJobDef instanceof SendMessageJob && otherJobDef instanceof SendMessageJob) {
        String msg1 = ((SendMessageJob) thisJobDef).getMessage();
        String msg2 = ((SendMessageJob) otherJobDef).getMessage();
        return StringUtils.equals(msg1, msg2);
    }
    return true;
}
Also used : SendMessageJob(nl.nn.adapterframework.scheduler.job.SendMessageJob) Locker(nl.nn.adapterframework.util.Locker) IJob(nl.nn.adapterframework.scheduler.job.IJob)

Aggregations

IJob (nl.nn.adapterframework.scheduler.job.IJob)1 SendMessageJob (nl.nn.adapterframework.scheduler.job.SendMessageJob)1 Locker (nl.nn.adapterframework.util.Locker)1