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 * Abstract representation of the database-level column types. 023 */ 024public enum ColumnSpec { 025 026 // ----- schema-based columns ----- 027 STRING(), // may be VARCHAR or CLOB depending on length 028 BOOLEAN(), // 029 LONG(), // 030 DOUBLE(), // 031 TIMESTAMP(), // 032 BLOBID(), // attached files 033 ARRAY_STRING(), // may be VARCHAR or CLOB array depending on length 034 ARRAY_BOOLEAN(), // 035 ARRAY_LONG(), // 036 ARRAY_DOUBLE(), // 037 ARRAY_TIMESTAMP(), // 038 ARRAY_BLOBID(), // attached files array 039 ARRAY_INTEGER(), 040 // ----- system columns ----- 041 NODEID, // node id primary generated key 042 NODEIDFK, // fk to main node id, not nullable (frag id) 043 NODEIDFKNP, // fk to main node id, not nullable, not primary 044 NODEIDFKMUL, // fk to main node id, not nullable, non-unique 045 NODEIDFKNULL, // fk to main node id, nullable 046 NODEIDPK, // node id primary key, but not a fk (locks) 047 NODEVAL, // same type as node id, not a fk (versionable, cluster...) 048 NODEARRAY, // array of node if supported 049 SYSNAME, // system names (type names etc) 050 SYSNAMEARRAY, // system names array (mixins), string if not suppported 051 TINYINT, // cluster inval kind 052 INTEGER, // complex prop order, ordered doc 053 AUTOINC, // auto-incremented integer (identity, serial, etc.) 054 FTINDEXED, // summary ft column being indexed 055 FTSTORED, // individual ft column 056 CLUSTERNODE, // cluster node id 057 CLUSTERFRAGS; // list of fragments impacted, for clustering 058 059 /** 060 * Checks if this spec holds a Nuxeo unique id (usually UUID). 061 */ 062 public boolean isId() { 063 switch (this) { 064 case NODEID: 065 case NODEIDFK: 066 case NODEIDFKNP: 067 case NODEIDFKMUL: 068 case NODEIDFKNULL: 069 case NODEIDPK: 070 case NODEVAL: 071 return true; 072 default: 073 return false; 074 } 075 } 076 077}