]> err.no Git - sope/blob - sope-appserver/WOXML/WOXMLMappingProperty.m
added hack to install in FHS to WOXMl
[sope] / sope-appserver / WOXML / WOXMLMappingProperty.m
1 /*
2   Copyright (C) 2000-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 "WOXMLMappingProperty.h"
24 #include "common.h"
25
26 @implementation WOXMLMappingProperty
27
28 - (id)initWithEntity:(WOXMLMappingEntity *)_entity {
29   self->entity = _entity;
30   return self;
31 }
32
33 - (void)dealloc {
34   RELEASE(self->name);
35   RELEASE(self->xmlTag);
36   RELEASE(self->codeBasedOn);
37   RELEASE(self->outputTags);
38   [super dealloc];
39 }
40
41 /* validity */
42
43 - (BOOL)isValid {
44   if ([self->name length] == 0)
45     return NO;
46   if ([self->xmlTag length] == 0)
47     return NO;
48   return YES;
49 }
50
51 - (WOXMLMappingEntity *)entity {
52   return self->entity;
53 }
54
55 /* attributes */
56
57 - (void)setName:(NSString *)_name {
58   ASSIGN(self->name, _name);
59 }
60 - (NSString *)name {
61   return self->name;
62 }
63
64 - (void)setXmlTag:(NSString *)_xmlTag {
65   ASSIGN(self->xmlTag, _xmlTag);
66 }
67 - (NSString *)xmlTag {
68   return self->xmlTag;
69 }
70
71 - (void)setCodeBasedOn:(NSString *)_codeBasedOn {
72   ASSIGN(self->codeBasedOn, _codeBasedOn);
73 }
74 - (NSString *)codeBasedOn {
75   return self->codeBasedOn;
76 }
77
78 - (void)setOutputTags:(NSString *)_tags {
79   ASSIGN(self->outputTags, _tags);
80 }
81 - (NSString *)outputTags {
82   return self->outputTags;
83 }
84
85 - (void)setAttribute:(BOOL)_flag {
86   self->attribute = _flag;
87 }
88 - (BOOL)attribute {
89   return self->attribute;
90 }
91
92 - (void)setForceList:(BOOL)_flag {
93   self->forceList = _flag;
94 }
95 - (BOOL)forceList {
96   return self->forceList;
97 }
98
99 - (void)setReportEmptyValues:(BOOL)_flag {
100   self->reportEmptyValues = _flag;
101 }
102 - (BOOL)reportEmptyValues {
103   return self->reportEmptyValues;
104 }
105
106 /* XML representation */
107
108 - (NSString *)xmlStringValue {
109   NSMutableString *s;
110   
111   s = [NSMutableString stringWithCapacity:100];
112   [s appendString:@"<property"];
113   [s appendString:@" name='"];
114   [s appendString:[self name]];
115   [s appendString:@"' xmlTag='"];
116   [s appendString:[self xmlTag]];
117   [s appendString:@"'"];
118   
119   if ([self reportEmptyValues])
120     [s appendString:@" reportEmptyValues='YES'"];
121   if ([self forceList])
122     [s appendString:@" forceList='YES'"];
123   if ([self attribute])
124     [s appendString:@" attribute='YES'"];
125   
126   [s appendString:@"/>\n"];
127   return s;
128 }
129
130 /* description */
131
132 - (NSString *)description {
133   NSMutableString *s;
134
135   s = [NSMutableString stringWithCapacity:100];
136   [s appendFormat:@"<%@ 0x%08X:", NSStringFromClass([self class]), self];
137
138   if ([self name])
139     [s appendFormat:@" name=%@", [self name]];
140   if ([self xmlTag])
141     [s appendFormat:@" tag=%@", [self xmlTag]];
142   if ([self codeBasedOn])
143     [s appendFormat:@" codeBasedOn=%@", [self codeBasedOn]];
144   if ([self outputTags])
145     [s appendFormat:@" out-tags=%@", [self outputTags]];
146
147   if ([self attribute])
148     [s appendString:@" attribute"];
149   if ([self forceList])
150     [s appendString:@" forceList"];
151   if ([self reportEmptyValues])
152     [s appendString:@" reportEmptyValues"];
153   
154   [s appendString:@">"];
155   return s;
156 }
157
158 @end /* WOXMLMappingProperty */