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.r2ml.reference.SimpleAssociationResolvPolicy;
13: import de.tu_cottbus.r2ml.AssociationAtom;
14:
15: /**
16: * @author Bastian Schenke (bastian.schenke@googlemail.com)
17: *
18: */
19: class AssociationAtomHandler implements XmlTypeHandler {
20:
21: /**
22: * Map a AssociationAtom to a PropertyPredicate.
23: *
24: * @param obj
25: * a
26: * @return a
27: *
28: * @see nz.org.take.r2ml.XmlTypeHandler#importObject(java.lang.Object,
29: * nz.org.take.r2ml.R2MLDriver)
30: */
31: public Object importObject(Object obj) throws R2MLException {
32:
33: R2MLDriver driver = R2MLDriver.get();
34: AssociationAtom atom = (AssociationAtom) obj;
35: if (MappingContext.get().isConclusion()) {
36: return new SimpleAssociationResolvPolicy().resolv(atom);
37: } else {
38: AssociationResolvPolicy policy = driver
39: .getAssociationResolvPolicy();
40: return policy.resolv(atom);
41: }
42: }
43:
44: }
|