1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 package org.ogf.graap.wsag.api.types;
36
37 import org.ogf.graap.wsag.api.NegotiationOffer;
38 import org.ogf.schemas.graap.wsAgreement.AgreementContextType;
39 import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType;
40 import org.ogf.schemas.graap.wsAgreement.AgreementType;
41 import org.ogf.schemas.graap.wsAgreement.TermTreeType;
42 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationConstraintSectionType;
43 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferContextType;
44 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferDocument;
45 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType;
46
47
48
49
50
51
52 public class NegotiationOfferTypeImpl extends WSAGXmlType implements NegotiationOffer
53 {
54
55 private org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType negotiationOffer =
56 org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType.Factory.newInstance();
57
58
59
60
61
62
63
64 public NegotiationOfferTypeImpl( AgreementTemplateType template )
65 {
66
67
68
69 AgreementType processed = processTemplate( template );
70
71
72
73
74 initialize( (NegotiationOfferType) processed.changeType( NegotiationOfferType.type ) );
75 }
76
77
78
79
80
81
82
83 public NegotiationOfferTypeImpl( NegotiationOfferType negotiationOffer )
84 {
85 initialize( (NegotiationOfferType) negotiationOffer.copy() );
86 }
87
88 private void initialize( org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType negOffer )
89 {
90
91
92
93 NegotiationOfferDocument negotiationOfferDoc = NegotiationOfferDocument.Factory.newInstance();
94 negotiationOfferDoc.addNewNegotiationOffer().set( negOffer.copy() );
95 negOffer = negotiationOfferDoc.getNegotiationOffer();
96
97 if ( negOffer == null )
98 {
99 throw new IllegalStateException( "Parameter negotiationOffer must not be null." );
100 }
101
102
103
104
105 if ( negOffer.getContext() == null )
106 {
107 throw new IllegalStateException( "Parameter negotiationOffer#Context must not be null." );
108 }
109
110 if ( negOffer.getTerms() == null )
111 {
112 throw new IllegalStateException( "Parameter negotiationOffer#Terms must not be null." );
113 }
114
115 this.negotiationOffer = negOffer;
116
117 String offerId = ( negOffer.getOfferId() != null ) ? negOffer.getOfferId() : "1";
118 String offerName = ( negOffer.getName() != null ) ? negOffer.getName() : "NEGOTIATIONOFFER";
119
120 setOfferId( offerId );
121 setName( offerName );
122 }
123
124
125
126
127 public String getOfferId()
128 {
129 return getNegotiationOffer().getOfferId();
130 }
131
132
133
134
135
136 public void setOfferId( String id )
137 {
138 getNegotiationOffer().setOfferId( id );
139 }
140
141
142
143
144 public String getName()
145 {
146 return getNegotiationOffer().getName();
147 }
148
149
150
151
152
153 public void setName( String name )
154 {
155 getNegotiationOffer().setName( name );
156 }
157
158
159
160
161 public String getAgreementId()
162 {
163 return getNegotiationOffer().getAgreementId();
164 }
165
166
167
168
169
170 public void setAgreementId( String id )
171 {
172 getNegotiationOffer().setAgreementId( id );
173 }
174
175
176
177
178
179
180 public AgreementContextType getContext()
181 {
182 return getNegotiationOffer().getContext();
183 }
184
185
186
187
188
189 public void setContext( AgreementContextType context )
190 {
191 getNegotiationOffer().setContext( context );
192 }
193
194
195
196
197 public TermTreeType getTerms()
198 {
199 return getNegotiationOffer().getTerms();
200 }
201
202
203
204
205
206 public void setTerms( TermTreeType terms )
207 {
208 getNegotiationOffer().setTerms( terms );
209 }
210
211
212
213
214 public NegotiationOfferContextType getNegotiationOfferContext()
215 {
216 return getNegotiationOffer().getNegotiationOfferContext();
217 }
218
219
220
221
222
223 public void setNegotiationOfferContext( NegotiationOfferContextType negOffercontext )
224 {
225 getNegotiationOffer().setNegotiationOfferContext( negOffercontext );
226 }
227
228
229
230
231 public NegotiationConstraintSectionType getNegotiationConstraints()
232 {
233 return getNegotiationOffer().getNegotiationConstraints();
234 }
235
236
237
238
239
240 public void setNegotiationConstraints( NegotiationConstraintSectionType constraints )
241 {
242 getNegotiationOffer().setNegotiationConstraints( constraints );
243 }
244
245 private org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType getNegotiationOffer()
246 {
247 return negotiationOffer;
248 }
249
250
251
252
253 public org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType getXMLObject()
254 {
255 return this.negotiationOffer;
256 }
257
258
259
260
261
262
263 public boolean validate()
264 {
265 return validate( negotiationOffer );
266 }
267
268 }