Project

General

Profile

« Previous | Next » 

Revision 8610

Change isEqual to private so it can be used by test suite

View differences:

src/edu/ucsb/nceas/metacat/dataone/SyncAccessPolicy.java
66 66
import edu.ucsb.nceas.metacat.admin.AdminException;
67 67
import edu.ucsb.nceas.metacat.properties.PropertyService;
68 68
import edu.ucsb.nceas.metacat.shared.ServiceException;
69
import edu.ucsb.nceas.utilities.GeneralPropertyException;
69 70
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
70 71
import edu.ucsb.nceas.utilities.SortedProperties;
71 72

  
......
171 172
									+ serialVersion.toString());
172 173
					cn.setAccessPolicy(session, pid, mnAccessPolicy,
173 174
							serialVersion.longValue());
174
					logMetacat.debug("Successfully set access policy");
175
					logMetacat.debug("Successfully set access policy for pid: " + pid.getValue());
175 176
					// Add this pid to the list of pids that were successfully
176 177
					// synced
177 178
					syncedIds.add(pid);
......
203 204
			} else {
204 205
				logMetacat.warn("Skipping pid: " + pid.getValue());
205 206
			}
206
			logMetacat.debug("Done syncing access policy for pid: "
207
			logMetacat.debug("Done checking access policy for pid: "
207 208
					+ pid.getValue());
208 209
		}
209 210

  
......
307 308

  
308 309
		@Override
309 310
		public void run() {
311
			
310 312
			// For the following query parameters - null indicates that the
311 313
			// query
312 314
			// will not be
......
316 318
			ObjectFormatIdentifier objectFormatId = null;
317 319
			Boolean replicaStatus = false; // return only pids for which this mn
318 320
											// is
319

  
320 321
			ObjectList objsToSync = null;
321 322
			Integer count = 0;
322 323
			Integer start = 0;
323 324
			Integer total = 0;
324 325
			List<Identifier> tmpIds = null;
326
			// If even one sync error encounted, don't set property that will disable
327
			// "syncAll" button in admin/replication web page.
328
			boolean syncError = false;
325 329
			List<Identifier> syncedIds = new ArrayList<Identifier>();
326

  
330
						
327 331
			try {
328 332
				count = Integer.valueOf(PropertyService
329 333
						.getProperty("database.webResultsetSize"));
......
379 383
									objectFormatId, replicaStatus, start, count);
380 384
				} catch (Exception e) {
381 385
					logMetacat.error("Error syncing ids");
386
					syncError = true;
382 387
					break;
383 388
				}
384 389
			}
385 390
			logMetacat
386 391
					.debug("syncTask thread completed. Number of guids synced: "
387 392
							+ syncedIds.size());
393
			if (!syncError) {
394
				try {
395
					PropertyService.setProperty(
396
							"dataone.syncaccesspolicies.synced",
397
							Boolean.TRUE.toString());
398
				} catch (GeneralPropertyException e) {
399
					logMetacat
400
							.error("Unable to update property dataone.syncaccesspolicies.synced=true");
401
				}
402
			}
388 403
		}
389
        //PropertyService.setProperty("dataone.systemmetadata.generated", Boolean.TRUE.toString());
390

  
391 404
	}
392 405

  
393 406
	/**
......
399 412
	 *            - second access policy in the comparison
400 413
	 * @return boolean - true if access policies are equivalent
401 414
	 */
402
	private boolean isEqual(AccessPolicy ap1, AccessPolicy ap2) {
415
	public boolean isEqual(AccessPolicy ap1, AccessPolicy ap2) {
403 416

  
404 417
		// Access Policy -> Access Rule -> (Subject, Permission)
405 418
		// i.e. Subject="slaughter", Permission="read,write,changePermission"

Also available in: Unified diff