1
+ var package = "javaxt.photos" ;
2
+ var models = {
3
+
4
+ //**************************************************************************
5
+ //** Contact
6
+ //**************************************************************************
7
+ /** Used to represent an individual or company.
8
+ */
9
+ Contact : {
10
+ fields : [
11
+ { name : 'id' , type : 'int' } ,
12
+ { name : 'firstName' , type : 'string' } ,
13
+ { name : 'lastName' , type : 'string' } ,
14
+ { name : 'fullName' , type : 'string' } ,
15
+ { name : 'gender' , type : 'string' } ,
16
+ { name : 'dob' , type : 'string' } ,
17
+ { name : 'lastModified' , type : 'date' }
18
+ ] ,
19
+ hasMany : [
20
+ { model : 'Phone' , name : 'phoneNumbers' } ,
21
+ { model : 'Email' , name : 'emails' } ,
22
+ { model : 'Address' , name : 'addresses' } ,
23
+ { model : 'Alias' , name : 'aliases' }
24
+ ]
25
+ } ,
26
+
27
+
28
+ //**************************************************************************
29
+ //** Phone
30
+ //**************************************************************************
31
+ /** Used to represent a contact's phone number.
32
+ */
33
+ Phone : {
34
+ fields : [
35
+ { name : 'number' , type : 'string' } ,
36
+ { name : 'type' , type : 'string' } , //home, mobile, work
37
+ { name : 'primary' , type : 'boolean' } //is primary phone?
38
+ ]
39
+ } ,
40
+
41
+
42
+ //**************************************************************************
43
+ //** Physical Address
44
+ //**************************************************************************
45
+ /** Used to represent a contact's physical address.
46
+ */
47
+ Address : {
48
+ fields : [
49
+ { name : 'type' , type : 'string' } , //home, work, etc
50
+ { name : 'street' , type : 'string' } ,
51
+ { name : 'city' , type : 'string' } ,
52
+ { name : 'state' , type : 'string' } ,
53
+ { name : 'postalCode' , type : 'string' } ,
54
+ { name : 'coordinates' , type : 'geo' } ,
55
+ { name : 'primary' , type : 'boolean' } //is principle address?
56
+ ]
57
+ } ,
58
+
59
+
60
+ //**************************************************************************
61
+ //** Email Address
62
+ //**************************************************************************
63
+ /** Used to represent an email address.
64
+ */
65
+ Email : {
66
+ fields : [
67
+ { name : 'type' , type : 'string' } , //personal, work, etc.
68
+ { name : 'address' , type : 'string' } , //name@server .com
69
+ { name : 'primary' , type : 'boolean' } //is primary email?
70
+ ] ,
71
+ constraints : [
72
+ { name : 'address' , required : true }
73
+ ]
74
+ } ,
75
+
76
+
77
+ //**************************************************************************
78
+ //** Alias
79
+ //**************************************************************************
80
+ /** Used to represent an alias associated with a contact.
81
+ */
82
+ Alias : {
83
+ fields : [
84
+ { name : 'name' , type : 'string' }
85
+ ] ,
86
+ constraints : [
87
+ { name : 'name' , required : true , length : 255 , unique : true }
88
+ ]
89
+ } ,
90
+
91
+
92
+ //**************************************************************************
93
+ //** UserAccount
94
+ //**************************************************************************
95
+ UserAccount : {
96
+ fields : [
97
+ { name : 'username' , type : 'string' } ,
98
+ { name : 'password' , type : 'password' } ,
99
+ { name : 'accessLevel' , type : 'int' } ,
100
+ { name : 'active' , type : 'boolean' } ,
101
+ { name : 'contact' , type : 'Contact' } ,
102
+ { name : 'auth' , type : 'json' }
103
+ ] ,
104
+ constraints : [
105
+ { name : 'username' , required : true , length : 255 , unique : true } ,
106
+ { name : 'password' , required : true } ,
107
+ { name : 'active' , required : true }
108
+ ] ,
109
+ defaults : [
110
+ { name : 'active' , value : true }
111
+ ]
112
+ } ,
113
+
114
+
115
+ //**************************************************************************
116
+ //** Path
117
+ //**************************************************************************
118
+ Path : {
119
+ fields : [
120
+ { name : 'dir' , type : 'string' } ,
121
+ { name : 'host' , type : 'Host' } ,
122
+ { name : 'lastIndexed' , type : 'date' }
123
+ ] ,
124
+ constraints : [
125
+ { name : 'dir' , required : true }
126
+ ]
127
+ } ,
128
+
129
+
130
+ //**************************************************************************
131
+ //** Host
132
+ //**************************************************************************
133
+ Host : {
134
+ fields : [
135
+ { name : 'name' , type : 'string' } ,
136
+ { name : 'description' , type : 'string' } ,
137
+ { name : 'metadata' , type : 'json' }
138
+ ]
139
+ } ,
140
+
141
+
142
+ //**************************************************************************
143
+ //** File
144
+ //**************************************************************************
145
+ File : {
146
+ fields : [
147
+ { name : 'name' , type : 'string' } ,
148
+ { name : 'description' , type : 'string' } ,
149
+ { name : 'path' , type : 'Path' } ,
150
+ { name : 'type' , type : 'string' } , //photo, video, etc
151
+ { name : 'date' , type : 'date' } ,
152
+ { name : 'size' , type : 'long' } ,
153
+ { name : 'location' , type : 'geo' } ,
154
+ { name : 'metadata' , type : 'json' }
155
+ ] ,
156
+ hasMany : [
157
+ { model : 'Rating' , name : 'ratings' } ,
158
+ { model : 'Keyword' , name : 'keywords' } ,
159
+ { model : 'Face' , name : 'faces' } ,
160
+ { model : 'Access' , name : 'accesses' }
161
+ ] ,
162
+ constraints : [
163
+ { name : 'name' , required : true } ,
164
+ { name : 'path' , required : true }
165
+ ]
166
+ } ,
167
+
168
+
169
+ //**************************************************************************
170
+ //** Rating
171
+ //**************************************************************************
172
+ Rating : {
173
+ fields : [
174
+ { name : 'user' , type : 'UserAccount' } ,
175
+ { name : 'rating' , type : 'int' } ,
176
+ { name : 'comment' , type : 'string' } ,
177
+ { name : 'date' , type : 'date' }
178
+ ]
179
+ } ,
180
+
181
+
182
+ //**************************************************************************
183
+ //** Keyword
184
+ //**************************************************************************
185
+ Keyword : {
186
+ fields : [
187
+ { name : 'keyword' , type : 'string' } ,
188
+ { name : 'category' , type : 'string' }
189
+ ]
190
+ } ,
191
+
192
+
193
+ //**************************************************************************
194
+ //** Face
195
+ //**************************************************************************
196
+ /** Used to represent a face extracted from a photo.
197
+ */
198
+ Face : {
199
+ fields : [
200
+ { name : 'coordinates' , type : 'string' } ,
201
+ { name : 'contact' , type : 'Contact' } ,
202
+ { name : 'metadata' , type : 'json' }
203
+ ]
204
+ } ,
205
+
206
+
207
+ //**************************************************************************
208
+ //** Access
209
+ //**************************************************************************
210
+ /** Used to log access to individual files.
211
+ */
212
+ Access : {
213
+ fields : [
214
+ { name : 'type' , type : 'string' } , //view, download, share, etc
215
+ { name : 'user' , type : 'UserAccount' } ,
216
+ { name : 'date' , type : 'date' } ,
217
+ { name : 'metadata' , type : 'json' }
218
+ ]
219
+ } ,
220
+
221
+
222
+ //**************************************************************************
223
+ //** Place
224
+ //**************************************************************************
225
+ /** Used to represent a location on the earth. Can be used to represent a
226
+ * descrete location such as a GPS point, a route, an area (e.g. park,
227
+ * country, state, etc).
228
+ */
229
+ Place : {
230
+ fields : [
231
+ { name : 'name' , type : 'string' } ,
232
+ { name : 'description' , type : 'string' } ,
233
+ { name : 'location' , type : 'geo' }
234
+ ]
235
+ } ,
236
+
237
+
238
+ //**************************************************************************
239
+ //** Album
240
+ //**************************************************************************
241
+ /** A collection of photos, videos, documents, etc.
242
+ */
243
+ Album : {
244
+ fields : [
245
+ { name : 'name' , type : 'string' } ,
246
+ { name : 'description' , type : 'string' } ,
247
+ { name : 'place' , type : 'Place' } ,
248
+ { name : 'parent' , type : 'Album' }
249
+ ] ,
250
+ hasMany : [
251
+ { model : 'Item' , name : 'items' } ,
252
+ { model : 'Privilege' , name : 'users' }
253
+ ]
254
+ } ,
255
+
256
+
257
+ //**************************************************************************
258
+ //** Item
259
+ //**************************************************************************
260
+ /** Used to represent an individual item in an Album.
261
+ */
262
+ Item : {
263
+ fields : [
264
+ { name : 'file' , type : 'File' } ,
265
+ { name : 'index' , type : 'long' }
266
+ ]
267
+ } ,
268
+
269
+
270
+ //**************************************************************************
271
+ //** Privilege
272
+ //**************************************************************************
273
+ Privilege : {
274
+ fields : [
275
+ { name : 'user' , type : 'UserAccount' } ,
276
+ { name : 'edit' , type : 'boolean' } ,
277
+ { name : 'share' , type : 'boolean' }
278
+ ]
279
+ }
280
+
281
+ } ;
0 commit comments