=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java 2012-03-22 12:34:46 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java 2012-04-29 18:04:08 +0000 @@ -40,6 +40,8 @@ { String ID = MapViewStore.class.getName(); + Collection getSystemAndUserMapViews( User user ); + Collection getMapViewsByMapSourceType( String mapSourceType ); Collection getMapViewsByFeatureType( String featureType, User user ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-03-19 22:10:02 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-04-29 18:04:08 +0000 @@ -152,6 +152,8 @@ MapView getIndicatorLastYearMapView( String indicatorUid, String organisationUnitUid, int level ); Collection getAllMapViews(); + + Collection getSystemAndUserMapViews(); Collection getMapViewsByFeatureType( String featureType ); === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java' --- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-03-26 13:00:42 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-04-29 18:04:08 +0000 @@ -27,6 +27,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.aggregation.AggregatedMapValue; import org.hisp.dhis.configuration.ConfigurationService; @@ -47,13 +51,8 @@ import org.hisp.dhis.system.util.MathUtils; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.user.User; -import org.hisp.dhis.user.UserSettingService; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - /** * @author Jan Henrik Overland */ @@ -121,13 +120,6 @@ this.periodService = periodService; } - private UserSettingService userSettingService; - - public void setUserSettingService( UserSettingService userSettingService ) - { - this.userSettingService = userSettingService; - } - private AggregatedDataValueService aggregatedDataValueService; public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService ) @@ -569,10 +561,15 @@ return mapView; } + public Collection getSystemAndUserMapViews() + { + User user = currentUserService.getCurrentUser(); + + return mapViewStore.getSystemAndUserMapViews( user ); + } + public Collection getAllMapViews() { - User user = currentUserService.getCurrentUser(); - Collection mapViews = mapViewStore.getAll(); if ( mapViews.size() > 0 ) === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java' --- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java 2012-03-22 12:34:46 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java 2012-04-29 18:04:08 +0000 @@ -45,6 +45,14 @@ implements MapViewStore { @SuppressWarnings( "unchecked" ) + public Collection getSystemAndUserMapViews( User user ) + { + return getCriteria( + Restrictions.or( Restrictions.isNull( "user" ), + Restrictions.eq( "user", user ) ) ).list(); + } + + @SuppressWarnings( "unchecked" ) public Collection getMapViewsByMapSourceType( String mapSourceType ) { Session session = sessionFactory.getCurrentSession(); === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-03-22 12:34:46 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-04-29 18:04:08 +0000 @@ -14,12 +14,10 @@ - - === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java 2012-04-29 18:04:08 +0000 @@ -72,7 +72,7 @@ public String execute() { - object = new ArrayList( mappingService.getAllMapViews() ); + object = new ArrayList( mappingService.getSystemAndUserMapViews() ); Collections.sort( object, new MapViewNameComparator() );