use of com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId in project service-api by reportportal.
the class WidgetConverter method toDashboardWidget.
/**
* Creates many-to-many object representation of dashboards and widgets
*
* @param model Widget model object
* @param dashboard Dashboard
* @param widget Widget
* @return many-to-many object representation
*/
public static DashboardWidget toDashboardWidget(DashboardResource.WidgetObjectModel model, Dashboard dashboard, Widget widget, boolean isCreatedOn) {
DashboardWidgetId id = new DashboardWidgetId();
id.setDashboardId(dashboard.getId());
id.setWidgetId(model.getWidgetId());
DashboardWidget dashboardWidget = new DashboardWidget();
dashboardWidget.setId(id);
dashboardWidget.setWidgetType(widget.getWidgetType());
dashboardWidget.setWidgetName(widget.getName());
dashboardWidget.setPositionX(model.getWidgetPosition().getX());
dashboardWidget.setPositionY(model.getWidgetPosition().getY());
dashboardWidget.setWidth(model.getWidgetSize().getWidth());
dashboardWidget.setHeight(model.getWidgetSize().getHeight());
dashboardWidget.setDashboard(dashboard);
dashboardWidget.setShare(widget.isShared());
dashboardWidget.setWidget(widget);
dashboardWidget.setCreatedOn(isCreatedOn);
dashboardWidget.setWidgetOwner(widget.getOwner());
return dashboardWidget;
}
use of com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId in project service-api by reportportal.
the class DashboardConverterTest method getDashboard.
private static Dashboard getDashboard() {
Dashboard dashboard = new Dashboard();
dashboard.setId(1L);
dashboard.setName("name");
dashboard.setDescription("description");
dashboard.setCreationDate(LocalDateTime.now());
dashboard.setOwner("owner");
final Project project = new Project();
project.setId(2L);
dashboard.setProject(project);
dashboard.setShared(true);
final DashboardWidget dashboardWidget = new DashboardWidget();
dashboardWidget.setId(new DashboardWidgetId(1L, 3L));
dashboardWidget.setPositionY(2);
dashboardWidget.setPositionX(3);
dashboardWidget.setWidth(5);
dashboardWidget.setHeight(6);
dashboardWidget.setWidgetName("widgetName");
dashboardWidget.setDashboard(dashboard);
final Widget widget = new Widget();
dashboardWidget.setWidget(widget);
dashboard.addWidget(dashboardWidget);
return dashboard;
}
use of com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId in project service-api by reportportal.
the class WidgetConverterTest method getDashboardWIdget.
private static DashboardWidget getDashboardWIdget() {
final DashboardWidget dashboardWidget = new DashboardWidget();
final Widget widget = new Widget();
widget.setId(1L);
dashboardWidget.setWidget(widget);
final Dashboard dashboard = new Dashboard();
dashboard.setId(2L);
dashboardWidget.setId(new DashboardWidgetId(dashboard.getId(), widget.getId()));
dashboardWidget.setDashboard(dashboard);
dashboardWidget.setPositionX(2);
dashboardWidget.setPositionY(4);
dashboardWidget.setHeight(5);
dashboardWidget.setWidth(6);
return dashboardWidget;
}
use of com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId in project service-api by reportportal.
the class DashboardBuilderTest method updateDashboard.
@Test
void updateDashboard() {
final String name = "name";
final String description = "description";
final boolean share = true;
UpdateDashboardRQ updateDashboardRQ = new UpdateDashboardRQ();
updateDashboardRQ.setName(name);
updateDashboardRQ.setDescription(description);
updateDashboardRQ.setShare(share);
updateDashboardRQ.setWidgets(Collections.singletonList(new DashboardResource.WidgetObjectModel("kek", 1L, new Size(10, 20), new Position(30, 40))));
DashboardWidget dashboardWidget = new DashboardWidget();
dashboardWidget.setHeight(5);
dashboardWidget.setWidth(10);
dashboardWidget.setPositionX(1);
dashboardWidget.setPositionY(2);
dashboardWidget.setId(new DashboardWidgetId(1L, 1L));
final Dashboard existDashboard = new Dashboard();
existDashboard.addWidget(dashboardWidget);
final Dashboard dashboard = new DashboardBuilder(existDashboard).addUpdateRq(updateDashboardRQ).get();
assertEquals(name, dashboard.getName());
assertEquals(description, dashboard.getDescription());
assertEquals(share, dashboard.isShared());
}
use of com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId in project service-api by reportportal.
the class DemoDashboardsService method createDashboardWidget.
private DashboardWidget createDashboardWidget(String owner, Dashboard dashboard, Widget widget, int posX, int posY, int width, int height) {
DashboardWidget dashboardWidget = new DashboardWidget();
dashboardWidget.setId(new DashboardWidgetId(dashboard.getId(), widget.getId()));
dashboardWidget.setDashboard(dashboard);
dashboardWidget.setWidget(widget);
dashboardWidget.setWidgetName(widget.getName());
dashboardWidget.setWidgetType(widget.getWidgetType());
dashboardWidget.setCreatedOn(true);
dashboardWidget.setWidgetOwner(owner);
dashboardWidget.setHeight(height);
dashboardWidget.setWidth(width);
dashboardWidget.setPositionX(posX);
dashboardWidget.setPositionY(posY);
dashboardWidgetRepository.save(dashboardWidget);
return dashboardWidget;
}
Aggregations