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 "SOGoObject.h"
24 #include "SOGoUserFolder.h"
27 @implementation SOGoObject
29 - (BOOL)doesRetainContainer {
33 - (id)initWithName:(NSString *)_name inContainer:(id)_container {
34 if ((self = [super init])) {
35 self->nameInContainer = [_name copy];
37 [self doesRetainContainer] ? [_container retain] : _container;
42 return [self initWithName:nil inContainer:nil];
46 if ([self doesRetainContainer])
47 [self->container release];
48 [self->nameInContainer release];
54 - (NSString *)nameInContainer {
55 return self->nameInContainer;
58 return self->container;
63 - (NSString *)ownerInContext:(id)_ctx {
64 return [[self container] ownerInContext:_ctx];
67 /* looking up shared objects */
69 - (SOGoUserFolder *)lookupUserFolder {
70 if (![self->container respondsToSelector:_cmd])
73 return [self->container lookupUserFolder];
75 - (SOGoGroupsFolder *)lookupGroupsFolder {
76 return [[self lookupUserFolder] lookupGroupsFolder];
80 if ([self doesRetainContainer])
81 [self->container release];
82 self->container = nil;
87 - (NSException *)delete {
88 return [NSException exceptionWithHTTPStatus:500 /* not implemented */
89 reason:@"delete not yet implemented, sorry ..."];
94 - (id)valueForUndefinedKey:(NSString *)_key {
100 - (NSString *)davDisplayName {
101 return [self nameInContainer];
104 - (id)DELETEAction:(id)_ctx {
105 return [self delete];
110 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
111 if (self->nameInContainer != nil)
112 [_ms appendFormat:@" name=%@", self->nameInContainer];
113 if (self->container != nil) {
114 [_ms appendFormat:@" container=0x%08X/%@",
115 self->container, [self->container valueForKey:@"nameInContainer"]];
119 - (NSString *)description {
122 ms = [NSMutableString stringWithCapacity:64];
123 [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
124 [self appendAttributesToDescription:ms];
125 [ms appendString:@">"];
129 @end /* SOGoObject */