KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > trans > DefaultTagValues


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: DefaultTagValues.java,v 1.1 2004/09/03 13:43:13 sinisa Exp $
22  */

23
24 /*
25  *
26  * @author Nenad Vico
27  * @since LBS1.8
28  * @version $Revision: 1.1 $
29  *
30  */

31 package org.enhydra.dods.trans;
32
33 import org.enhydra.dods.Common;
34
35 /**
36  * This class contains default values for Table, Column and Referrer class attributes.
37  */

38 public class DefaultTagValues {
39     
40     // Default values for table
41
public static final String JavaDoc TABLE_AUTHOR = "NN";
42     public static final String JavaDoc TABLE_PROJECT_NAME = "DODS Project";
43     public static final String JavaDoc TABLE_TEMPLATE_SET = "standard";
44     public static String JavaDoc TABLE_EXTENDS_VALUE = "com.lutris.dods.builder.generator.dataobject.GenericDO";
45     public static String JavaDoc TABLE_DB_VENDOR = "Standard";
46     public static String JavaDoc TABLE_STRING_MATCH = "LIKE";
47     public static String JavaDoc TABLE_STRING_WILDCARD = "%";
48     public static boolean TABLE_DELETE_CASCADE = false;
49     public static boolean MASS_UPDATES = false;
50     public static boolean MASS_DELETES = false;
51     
52     public static final boolean DO_IS_OID_BASED = true;
53     public static final boolean DO_SECURITY = false;
54     public static final boolean DO_NON_SECURITY = true;
55     public static final boolean DO_MULTIDB = false;
56     public static final boolean IS_ANY_COLUMN_SECURE = false;
57     public static final boolean DATABASE_SECURITY = false;
58     public static final boolean DATABASE_NON_SECURITY = true;
59     public static final boolean DATABASE_MASS_UPDATE = false;
60     public static final boolean DATABASE_MASS_DELETE = false;
61     
62     // Default values for column
63
public static final boolean COLUMN_IS_REFERENCE = false;
64     public static final boolean COLUMN_REF_CONSTARINT = false;
65     public static final boolean COLUMN_REF_IS_ABSTARCT = false;
66     public static final boolean COLUMN_REF_IS_FOREIGN_KEY = false;
67     public static final String JavaDoc COLUMN_REF_FOREIGN_KEY_COLUMN_NAME = null;
68     public static final boolean COLUMN_IS_CONSTANT = false;
69     public static final String JavaDoc COLUMN_DB_TYPE = "VARCHAR";
70     public static final String JavaDoc COLUMN_JAVA_TYPE = "String";
71     public static final boolean COLUMN_USED_FOR_QUERY = true;
72     public static final boolean COLUMN_CAN_BE_NULL = false;
73     public static final boolean COLUMN_IS_PRIMARY_KEY = false;
74     public static final boolean COLUMN_IS_ARRAY = false;
75     public static final boolean COLUMN_IS_INDEX = false;
76     public static final boolean COLUMN_IS_UNIQUE = false;
77     public static final boolean COLUMN_SECURITY = false;
78     public static final boolean COLUMN_NON_SECURITY = true;
79
80     
81
82     /**
83      * Load default values which depend on database.
84      *
85      * @param database Database which is used in doml file.
86      */

87     public static void loadDatabaseValues(String JavaDoc database) {
88         TABLE_DB_VENDOR = database;
89         TABLE_DELETE_CASCADE = Common.getDodsConfProperty("DeleteCascade", database).equals("true");
90     }
91
92     /**
93      * Get default size of column.
94      *
95      * @param dbType Database type.
96      * @param javaType Java type.
97      *
98      * @return Default size of column.
99      */

100     public static String JavaDoc getDefaultSize(String JavaDoc dbType, String JavaDoc javaType) {
101         if (dbType.equalsIgnoreCase("VARCHAR")) {
102             return "32";
103         }
104         if (dbType.equalsIgnoreCase("VARCHAR2")) {
105             return "32";
106         }
107         if (dbType.equalsIgnoreCase("NVARCHAR2")) {
108             return "32";
109         }
110         if (dbType.equalsIgnoreCase("RAW")) {
111             return "32";
112         }
113         if (dbType.equalsIgnoreCase("CHAR")) {
114             return "32";
115         }
116         if (dbType.equalsIgnoreCase("NCHAR")) {
117             return "32";
118         }
119         if (dbType.equalsIgnoreCase("NUMBER")) {
120             return "19,0";
121         }
122         if (dbType.equalsIgnoreCase("NUMERIC")) {
123             return "19,0";
124         }
125         if (dbType.equalsIgnoreCase("BINARY")) {
126             return "8";
127         }
128         if (javaType.equalsIgnoreCase("BigDecimal")) {
129             return "19,0";
130         }
131         if (javaType.equalsIgnoreCase("java.math.BigDecimal")) {
132             return "19,0";
133         }
134         return null; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! not finished
135
}
136 }
137
Popular Tags