Search in sources :

Example 16 with DashboardItem

use of org.hisp.dhis.dashboard.DashboardItem in project dhis2-core by dhis2.

the class DashboardController method hasDashboardItemsTypeSet.

private boolean hasDashboardItemsTypeSet(final List<DashboardItem> items) {
    if (isNotEmpty(items)) {
        for (final DashboardItem item : items) {
            final boolean hasAssociationType = item != null && (item.getLinkItems() != null || item.getEmbeddedItem() != null || item.getText() != null || item.getMessages() != null);
            final boolean hasType = item != null && item.getType() != null;
            if (!hasType && !hasAssociationType) {
                return false;
            }
        }
    }
    return true;
}
Also used : DashboardItem(org.hisp.dhis.dashboard.DashboardItem)

Aggregations

DashboardItem (org.hisp.dhis.dashboard.DashboardItem)16 Dashboard (org.hisp.dhis.dashboard.Dashboard)11 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)6 UpdateAccessDeniedException (org.hisp.dhis.hibernate.exception.UpdateAccessDeniedException)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 Map (org.hisp.dhis.mapping.Map)4 Test (org.junit.jupiter.api.Test)3 StringWriter (java.io.StringWriter)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HashMap (java.util.HashMap)2 VelocityContext (org.apache.velocity.VelocityContext)2 VelocityManager (org.hisp.dhis.system.velocity.VelocityManager)2 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)2 EventReport (org.hisp.dhis.eventreport.EventReport)1 EventVisualization (org.hisp.dhis.eventvisualization.EventVisualization)1 Report (org.hisp.dhis.report.Report)1 JobConfiguration (org.hisp.dhis.scheduling.JobConfiguration)1 TaskId (org.hisp.dhis.scheduling.TaskId)1 User (org.hisp.dhis.user.User)1