2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
23 #include "SOGoContentObject.h"
25 #include <OGoContentStore/OCSFolder.h>
27 @implementation SOGoContentObject
30 [self->content release];
31 [self->ocsPath release];
41 - (void)setOCSPath:(NSString *)_path {
42 if ([self->ocsPath isEqualToString:_path])
46 [self logWithFormat:@"WARNING: OCS path is already set! '%@'", _path];
48 ASSIGNCOPY(self->ocsPath, _path);
51 - (NSString *)ocsPath {
52 if (self->ocsPath == nil) {
55 if ((p = [self ocsPathOfContainer]) != nil) {
56 if (![p hasSuffix:@"/"]) p = [p stringByAppendingString:@"/"];
57 p = [p stringByAppendingString:[self nameInContainer]];
58 self->ocsPath = [p copy];
64 - (NSString *)ocsPathOfContainer {
65 if (![[self container] respondsToSelector:@selector(ocsPath)])
68 return [[self container] ocsPath];
71 - (OCSFolder *)ocsFolder {
72 if (![[self container] respondsToSelector:@selector(ocsFolder)])
75 return [[self container] ocsFolder];
80 - (NSString *)contentAsString {
83 if (self->content != nil)
86 if ((folder = [self ocsFolder]) == nil) {
87 [self logWithFormat:@"did not find folder of appointment."];
91 self->content = [[folder fetchContentWithName:[self nameInContainer]] copy];
95 - (NSException *)saveContentString:(NSString *)_str {
99 if ((folder = [self ocsFolder]) == nil) {
100 [self logWithFormat:@"did not find folder of appointment."];
104 if ((ex = [folder writeContent:_str toName:[self nameInContainer]])) {
105 [self logWithFormat:@"write failed: %@", ex];
114 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
115 [super appendAttributesToDescription:_ms];
117 [_ms appendFormat:@" ocs=%@", [self ocsPath]];
120 @end /* SOGoContentObject */