001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 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.kernel;
032:
033: import java.util.*;
034:
035: import de.ug2t.model.values.*;
036:
037: public class KeDataMapper extends KeRegisteredObject {
038: protected ArrayList pdm_VO1 = new ArrayList();
039: protected ArrayList pdm_VO2 = new ArrayList();
040: protected ArrayList pdm_VTF = new ArrayList();
041:
042: public KeDataMapper() {
043: super (false);
044: }
045:
046: public void pcmf_addMaping(Object xObj1, Object xObj2,
047: KeRegisteredObject xTransformer) {
048: KeLog.pcmf_logEnter("pcmf_addMaping(" + xObj1 + "," + xObj2
049: + "," + xTransformer + ")", this );
050:
051: this .pdm_VO1.add(xObj1);
052: this .pdm_VO2.add(xObj2);
053: this .pdm_VTF.add(xTransformer);
054:
055: KeLog.pcmf_logLeave("pcmf_addMaping(" + xObj1 + "," + xObj2
056: + "," + xTransformer + ")", this );
057:
058: return;
059: };
060:
061: public void pcmf_removeMappings() {
062: this .pdm_VO1.clear();
063: this .pdm_VO2.clear();
064: this .pdm_VTF.clear();
065: }
066:
067: // Ändert die Kopierrichtung
068: public void pcmf_switchDir() {
069: KeLog.pcmf_logEnter("pcmf_switchDir()", this );
070:
071: ArrayList l_tmp = null;
072:
073: l_tmp = this .pdm_VO1;
074: this .pdm_VO1 = this .pdm_VO2;
075: this .pdm_VO2 = l_tmp;
076:
077: KeLog.pcmf_logLeave("pcmf_switchDir()", this );
078:
079: return;
080: };
081:
082: public Object pcmf_execObj(Object xObj) {
083: KeLog.pcmf_logEnter("pcmf_execObj(" + xObj + ")", this );
084:
085: Iterator l_it1 = this .pdm_VO1.iterator();
086: Iterator l_it2 = this .pdm_VO2.iterator();
087: Iterator l_it3 = this .pdm_VTF.iterator();
088:
089: Object l_o1 = null;
090: Object l_o2 = null;
091: KeRegisteredObject l_tf = null;
092:
093: while (l_it1.hasNext()) {
094: l_o1 = l_it1.next();
095: l_o2 = l_it2.next();
096:
097: l_tf = (KeRegisteredObject) l_it3.next();
098:
099: if (l_tf != null)
100: l_o1 = (KeRegisteredObject) l_tf.pcmf_execObj(l_o1);
101:
102: if (l_o2 instanceof KeRegisteredObject)
103: ((KeRegisteredObject) l_o2).pcmf_setValue(l_o1);
104: else if (l_o2 instanceof IMoSingleValue)
105: ((IMoSingleValue) l_o2).pcmf_setValueValidate(l_o1);
106: else
107: KeLog.pcmf_log("ug2t",
108: "cannot map value due to wrong class", this ,
109: KeLog.ERROR);
110: }
111: ;
112:
113: KeLog.pcmf_logLeave("pcmf_execObj(" + xObj + ")", this);
114:
115: return (this);
116: };
117: }
|