001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 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 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.ecm.core.storage.sql; 020 021/** 022 * The different types of selections available, and information about what they correspond to in the database. 023 */ 024public enum SelectionType { 025 026 /** 027 * Selection for the children of a given parent id. 028 */ 029 CHILDREN(Model.HIER_TABLE_NAME, Model.HIER_PARENT_KEY, Model.HIER_CHILD_NAME_KEY, Model.HIER_CHILD_ISPROPERTY_KEY, 030 Invalidations.PARENT), 031 032 /** 033 * Selection for the versions of a given version series. 034 */ 035 SERIES_VERSIONS(Model.VERSION_TABLE_NAME, Model.VERSION_VERSIONABLE_KEY, null, null, "__SERIES_VERSIONS__"), 036 037 /** 038 * Selection for the proxies of a given version series. 039 */ 040 SERIES_PROXIES(Model.PROXY_TABLE_NAME, Model.PROXY_VERSIONABLE_KEY, null, null, Invalidations.SERIES_PROXIES), 041 042 /** 043 * Selection for the proxies of a given target. 044 */ 045 TARGET_PROXIES(Model.PROXY_TABLE_NAME, Model.PROXY_TARGET_KEY, null, null, Invalidations.TARGET_PROXIES); 046 047 /** 048 * The table name for this selection. 049 */ 050 public final String tableName; 051 052 /** 053 * The key for the selection id. 054 * <p> 055 * For instance for a children selection this is the parent id. 056 */ 057 public final String selKey; 058 059 /** 060 * The key to use to additionally filter on fragment values. 061 * <p> 062 * For instance for a children selection this is the child name. 063 */ 064 public final String filterKey; 065 066 /** 067 * The key to use to additionally filter on criterion. 068 * <p> 069 * For instance for a children selection this is the complex property flag. 070 * <p> 071 * This can be {@code null} for no criterion filtering. 072 */ 073 public final String criterionKey; 074 075 /** 076 * Pseudo-table to use to notify about selection invalidation. 077 */ 078 public final String invalidationTableName; 079 080 private SelectionType(String tableName, String selKey, String filterKey, String criterionKey, 081 String invalidationTableName) { 082 this.tableName = tableName; 083 this.selKey = selKey; 084 this.filterKey = filterKey; 085 this.criterionKey = criterionKey; 086 this.invalidationTableName = invalidationTableName; 087 } 088}