/* * Licensed to David Pilato (the "Author") under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Author licenses this * file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package fr.pilato.elasticsearch.crawler.fs.meta.doc; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Represents document metadata */ public class Meta { /** * Generated json field names */ static public final class FIELD_NAMES { public static final String AUTHOR = "author"; public static final String TITLE = "title"; public static final String DATE = "date"; public static final String KEYWORDS = "keywords"; public static final String LANGUAGE = "language"; } private String author; private String title; private LocalDateTime date; private List<String> keywords; private String language; private Map<String, String> raw; public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public LocalDateTime getDate() { return date; } public void setDate(LocalDateTime date) { this.date = date; } public List<String> getKeywords() { return keywords; } public void setKeywords(List<String> keywords) { this.keywords = keywords; } public Map<String, String> getRaw() { return raw; } public void setRaw(Map<String, String> raw) { this.raw = raw; } public void addRaw(String key, String value) { if (this.raw == null) { this.raw = new HashMap<>(); } this.raw.put(key, value); } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Meta meta = (Meta) o; if (author != null ? !author.equals(meta.author) : meta.author != null) return false; if (title != null ? !title.equals(meta.title) : meta.title != null) return false; if (date != null ? !date.equals(meta.date) : meta.date != null) return false; return !(keywords != null ? !keywords.equals(meta.keywords) : meta.keywords != null); } @Override public int hashCode() { int result = author != null ? author.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (date != null ? date.hashCode() : 0); result = 31 * result + (keywords != null ? keywords.hashCode() : 0); return result; } }