public void setAgeOffHours(final long ageOfHours) { setAgeOffTime(HOURS_TO_MILLISECONDS * ageOfHours); }
public void ageOffInMilliseconds() { // --------------------------------------------------------- final AgeOff function = new AgeOff(100000L); // --------------------------------------------------------- runExample(function, null, "", now, now - 100000L, now + 100000L, String.valueOf(now)); } }
private Pair<FilterPredicate, Set<Path>> addAgeOffFilter(final AgeOff ageOff, final String[] selection, final String group) throws SerialisationException { String[] paths = schemaUtils.getPaths(group, selection[0]); if (paths == null) { paths = new String[1]; paths[0] = selection[0]; } FilterPredicate filter = null; for (int i = 0; i < paths.length; i++) { final String path = paths[i]; FilterPredicate tempFilter; Long ageOffTime = System.currentTimeMillis() - ageOff.getAgeOffTime(); tempFilter = gt(longColumn(path), ageOffTime); if (filter == null) { filter = tempFilter; } else { filter = and(filter, tempFilter); } } return new Pair<>(filter, getAllPathsForColumn(group)); }
public static Schema createSchema(final Long timeToLive) { final Schema.Builder builder = new Schema.Builder() .json(StreamUtil.openStreams(GafferResultCacheUtil.class, "gafferResultCache/schema")); if (null != timeToLive) { builder.merge(new Schema.Builder() .type("timestamp", new TypeDefinition.Builder() .validateFunctions(new AgeOff(timeToLive)) .build()) .build()); } return builder.build(); } }
public void setAgeOffDays(final int ageOfDays) { setAgeOffTime(DAYS_TO_MILLISECONDS * ageOfDays); }