Revision 9068
Added by Jing Tao over 9 years ago
D1NodeService.java | ||
---|---|---|
338 | 338 |
"permission to WRITE to the Node."); |
339 | 339 |
|
340 | 340 |
} |
341 |
|
|
342 |
// verify the pid is valid format |
|
343 |
if (!isValidIdentifier(pid)) { |
|
344 |
throw new InvalidRequest("1202", "The provided identifier is invalid."); |
|
345 |
} |
|
346 |
|
|
341 |
|
|
347 | 342 |
// verify that pid == SystemMetadata.getIdentifier() |
348 | 343 |
logMetacat.debug("Comparing pid|sysmeta_pid: " + |
349 | 344 |
pid.getValue() + "|" + sysmeta.getIdentifier().getValue()); |
... | ... | |
377 | 372 |
|
378 | 373 |
} |
379 | 374 |
|
380 |
// verify the sid in the system metadata |
|
381 |
Identifier sid = sysmeta.getSeriesId(); |
|
382 |
if(sid != null) { |
|
383 |
if (!isValidIdentifier(sid)) { |
|
384 |
throw new InvalidSystemMetadata("1180", "The provided series id is invalid."); |
|
385 |
} |
|
386 |
try { |
|
387 |
idExists = IdentifierManager.getInstance().identifierExists(sid.getValue()); |
|
388 |
} catch (SQLException e) { |
|
389 |
throw new ServiceFailure("1190", |
|
390 |
"The series identifier " + sid.getValue() + |
|
391 |
" in the system metadata couldn't be determined if it is unique since : "+e.getMessage()); |
|
392 |
} |
|
393 |
if (idExists) { |
|
394 |
throw new InvalidSystemMetadata("1180", |
|
395 |
"The series identifier " + sid.getValue() + |
|
396 |
" is already used by another object and" + |
|
397 |
"therefore can not be used for this object. Clients should choose" + |
|
398 |
"a new identifier that is unique and retry the operation or " + |
|
399 |
"use CN.reserveIdentifier() to reserve one."); |
|
400 |
|
|
401 |
} |
|
402 |
//the series id equals the pid (new pid hasn't been registered in the system, so IdentifierManager.getInstance().identifierExists method can't exclude this scenario ) |
|
403 |
if(sid.getValue().equals(pid.getValue())) { |
|
404 |
throw new InvalidSystemMetadata("1180", "The series id "+sid.getValue()+" in the system metadata shouldn't have the same value of the pid."); |
|
405 |
} |
|
406 |
} |
|
407 | 375 |
|
408 | 376 |
// TODO: this probably needs to be refined more |
409 | 377 |
try { |
Also available in: Unified diff
Moved the rules for the SID from D1NodeService.create to MNodeService.create.
Also moved the code to check the validation of an pid from D1NodeService.create to MNodeService.create, MNodeService.replicate and CNodeService.create.