Revision 41333

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/persistence/serverData/ServerDataPersistence.java
62 62
	 */
63 63
	public ServerDataPersistence(String serviceType) {
64 64
		this.serviceType = serviceType;
65
		serverList = new ArrayList<ServerData>();
65
		this.serverList = new ArrayList<ServerData>();
66 66
	}
67 67
	
68 68
	public ServerDataPersistence() {
69
            this.serverList = new ArrayList<ServerData>();
70
            this.serviceType = "UNKNOW";
69 71
	}
70 72

  
71 73
	/**
72
	 * This method adds a ServerData using the Andami
73
	 * persistence model. If the server exists just actualizes
74
	 * This method adds a ServerData using the Andami persistence model. 
75
         * If the server exists just actualizes
74 76
	 * the type and subtype fileds and changes the last access
75 77
	 * value to the current time.
78
         * 
76 79
	 * @param server
77
	 * ServerData
80
	 *          ServerData
78 81
	 */
79 82
	public void addServerData(ServerData server) {
80
		serverList.add(server);
83
            String address = server.getServerAddress();
84
            for (int i = 0; i < serverList.size(); i++) {
85
                ServerData sd = serverList.get(i);
86
                if(sd.getServerAddress().equals(address)) {
87
                    // Already exist, update  it
88
                    serverList.set(i, server);
89
                    return;
90
                }
91
            }
92
            // Add the new server
93
            serverList.add(server);
81 94
	}
82 95
	
83 96
	/**
......
163 176
		}
164 177
		return 0;
165 178
	}
179
        
180
        public boolean isEmpty() {
181
            if( serverList==null ) {
182
                return true;
183
            }
184
            return serverList.isEmpty();
185
        }
166 186
	
167 187
}

Also available in: Unified diff