private prepareSimpleTriggerAttributes()

in src/main/groovy/grails/plugins/quartz/config/TriggersConfigBuilder.groovy [145:196]


    private prepareSimpleTriggerAttributes(Map triggerAttributes) {
        def prepare = prepareTriggerAttribute.curry(triggerAttributes)

        // Process the old deprecated property "timeout"
        if (triggerAttributes[Constants.TIMEOUT] != null) {
            GrailsUtil.deprecated("You're using deprecated 'timeout' property in the ${jobName}, use 'repeatInterval' instead")

            if (!(triggerAttributes[Constants.TIMEOUT] instanceof Integer || triggerAttributes[Constants.TIMEOUT] instanceof Long)) {
                throw new IllegalArgumentException(
                        "timeout trigger property in the job class ${jobName} must be Integer or Long"
                )
            }
            if (((Number) triggerAttributes[Constants.TIMEOUT]).longValue() < 0) {
                throw new IllegalArgumentException(
                        "timeout trigger property for job class ${jobName} is negative (possibly integer overflow error)"
                )
            }
            triggerAttributes[Constants.REPEAT_INTERVAL] = triggerAttributes.remove(Constants.TIMEOUT)
        }

        // Validate repeat interval
        prepare(
                Constants.REPEAT_INTERVAL,
                Constants.DEFAULT_REPEAT_INTERVAL,
                {
                    if (!(it instanceof Integer || it instanceof Long)) {
                        throw new IllegalArgumentException("repeatInterval trigger property in the job class ${jobName} must be Integer or Long")
                    }
                    if (((Number) it).longValue() < 0) {
                        throw new IllegalArgumentException("repeatInterval trigger property for job class ${jobName} is negative (possibly integer overflow error)")
                    }
                }
        )

        // Validate repeat count
        prepare(
                Constants.REPEAT_COUNT,
                Constants.DEFAULT_REPEAT_COUNT,
                {
                    if (!(it instanceof Integer || it instanceof Long)) {
                        throw new IllegalArgumentException(
                                "repeatCount trigger property in the job class ${jobName} must be Integer or Long"
                        )
                    }
                    if (((Number) it).longValue() < 0 && ((Number) it).longValue() != SimpleTrigger.REPEAT_INDEFINITELY) {
                        throw new IllegalArgumentException(
                                "repeatCount trigger property for job class ${jobName} is negative (possibly integer overflow error)"
                        )
                    }
                }
        )
    }