Revision 9192
Added by Jing Tao over 9 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
2125 | 2125 |
} |
2126 | 2126 |
} |
2127 | 2127 |
|
2128 |
/** |
|
2129 |
* Update the system metadata of the specified pid. |
|
2130 |
*/ |
|
2131 |
@Override |
|
2132 |
public boolean updateSystemMetadata(Session session, Identifier pid, |
|
2133 |
SystemMetadata sysmeta) throws NotImplemented, NotAuthorized, |
|
2134 |
ServiceFailure, InvalidRequest, InvalidSystemMetadata, InvalidToken { |
|
2135 |
if(sysmeta == null) { |
|
2136 |
throw new InvalidRequest("4863", "The system metadata object should NOT be null in the updateSystemMetadata request."); |
|
2137 |
} |
|
2138 |
if(pid == null || pid.getValue() == null) { |
|
2139 |
throw new InvalidRequest("4863", "Please specify the id in the updateSystemMetadata request ") ; |
|
2140 |
} |
|
2141 |
|
|
2142 |
if (session == null) { |
|
2143 |
//TODO: many of the thrown exceptions do not use the correct error codes |
|
2144 |
//check these against the docs and correct them |
|
2145 |
throw new NotAuthorized("4861", "No Session - could not authorize for updating system metadata." + |
|
2146 |
" If you are not logged in, please do so and retry the request."); |
|
2147 |
} else { |
|
2148 |
//only CN is allwoed |
|
2149 |
if(!isCNAdmin(session)) { |
|
2150 |
throw new NotAuthorized("4861", "The client -"+ session.getSubject().getValue()+ "is not authorized for updating the system metadata of the object "+pid.getValue()); |
|
2151 |
} |
|
2152 |
} |
|
2153 |
//update the system metadata locally |
|
2154 |
boolean success = super.updateSystemMetadata(session, pid, sysmeta); |
|
2155 |
return success; |
|
2156 |
} |
|
2157 |
|
|
2128 | 2158 |
@Override |
2129 | 2159 |
public boolean synchronize(Session session, Identifier pid) throws NotAuthorized, InvalidRequest, NotImplemented{ |
2130 | 2160 |
throw new NotImplemented("0000", "CN query services are not implemented in Metacat."); |
Also available in: Unified diff
Add a new method -updateSystemMetadata. It only can be called by CNs.