001 /*
002 * The MIT License
003 * Copyright (c) 2012 Microsoft Corporation
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023
024 package microsoft.exchange.webservices.data.core.service.schema;
025
026 import microsoft.exchange.webservices.data.attribute.Schema;
027 import microsoft.exchange.webservices.data.core.XmlElementNames;
028 import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
029 import microsoft.exchange.webservices.data.core.enumeration.property.PropertyDefinitionFlags;
030 import microsoft.exchange.webservices.data.core.enumeration.service.TaskMode;
031 import microsoft.exchange.webservices.data.core.enumeration.service.TaskStatus;
032 import microsoft.exchange.webservices.data.property.complex.ICreateComplexPropertyDelegate;
033 import microsoft.exchange.webservices.data.property.complex.StringList;
034 import microsoft.exchange.webservices.data.property.definition.BoolPropertyDefinition;
035 import microsoft.exchange.webservices.data.property.definition.ComplexPropertyDefinition;
036 import microsoft.exchange.webservices.data.property.definition.DateTimePropertyDefinition;
037 import microsoft.exchange.webservices.data.property.definition.DoublePropertyDefinition;
038 import microsoft.exchange.webservices.data.property.definition.GenericPropertyDefinition;
039 import microsoft.exchange.webservices.data.property.definition.IntPropertyDefinition;
040 import microsoft.exchange.webservices.data.property.definition.PropertyDefinition;
041 import microsoft.exchange.webservices.data.property.definition.RecurrencePropertyDefinition;
042 import microsoft.exchange.webservices.data.property.definition.StringPropertyDefinition;
043 import microsoft.exchange.webservices.data.property.definition.TaskDelegationStatePropertyDefinition;
044
045 import java.util.EnumSet;
046
047 /**
048 * Represents the schema for task item.
049 */
050 @Schema
051 public class TaskSchema extends ItemSchema {
052
053 /**
054 * Field URIs for tasks.
055 */
056 private static class FieldUris {
057
058 /**
059 * The Constant ActualWork.
060 */
061 public final static String ActualWork = "task:ActualWork";
062
063 /**
064 * The Constant AssignedTime.
065 */
066 public final static String AssignedTime = "task:AssignedTime";
067
068 /**
069 * The Constant BillingInformation.
070 */
071 public final static String BillingInformation =
072 "task:BillingInformation";
073
074 /**
075 * The Constant ChangeCount.
076 */
077 public final static String ChangeCount = "task:ChangeCount";
078
079 /**
080 * The Constant Companies.
081 */
082 public final static String Companies = "task:Companies";
083
084 /**
085 * The Constant CompleteDate.
086 */
087 public final static String CompleteDate = "task:CompleteDate";
088
089 /**
090 * The Constant Contacts.
091 */
092 public final static String Contacts = "task:Contacts";
093
094 /**
095 * The Constant DelegationState.
096 */
097 public final static String DelegationState = "task:DelegationState";
098
099 /**
100 * The Constant Delegator.
101 */
102 public final static String Delegator = "task:Delegator";
103
104 /**
105 * The Constant DueDate.
106 */
107 public final static String DueDate = "task:DueDate";
108
109 /**
110 * The Constant IsAssignmentEditable.
111 */
112 public final static String IsAssignmentEditable =
113 "task:IsAssignmentEditable";
114
115 /**
116 * The Constant IsComplete.
117 */
118 public final static String IsComplete = "task:IsComplete";
119
120 /**
121 * The Constant IsRecurring.
122 */
123 public final static String IsRecurring = "task:IsRecurring";
124
125 /**
126 * The Constant IsTeamTask.
127 */
128 public final static String IsTeamTask = "task:IsTeamTask";
129
130 /**
131 * The Constant Mileage.
132 */
133 public final static String Mileage = "task:Mileage";
134
135 /**
136 * The Constant Owner.
137 */
138 public final static String Owner = "task:Owner";
139
140 /**
141 * The Constant PercentComplete.
142 */
143 public final static String PercentComplete = "task:PercentComplete";
144
145 /**
146 * The Constant Recurrence.
147 */
148 public final static String Recurrence = "task:Recurrence";
149
150 /**
151 * The Constant StartDate.
152 */
153 public final static String StartDate = "task:StartDate";
154
155 /**
156 * The Constant Status.
157 */
158 public final static String Status = "task:Status";
159
160 /**
161 * The Constant StatusDescription.
162 */
163 public final static String StatusDescription = "task:StatusDescription";
164
165 /**
166 * The Constant TotalWork.
167 */
168 public final static String TotalWork = "task:TotalWork";
169 }
170
171
172 /**
173 * Defines the ActualWork property.
174 */
175 public static final PropertyDefinition ActualWork =
176 new IntPropertyDefinition(
177 XmlElementNames.ActualWork, FieldUris.ActualWork, EnumSet.of(
178 PropertyDefinitionFlags.CanSet,
179 PropertyDefinitionFlags.CanUpdate,
180 PropertyDefinitionFlags.CanDelete,
181 PropertyDefinitionFlags.CanFind),
182 ExchangeVersion.Exchange2007_SP1,
183
184 true); // isNullable
185
186 /**
187 * Defines the AssignedTime property.
188 */
189 public static final PropertyDefinition AssignedTime =
190 new DateTimePropertyDefinition(
191 XmlElementNames.AssignedTime, FieldUris.AssignedTime, EnumSet
192 .of(PropertyDefinitionFlags.CanFind),
193 ExchangeVersion.Exchange2007_SP1, true);
194
195 /**
196 * Defines the BillingInformation property.
197 */
198 public static final PropertyDefinition BillingInformation =
199 new StringPropertyDefinition(
200 XmlElementNames.BillingInformation, FieldUris.BillingInformation,
201 EnumSet.of(PropertyDefinitionFlags.CanSet,
202 PropertyDefinitionFlags.CanUpdate,
203 PropertyDefinitionFlags.CanDelete,
204 PropertyDefinitionFlags.CanFind),
205 ExchangeVersion.Exchange2007_SP1);
206
207 /**
208 * Defines the ChangeCount property.
209 */
210 public static final PropertyDefinition ChangeCount =
211 new IntPropertyDefinition(
212 XmlElementNames.ChangeCount, FieldUris.ChangeCount, EnumSet
213 .of(PropertyDefinitionFlags.CanFind),
214 ExchangeVersion.Exchange2007_SP1);
215
216 /**
217 * Defines the Companies property.
218 */
219 public static final PropertyDefinition Companies =
220 new ComplexPropertyDefinition<StringList>(
221 StringList.class,
222 XmlElementNames.Companies, FieldUris.Companies, EnumSet.of(
223 PropertyDefinitionFlags.AutoInstantiateOnRead,
224 PropertyDefinitionFlags.CanSet,
225 PropertyDefinitionFlags.CanUpdate,
226 PropertyDefinitionFlags.CanDelete,
227 PropertyDefinitionFlags.CanFind),
228 ExchangeVersion.Exchange2007_SP1,
229 new ICreateComplexPropertyDelegate<StringList>() {
230 public StringList createComplexProperty() {
231 return new StringList();
232 }
233 });
234
235 /**
236 * Defines the CompleteDate property.
237 */
238 public static final PropertyDefinition CompleteDate =
239 new DateTimePropertyDefinition(
240 XmlElementNames.CompleteDate, FieldUris.CompleteDate, EnumSet.of(
241 PropertyDefinitionFlags.CanSet,
242 PropertyDefinitionFlags.CanUpdate,
243 PropertyDefinitionFlags.CanDelete,
244 PropertyDefinitionFlags.CanFind),
245 ExchangeVersion.Exchange2007_SP1, true); // isNullable
246
247 /**
248 * Defines the Contacts property.
249 */
250 public static final PropertyDefinition Contacts =
251 new ComplexPropertyDefinition<StringList>(
252 StringList.class,
253 XmlElementNames.Contacts, FieldUris.Contacts, EnumSet.of(
254 PropertyDefinitionFlags.AutoInstantiateOnRead,
255 PropertyDefinitionFlags.CanSet,
256 PropertyDefinitionFlags.CanUpdate,
257 PropertyDefinitionFlags.CanDelete,
258 PropertyDefinitionFlags.CanFind),
259 ExchangeVersion.Exchange2007_SP1,
260 new ICreateComplexPropertyDelegate<StringList>() {
261 public StringList createComplexProperty() {
262 return new StringList();
263 }
264 });
265
266 /**
267 * Defines the DelegationState property.
268 */
269 public static final PropertyDefinition DelegationState =
270 new TaskDelegationStatePropertyDefinition(
271 XmlElementNames.DelegationState, FieldUris.DelegationState, EnumSet
272 .of(PropertyDefinitionFlags.CanFind),
273 ExchangeVersion.Exchange2007_SP1);
274
275 /**
276 * Defines the Delegator property.
277 */
278 public static final PropertyDefinition Delegator =
279 new StringPropertyDefinition(
280 XmlElementNames.Delegator, FieldUris.Delegator, EnumSet
281 .of(PropertyDefinitionFlags.CanFind),
282 ExchangeVersion.Exchange2007_SP1);
283
284 /**
285 * Defines the DueDate property.
286 */
287 public static final PropertyDefinition DueDate =
288 new DateTimePropertyDefinition(
289 XmlElementNames.DueDate, FieldUris.DueDate, EnumSet.of(
290 PropertyDefinitionFlags.CanSet,
291 PropertyDefinitionFlags.CanUpdate,
292 PropertyDefinitionFlags.CanDelete,
293 PropertyDefinitionFlags.CanFind),
294 ExchangeVersion.Exchange2007_SP1, true); // isNullable
295
296 /**
297 * Defines the Mode property.
298 */
299 public static final PropertyDefinition Mode =
300 new GenericPropertyDefinition<TaskMode>(
301 TaskMode.class,
302 XmlElementNames.IsAssignmentEditable,
303 FieldUris.IsAssignmentEditable, EnumSet
304 .of(PropertyDefinitionFlags.CanFind),
305 ExchangeVersion.Exchange2007_SP1);
306
307 /**
308 * Defines the IsComplete property.
309 */
310 public static final PropertyDefinition IsComplete =
311 new BoolPropertyDefinition(
312 XmlElementNames.IsComplete, FieldUris.IsComplete, EnumSet
313 .of(PropertyDefinitionFlags.CanFind),
314 ExchangeVersion.Exchange2007_SP1);
315
316 /**
317 * Defines the IsRecurring property.
318 */
319 public static final PropertyDefinition IsRecurring =
320 new BoolPropertyDefinition(
321 XmlElementNames.IsRecurring, FieldUris.IsRecurring, EnumSet
322 .of(PropertyDefinitionFlags.CanFind),
323 ExchangeVersion.Exchange2007_SP1);
324
325 /**
326 * Defines the IsTeamTask property.
327 */
328 public static final PropertyDefinition IsTeamTask =
329 new BoolPropertyDefinition(
330 XmlElementNames.IsTeamTask, FieldUris.IsTeamTask, EnumSet
331 .of(PropertyDefinitionFlags.CanFind),
332 ExchangeVersion.Exchange2007_SP1);
333
334 /**
335 * Defines the Mileage property.
336 */
337 public static final PropertyDefinition Mileage =
338 new StringPropertyDefinition(
339 XmlElementNames.Mileage, FieldUris.Mileage, EnumSet.of(
340 PropertyDefinitionFlags.CanSet,
341 PropertyDefinitionFlags.CanUpdate,
342 PropertyDefinitionFlags.CanDelete,
343 PropertyDefinitionFlags.CanFind),
344 ExchangeVersion.Exchange2007_SP1);
345
346 /**
347 * Defines the Owner property.
348 */
349 public static final PropertyDefinition Owner = new StringPropertyDefinition(
350 XmlElementNames.Owner, FieldUris.Owner, EnumSet
351 .of(PropertyDefinitionFlags.CanFind),
352 ExchangeVersion.Exchange2007_SP1);
353
354 /**
355 * Defines the PercentComplete property.
356 */
357 public static final PropertyDefinition PercentComplete =
358 new DoublePropertyDefinition(
359 XmlElementNames.PercentComplete, FieldUris.PercentComplete, EnumSet
360 .of(PropertyDefinitionFlags.CanSet,
361 PropertyDefinitionFlags.CanUpdate,
362 PropertyDefinitionFlags.CanFind),
363 ExchangeVersion.Exchange2007_SP1);
364
365 /**
366 * Defines the Recurrence property.
367 */
368 public static final PropertyDefinition Recurrence =
369 new RecurrencePropertyDefinition(
370 XmlElementNames.Recurrence, FieldUris.Recurrence, EnumSet.of(
371 PropertyDefinitionFlags.CanSet,
372 PropertyDefinitionFlags.CanUpdate,
373 PropertyDefinitionFlags.CanDelete),
374 ExchangeVersion.Exchange2007_SP1);
375
376 /**
377 * Defines the StartDate property.
378 */
379 public static final PropertyDefinition StartDate =
380 new DateTimePropertyDefinition(
381 XmlElementNames.StartDate, FieldUris.StartDate, EnumSet.of(
382 PropertyDefinitionFlags.CanSet,
383 PropertyDefinitionFlags.CanUpdate,
384 PropertyDefinitionFlags.CanDelete,
385 PropertyDefinitionFlags.CanFind),
386 ExchangeVersion.Exchange2007_SP1, true); // isNullable
387
388 /**
389 * Defines the Status property.
390 */
391 public static final PropertyDefinition Status =
392 new GenericPropertyDefinition<TaskStatus>(
393 TaskStatus.class,
394 XmlElementNames.Status, FieldUris.Status, EnumSet.of(
395 PropertyDefinitionFlags.CanSet,
396 PropertyDefinitionFlags.CanUpdate,
397 PropertyDefinitionFlags.CanFind),
398 ExchangeVersion.Exchange2007_SP1);
399
400 /**
401 * Defines the StatusDescription property.
402 */
403 public static final PropertyDefinition StatusDescription =
404 new StringPropertyDefinition(
405 XmlElementNames.StatusDescription, FieldUris.StatusDescription,
406 EnumSet.of(PropertyDefinitionFlags.CanFind),
407 ExchangeVersion.Exchange2007_SP1);
408
409 /**
410 * Defines the TotalWork property.
411 */
412 public static final PropertyDefinition TotalWork =
413 new IntPropertyDefinition(
414 XmlElementNames.TotalWork, FieldUris.TotalWork, EnumSet.of(
415 PropertyDefinitionFlags.CanSet,
416 PropertyDefinitionFlags.CanUpdate,
417 PropertyDefinitionFlags.CanDelete,
418 PropertyDefinitionFlags.CanFind),
419 ExchangeVersion.Exchange2007_SP1, true); // isNullable
420
421 /**
422 * This must be declared after the property definitions.
423 */
424 public static final TaskSchema Instance = new TaskSchema();
425
426 /**
427 * This must be declared after the property definitions.
428 */
429 @Override
430 protected void registerProperties() {
431 super.registerProperties();
432
433 this.registerProperty(ActualWork);
434 this.registerProperty(AssignedTime);
435 this.registerProperty(BillingInformation);
436 this.registerProperty(ChangeCount);
437 this.registerProperty(Companies);
438 this.registerProperty(CompleteDate);
439 this.registerProperty(Contacts);
440 this.registerProperty(DelegationState);
441 this.registerProperty(Delegator);
442 this.registerProperty(DueDate);
443 this.registerProperty(Mode);
444 this.registerProperty(IsComplete);
445 this.registerProperty(IsRecurring);
446 this.registerProperty(IsTeamTask);
447 this.registerProperty(Mileage);
448 this.registerProperty(Owner);
449 this.registerProperty(PercentComplete);
450 this.registerProperty(Recurrence);
451 this.registerProperty(StartDate);
452 this.registerProperty(Status);
453 this.registerProperty(StatusDescription);
454 this.registerProperty(TotalWork);
455 }
456
457 /**
458 * Initializes a new instance of the class.
459 */
460 TaskSchema() {
461 super();
462 }
463
464 }