View difference between Paste ID: bYCm4ain and 6KMw5kKE
SHOW: | | - or go back to the newest paste.
1
package com.conceptualsystems.database;
2
3
import android.provider.BaseColumns;
4
5
import java.util.HashMap;
6
import java.util.Map;
7
8
///////////////////////////////////
9
//  CHANGELOG
10
//  =============================
11
//  6/24/11 - v2
12
13
public final class DatabaseSchema {
14
	public static final String DATABASE_NAME = "smskitting";
15
	public static final int DATABASE_VERSION = 5;
16
	public static final String SORT_ASC = " ASC";
17
	public static final String SORT_DESC = " DESC";
18
	public static final String[] ORDERS = {SORT_ASC,SORT_DESC};
19
	public static final int OFF = 0;
20
	public static final int ON = 1;
21
	public static final Map<String, Class<? extends Schema>> DatabaseTables = new HashMap<String, Class<? extends Schema>>();
22
	public static final DatabaseSchema instance = new DatabaseSchema();
23
24-
	/*** tried this
24+
25
	static {
26
		instance.DatabaseTables.put("kit", KitSchema);
27
	}
28-
	***** and this
28+
29
		instance.DatabaseTables.put("KitSchema", KitSchema);
30
	}
31
32-
	 */
32+
33
		return instance;
34
	}
35
	
36
	public static final class KitSchema implements Schema {
37
		public static final String TABLE_NAME = "kit";
38
		public static final String COLUMN_ID = "kit_id";
39
		public static final String COLUMN_RAW_ID = "raw_id";
40
		public static final String COLUMN_FIN_ID = "fin_id";
41
		public static final String COLUMN_DATE = "date";
42
		public static final String COLUMN_GROSS = "gross";
43
		public static final String COLUMN_NET = "net";
44
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
45
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
46
				COLUMN_ID + " TEXT NOT NULL," + 
47
				COLUMN_RAW_ID + " TEXT," + 
48
				COLUMN_FIN_ID + " TEXT NOT NULL," + 
49
				COLUMN_DATE + " LONG NOT NULL," + 
50
				COLUMN_GROSS + " LONG NOT NULL," + 
51
				COLUMN_NET + " LONG NOT NULL);";
52
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
53
	}
54
55
	public static final class ShipmentSchema implements BaseColumns {
56
		public static final String TABLE_NAME = "shipment";
57
		public static final String COLUMN_ID = "kit_id";
58
		public static final String COLUMN_SHIP_ID = "ship_id";
59
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
60
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
61
				COLUMN_SHIP_ID + " TEXT NOT NULL," + 
62
				COLUMN_ID + " TEXT NOT NULL);";
63
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
64
	}
65
	
66
	public static final class TargetSchema implements BaseColumns {
67
		public static final String TABLE_NAME = "target";
68
		public static final String COLUMN_TARGET = "target_weight";
69
		public static final String COLUMN_SHIP_ID = "ship_id";
70
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
71
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
72
				COLUMN_SHIP_ID + " TEXT NOT NULL," + 
73
				COLUMN_TARGET + " TEXT NOT NULL);";
74
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
75
	}
76
	
77
	public static final class SiteSchema implements BaseColumns {
78
		public static final String TABLE_NAME = "site";
79
		public static final String COLUMN_LABEL = "label";
80
		public static final String COLUMN_IP = "ip";
81
		public static final String COLUMN_PORT = "port";
82
		public static final String COLUMN_ACTIVATION_CODE = "code";
83
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
84
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
85
				COLUMN_LABEL + " TEXT NOT NULL," + 
86
				COLUMN_IP + " TEXT NOT NULL," + 
87
				COLUMN_ACTIVATION_CODE + " TEXT," + 
88
				COLUMN_PORT + " TEXT NOT NULL);";
89
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
90
	}
91
	
92
	public static final class CustomerSchema implements BaseColumns {
93
		public static final String TABLE_NAME = "customers";
94
		public static final String COLUMN_NAME = "name";
95
		public static final String COLUMN_ID = "cust_id";
96
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
97
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
98
				COLUMN_ID + " TEXT NOT NULL," + 
99
				COLUMN_NAME + " TEXT NOT NULL);";
100
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
101
	}
102
	
103
	public static final class ProductSchema implements BaseColumns {
104
		public static final String TABLE_NAME = "products";
105
		public static final String COLUMN_NAME = "name";
106
		public static final String COLUMN_ID = "prod_id";
107
		public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + 
108
				_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
109
				COLUMN_ID + " TEXT NOT NULL," + 
110
				COLUMN_NAME + " TEXT NOT NULL);";
111
		public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
112
	}
113
}
114
115-
}
115+
116
117
////////////////////////
118
// COMPILER OUTPUT
119
/*
120
Error:(26, 44) cannot find symbol variable KitSchema
121
Error:(29, 50) cannot find symbol variable KitSchema
122
*/