return outputBean;
}
private JsonBean getConnections(RequestContext ctx) {
String sxid = ctx.getLastURLElement();
ConnectionBean bean;
Locale locale = ctx.getAcceptLanguageHeader();
Repository repository = RepositoryManager.getInstance().getRepository();
if (sxid.equals("all")) {
List<MConnection> connections = repository.findConnections();
bean = new ConnectionBean(connections);
// Add associated resources into the bean
for( MConnection connection : connections) {
long connectorId = connection.getConnectorId();
if(!bean.hasConnectorBundle(connectorId)) {
bean.addConnectorBundle(connectorId,
ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
}
}
} else {
long xid = Long.valueOf(sxid);
MConnection connection = repository.findConnection(xid);
long connectorId = connection.getConnectorId();
bean = new ConnectionBean(connection);
bean.addConnectorBundle(connectorId,
ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
}
// Sent framework resource bundle in all cases
bean.setFrameworkBundle(FrameworkManager.getInstance().getBundle(locale));
return bean;
}