View Javadoc

1   package zeus.concepts.xmlobject.acc;
2   
3   import org.w3c.dom.Node;
4   import org.w3c.dom.NodeList;
5   
6   public class Contact {
7   
8       private String zeusName;
9       private String fipaAddress;
10  
11      public Contact() {
12      }
13  
14      public void setZeusName(String zeusName) {
15          this.zeusName = zeusName;
16      }
17  
18      public String getZeusName() {
19          return zeusName;
20      }
21  
22      public void setFipaAddress(String fipaAddress) {
23          this.fipaAddress = fipaAddress;
24      }
25  
26      public String getFipaAddress() {
27          return fipaAddress;
28      }
29  
30      public String toString() {
31          return toString("");
32      }
33  
34      public String toString(String indent) {
35          String output = indent + "<contact";
36  
37          if(getZeusName() != null) {
38              output += " ZEUS-name=\"" + getZeusName() + "\"";
39          }
40          if(getFipaAddress() != null) {
41              output += " FIPA-address=\"" + getFipaAddress() + "\"";
42          }
43  
44          output += indent + "</contact>\n";
45          return output;
46      }
47  
48      public void translate(Node node) {
49          Node zeusName = node.getAttributes().getNamedItem("ZEUS-name");
50          if(zeusName != null) {
51              setZeusName(zeusName.getNodeValue());
52          }
53          Node fipaAddress = node.getAttributes().getNamedItem("FIPA-address");
54          if(fipaAddress != null) {
55              setFipaAddress(fipaAddress.getNodeValue());
56          }
57      }
58  
59  }