Skip to content

Commit

Permalink
Add additional items to XML Node so when you list children you have a…
Browse files Browse the repository at this point in the history
… bit more detail... Needs cleanup.
  • Loading branch information
gwilmer committed Dec 18, 2012
1 parent 307e09a commit 6c32bec
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 5 deletions.
Expand Up @@ -656,10 +656,27 @@ private NodeList childrenImpl(ISymmetricEngine engine) {
NetworkedNode networkedNode = nodeService.getRootNetworkedNode();
Set<NetworkedNode> childNetwork = networkedNode.getChildren();
for (NetworkedNode child : childNetwork) {

List<NodeHost> nodeHosts = nodeService.findNodeHosts(child.getNode().getNodeId());
NodeSecurity nodeSecurity = nodeService.findNodeSecurity(child.getNode().getNodeId());

xmlChildNode = new Node();
xmlChildNode.setName(child.getNode().getNodeId());
xmlChildNode.setExternalId(child.getNode().getExternalId());
xmlChildNode.setRootNode(false);
xmlChildNode.setSyncUrl(child.getNode().getSyncUrl());

xmlChildNode.setBatchInErrorCount(child.getNode().getBatchInErrorCount());
xmlChildNode.setBatchToSendCount(child.getNode().getBatchToSendCount());
if (nodeHosts.size()>0) {
xmlChildNode.setLastHeartbeat(nodeHosts.get(0).getHeartbeatTime());
}
xmlChildNode.setRegistered(nodeSecurity.hasRegistered());
xmlChildNode.setInitialLoaded(nodeSecurity.hasInitialLoaded());
xmlChildNode.setReverseInitialLoaded(nodeSecurity.hasReverseInitialLoaded());
if (child.getNode().getCreatedAtNodeId() == null) {
xmlChildNode.setRootNode(true);
}
children.addNode(xmlChildNode);
}
}
Expand All @@ -671,9 +688,22 @@ private Node nodeImpl(ISymmetricEngine engine) {
INodeService nodeService = engine.getNodeService();
Node xmlNode = new Node();
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity();
List<NodeHost> nodeHosts = nodeService.findNodeHosts(modelNode.getNodeId());
NodeSecurity nodeSecurity = nodeService.findNodeSecurity(modelNode.getNodeId());
xmlNode.setName(modelNode.getNodeId());
xmlNode.setExternalId(modelNode.getExternalId());
xmlNode.setRootNode(isRootNode(engine, modelNode));
xmlNode.setSyncUrl(modelNode.getSyncUrl());
xmlNode.setBatchInErrorCount(modelNode.getBatchInErrorCount());
xmlNode.setBatchToSendCount(modelNode.getBatchToSendCount());
xmlNode.setLastHeartbeat(nodeHosts.get(0).getHeartbeatTime());
xmlNode.setRegistered(nodeSecurity.hasRegistered());
xmlNode.setInitialLoaded(nodeSecurity.hasInitialLoaded());
xmlNode.setRegistered(nodeSecurity.hasReverseInitialLoaded());
if (modelNode.getCreatedAtNodeId() == null) {
xmlNode.setRootNode(true);
}

return xmlNode;
}

Expand Down
Expand Up @@ -20,16 +20,65 @@
*/
package org.jumpmind.symmetric.web.rest.model;

import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Node {

private String name;
private boolean isRootNode;
private String externalId;
private boolean rootNode;
private String syncUrl;
private int batchToSendCount;
private int batchInErrorCount;
private Date lastHeartbeat;
private boolean registered;
private boolean initialLoaded;
private boolean reverseInitialLoaded;

public boolean isReverseInitialLoaded() {
return reverseInitialLoaded;
}

public void setReverseInitialLoaded(boolean reverseInitialLoaded) {
this.reverseInitialLoaded = reverseInitialLoaded;
}

public String getSyncUrl() {
public int getBatchToSendCount() {
return batchToSendCount;
}

public void setBatchToSendCount(int batchToSendCount) {
this.batchToSendCount = batchToSendCount;
}

public int getBatchInErrorCount() {
return batchInErrorCount;
}

public void setBatchInErrorCount(int batchInErrorCount) {
this.batchInErrorCount = batchInErrorCount;
}

public boolean isRegistered() {
return registered;
}

public void setRegistered(boolean registered) {
this.registered = registered;
}

public boolean isInitialLoaded() {
return initialLoaded;
}

public void setInitialLoaded(boolean initialLoaded) {
this.initialLoaded = initialLoaded;
}

public String getSyncUrl() {
return syncUrl;
}

Expand All @@ -38,11 +87,11 @@ public void setSyncUrl(String syncUrl) {
}

public boolean isRootNode() {
return isRootNode;
return rootNode;
}

public void setRootNode(boolean isRootNode) {
this.isRootNode = isRootNode;
public void setRootNode(boolean rootNode) {
this.rootNode = rootNode;
}

public Node(String name) {
Expand All @@ -61,4 +110,19 @@ public void setName(String name) {
this.name = name;
}

public Date getLastHeartbeat() {
return lastHeartbeat;
}

public void setLastHeartbeat(Date lastHeartbeat) {
this.lastHeartbeat = lastHeartbeat;
}

public String getExternalId() {
return externalId;
}

public void setExternalId(String externalId) {
this.externalId = externalId;
}
}

0 comments on commit 6c32bec

Please sign in to comment.