001/*
002 * Copyright (C) 2014 Jörg Prante
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.xbib.elasticsearch.plugin.jdbc.util;
017
018import java.io.IOException;
019import java.util.Map;
020
021/**
022 * A structured object is composed by an object data source together with
023 * meta data about the object.
024 */
025public interface IndexableObject {
026
027    /**
028     * Set the operation type, either "index", "create", or "delete"
029     *
030     * @param optype the operaion type
031     * @return this indexable object
032     */
033    IndexableObject optype(String optype);
034
035    /**
036     * Get the operation type
037     *
038     * @return the operation type
039     */
040    String optype();
041
042    /**
043     * Set the index
044     *
045     * @param index the index
046     * @return this object
047     */
048    IndexableObject index(String index);
049
050    /**
051     * Get the index
052     *
053     * @return the index
054     */
055    String index();
056
057    /**
058     * Set the type
059     *
060     * @param type the type
061     * @return this object
062     */
063    IndexableObject type(String type);
064
065    /**
066     * Get the type
067     *
068     * @return the type
069     */
070    String type();
071
072    /**
073     * Set the ID
074     *
075     * @param id the ID
076     * @return this object
077     */
078    IndexableObject id(String id);
079
080    /**
081     * Get the ID
082     *
083     * @return the ID
084     */
085    String id();
086
087    /**
088     * Set meta data of this indexable object
089     *
090     * @param key   the meta data key
091     * @param value the meta data value
092     * @return this object
093     */
094    IndexableObject meta(String key, String value);
095
096    String meta(String key);
097
098    IndexableObject source(Map<String, Object> source);
099
100    Map<String, Object> source();
101
102    String build() throws IOException;
103
104    boolean isEmpty();
105
106    IndexableObject ignoreNull(boolean ignorenull);
107
108}