1 /*
2   Copyright (C) 2006-2016 Inverse inc.
3   Copyright (C) 2004-2005 SKYRIX Software AG
4 
5   This file is part of SOGo.
6 
7   SOGo is free software; you can redistribute it and/or modify it under
8   the terms of the GNU Lesser General Public License as published by the
9   Free Software Foundation; either version 2, or (at your option) any
10   later version.
11 
12   SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
13   WARRANTY; without even the implied warranty of MERCHANTABILITY or
14   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15   License for more details.
16 
17   You should have received a copy of the GNU Lesser General Public
18   License along with SOGo; see the file COPYING.  If not, write to the
19   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20   02111-1307, USA.
21 */
22 
23 #ifndef __SOGo_SOGoContentObject_H__
24 #define __SOGo_SOGoContentObject_H__
25 
26 #import <SOGo/SOGoObject.h>
27 
28 @class NSArray;
29 @class NSCalendarDate;
30 @class NSException;
31 @class NSString;
32 @class SOGoGCSFolder;
33 @class WOContext;
34 
35 @interface SOGoContentObject : SOGoObject
36 {
37   BOOL isNew;
38   NSString *content;
39   unsigned int version;
40   NSCalendarDate *creationDate;
41   NSCalendarDate *lastModified;
42 }
43 
44 + (id) objectWithRecord: (NSDictionary *) objectRecord
45 	    inContainer: (SOGoGCSFolder *) newContainer;
46 + (id) objectWithName: (NSString *) newName
47 	   andContent: (NSString *) newContent
48 	  inContainer: (SOGoGCSFolder *) newContainer;
49 - (id) initWithRecord: (NSDictionary *) objectRecord
50 	  inContainer: (SOGoGCSFolder *) newContainer;
51 - (id) initWithName: (NSString *) newName
52 	 andContent: (NSString *) newContent
53 	inContainer: (SOGoGCSFolder *) newContainer;
54 - (Class *) parsingClass;
55 
56 /* content */
57 
58 - (BOOL) isNew;
59 - (void) setIsNew: (BOOL) newIsNew;
60 
61 - (unsigned int) version;
62 
63 - (NSCalendarDate *) creationDate;
64 - (NSCalendarDate *) lastModified;
65 
66 - (NSString *) contentAsString;
67 - (NSException *) saveComponent: (id) theComponent
68                     baseVersion: (unsigned int) _baseVersion;
69 - (NSException *) saveComponent: (id) theComponent;
70 
71 - (id) PUTAction: (WOContext *) _ctx;
72 
73 /* actions */
74 - (NSException *) copyToFolder: (SOGoGCSFolder *) newFolder;
75 - (NSException *) moveToFolder: (SOGoGCSFolder *) newFolder;
76 - (NSException *) delete;
77 - (NSException *) touch;
78 
79 /* DAV support */
80 
81 - (id) davEntityTag;
82 - (NSString *) davCreationDate;
83 - (NSString *) davLastModified;
84 - (NSString *) davContentLength;
85 
86 @end
87 
88 @interface SOGoContentObject (OptionalMethods)
89 
90 - (NSException *) prepareDelete;
91 
92 @end
93 
94 #endif /* __SOGo_SOGoContentObject_H__ */
95