Ignore:
Timestamp:
2014-10-18T15:31:53+02:00 (10 years ago)
Author:
donvip
Message:

[josm_opendata] fix some sonar issues

Location:
applications/editors/josm/plugins/opendata/modules/be.bruxelles/src/org/openstreetmap/josm/plugins/opendata/modules/be/bruxelles
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/modules/be.bruxelles/src/org/openstreetmap/josm/plugins/opendata/modules/be/bruxelles/BruxellesConstants.java

    r30563 r30731  
    44
    55public interface BruxellesConstants {
    6        
    7         /**
    8         * Source
    9         */
    10         public static final String SOURCE_BRUXELLES = "Ville de Bruxelles";
    11        
    12         /**
    13         * Portal
    14         */
    15         public static final String PORTAL_EN = "http://www.brussels.be";
    16         public static final String PORTAL_FR = "http://www.bruxelles.be";
    17         public static final String PORTAL_NL = "http://www.brussel.be";
     6   
     7    /**
     8    * Source
     9    */
     10    public static final String SOURCE_BRUXELLES = "Ville de Bruxelles";
     11   
     12    /**
     13    * Portal
     14    */
     15    public static final String PORTAL_EN = "http://www.brussels.be";
     16    public static final String PORTAL_FR = "http://www.bruxelles.be";
     17    public static final String PORTAL_NL = "http://www.brussel.be";
    1818}
  • applications/editors/josm/plugins/opendata/modules/be.bruxelles/src/org/openstreetmap/josm/plugins/opendata/modules/be/bruxelles/BruxellesModule.java

    r30340 r30731  
    88public class BruxellesModule extends AbstractModule {
    99
    10         public BruxellesModule(ModuleInformation info) {
    11                 super(info);
    12                 handlers.add(BDHandler.class);
     10    public BruxellesModule(ModuleInformation info) {
     11        super(info);
     12        handlers.add(BDHandler.class);
    1313    }
    1414}
  • applications/editors/josm/plugins/opendata/modules/be.bruxelles/src/org/openstreetmap/josm/plugins/opendata/modules/be/bruxelles/datasets/BruxellesDataSetHandler.java

    r30340 r30731  
    1111
    1212public abstract class BruxellesDataSetHandler extends BelgianDataSetHandler implements BruxellesConstants {
    13        
    14         private Integer localPortalId;
    15        
    16         public BruxellesDataSetHandler() {
    17                 init(null, null);
    18         }
     13   
     14    private Integer localPortalId;
     15   
     16    public BruxellesDataSetHandler() {
     17        init(null, null);
     18    }
    1919
    20         public BruxellesDataSetHandler(Integer portalId) {
    21                 init(portalId, null);
    22         }
     20    public BruxellesDataSetHandler(Integer portalId) {
     21        init(portalId, null);
     22    }
    2323
    24         public BruxellesDataSetHandler(Integer portalId, Projection singleProjection) {
    25                 init(portalId, singleProjection);
    26         }
     24    public BruxellesDataSetHandler(Integer portalId, Projection singleProjection) {
     25        init(portalId, singleProjection);
     26    }
    2727
    28         public BruxellesDataSetHandler(Integer portalId, Projection singleProjection, String relevantTag) {
    29                 super(relevantTag);
    30                 init(portalId, singleProjection);
    31         }
     28    public BruxellesDataSetHandler(Integer portalId, Projection singleProjection, String relevantTag) {
     29        super(relevantTag);
     30        init(portalId, singleProjection);
     31    }
    3232
    33         public BruxellesDataSetHandler(Integer portalId, String relevantTag) {
    34                 super(relevantTag);
    35                 init(portalId, null);
    36         }
     33    public BruxellesDataSetHandler(Integer portalId, String relevantTag) {
     34        super(relevantTag);
     35        init(portalId, null);
     36    }
    3737
    38         private void init(Integer portalId, Projection singleProjection) {
    39                 setSingleProjection(singleProjection);
    40                 this.localPortalId = portalId;
    41         }
     38    private void init(Integer portalId, Projection singleProjection) {
     39        setSingleProjection(singleProjection);
     40        this.localPortalId = portalId;
     41    }
    4242
    43         @Override
    44         public String getSource() {
    45                 return SOURCE_BRUXELLES;
    46         }
     43    @Override
     44    public String getSource() {
     45        return SOURCE_BRUXELLES;
     46    }
    4747
    48         @Override
    49         public URL getLocalPortalURL() {
    50                 String basePortal = null;
    51                 String lang = OdUtils.getJosmLanguage();
    52                        
    53                 if (lang.startsWith("fr")) {
    54                         basePortal = PORTAL_FR;
    55                 } else if (lang.startsWith("nl")) {
    56                         basePortal = PORTAL_NL;
    57                 } else {
    58                         basePortal = PORTAL_EN;
    59                 }
     48    @Override
     49    public URL getLocalPortalURL() {
     50        String basePortal = null;
     51        String lang = OdUtils.getJosmLanguage();
     52           
     53        if (lang.startsWith("fr")) {
     54            basePortal = PORTAL_FR;
     55        } else if (lang.startsWith("nl")) {
     56            basePortal = PORTAL_NL;
     57        } else {
     58            basePortal = PORTAL_EN;
     59        }
    6060
    61                 try {
    62                         return new URL(basePortal + "/artdet.cfm?id=" + localPortalId);
    63                 } catch (MalformedURLException e) {
    64                         e.printStackTrace();
    65                         return null;
    66                 }
    67         }
     61        try {
     62            return new URL(basePortal + "/artdet.cfm?id=" + localPortalId);
     63        } catch (MalformedURLException e) {
     64            e.printStackTrace();
     65            return null;
     66        }
     67    }
    6868}
  • applications/editors/josm/plugins/opendata/modules/be.bruxelles/src/org/openstreetmap/josm/plugins/opendata/modules/be/bruxelles/datasets/culture/BDHandler.java

    r30340 r30731  
    88public class BDHandler extends BruxellesDataSetHandler {
    99
    10         public BDHandler() {
    11                 getCsvHandler().setSeparator(",");
    12         }
    13        
    14         @Override
    15         public boolean acceptsFilename(String filename) {
    16                 return acceptsCsvFilename(filename, "textfile");
    17         }
     10    public BDHandler() {
     11        getCsvHandler().setSeparator(",");
     12    }
     13   
     14    @Override
     15    public boolean acceptsFilename(String filename) {
     16        return acceptsCsvFilename(filename, "textfile");
     17    }
    1818
    19         @Override
    20         public void updateDataSet(DataSet ds) {
    21                 for (Node n : ds.getNodes()) {
    22                         n.put("tourism", "artwork");
    23                         replace(n, "Description", "name");
    24                 }
    25         }
     19    @Override
     20    public void updateDataSet(DataSet ds) {
     21        for (Node n : ds.getNodes()) {
     22            n.put("tourism", "artwork");
     23            replace(n, "Description", "name");
     24        }
     25    }
    2626}
Note: See TracChangeset for help on using the changeset viewer.