import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.restlet.data.MediaType; import org.restlet.resource.DomRepresentation; import org.w3c.dom.Document; import org.w3c.dom.Element; import com.db4o.query.Predicate; import edu.gvsu.cis.cs656.lab4.server.RegistrationInfo; public class User extends RegistrationInfo { public DomRepresentation getDomRepresentation() throws IOException { DomRepresentation rep = new DomRepresentation(MediaType.TEXT_XML); Document d = rep.getDocument(); Element eltRoot = d.createElement("user"); d.appendChild(eltRoot); fillNodes(d, eltRoot); return rep; } public void fillNodes(Document d, Element eltRoot) { Element eltName = d.createElement("name"); eltName.appendChild(d.createTextNode(getUserName())); eltRoot.appendChild(eltName); Element eltHost = d.createElement("host"); eltHost.appendChild(d.createTextNode(getHost())); eltRoot.appendChild(eltHost); Element eltPort = d.createElement("port"); eltPort.appendChild(d.createTextNode(new String(getPort()))); eltRoot.appendChild(eltPort); Element eltStatus = d.createElement("status"); eltStatus.appendChild( d.createTextNode(getStatus() ? "available" : "away")); eltRoot.appendChild(eltStatus); } }