LCOV - code coverage report
Current view: top level - server/index/change - ChangeSchemaDefinitions.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 25 25 100.0 %
Date: 2022-11-19 15:00:39 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright (C) 2016 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.server.index.change;
      16             : 
      17             : import static com.google.gerrit.index.SchemaUtil.schema;
      18             : 
      19             : import com.google.common.collect.ImmutableList;
      20             : import com.google.gerrit.index.IndexedField;
      21             : import com.google.gerrit.index.Schema;
      22             : import com.google.gerrit.index.SchemaDefinitions;
      23             : import com.google.gerrit.server.query.change.ChangeData;
      24             : 
      25             : /**
      26             :  * Definition of change index versions (schemata). See {@link SchemaDefinitions}.
      27             :  *
      28             :  * <p>Upgrades are subject to constraints, see {@code
      29             :  * com.google.gerrit.index.IndexUpgradeValidator}.
      30             :  */
      31             : public class ChangeSchemaDefinitions extends SchemaDefinitions<ChangeData> {
      32             :   /** Added new field {@link ChangeField#IS_SUBMITTABLE_SPEC} based on submit requirements. */
      33             :   @Deprecated
      34         154 :   static final Schema<ChangeData> V74 =
      35         154 :       schema(
      36             :           /* version= */ 74,
      37         154 :           ImmutableList.of(
      38             :               ChangeField.ADDED,
      39             :               ChangeField.APPROVAL,
      40             :               ChangeField.ATTENTION_SET_FULL,
      41             :               ChangeField.CHANGE,
      42             :               ChangeField.CHERRY_PICK,
      43             :               ChangeField.COMMENT,
      44             :               ChangeField.COMMENTBY,
      45             :               ChangeField.COMMIT,
      46             :               ChangeField.COMMIT_MESSAGE,
      47             :               ChangeField.DELETED,
      48             :               ChangeField.DELTA,
      49             :               ChangeField.DRAFTBY,
      50             :               ChangeField.EDITBY,
      51             :               ChangeField.EXACT_COMMIT,
      52             :               ChangeField.GROUP,
      53             :               ChangeField.ID,
      54             :               ChangeField.LABEL,
      55             :               ChangeField.LEGACY_ID_STR,
      56             :               ChangeField.MERGE,
      57             :               ChangeField.MERGEABLE,
      58             :               ChangeField.PATCH_SET,
      59             :               ChangeField.PRIVATE,
      60             :               ChangeField.REF_STATE,
      61             :               ChangeField.REF_STATE_PATTERN,
      62             :               ChangeField.REVIEWEDBY,
      63             :               ChangeField.STAR,
      64             :               ChangeField.STARBY,
      65             :               ChangeField.STARTED,
      66             :               ChangeField.STORED_SUBMIT_RECORD_LENIENT,
      67             :               ChangeField.STORED_SUBMIT_RECORD_STRICT,
      68             :               ChangeField.STORED_SUBMIT_REQUIREMENTS,
      69             :               ChangeField.SUBMIT_RECORD,
      70             :               ChangeField.SUBMIT_RULE_RESULT,
      71             :               ChangeField.TOTAL_COMMENT_COUNT,
      72             :               ChangeField.TR,
      73             :               ChangeField.UNRESOLVED_COMMENT_COUNT,
      74             :               ChangeField.UPDATED,
      75             :               ChangeField.WIP),
      76         154 :           ImmutableList.<IndexedField<ChangeData, ?>>of(
      77             :               ChangeField.ASSIGNEE_FIELD,
      78             :               ChangeField.ATTENTION_SET_USERS_COUNT_FIELD,
      79             :               ChangeField.ATTENTION_SET_USERS_FIELD,
      80             :               ChangeField.AUTHOR_PARTS_FIELD,
      81             :               ChangeField.CHERRY_PICK_OF_CHANGE_FIELD,
      82             :               ChangeField.CHERRY_PICK_OF_PATCHSET_FIELD,
      83             :               ChangeField.COMMITTER_PARTS_FIELD,
      84             :               ChangeField.DIRECTORY_FIELD,
      85             :               ChangeField.EXACT_AUTHOR_FIELD,
      86             :               ChangeField.EXACT_COMMITTER_FIELD,
      87             :               ChangeField.EXTENSION_FIELD,
      88             :               ChangeField.FILE_PART_FIELD,
      89             :               ChangeField.FOOTER_FIELD,
      90             :               ChangeField.HASHTAG_CASE_AWARE_FIELD,
      91             :               ChangeField.HASHTAG_FIELD,
      92             :               ChangeField.IS_PURE_REVERT_FIELD,
      93             :               ChangeField.IS_SUBMITTABLE_FIELD,
      94             :               ChangeField.MERGED_ON_FIELD,
      95             :               ChangeField.ONLY_EXTENSIONS_FIELD,
      96             :               ChangeField.OWNER_FIELD,
      97             :               ChangeField.PATH_FIELD,
      98             :               ChangeField.PENDING_REVIEWER_BY_EMAIL_FIELD,
      99             :               ChangeField.PENDING_REVIEWER_FIELD,
     100             :               ChangeField.PROJECT_FIELD,
     101             :               ChangeField.REF_FIELD,
     102             :               ChangeField.REVERT_OF_FIELD,
     103             :               ChangeField.REVIEWER_BY_EMAIL_FIELD,
     104             :               ChangeField.REVIEWER_FIELD,
     105             :               ChangeField.STATUS_FIELD,
     106             :               ChangeField.SUBMISSIONID_FIELD,
     107             :               ChangeField.TOPIC_FIELD,
     108             :               ChangeField.UPLOADER_FIELD),
     109         154 :           ImmutableList.<IndexedField<ChangeData, ?>.SearchSpec>of(
     110             :               ChangeField.ASSIGNEE_SPEC,
     111             :               ChangeField.ATTENTION_SET_USERS,
     112             :               ChangeField.ATTENTION_SET_USERS_COUNT,
     113             :               ChangeField.AUTHOR_PARTS_SPEC,
     114             :               ChangeField.CHERRY_PICK_OF_CHANGE,
     115             :               ChangeField.CHERRY_PICK_OF_PATCHSET,
     116             :               ChangeField.COMMITTER_PARTS_SPEC,
     117             :               ChangeField.DIRECTORY_SPEC,
     118             :               ChangeField.EXACT_AUTHOR_SPEC,
     119             :               ChangeField.EXACT_COMMITTER_SPEC,
     120             :               ChangeField.EXACT_TOPIC,
     121             :               ChangeField.EXTENSION_SPEC,
     122             :               ChangeField.FILE_PART_SPEC,
     123             :               ChangeField.FOOTER_SPEC,
     124             :               ChangeField.FUZZY_HASHTAG,
     125             :               ChangeField.FUZZY_TOPIC,
     126             :               ChangeField.HASHTAG_CASE_AWARE_SPEC,
     127             :               ChangeField.HASHTAG_SPEC,
     128             :               ChangeField.IS_PURE_REVERT_SPEC,
     129             :               ChangeField.IS_SUBMITTABLE_SPEC,
     130             :               ChangeField.MERGED_ON_SPEC,
     131             :               ChangeField.ONLY_EXTENSIONS_SPEC,
     132             :               ChangeField.OWNER_SPEC,
     133             :               ChangeField.PATH_SPEC,
     134             :               ChangeField.PENDING_REVIEWER_BY_EMAIL,
     135             :               ChangeField.PENDING_REVIEWER_SPEC,
     136             :               ChangeField.PROJECTS_SPEC,
     137             :               ChangeField.PROJECT_SPEC,
     138             :               ChangeField.REF_SPEC,
     139             :               ChangeField.REVERT_OF,
     140             :               ChangeField.REVIEWER_BY_EMAIL,
     141             :               ChangeField.REVIEWER_SPEC,
     142             :               ChangeField.STATUS_SPEC,
     143             :               ChangeField.SUBMISSIONID_SPEC,
     144             :               ChangeField.UPLOADER_SPEC));
     145             : 
     146             :   /**
     147             :    * Added new field {@link ChangeField#PREFIX_HASHTAG} and {@link ChangeField#PREFIX_TOPIC} to
     148             :    * allow easier search for topics.
     149             :    */
     150             :   @Deprecated
     151         154 :   static final Schema<ChangeData> V75 =
     152             :       new Schema.Builder<ChangeData>()
     153         154 :           .add(V74)
     154         154 :           .addSearchSpecs(ChangeField.PREFIX_HASHTAG)
     155         154 :           .addSearchSpecs(ChangeField.PREFIX_TOPIC)
     156         154 :           .build();
     157             : 
     158             :   /** Added new field {@link ChangeField#FOOTER_NAME}. */
     159             :   @Deprecated
     160         154 :   static final Schema<ChangeData> V76 =
     161             :       new Schema.Builder<ChangeData>()
     162         154 :           .add(V75)
     163         154 :           .addIndexedFields(ChangeField.FOOTER_NAME_FIELD)
     164         154 :           .addSearchSpecs(ChangeField.FOOTER_NAME)
     165         154 :           .build();
     166             : 
     167             :   /** Added new field {@link ChangeField#COMMIT_MESSAGE_EXACT}. */
     168             :   @Deprecated
     169         154 :   static final Schema<ChangeData> V77 =
     170         154 :       new Schema.Builder<ChangeData>().add(V76).add(ChangeField.COMMIT_MESSAGE_EXACT).build();
     171             : 
     172             :   // Upgrade Lucene to 7.x requires reindexing.
     173         154 :   @Deprecated static final Schema<ChangeData> V78 = schema(V77);
     174             : 
     175             :   /** Remove draft and star fields. */
     176         154 :   static final Schema<ChangeData> V79 =
     177             :       new Schema.Builder<ChangeData>()
     178         154 :           .add(V78)
     179         154 :           .remove(ChangeField.DRAFTBY, ChangeField.STAR, ChangeField.STARBY)
     180         154 :           .build();
     181             :   /**
     182             :    * Name of the change index to be used when contacting index backends or loading configurations.
     183             :    */
     184             :   public static final String NAME = "changes";
     185             : 
     186             :   /** Singleton instance of the schema definitions. This is one per JVM. */
     187         154 :   public static final ChangeSchemaDefinitions INSTANCE = new ChangeSchemaDefinitions();
     188             : 
     189             :   private ChangeSchemaDefinitions() {
     190         154 :     super(NAME, ChangeData.class);
     191         154 :   }
     192             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750