1 package org.objectweb.kilim.description; 2 3 import org.objectweb.kilim.KilimException; 4 5 8 public class Transformer extends BasicNamedElementImpl { 9 private BasicElement action; 10 11 19 public Transformer(String aName, int aStatus, boolean isP, TemplateDescription aTemplate) throws KilimException { 20 super(aName, aStatus, isP, true, aTemplate); 21 action = new NullElement(aName, aStatus, isP, true, aTemplate); 22 } 23 24 31 public Transformer(String aName, int aStatus, TemplateDescription aTemplate) throws KilimException { 32 super(aName, aStatus, false, true, aTemplate); 33 } 34 35 38 public int getKind() { 39 return KILIM.TRANSFORMER; 40 } 41 42 47 public void setAction(BasicElement aAction) throws KilimException { 48 if (aAction != null && !aAction.performsAction()) { 49 throw new KilimException("illegal attempt to set a non transformer inline to the transformer " + getLocalName() + " in template " + getContainingTemplate().getName()); 50 } 51 action = aAction; 52 } 53 54 59 public BasicElement getAction() throws KilimException { 60 return action; 61 } 62 63 66 public void setLocalName(String aName) throws KilimException { 67 String oName = getLocalName(); 68 super.setLocalName(aName); 69 TemplateDescription template = getContainingTemplate(); 70 if (template != null) { 71 template.removeLocalTransformer(oName); 72 template.addLocalTransformer(this); 73 } 74 } 75 76 79 public void setStatus(int aStatus) throws KilimException { 80 super.setStatus(aStatus); 81 TemplateDescription template = getContainingTemplate(); 82 if (template != null) { 83 template.removeLocalTransformer(getLocalName()); 84 template.addLocalTransformer(this); 85 } 86 } 87 } 88 | Popular Tags |