use of org.jumpmind.symmetric.model.NodeGroupLink in project symmetric-ds by JumpMind.
the class AbstractRouterServiceTest method getTestRoutingTableTrigger.
protected TriggerRouter getTestRoutingTableTrigger(String tableName) {
TriggerRouter trigger = null;
Set<TriggerRouter> triggerRouters = getTriggerRouterService().getTriggerRouterForTableForCurrentNode(null, null, tableName, true);
if (triggerRouters == null || triggerRouters.size() == 0) {
trigger = new TriggerRouter();
trigger.getTrigger().setSourceTableName(tableName);
trigger.getTrigger().setTriggerId(tableName);
trigger.getRouter().setNodeGroupLink(new NodeGroupLink(TestConstants.TEST_ROOT_NODE_GROUP, TestConstants.TEST_CLIENT_NODE_GROUP));
if (tableName.equals(TEST_TABLE_2)) {
trigger.getTrigger().setChannelId(TestConstants.TEST_CHANNEL_ID_OTHER);
} else {
trigger.getTrigger().setChannelId(TestConstants.TEST_CHANNEL_ID);
}
} else {
trigger = triggerRouters.iterator().next();
}
return trigger;
}
use of org.jumpmind.symmetric.model.NodeGroupLink in project symmetric-ds by JumpMind.
the class InfoUriHandler method handle.
public void handle(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
res.setContentType("text/plain");
Node node = nodeService.findIdentity();
List<NodeGroupLink> nodeGroupLinks = configurationService.getNodeGroupLinks(true);
Properties properties = new Properties();
properties.setProperty(ParameterConstants.EXTERNAL_ID, parameterService.getExternalId());
properties.setProperty(ParameterConstants.NODE_GROUP_ID, parameterService.getNodeGroupId());
properties.setProperty(ParameterConstants.EXTERNAL_ID, parameterService.getExternalId());
if (nodeGroupLinks != null) {
Set<String> groups = new HashSet<String>();
StringBuilder b = new StringBuilder();
for (NodeGroupLink nodeGroupLink : nodeGroupLinks) {
if (nodeGroupLink.getSourceNodeGroupId().equals(node.getNodeGroupId())) {
groups.add(nodeGroupLink.getTargetNodeGroupId());
} else if (nodeGroupLink.getTargetNodeGroupId().equals(node.getNodeGroupId())) {
groups.add(nodeGroupLink.getSourceNodeGroupId());
}
}
for (String group : groups) {
b.append(group).append(",");
}
properties.setProperty(InfoConstants.NODE_GROUP_IDS, b.substring(0, b.length() > 0 ? b.length() - 1 : 0));
}
if (node != null) {
properties.setProperty(InfoConstants.NODE_ID, node.getNodeId());
if (node.getDatabaseType() != null) {
properties.setProperty(InfoConstants.DATABASE_TYPE, node.getDatabaseType());
}
if (node.getDatabaseVersion() != null) {
properties.setProperty(InfoConstants.DATABASE_VERSION, node.getDatabaseVersion());
}
if (node.getDeploymentType() != null) {
properties.setProperty(InfoConstants.DEPLOYMENT_TYPE, node.getDeploymentType());
}
if (node.getSymmetricVersion() != null) {
properties.setProperty(InfoConstants.SYMMETRIC_VERSION, node.getSymmetricVersion());
}
}
properties.store(res.getOutputStream(), "SymmetricDS");
res.flushBuffer();
}
Aggregations