Revision 8629
Added by Peter Slaughter almost 11 years ago
src/edu/ucsb/nceas/metacat/MetacatHandler.java | ||
---|---|---|
3392 | 3392 |
SystemMetadata mnSysMeta = null; |
3393 | 3393 |
Session session = null; |
3394 | 3394 |
Identifier pid = new Identifier(); |
3395 |
String guid = null; |
|
3395 | 3396 |
AccessPolicy mnAccessPolicy = null; |
3396 | 3397 |
SystemMetadata cnSysMeta = null; |
3397 | 3398 |
|
... | ... | |
3410 | 3411 |
"?action=setaccess&docid=<doc_id>&accessBlock=<access_section>"); |
3411 | 3412 |
outputResponse(successList, errorList, out); |
3412 | 3413 |
return; |
3414 |
} else { |
|
3415 |
// look-up pid assuming docid |
|
3416 |
guid = docList[0]; |
|
3417 |
try { |
|
3418 |
String docid = DocumentUtil.getDocIdFromAccessionNumber(docList[0]); |
|
3419 |
int rev = DocumentUtil.getRevisionFromAccessionNumber(docList[0]); |
|
3420 |
guid = IdentifierManager.getInstance().getGUID(docid, rev); |
|
3421 |
} catch (McdbDocNotFoundException e) { |
|
3422 |
// log the warning |
|
3423 |
logMetacat.warn("No pid found for [assumed] docid: " + docList[0]); |
|
3424 |
} catch (Exception e) { |
|
3425 |
logMetacat.warn("Error looking up pid for [assumed] dociid: " + docList[0]); |
|
3426 |
} |
|
3413 | 3427 |
} |
3414 | 3428 |
try { |
3415 | 3429 |
AccessControlForSingleFile accessControl = |
... | ... | |
3420 | 3434 |
docList[0]); |
3421 | 3435 |
|
3422 | 3436 |
// force hazelcast to update system metadata |
3423 |
HazelcastService.getInstance().refreshSystemMetadataEntry(docList[0]);
|
|
3437 |
HazelcastService.getInstance().refreshSystemMetadataEntry(guid);
|
|
3424 | 3438 |
|
3425 | 3439 |
// Update the CN with the modified access policy |
3426 |
logMetacat.debug("Setting CN access policy for pid: " + docList[0]);
|
|
3440 |
logMetacat.debug("Setting CN access policy for pid: " + guid);
|
|
3427 | 3441 |
|
3428 | 3442 |
try { |
3429 |
ArrayList<String> guids = new ArrayList<String>(Arrays.asList(docList[0]));
|
|
3443 |
ArrayList<String> guids = new ArrayList<String>(Arrays.asList(guid));
|
|
3430 | 3444 |
SyncAccessPolicy syncAP = new SyncAccessPolicy(); |
3431 | 3445 |
|
3432 |
logMetacat.debug("Trying to syncing access policy for pids: "
|
|
3433 |
+ docList[0]);
|
|
3446 |
logMetacat.debug("Trying to syncing access policy for pid: " |
|
3447 |
+ guid);
|
|
3434 | 3448 |
syncAP.sync(guids); |
3435 | 3449 |
} catch (Exception e) { |
3436 |
logMetacat.error("Error syncing pids: " + docList[0]
|
|
3450 |
logMetacat.error("Error syncing pid: " + guid
|
|
3437 | 3451 |
+ " Exception " + e.getMessage()); |
3438 | 3452 |
e.printStackTrace(System.out); |
3439 | 3453 |
} |
... | ... | |
3570 | 3584 |
} |
3571 | 3585 |
} |
3572 | 3586 |
// force hazelcast to update system metadata |
3573 |
HazelcastService.getInstance().refreshSystemMetadataEntry(docList[0]);
|
|
3587 |
HazelcastService.getInstance().refreshSystemMetadataEntry(guid);
|
|
3574 | 3588 |
|
3575 |
logMetacat.debug("Setting CN access policy for pid: " + docList[0]);
|
|
3589 |
logMetacat.debug("Setting CN access policy for pid: " + guid);
|
|
3576 | 3590 |
|
3577 | 3591 |
try { |
3578 |
ArrayList<String> guids = new ArrayList<String>(Arrays.asList(docList[0]));
|
|
3592 |
ArrayList<String> guids = new ArrayList<String>(Arrays.asList(guid));
|
|
3579 | 3593 |
SyncAccessPolicy syncAP = new SyncAccessPolicy(); |
3580 | 3594 |
|
3581 | 3595 |
logMetacat.debug("Trying to syncing access policy for pids: " |
3582 |
+ docList[0]);
|
|
3596 |
+ guid);
|
|
3583 | 3597 |
syncAP.sync(guids); |
3584 | 3598 |
} catch (Exception e) { |
3585 |
logMetacat.error("Error syncing pids: " + docList[0]
|
|
3599 |
logMetacat.error("Error syncing pids: " + guid
|
|
3586 | 3600 |
+ " Exception " + e.getMessage()); |
3587 | 3601 |
e.printStackTrace(System.out); |
3588 | 3602 |
} |
Also available in: Unified diff
setAccessAction: get guid from passed in id for calls to SyncAccessPolicy, HazelcastService.refreshSystemMetadataEntry