use of io.syndesis.common.model.connection.ConnectionOverview in project syndesis by syndesisio.
the class ConnectionHandler method list.
@Override
public ListResult<ConnectionOverview> list(@Context UriInfo uriInfo) {
final DataManager dataManager = getDataManager();
final ListResult<Connection> connections = fetchAll(Connection.class, uriInfo);
final List<ConnectionOverview> overviews = new ArrayList<>(connections.getTotalCount());
for (Connection connection : connections.getItems()) {
final String id = connection.getId().get();
final ConnectionOverview.Builder builder = new ConnectionOverview.Builder().createFrom(connection);
// set the connector
DataManagerSupport.fetch(dataManager, Connector.class, connection.getConnectorId()).ifPresent(builder::connector);
// set the board
DataManagerSupport.fetchBoard(dataManager, ConnectionBulletinBoard.class, id).ifPresent(builder::board);
overviews.add(builder.build());
}
return ListResult.of(overviews);
}
use of io.syndesis.common.model.connection.ConnectionOverview in project syndesis by syndesisio.
the class ConnectionHandler method get.
@Override
public ConnectionOverview get(final String id) {
final DataManager dataManager = getDataManager();
final Connection connection = dataManager.fetch(Connection.class, id);
if (connection == null) {
throw new EntityNotFoundException();
}
final ConnectionOverview.Builder builder = new ConnectionOverview.Builder().createFrom(connection);
// set the connector
DataManagerSupport.fetch(dataManager, Connector.class, connection.getConnectorId()).ifPresent(builder::connector);
// set the board
DataManagerSupport.fetchBoard(dataManager, ConnectionBulletinBoard.class, id).ifPresent(builder::board);
return builder.build();
}
Aggregations