1 10 package org.mmbase.bridge.jsp.taglib.edit; 11 12 import org.mmbase.bridge.jsp.taglib.util.Attribute; 13 import javax.servlet.jsp.JspTagException ; 14 15 import org.mmbase.bridge.Node; 16 import org.mmbase.bridge.RelationManager; 17 import org.mmbase.bridge.Relation; 18 19 import org.mmbase.bridge.jsp.taglib.NodeTag; 20 21 import org.mmbase.util.logging.Logger; 22 import org.mmbase.util.logging.Logging; 23 24 30 31 public class CreateRelationTag extends NodeTag { 32 33 private static final Logger log = Logging.getLoggerInstance(CreateRelationTag.class); 34 35 private Attribute role = Attribute.NULL; 36 private Attribute source = Attribute.NULL; 37 private Attribute destination = Attribute.NULL; 38 39 public void setRole(String r) throws JspTagException { 40 role = getAttribute(r); 41 } 42 43 public void setSource(String s) throws JspTagException { 44 source = getAttribute(s); 45 } 46 public void setDestination(String d) throws JspTagException { 47 destination = getAttribute(d); 48 } 49 50 public int doStartTag() throws JspTagException { 51 RelationManager rm = getCloudVar().getRelationManager(role.getString(this)); 52 Node sourceNode = getNode(source.getString(this)); 53 Node destinationNode = getNode(destination.getString(this)); 54 55 if (log.isDebugEnabled()) { 56 log.debug("cloud from relationmanager " + rm.getCloud().getName()); 57 log.debug("cloud from source node " + sourceNode.getCloud().getName()); 58 log.debug("cloud from dest node " + destinationNode.getCloud().getName()); 59 } 60 61 Relation r = rm.createRelation(sourceNode, destinationNode); 62 r.commit(); 63 64 setNodeVar(r); 65 fillVars(); 66 return EVAL_BODY_BUFFERED; 67 } 68 69 } 70 | Popular Tags |