~dhis2-devs-core/dhis2/ivb2.16

« back to all changes in this revision

Viewing changes to local/in/dhis-web-ivb/src/main/java/org/hisp/dhis/ivb/report/action/GaviReportFormAction.java

  • Committer: Bharath
  • Date: 2015-04-04 06:41:32 UTC
  • Revision ID: chbharathk@gmail.com-20150404064132-g3vz9zg1dpbhi62j
ProgReviewTAReport; Other enhancements

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import org.hisp.dhis.dataset.Section;
20
20
import org.hisp.dhis.dataset.SectionService;
21
21
import org.hisp.dhis.i18n.I18nService;
 
22
import org.hisp.dhis.ivb.util.IVBUtil;
 
23
import org.hisp.dhis.lookup.Lookup;
 
24
import org.hisp.dhis.lookup.LookupService;
22
25
import org.hisp.dhis.message.MessageService;
23
26
import org.hisp.dhis.organisationunit.OrganisationUnit;
24
27
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
25
28
import org.hisp.dhis.oust.manager.SelectionTreeManager;
26
29
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
27
30
import org.hisp.dhis.user.CurrentUserService;
 
31
import org.hisp.dhis.user.User;
 
32
import org.hisp.dhis.user.UserAuthorityGroup;
28
33
import org.hisp.dhis.user.UserGroup;
29
34
import org.springframework.beans.factory.annotation.Autowired;
30
35
 
107
112
    
108
113
    @Autowired
109
114
    private DataElementService dataElementGroupService;
 
115
    
 
116
    @Autowired
 
117
    private LookupService lookupService;
 
118
    
 
119
    @Autowired
 
120
    private IVBUtil ivbUtil;
 
121
    
110
122
    // -------------------------------------------------------------------------
111
123
    // Getters & Setters
112
124
    // -------------------------------------------------------------------------
146
158
        return adminStatus;
147
159
    }
148
160
    
149
 
    public String execute()
 
161
    private String displayRestrictedDesCheckBox = "Y";
 
162
    
 
163
    public String getDisplayRestrictedDesCheckBox() 
 
164
    {
 
165
                return displayRestrictedDesCheckBox;
 
166
        }
 
167
 
 
168
        public String execute()
150
169
    {
151
170
        userName = currentUserService.getCurrentUser().getUsername();
152
171
 
203
222
            }
204
223
        });
205
224
        
 
225
        
 
226
        Lookup lookup = lookupService.getLookupByName( Lookup.RESTRICTED_DE_ATTRIBUTE_ID );
 
227
        int restrictedDeAttributeId = Integer.parseInt( lookup.getValue() );
 
228
        Set<DataElement> restrictedDes = ivbUtil.getRestrictedDataElements( restrictedDeAttributeId );
 
229
 
 
230
        User curUser = currentUserService.getCurrentUser();
 
231
        List<UserAuthorityGroup> userAuthorityGroups = new ArrayList<UserAuthorityGroup>( curUser.getUserCredentials().getUserAuthorityGroups() );
 
232
        Set<DataElement> userDataElements = new HashSet<DataElement>();
 
233
        for ( UserAuthorityGroup userAuthorityGroup : userAuthorityGroups )
 
234
        {
 
235
            userDataElements.addAll( userAuthorityGroup.getDataElements() );
 
236
        }
 
237
        
 
238
        restrictedDes.removeAll( userDataElements );
 
239
        
 
240
        if( restrictedDes != null && restrictedDes.size() > 0 )
 
241
        {
 
242
                displayRestrictedDesCheckBox = "N";
 
243
        }
 
244
        
206
245
        return SUCCESS;
207
246
    }
208
247