← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 185: Javadoc for MappingService.java and MappingStore.java.

 

------------------------------------------------------------
revno: 185
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-04-16 17:30:49 +0200
message:
  Javadoc for MappingService.java and MappingStore.java.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java

=== 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	2009-04-06 18:55:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2009-04-16 15:30:49 +0000
@@ -42,37 +42,204 @@
     // Map
     // -------------------------------------------------------------------------
 
+    /**
+     * Adds a Map.
+     * 
+     * @param map, the Map to add.
+     * @return a generated unique id of the added Map.
+     */
     int addMap( Map map );
 
+    /**
+     * Adds a Map.
+     * 
+     * @param mapLayerPath, the link to Geoserver.
+     * @param organisationUnitId, the id of the organisation unit.
+     * @param organisationUnitLevelId, the level of the organisation units into
+     *        which the map is devided.
+     * @param uniqueColumn, the shapefile column which holds the unique
+     *        organisation unit value.
+     * @param nameColumn, the shapefile column which holds the name of the
+     *        organisation unit.
+     * @param longitude
+     * @param latitude
+     * @param zoom
+     * @return a generated unique id of the added Map.
+     */
+    int addMap( String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
+        String nameColumn, String longitude, String latitude, int zoom );
+
+    /**
+     * Adds a map. If a map with the same mapLayerPath already exists, the map
+     * will be updated.
+     * 
+     * @param mapLayerPath, the link to Geoserver.
+     * @param organisationUnitId, the id of the organisation unit.
+     * @param organisationUnitLevelId, the level of the organisation units into
+     *        which the map is devided.
+     * @param uniqueColumn, the shapefile column which holds the unique
+     *        organisation unit value.
+     * @param nameColumn, the shapefile column which holds the name of the
+     *        organisation unit.
+     * @param longitude
+     * @param latitude
+     * @param zoom
+     */
+    void addOrUpdateMap( String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
+        String nameColumn, String longitude, String latitude, int zoom );
+
+    /**
+     * Updates a Map.
+     * 
+     * @param map, the Map to update.
+     */
     void updateMap( Map map );
 
+    /**
+     * Deletes a Map.
+     * 
+     * @param map, the Map to delete.
+     */
     void deleteMap( Map map );
 
+    /**
+     * Returns the Map with the given id.
+     * 
+     * @param id, the id of the map.
+     * @return the Map with the given id.
+     */
     Map getMap( int id );
-    
+
+    /**
+     * Returns the Map with the given map layer path.
+     * 
+     * @param id, the id of the map.
+     * @return a Map.
+     */
     Map getMapByMapLayerPath( String mapLayerPath );
 
+    /**
+     * Returns a Collection of all Maps.
+     * 
+     * @return a Collection of all Maps.
+     */
     Collection<Map> getAllMaps();
-    
+
+    /**
+     * Returns a Collection of all Maps at the given level.
+     * 
+     * @param organisationUnitLevel, the organisation unit level to return maps
+     *        at.
+     * @return a Collection with all Maps at the given level.
+     */
     Collection<Map> getMapsAtLevel( OrganisationUnitLevel organisationUnitLevel );
 
     // -------------------------------------------------------------------------
     // MapOrganisationUnitRelation
     // -------------------------------------------------------------------------
 
+    /**
+     * Adds a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        add.
+     * @return a generated unique id of the added MapOrganisationUnitRelation.
+     */
     int addMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
 
+    /**
+     * Adds a MapOrganisationUnitRelation.
+     * 
+     * @param mapLayerPath, the map the MapOrganisationUnitRelation should be
+     *        added to.
+     * @param organisationUnitId, an organisation unit in the database.
+     * @param featureId, the id of an organisation unit in the shapefile.
+     * @return a generated unique id of the added MapOrganisationUnitRelation.
+     */
+    int addMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId );
+
+    /**
+     * Adds a MapOrganisationUnitRelation. If it already exists, it will be
+     * updated.
+     * 
+     * @param mapLayerPath, the map the MapOrganisationUnitRelation should be
+     *        added to.
+     * @param organisationUnitId, an organisation unit in the database.
+     * @param featureId, the id of an organisation unit in the shapefile.
+     * @return a generated unique id of the added MapOrganisationUnitRelation.
+     */
+    void addOrUpdateMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId );
+
+    /**
+     * Updates a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        update.
+     */
     void updateMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
 
+    /**
+     * Deletes a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        delete.
+     */
     void deleteMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
-    
+
+    /**
+     * Returns a MapOrganisationUnitRelation.
+     * 
+     * @param id, the id of the returned MapOrganisationUnitRelation.
+     * @return the MapOrganisationUnitRelation with the given id.
+     */
     MapOrganisationUnitRelation getMapOrganisationUnitRelation( int id );
-    
+
+    /**
+     * Returns a MapOrganisationUnitRelation.
+     * 
+     * @param map, the foreign Map in the MapOrganisationUnitRelation.
+     * @param map, the foreign OrganisationUnit in the
+     *        MapOrganisationUnitRelation.
+     * @return the MapOrganisationUnitRelation which contains the given Map and
+     *         OrganisationUnit.
+     */
     MapOrganisationUnitRelation getMapOrganisationUnitRelation( Map map, OrganisationUnit organisationUnit );
-    
+
+    /**
+     * Returns a Collection of MapOrganisationUnitRelations.
+     * 
+     * @return a Collection of all MapOrganisationUnitRelations.
+     */
     Collection<MapOrganisationUnitRelation> getAllMapOrganisationUnitRelations();
-    
+
+    /**
+     * Returns a Collection of all MapOrganisationUnitRelations connected to the
+     * given Map.
+     * 
+     * @param map, the Map to which the MapOrganisationUnitRelations are
+     *        connected.
+     * @return a Collection of MapOrganisationUnitRelations connected to the
+     *         given Map.
+     */
     Collection<MapOrganisationUnitRelation> getMapOrganisationUnitRelationByMap( Map map );
-    
+
+    /**
+     * Returns a Collection of all existing MapOrganisationUnitRelations and the
+     * MapOrganisationUnitRelations that are not yet created (no featureId).
+     * 
+     * @param map, the Map to which the MapOrganisationUnitRelations are
+     *        connected.
+     * @return a Collection of MapOrganisationUnitRelations.
+     */
     Collection<MapOrganisationUnitRelation> getAvailableMapOrganisationUnitRelations( Map map );
+
+    /**
+     * Returns a Collection of all existing MapOrganisationUnitRelations and the
+     * MapOrganisationUnitRelations that are not yet created (no featureId).
+     * 
+     * @param mapLayerPath, the map to which the MapOrganisationUnitRelations
+     *        are connected.
+     * @return a Collection of MapOrganisationUnitRelations.
+     */
+    Collection<MapOrganisationUnitRelation> getAvailableMapOrganisationUnitRelations( String mapLayerPath );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java	2009-04-06 18:55:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java	2009-04-16 15:30:49 +0000
@@ -42,35 +42,123 @@
     // Map
     // -------------------------------------------------------------------------
 
+    /**
+     * Adds a Map.
+     * 
+     * @param map, the Map to add.
+     * @return a generated unique id of the added Map.
+     */
     int addMap( Map map );
 
+    /**
+     * Updates a Map.
+     * 
+     * @param map, the Map to update.
+     */
     void updateMap( Map map );
 
+    /**
+     * Deletes a Map.
+     * 
+     * @param map, the Map to delete.
+     */
     void deleteMap( Map map );
 
+    /**
+     * Returns the Map with the given id.
+     * 
+     * @param id, the id of the map.
+     * @return the Map with the given id.
+     */
     Map getMap( int id );
-    
+
+    /**
+     * Returns the Map with the given map layer path.
+     * 
+     * @param id, the id of the map.
+     * @return a Map.
+     */
     Map getMapByMapLayerPath( String mapLayerPath );
 
+    /**
+     * Returns a Collection of all Maps.
+     * 
+     * @return a Collection of all Maps.
+     */
     Collection<Map> getAllMaps();
-    
+
+    /**
+     * Returns a Collection of all Maps at the given level.
+     * 
+     * @param organisationUnitLevel, the organisation unit level to return maps
+     *        at.
+     * @return a Collection with all Maps at the given level.
+     */
     Collection<Map> getMapsAtLevel( OrganisationUnitLevel organisationUnitLevel );
     
     // -------------------------------------------------------------------------
     // MapOrganisationUnitRelation
     // -------------------------------------------------------------------------
 
+    /**
+     * Adds a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        add.
+     * @return a generated unique id of the added MapOrganisationUnitRelation.
+     */
     int addMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
 
+    /**
+     * Updates a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        update.
+     */
     void updateMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
 
+    /**
+     * Deletes a MapOrganisationUnitRelation.
+     * 
+     * @param mapOrganisationUnitRelation, the MapOrganisationUnitRelation to
+     *        delete.
+     */
     void deleteMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation );
     
+    /**
+     * Returns a MapOrganisationUnitRelation.
+     * 
+     * @param id, the id of the returned MapOrganisationUnitRelation.
+     * @return the MapOrganisationUnitRelation with the given id.
+     */
     MapOrganisationUnitRelation getMapOrganisationUnitRelation( int id );
-    
+
+    /**
+     * Returns a MapOrganisationUnitRelation.
+     * 
+     * @param map, the foreign Map in the MapOrganisationUnitRelation.
+     * @param map, the foreign OrganisationUnit in the
+     *        MapOrganisationUnitRelation.
+     * @return the MapOrganisationUnitRelation which contains the given Map and
+     *         OrganisationUnit.
+     */
     MapOrganisationUnitRelation getMapOrganisationUnitRelation( Map map, OrganisationUnit organisationUnit );
     
+    /**
+     * Returns a Collection of MapOrganisationUnitRelations.
+     * 
+     * @return a Collection of all MapOrganisationUnitRelations.
+     */
     Collection<MapOrganisationUnitRelation> getAllMapOrganisationUnitRelations();
     
+    /**
+     * Returns a Collection of all MapOrganisationUnitRelations connected to the
+     * given Map.
+     * 
+     * @param map, the Map to which the MapOrganisationUnitRelations are
+     *        connected.
+     * @return a Collection of MapOrganisationUnitRelations connected to the
+     *         given Map.
+     */
     Collection<MapOrganisationUnitRelation> getMapOrganisationUnitRelationByMap( Map map );
 }

=== 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	2009-04-16 14:10:22 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-04-16 15:30:49 +0000
@@ -53,14 +53,14 @@
     {
         this.mappingService = mappingService;
     }
-    
+
     private MappingStore mappingStore;
 
     public void setMappingStore( MappingStore mappingStore )
     {
         this.mappingStore = mappingStore;
     }
-    
+
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -81,36 +81,6 @@
         return mappingStore.addMap( map );
     }
 
-    public void updateMap( Map map )
-    {
-        mappingStore.updateMap( map );
-    }
-
-    public void deleteMap( Map map )
-    {
-        mappingStore.deleteMap( map );
-    }
-
-    public Map getMap( int id )
-    {
-        return mappingStore.getMap( id );
-    }
-    
-    public Map getMapByMapLayerPath( String mapLayerPath )
-    {
-        return mappingStore.getMapByMapLayerPath( mapLayerPath );
-    }
-
-    public Collection<Map> getAllMaps()
-    {
-        return mappingStore.getAllMaps();
-    }
-
-    public Collection<Map> getMapsAtLevel( OrganisationUnitLevel organisationUnitLevel )
-    {
-        return mappingStore.getMapsAtLevel( organisationUnitLevel );
-    }
-    
     public int addMap( String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
         String nameColumn, String longitude, String latitude, int zoom )
     {
@@ -159,14 +129,44 @@
             mappingService.addMap( map );
         }
     }
-    
+
+    public void updateMap( Map map )
+    {
+        mappingStore.updateMap( map );
+    }
+
+    public void deleteMap( Map map )
+    {
+        mappingStore.deleteMap( map );
+    }
+
     public void deleteMapByMapLayerPath( String mapLayerPath )
     {
         Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
-        
+
         mappingService.deleteMap( map );
     }
-    
+
+    public Map getMap( int id )
+    {
+        return mappingStore.getMap( id );
+    }
+
+    public Map getMapByMapLayerPath( String mapLayerPath )
+    {
+        return mappingStore.getMapByMapLayerPath( mapLayerPath );
+    }
+
+    public Collection<Map> getAllMaps()
+    {
+        return mappingStore.getAllMaps();
+    }
+
+    public Collection<Map> getMapsAtLevel( OrganisationUnitLevel organisationUnitLevel )
+    {
+        return mappingStore.getMapsAtLevel( organisationUnitLevel );
+    }
+
     // -------------------------------------------------------------------------
     // MapOrganisationUnitRelation
     // -------------------------------------------------------------------------
@@ -176,6 +176,41 @@
         return mappingStore.addMapOrganisationUnitRelation( mapOrganisationUnitRelation );
     }
 
+    public int addMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId )
+    {
+        Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
+
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+        MapOrganisationUnitRelation mapOrganisationUnitRelation = new MapOrganisationUnitRelation( map,
+            organisationUnit, featureId );
+
+        return mappingService.addMapOrganisationUnitRelation( mapOrganisationUnitRelation );
+    }
+
+    public void addOrUpdateMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId )
+    {
+        Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
+
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+        MapOrganisationUnitRelation mapOrganisationUnitRelation = mappingService.getMapOrganisationUnitRelation( map,
+            organisationUnit );
+
+        if ( mapOrganisationUnitRelation != null )
+        {
+            mapOrganisationUnitRelation.setFeatureId( featureId );
+
+            mappingService.updateMapOrganisationUnitRelation( mapOrganisationUnitRelation );
+        }
+        else
+        {
+            mapOrganisationUnitRelation = new MapOrganisationUnitRelation( map, organisationUnit, featureId );
+
+            mappingService.addMapOrganisationUnitRelation( mapOrganisationUnitRelation );
+        }
+    }
+
     public void updateMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation )
     {
         mappingStore.updateMapOrganisationUnitRelation( mapOrganisationUnitRelation );
@@ -190,7 +225,7 @@
     {
         return mappingStore.getMapOrganisationUnitRelation( id );
     }
-    
+
     public MapOrganisationUnitRelation getMapOrganisationUnitRelation( Map map, OrganisationUnit organisationUnit )
     {
         return mappingStore.getMapOrganisationUnitRelation( map, organisationUnit );
@@ -205,57 +240,23 @@
     {
         return mappingStore.getMapOrganisationUnitRelationByMap( map );
     }
-    
+
     public Collection<MapOrganisationUnitRelation> getAvailableMapOrganisationUnitRelations( Map map )
     {
-        Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( map.getOrganisationUnitLevel().getLevel() );
-        
+        Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( map
+            .getOrganisationUnitLevel().getLevel() );
+
         Collection<MapOrganisationUnitRelation> relations = new ArrayList<MapOrganisationUnitRelation>();
-        
+
         for ( OrganisationUnit unit : organisationUnits )
         {
             MapOrganisationUnitRelation relation = getMapOrganisationUnitRelation( map, unit );
-            
+
             relations.add( relation != null ? relation : new MapOrganisationUnitRelation( map, unit, null ) );
         }
-        
+
         return relations;
     }
-    
-    public int addMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId )
-    {
-        Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
-
-        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
-
-        MapOrganisationUnitRelation mapOrganisationUnitRelation = new MapOrganisationUnitRelation( map,
-            organisationUnit, featureId );
-
-        return mappingService.addMapOrganisationUnitRelation( mapOrganisationUnitRelation );
-    }
-
-    public void addOrUpdateMapOrganisationUnitRelation( String mapLayerPath, int organisationUnitId, String featureId )
-    {
-        Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
-
-        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
-
-        MapOrganisationUnitRelation mapOrganisationUnitRelation = mappingService.getMapOrganisationUnitRelation( map,
-            organisationUnit );
-
-        if ( mapOrganisationUnitRelation != null )
-        {
-            mapOrganisationUnitRelation.setFeatureId( featureId );
-
-            mappingService.updateMapOrganisationUnitRelation( mapOrganisationUnitRelation );
-        }
-        else
-        {
-            mapOrganisationUnitRelation = new MapOrganisationUnitRelation( map, organisationUnit, featureId );
-
-            mappingService.addMapOrganisationUnitRelation( mapOrganisationUnitRelation );
-        }
-    }
 
     public Collection<MapOrganisationUnitRelation> getAvailableMapOrganisationUnitRelations( String mapLayerPath )
     {



--
Trunk
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.