Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public byte[] setWatermark(byte[] bytes, Long locationPosition, Long timePosition, Map<String, Object> properties) {
- String longitude = null;
- String latitude = null;
- LocalDateTime time = null;
- if (locationPosition != 0 && longitude != null && latitude != null) {
- bytes = createLocationWatermark(bytes, locationPosition, longitude, latitude);
- }
- if (timePosition != 0 && time != null) {
- bytes = createTimeWatermark(bytes, timePosition, time);
- }
- return bytes;
- }
- public Map<String, Object> extractPropertiesFromDocument(Document document) {
- Map<String, Object> properties = new HashMap<>();
- for (Property property : document.getProperties()) {
- if (property.getValue() != null) {
- if (property.getDisplayName().equals("Longitude")) {
- String longitude = property.getValue().toString();
- properties.put(longitude, longitude);
- }
- if (property.getDisplayName().equals("Latitude")) {
- String latitude = property.getValue().toString();
- properties.put(latitude, latitude);
- }
- if (property.getDisplayName().equals("Date and Time")) {
- LocalDateTime time = ((GregorianCalendar) property.getValue()).getTime().toInstant()
- .atZone(ZoneId.systemDefault()).toLocalDateTime();
- properties.put("time", time);
- }
- }
- }
- return properties;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement