~sis-ma/dhis2/SISMA-362

« back to all changes in this revision

Viewing changes to local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/Report_inDeletionHandler.java

committing recent india modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.dhis.reports;
 
2
 
 
3
import org.hisp.dhis.source.Source;
 
4
import org.hisp.dhis.system.deletion.DeletionHandler;
 
5
 
 
6
public class Report_inDeletionHandler
 
7
    extends DeletionHandler
 
8
{
 
9
    // -------------------------------------------------------------------------
 
10
    // Dependencies
 
11
    // -------------------------------------------------------------------------
 
12
    
 
13
    private ReportService reportService;
 
14
 
 
15
    public void setReportService( ReportService reportService )
 
16
    {
 
17
        this.reportService = reportService;
 
18
    }
 
19
 
 
20
    // -------------------------------------------------------------------------
 
21
    // DeletionHandler implementation
 
22
    // -------------------------------------------------------------------------
 
23
    
 
24
    @Override
 
25
    public String getClassName()
 
26
    {
 
27
        return Report_in.class.getSimpleName();
 
28
    }
 
29
 
 
30
    @Override
 
31
    public void deleteSource( Source source )
 
32
    {
 
33
        for ( Report_in report : reportService.getAllReports() )
 
34
        {
 
35
            if ( report.getSources().remove( source ) )
 
36
            {
 
37
                reportService.updateReport( report );
 
38
            }
 
39
        }
 
40
    }
 
41
 
 
42
    public void deleteReport_in( Report_in report )
 
43
    {
 
44
    }
 
45
 
 
46
    public boolean allowDeleteReport_in( Report_in report )
 
47
    {
 
48
        return true;
 
49
    }
 
50
}