]> err.no Git - scalable-opengroupware.org/blob - SoObjects/SOGo/SOGoGroupsFolder.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1087 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SoObjects / SOGo / SOGoGroupsFolder.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
22 #import <NGObjWeb/NSException+HTTP.h>
23 #import <NGExtensions/NSObject+Logs.h>
24
25 #import "SOGoGroupsFolder.h"
26
27 @implementation SOGoGroupsFolder
28
29 // - (void)dealloc {
30 //   [super dealloc];
31 // }
32
33 /* accessors */
34
35 /* SOPE */
36
37 - (BOOL) isFolderish
38 {
39   return YES;
40 }
41
42 /* looking up shared objects */
43
44 - (SOGoGroupsFolder *) lookupGroupsFolder
45 {
46   return self;
47 }
48
49 /* pathes */
50
51 /* name lookup */
52
53 - (id) customGroup: (NSString *) _key
54          inContext: (id) _ctx
55 {
56   static Class groupClass = Nil;
57   id group;
58
59   if (!groupClass)
60     groupClass = NSClassFromString(@"SOGoCustomGroupFolder");
61   if (!groupClass)
62     {
63       [self logWithFormat:@"ERROR: missing SOGoCustomGroupFolder class!"];
64       group = nil;
65     }
66   else
67     group = [groupClass objectWithName: _key inContainer: self];
68
69   return group;
70 }
71
72 - (id) lookupName: (NSString *) _key
73         inContext: (id) _ctx
74           acquire: (BOOL) _flag
75 {
76   id obj;
77   
78   /* first check attributes directly bound to the application */
79   obj = [super lookupName: _key inContext: _ctx acquire: NO];
80   if (!obj)
81     {
82       if ([_key hasPrefix: @"_custom_"])
83         obj = [self customGroup: _key inContext: _ctx];
84       else
85         obj = [NSException exceptionWithHTTPStatus:404 /* Not Found */];
86     }
87
88   return obj;
89 }
90
91 @end /* SOGoGroupsFolder */