Revision 46419 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java

View differences:

DefaultDataManager.java
172 172

  
173 173
    private ClassLoader resourcesLoader = null;
174 174

  
175
    private List<DataProfile> dataProfiles;
175
    private Map<String,DataProfile> dataProfiles;
176 176
    
177 177
    private final Map<String, DatabaseWorkspaceManager> databaseWorkspaces = new HashMap<>();
178 178
 
......
1171 1171
            return;
1172 1172
        }
1173 1173
        if( this.dataProfiles==null ) {
1174
            this.dataProfiles = new ArrayList<>();
1175
            this.dataProfiles.add(profile);
1176
            return;
1174
            this.dataProfiles = new HashMap<>();
1177 1175
        }
1178
        for (DataProfile theProfile : this.dataProfiles) {
1179
            if( theProfile.getID().equalsIgnoreCase(profile.getID()) ) {
1180
                return;
1181
            }
1182
        }
1183
        this.dataProfiles.add(profile);
1176
        this.dataProfiles.put(profile.getID().toLowerCase(), profile);
1184 1177
    }
1185 1178

  
1186 1179
    @Override
......
1188 1181
        if( this.dataProfiles==null ) {
1189 1182
            return null;
1190 1183
        }
1191
        return Collections.unmodifiableList(this.dataProfiles);
1184
        return Collections.unmodifiableList(new ArrayList<>(this.dataProfiles.values()));
1192 1185
    }
1193 1186

  
1194 1187
    @Override
......
1196 1189
        if( StringUtils.isBlank(name) ) {
1197 1190
            return null;
1198 1191
        }
1199
        for (DataProfile theProfile : this.dataProfiles) {
1200
            if( name.equalsIgnoreCase(theProfile.getName()) ) {
1201
                return theProfile;
1202
            }
1192
        if(this.dataProfiles == null){
1193
            return null;
1203 1194
        }
1204
        return null;
1195
        return this.dataProfiles.get(name.toLowerCase());
1205 1196
    }
1206 1197

  
1207 1198
    private StoresRepository storesRepository;

Also available in: Unified diff