]> err.no Git - scalable-opengroupware.org/blob - SOGo/SoObjects/SOGo/SOGoFolder.m
c40c45e84ddc6d47af12b58fd4aee0fe9e5c44c2
[scalable-opengroupware.org] / SOGo / SoObjects / SOGo / SOGoFolder.m
1 /*
2   Copyright (C) 2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #include "SOGoFolder.h"
24 #include "common.h"
25 #include <OGoContentStore/OCSFolderManager.h>
26 #include <OGoContentStore/OCSFolder.h>
27
28 @implementation SOGoFolder
29
30 - (void)dealloc {
31   [self->ocsFolder release];
32   [self->ocsPath   release];
33   [super dealloc];
34 }
35
36 /* accessors */
37
38 - (BOOL)isFolderish {
39   return YES;
40 }
41
42 - (void)setOCSPath:(NSString *)_path {
43   if ([self->ocsPath isEqualToString:_path])
44     return;
45   
46   if (self->ocsPath)
47     [self logWithFormat:@"WARNING: OCS path is already set! '%@'", _path];
48   
49   ASSIGNCOPY(self->ocsPath, _path);
50 }
51 - (NSString *)ocsPath {
52   return self->ocsPath;
53 }
54
55 - (OCSFolderManager *)folderManager {
56   return [OCSFolderManager defaultFolderManager];
57 }
58 - (OCSFolder *)ocsFolder {
59   if (self->ocsFolder != nil)
60     return [self->ocsFolder isNotNull] ? self->ocsFolder : nil;
61   
62   self->ocsFolder = 
63     [[[self folderManager] folderAtPath:[self ocsPath]] retain];
64   return self->ocsFolder;
65 }
66
67 /* description */
68
69 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
70   [super appendAttributesToDescription:_ms];
71   
72   [_ms appendFormat:@" ocs=%@", [self ocsPath]];
73 }
74
75 @end /* SOGoFolder */