001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Florent Guillaume 011 */ 012package org.nuxeo.ecm.core.storage.sql; 013 014/** 015 * Abstract representation of the database-level column types. 016 */ 017public enum ColumnSpec { 018 019 // ----- schema-based columns ----- 020 STRING(), // may be VARCHAR or CLOB depending on length 021 BOOLEAN(), // 022 LONG(), // 023 DOUBLE(), // 024 TIMESTAMP(), // 025 BLOBID(), // attached files 026 ARRAY_STRING(), // may be VARCHAR or CLOB array depending on length 027 ARRAY_BOOLEAN(), // 028 ARRAY_LONG(), // 029 ARRAY_DOUBLE(), // 030 ARRAY_TIMESTAMP(), // 031 ARRAY_BLOBID(), // attached files array 032 ARRAY_INTEGER(), 033 // ----- system columns ----- 034 NODEID, // node id primary generated key 035 NODEIDFK, // fk to main node id, not nullable (frag id) 036 NODEIDFKNP, // fk to main node id, not nullable, not primary 037 NODEIDFKMUL, // fk to main node id, not nullable, non-unique 038 NODEIDFKNULL, // fk to main node id, nullable 039 NODEIDPK, // node id primary key, but not a fk (locks) 040 NODEVAL, // same type as node id, not a fk (versionable, cluster...) 041 NODEARRAY, // array of node if supported 042 SYSNAME, // system names (type names etc) 043 SYSNAMEARRAY, // system names array (mixins), string if not suppported 044 TINYINT, // cluster inval kind 045 INTEGER, // complex prop order, ordered doc 046 AUTOINC, // auto-incremented integer (identity, serial, etc.) 047 FTINDEXED, // summary ft column being indexed 048 FTSTORED, // individual ft column 049 CLUSTERNODE, // cluster node id 050 CLUSTERFRAGS; // list of fragments impacted, for clustering 051 052 /** 053 * Checks if this spec holds a Nuxeo unique id (usually UUID). 054 */ 055 public boolean isId() { 056 switch (this) { 057 case NODEID: 058 case NODEIDFK: 059 case NODEIDFKNP: 060 case NODEIDFKMUL: 061 case NODEIDFKNULL: 062 case NODEIDPK: 063 case NODEVAL: 064 return true; 065 default: 066 return false; 067 } 068 } 069 070}