001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.ho;
032:
033: import java.io.*;
034: import java.util.*;
035:
036: import de.ug2t.channel.ho.session.*;
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.interfaces.*;
039: import de.ug2t.xmlScript.*;
040:
041: public class HoGenericDataContainer extends KeRegisteredObject
042: implements IUnLazyComponent {
043: private transient IHoSession pem_session = null;
044: private ArrayList pem_values = new ArrayList();
045: private String pem_sep = ";";
046:
047: // @@
048:
049: public HoGenericDataContainer() {
050: this .pem_session = (IHoSession) KeRegisteredObject
051: .pcmf_getObjByName(IHoSession.SESSION_NAME);
052:
053: if (this .pem_session != null
054: && this .pem_session.pcmf_isClientSide() == false) {
055: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
056: "");
057: // Deklaration
058: if (this .pem_session.pcmf_isInTransaction()) {
059: ScXmlScript.pcmf_createPBody(l_remCall);
060: } else {
061: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
062: ScXmlScript.pcmf_addProc(l_remCall, null);
063: }
064: ;
065: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
066: "de.ug2t.channel.ho.HoGenericDataContainer",
067: "global");
068: ScXmlScript.pcmf_endAll(l_remCall);
069: this .pem_session.pcmf_call(l_remCall.toString(), this );
070: }
071: ;
072:
073: return;
074: };
075:
076: public boolean equals(Object o) {
077: if (o instanceof HoGenericDataContainer)
078: return (this .pem_values
079: .equals((((HoGenericDataContainer) o)
080: .pcmf_getOrgValueArray())));
081: else
082: return (false);
083: }
084:
085: public void pcmf_addRemoteValue_S2C(String xString) {
086: if (pem_session != null) {
087: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
088: "");
089:
090: if (this .pem_session.pcmf_isInTransaction()) {
091: ScXmlScript.pcmf_createPBody(l_remCall);
092: } else {
093: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
094: ScXmlScript.pcmf_addProc(l_remCall, null);
095: }
096: ;
097: ScXmlScript.pcmf_addCall(l_remCall, null, this
098: .pcmf_getRemName(), "pcmf_addValue");
099: ScXmlScript.pcmf_addCallPar(l_remCall, xString, "false",
100: "java.lang.String");
101: ScXmlScript.pcmf_endAll(l_remCall);
102:
103: this .pem_session.pcmf_call(l_remCall.toString(), this );
104: }
105: ;
106: this .pcmf_addValue(xString);
107:
108: return;
109: }
110:
111: public void pcmf_addRemoteValue_S2C(KeRegisteredObject xObj) {
112: if (pem_session != null) {
113: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
114: "");
115:
116: if (this .pem_session.pcmf_isInTransaction()) {
117: ScXmlScript.pcmf_createPBody(l_remCall);
118: } else {
119: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
120: ScXmlScript.pcmf_addProc(l_remCall, null);
121: }
122: ;
123: ScXmlScript.pcmf_addCall(l_remCall, null, this
124: .pcmf_getRemName(), "pcmf_addValue");
125: ScXmlScript.pcmf_addCallPar(l_remCall, xObj
126: .pcmf_getRemName(), "true",
127: "de.ug2t.kernel.KeRegisteredObject");
128: ScXmlScript.pcmf_endAll(l_remCall);
129:
130: this .pem_session.pcmf_call(l_remCall.toString(), this );
131: }
132: ;
133: this .pcmf_addValue(xObj);
134:
135: return;
136: }
137:
138: public void pcmf_addRemoteValue_C2S(String xString) {
139: if (pem_session != null) {
140: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
141: "");
142:
143: if (this .pem_session.pcmf_isInTransaction()) {
144: ScXmlScript.pcmf_createPBody(l_remCall);
145: } else {
146: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
147: ScXmlScript.pcmf_addProc(l_remCall, null);
148: }
149: ;
150: ScXmlScript.pcmf_addCall(l_remCall, null, this
151: .pcmf_getObjName(), "pcmf_addValue");
152: ScXmlScript.pcmf_addCallPar(l_remCall, xString, "false",
153: "java.lang.String");
154: ScXmlScript.pcmf_endAll(l_remCall);
155:
156: this .pem_session.pcmf_call(l_remCall.toString(), this );
157: }
158: ;
159: this .pcmf_addValue(xString);
160:
161: return;
162: }
163:
164: public void pcmf_setRemoteValues_C2S(ArrayList xValues) {
165: if (pem_session != null) {
166: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
167: "");
168:
169: if (this .pem_session.pcmf_isInTransaction()) {
170: ScXmlScript.pcmf_createPBody(l_remCall);
171: } else {
172: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
173: ScXmlScript.pcmf_addProc(l_remCall, null);
174: }
175: ;
176:
177: ScXmlScript.pcmf_addCall(l_remCall, null, this
178: .pcmf_getObjName(), "pcmf_clearValues");
179: ScXmlScript.pcmf_endCall(l_remCall);
180:
181: this .pcmf_clearValues();
182:
183: Iterator l_it = xValues.iterator();
184: while (l_it.hasNext()) {
185: String l_value = l_it.next().toString();
186: ScXmlScript.pcmf_addCall(l_remCall, null, this
187: .pcmf_getObjName(), "pcmf_addValue");
188: ScXmlScript.pcmf_addCallPar(l_remCall, l_value,
189: "false", "java.lang.String");
190: ScXmlScript.pcmf_endCall(l_remCall);
191: this .pcmf_addValue(l_value);
192: }
193:
194: ScXmlScript.pcmf_endAll(l_remCall);
195:
196: this .pem_session.pcmf_call(l_remCall.toString(), this );
197: }
198: ;
199: return;
200: }
201:
202: public void pcmf_setRemoteValueObjects_C2S(ArrayList xValues) {
203: if (pem_session != null) {
204: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
205: "");
206:
207: if (this .pem_session.pcmf_isInTransaction()) {
208: ScXmlScript.pcmf_createPBody(l_remCall);
209: } else {
210: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
211: ScXmlScript.pcmf_addProc(l_remCall, null);
212: }
213: ;
214:
215: ScXmlScript.pcmf_addCall(l_remCall, null, this
216: .pcmf_getObjName(), "pcmf_clearValues");
217: ScXmlScript.pcmf_endCall(l_remCall);
218:
219: this .pcmf_clearValues();
220:
221: Iterator l_it = xValues.iterator();
222: while (l_it.hasNext()) {
223: KeRegisteredObject l_value = (KeRegisteredObject) l_it
224: .next();
225: ScXmlScript.pcmf_addCall(l_remCall, null, this
226: .pcmf_getObjName(), "pcmf_addValue");
227: ScXmlScript.pcmf_addCallPar(l_remCall, l_value
228: .pcmf_getObjName(), "true",
229: "de.ug2t.kernel.KeRegisteredObject");
230: ScXmlScript.pcmf_endCall(l_remCall);
231: this .pcmf_addValue(l_value);
232: }
233:
234: ScXmlScript.pcmf_endAll(l_remCall);
235:
236: this .pem_session.pcmf_call(l_remCall.toString(), this );
237: }
238: ;
239: return;
240: }
241:
242: public void pcmf_addRemoteValue_C2S(KeRegisteredObject xObj) {
243: if (pem_session != null) {
244: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
245: "");
246:
247: if (this .pem_session.pcmf_isInTransaction()) {
248: ScXmlScript.pcmf_createPBody(l_remCall);
249: } else {
250: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
251: ScXmlScript.pcmf_addProc(l_remCall, null);
252: }
253: ;
254: ScXmlScript.pcmf_addCall(l_remCall, null, this
255: .pcmf_getObjName(), "pcmf_addValue");
256: ScXmlScript.pcmf_addCallPar(l_remCall, xObj
257: .pcmf_getObjName(), "true",
258: "de.ug2t.kernel.KeRegisteredObject");
259: ScXmlScript.pcmf_endAll(l_remCall);
260:
261: this .pem_session.pcmf_call(l_remCall.toString(), this );
262: }
263: ;
264: this .pcmf_addValue(xObj);
265:
266: return;
267: }
268:
269: public void pcmf_clearRemoteValues_S2C() {
270: if (pem_session != null) {
271: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
272: "");
273:
274: if (this .pem_session.pcmf_isInTransaction()) {
275: ScXmlScript.pcmf_createPBody(l_remCall);
276: } else {
277: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
278: ScXmlScript.pcmf_addProc(l_remCall, null);
279: }
280: ;
281: ScXmlScript.pcmf_addCall(l_remCall, null, this
282: .pcmf_getRemName(), "pcmf_clearValues");
283: ScXmlScript.pcmf_endAll(l_remCall);
284:
285: this .pem_session.pcmf_call(l_remCall.toString(), this );
286: }
287: ;
288:
289: this .pcmf_clearValues();
290: }
291:
292: public void pcmf_clearRemoteValues_C2S() {
293: if (pem_session != null) {
294: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
295: "");
296:
297: if (this .pem_session.pcmf_isInTransaction()) {
298: ScXmlScript.pcmf_createPBody(l_remCall);
299: } else {
300: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
301: ScXmlScript.pcmf_addProc(l_remCall, null);
302: }
303: ;
304: ScXmlScript.pcmf_addCall(l_remCall, null, this
305: .pcmf_getObjName(), "pcmf_clearValues");
306: ScXmlScript.pcmf_endAll(l_remCall);
307:
308: this .pem_session.pcmf_call(l_remCall.toString(), this );
309: }
310: ;
311:
312: this .pcmf_clearValues();
313: }
314:
315: public void pcmf_addValue(String xString) {
316: this .pem_values.add(xString);
317: }
318:
319: public int pcmf_size() {
320: return (this .pem_values.size());
321: }
322:
323: public boolean pcmf_contains(Object xObj) {
324: return (this .pem_values.contains(xObj));
325: }
326:
327: public void pcmf_removeValue(Object xObj) {
328: this .pem_values.remove(xObj);
329: }
330:
331: public void pcmf_addValue(KeRegisteredObject xObj) {
332: this .pem_values.add(xObj);
333: }
334:
335: public void pcmf_clearValues() {
336: this .pem_values.clear();
337: }
338:
339: public Iterator pcmf_getValueIt() {
340: return (new ArrayList(this .pem_values).iterator());
341: }
342:
343: public ArrayList pcmf_getValueArray() {
344: return (new ArrayList(this .pem_values));
345: }
346:
347: protected ArrayList pcmf_getOrgValueArray() {
348: return (this .pem_values);
349: }
350:
351: public Object pcmf_getValueAt(int xIdx) {
352: return (this .pem_values.get(xIdx));
353: }
354:
355: public void pcmf_setSep(String xSep) {
356: this .pem_sep = xSep;
357: }
358:
359: public String toString(Object xObj) {
360: StringBuffer l_ret = new StringBuffer();
361: Iterator l_it = this .pem_values.iterator();
362:
363: while (l_it.hasNext()) {
364: Object l_obj = l_it.next();
365: if (l_obj == xObj)
366: l_ret.append("this");
367: else
368: l_ret.append(l_obj.toString());
369:
370: if (l_it.hasNext())
371: l_ret.append(this .pem_sep);
372: }
373:
374: return (l_ret.toString());
375: }
376:
377: public String toString() {
378: StringBuffer l_ret = new StringBuffer();
379: Iterator l_it = this .pem_values.iterator();
380:
381: while (l_it.hasNext()) {
382: l_ret.append(l_it.next().toString());
383: if (l_it.hasNext())
384: l_ret.append(this .pem_sep);
385: }
386:
387: return (l_ret.toString());
388: }
389:
390: public void pcmf_delete() throws Exception {
391: if (this .pdm_deleted == true)
392: return;
393:
394: String l_remName = this .pcmf_getRemName();
395: super .pcmf_delete();
396:
397: if (pem_session != null
398: && pem_session.pcmf_isClientSide() == false) {
399: if (l_remName != null) {
400: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
401: "");
402:
403: if (this .pem_session.pcmf_isInTransaction()) {
404: ScXmlScript.pcmf_createPBody(l_remCall);
405: } else {
406: ScXmlScript.pcmf_createxScriptString(l_remCall,
407: null);
408: ScXmlScript.pcmf_addProc(l_remCall, null);
409: }
410: ;
411:
412: ScXmlScript.pcmf_addCall(l_remCall, null, l_remName,
413: "pcmf_delete");
414: ScXmlScript.pcmf_endAll(l_remCall);
415:
416: this .pem_session.pcmf_call(l_remCall.toString(), this );
417: }
418: }
419: ;
420:
421: return;
422: }
423:
424: public void pcmf_copy(HoGenericDataContainer xtoCopy) {
425: if (xtoCopy == this )
426: return;
427:
428: this .pem_values = new ArrayList(xtoCopy.pcmf_getValueArray());
429: return;
430: }
431:
432: public void pcmf_echoValues() {
433: if (pem_session != null) {
434: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
435: "");
436:
437: if (this .pem_session.pcmf_isInTransaction()) {
438: ScXmlScript.pcmf_createPBody(l_remCall);
439: } else {
440: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
441: ScXmlScript.pcmf_addProc(l_remCall, null);
442: }
443: ;
444: ScXmlScript.pcmf_addCall(l_remCall, null, this
445: .pcmf_getRemName(), "pcmf_clearValues");
446: ScXmlScript.pcmf_endAll(l_remCall);
447:
448: this .pem_session.pcmf_echoCall(l_remCall.toString());
449: }
450: ;
451:
452: Iterator l_it = this .pem_values.iterator();
453: while (l_it.hasNext()) {
454: Object l_obj = l_it.next();
455:
456: if (l_obj == null)
457: continue;
458:
459: if (pem_session != null) {
460: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
461: "");
462:
463: if (this .pem_session.pcmf_isInTransaction()) {
464: ScXmlScript.pcmf_createPBody(l_remCall);
465: } else {
466: ScXmlScript.pcmf_createxScriptString(l_remCall,
467: null);
468: ScXmlScript.pcmf_addProc(l_remCall, null);
469: }
470: ;
471: ScXmlScript.pcmf_addCall(l_remCall, null, this
472: .pcmf_getRemName(), "pcmf_addValue");
473:
474: if (l_obj instanceof KeRegisteredObject)
475: ScXmlScript.pcmf_addCallPar(l_remCall,
476: ((KeRegisteredObject) l_obj)
477: .pcmf_getRemName(), "true",
478: "de.ug2t.kernel.KeRegisteredObject");
479: else
480: ScXmlScript.pcmf_addCallPar(l_remCall, l_obj
481: .toString(), "false", "java.lang.String");
482:
483: ScXmlScript.pcmf_endAll(l_remCall);
484:
485: this.pem_session.pcmf_echoCall(l_remCall.toString());
486: }
487: ;
488: }
489: }
490: }
|