Changeset 11709 in josm for trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
- Timestamp:
- 2017-03-09T22:49:28+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r11632 r11709 100 100 101 101 /** 102 * Upload policy. 103 * 104 * Determines if upload to the OSM server is intended, discouraged, or 105 * disabled / blocked. 106 */ 107 public enum UploadPolicy { 108 /** 109 * Normal dataset, upload intended. 110 */ 111 NORMAL("true"), 112 /** 113 * Upload discouraged, for example when using or distributing a private dataset. 114 */ 115 DISCOURAGED("false"), 116 /** 117 * Upload blocked. 118 * Upload options completely disabled. Intended for special cases 119 * where a warning dialog is not enough, see #12731. 120 * 121 * For the user, it shouldn't be too easy to disable this flag. 122 */ 123 BLOCKED("never"); 124 125 String xml_flag; 126 127 private UploadPolicy(String xml_flag) { 128 this.xml_flag = xml_flag; 129 } 130 131 /** 132 * Get the corresponding value of the <code>upload='...'</code> XML-attribute 133 * in the .osm file. 134 * @return value of the <code>upload</code> attribute 135 */ 136 public String getXmlFlag() { 137 return xml_flag; 138 } 139 }; 140 141 /** 102 142 * Maximum number of events that can be fired between beginUpdate/endUpdate to be send as single events (ie without DatasetChangedEvent) 103 143 */ … … 124 164 private int highlightUpdateCount; 125 165 126 private boolean uploadDiscouraged;166 private UploadPolicy uploadPolicy; 127 167 128 168 private final ReadWriteLock lock = new ReentrantReadWriteLock(); … … 300 340 301 341 /** 302 * Determines if upload is being discouraged (i.e. this dataset contains private data which should not be uploaded) 342 * Determines if upload is being discouraged. 343 * (i.e. this dataset contains private data which should not be uploaded) 303 344 * @return {@code true} if upload is being discouraged, {@code false} otherwise 304 345 * @see #setUploadDiscouraged 305 */ 346 * @deprecated use {@link #getUploadPolicy()} 347 */ 348 @Deprecated 306 349 public boolean isUploadDiscouraged() { 307 return upload Discouraged;350 return uploadPolicy == UploadPolicy.DISCOURAGED || uploadPolicy == UploadPolicy.BLOCKED; 308 351 } 309 352 … … 312 355 * @param uploadDiscouraged {@code true} if this dataset contains private data which should not be uploaded 313 356 * @see #isUploadDiscouraged 314 */ 357 * @deprecated use {@link #setUploadPolicy(UploadPolicy)} 358 */ 359 @Deprecated 315 360 public void setUploadDiscouraged(boolean uploadDiscouraged) { 316 this.uploadDiscouraged = uploadDiscouraged; 361 if (uploadPolicy != UploadPolicy.BLOCKED) { 362 this.uploadPolicy = uploadDiscouraged ? UploadPolicy.DISCOURAGED : UploadPolicy.NORMAL; 363 } 364 } 365 366 /** 367 * Get the upload policy. 368 * @return the upload policy 369 * @see #setUploadPolicy(UploadPolicy) 370 */ 371 public UploadPolicy getUploadPolicy() { 372 return this.uploadPolicy; 373 } 374 375 /** 376 * Sets the upload policy. 377 * @param uploadPolicy the upload policy 378 * @see #getUploadPolicy() 379 */ 380 public void setUploadPolicy(UploadPolicy uploadPolicy) { 381 this.uploadPolicy = uploadPolicy; 317 382 } 318 383
Note:
See TracChangeset
for help on using the changeset viewer.