1 28 29 package org.objectweb.openccm.uml.transformation.rules.xml; 30 31 import ispuml.mdaTransformation.RuleContext; 32 import ispuml.mdaTransformation.TransformationException; 33 import ispuml.mdaTransformation.rules.xml.BeanProperty; 34 import ispuml.mdaTransformation.rules.xml.CopyXmlAction; 35 36 41 public class CopyAssociatedClass extends CopyXmlAction { 42 43 44 private String associatedClassWithStereotype; 45 46 47 private String associatedClassHasStereotype; 48 49 50 private String associatedClassWithType; 51 52 53 private AssociatedClassUtils assoClassUtils; 54 55 56 59 public CopyAssociatedClass () { 60 super(); 61 assoClassUtils = new AssociatedClassUtils(); 62 srcProperty = new AssociatedBeanProperty(); 63 } 64 65 66 70 public void setAssociatedClassWithStereotype(String stereotype) { 71 associatedClassWithStereotype = stereotype; 72 } 73 74 75 79 public void setAssociatedClassHasStereotype(String stereotype) { 80 associatedClassHasStereotype = stereotype; 81 } 82 83 84 88 public void setAssociatedClassWithType(String type) { 89 associatedClassWithType = type; 90 } 91 92 93 private class AssociatedBeanProperty extends BeanProperty { 94 97 public Object getValue(Object object, RuleContext context) throws TransformationException { 98 Object bean = super.getValue(object, context); 99 if (associatedClassWithType != null) 100 return assoClassUtils.getAssociatedClass(bean, associatedClassWithType, context.engineContext.getModel(object)); 101 else 102 return assoClassUtils.getAssociatedClass(bean, associatedClassWithStereotype, associatedClassHasStereotype, context.engineContext.getModel(object)); 103 } 104 } 105 106 } 107 | Popular Tags |