@Test public void testAddKeyToElement() { VertexFactory<TemporalVertex> vf = getConfig().getTemporalGraphFactory().getVertexFactory(); KeyFunctionWithDefaultValue<TemporalElement, Long> function = TemporalGroupingKeys.timeStamp( TimeDimension.VALID_TIME, TimeDimension.Field.FROM); TemporalElement element = vf.createVertex(); function.addKeyToElement(element, TemporalElement.DEFAULT_TIME_FROM); assertEquals(PropertyValue.create(TemporalElement.DEFAULT_TIME_FROM), element.getPropertyValue("time_VALID_TIME_FROM")); function.addKeyToElement(element, -1L); assertEquals(PropertyValue.create(-1L), element.getPropertyValue("time_VALID_TIME_FROM")); element = vf.createVertex(); function = TemporalGroupingKeys.timeStamp(TimeDimension.VALID_TIME, TimeDimension.Field.FROM, ChronoField.DAY_OF_MONTH); function.addKeyToElement(element, -1L); assertNull(element.getPropertyValue("time_VALID_TIME_FROM_DayOfMonth")); function.addKeyToElement(element, 2L); assertEquals(PropertyValue.create(2L), element.getPropertyValue("time_VALID_TIME_FROM_DayOfMonth")); }
@Override public void addKeyToElement(T element, Object key) { if (!(key instanceof Long)) { throw new IllegalArgumentException("Invalid type for key: " + key.getClass().getSimpleName()); } if (fieldOfTimeStamp == null || !getDefaultKey().equals(key)) { element.setProperty(targetPropertyKey, PropertyValue.create(key)); } }
TimeStampKeyFunction implements KeyFunctionWithDefaultValue<T, Long> { @Override public void addKeyToElement(T element, Object key) { if (!(key instanceof Long)) { throw new IllegalArgumentException("Invalid type for key: " + key.getClass().getSimpleName()); } if (fieldOfTimeStamp == null || !getDefaultKey().equals(key)) { element.setProperty(targetPropertyKey, PropertyValue.create(key)); } } }
TimeStampKeyFunction implements KeyFunctionWithDefaultValue<T, Long> { @Override public void addKeyToElement(T element, Object key) { if (!(key instanceof Long)) { throw new IllegalArgumentException("Invalid type for key: " + key.getClass().getSimpleName()); } if (fieldOfTimeStamp == null || !getDefaultKey().equals(key)) { element.setProperty(targetPropertyKey, PropertyValue.create(key)); } } TimeStampKeyFunction(TimeDimension timeDimension,
    TimeDimension.Field timeDimensionField, TemporalField fieldOfTimeStamp); }
TimeStampKeyFunction implements KeyFunctionWithDefaultValue<T, Long> { @Override public void addKeyToElement(T element, Object key) { if (!(key instanceof Long)) { throw new IllegalArgumentException("Invalid type for key: " + key.getClass().getSimpleName()); } if (fieldOfTimeStamp == null || !getDefaultKey().equals(key)) { element.setProperty(targetPropertyKey, PropertyValue.create(key)); } } TimeStampKeyFunction(TimeDimension timeDimension,
    TimeDimension.Field timeDimensionField, TemporalField fieldOfTimeStamp); @Override Long getKey(T element); @Override void addKeyToElement(T element, Object key); @Override TypeInformation<Long> getType(); @Override Long getDefaultKey(); }
TimeStampKeyFunction implements KeyFunctionWithDefaultValue<T, Long> { @Override public void addKeyToElement(T element, Object key) { if (!(key instanceof Long)) { throw new IllegalArgumentException("Invalid type for key: " + key.getClass().getSimpleName()); } if (fieldOfTimeStamp == null || !getDefaultKey().equals(key)) { element.setProperty(targetPropertyKey, PropertyValue.create(key)); } } TimeStampKeyFunction(TimeDimension timeDimension,
    TimeDimension.Field timeDimensionField, TemporalField fieldOfTimeStamp); @Override Long getKey(T element); @Override void addKeyToElement(T element, Object key); @Override TypeInformation<Long> getType(); @Override Long getDefaultKey();  }