01: /*
02: * Copyright 2007 Bastian Schenke Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
05: * Unless required by applicable law or agreed to in writing, software distributed under the
06: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
07: * either express or implied. See the License for the specific language governing permissions
08: * and limitations under the License.
09: */
10: package nz.org.take.r2ml;
11:
12: import nz.org.take.Fact;
13: import de.tu_cottbus.r2ml.Atom;
14: import de.tu_cottbus.r2ml.Conclusion;
15:
16: /**
17: * @author Bastian Schenke (bastian.schenke(at)googlemail.com)
18: *
19: */
20: public class ConclusionHandler implements XmlTypeHandler {
21:
22: /**
23: * @param Object obj a Conclusion object
24: *
25: * @return a Fact
26: */
27: public Object importObject(Object obj) throws R2MLException {
28: MappingContext.get().enter(this );
29: Fact conclusionFact = null;
30: try {
31: Atom atom = ((Conclusion) obj).getAtom().getValue();
32: XmlTypeHandler handler = R2MLDriver.get()
33: .getHandlerByXmlType(atom.getClass());
34: conclusionFact = (Fact) handler.importObject(atom);
35: } catch (R2MLException e) {
36: e.printStackTrace();
37: }
38: MappingContext.get().leave(this);
39: return conclusionFact;
40: }
41:
42: }
|