View Javadoc
1   /*
2    * Prometheus: Application Framework
3    * Copyright 2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  
18  package io.github.tonywasher.joceanus.prometheus.database;
19  
20  import io.github.tonywasher.joceanus.metis.data.MetisDataItem.MetisDataFieldId;
21  
22  import java.util.List;
23  import java.util.Map;
24  
25  /**
26   * Table Control interface.
27   */
28  public interface PrometheusTableControl {
29      /**
30       * Obtain the driver.
31       *
32       * @return the driver
33       */
34      PrometheusJDBCDriver getDriver();
35  
36      /**
37       * Obtain the column map.
38       *
39       * @return the map
40       */
41      Map<MetisDataFieldId, PrometheusColumnControl> getMap();
42  
43      /**
44       * Sort List.
45       *
46       * @return the sort list
47       */
48      List<PrometheusColumnControl> getSortList();
49  
50      /**
51       * Note that we have a sort on reference.
52       */
53      void setSortOnReference();
54  
55      /**
56       * Build the Join string for the list of columns.
57       *
58       * @param pChar   the character for this table
59       * @param pOffset the join offset
60       * @return the SQL string
61       */
62      String getJoinString(char pChar,
63                           Integer pOffset);
64  
65      /**
66       * Build the Order string for the list of columns.
67       *
68       * @param pChar   the character for this table
69       * @param pOffset the join offset
70       * @return the SQL string
71       */
72      String getOrderString(char pChar,
73                            Integer pOffset);
74  
75      /**
76       * Add quote if necessary.
77       *
78       * @param pBuilder the builder
79       */
80      void addQuoteIfAllowed(StringBuilder pBuilder);
81  }