public static Long plus(final LocalDateTime now, final DataRetentionRule rule) {
        if (rule.isForever()) {
            return null;
        }

        final LocalDateTime age;
        switch (rule.getTimeUnit()) {
            case MINUTES:
                age = now.plusMinutes(rule.getAge());
                break;
            case HOURS:
                age = now.plusHours(rule.getAge());
                break;
            case DAYS:
                age = now.plusDays(rule.getAge());
                break;
            case WEEKS:
                age = now.plusWeeks(rule.getAge());
                break;
            case MONTHS:
                age = now.plusMonths(rule.getAge());
                break;
            case YEARS:
                age = now.plusYears(rule.getAge());
                break;
            default:
                age = null;
        }

        if (age == null) {
            return null;
        }

        return age.toInstant(ZoneOffset.UTC).toEpochMilli();
    }
A utility class to calculate times from supplied retention ages.
stroom-meta/stroom-meta-impl/src/main/java/stroom/meta/impl/DataRetentionAgeUtil.java