Class SystemMetadataManager
java.lang.Object
edu.ucsb.nceas.metacat.systemmetadata.SystemMetadataManager
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic int
convertPermission
(org.dataone.service.types.v1.Permission permission) Utility method to convert a permission object to an integervoid
delete
(org.dataone.service.types.v1.Identifier id) Delete a system metadata record from the storevoid
delete
(org.dataone.service.types.v1.Identifier guid, DBConnection dbConn) Delete the system metadata for the given guid with the DBConnection objectorg.dataone.service.types.v2.SystemMetadata
get
(org.dataone.service.types.v1.Identifier pid) Get the system metadata associated with the given identifier from the store.static SystemMetadataManager
Get the singleton SystemMetadataManager instancevoid
store
(org.dataone.service.types.v2.SystemMetadata sysmeta) Store a system metadata record into the store The modification time will be changed and system metadata version will be checked during the processvoid
store
(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, DBConnection dbConn, SystemMetadataManager.SysMetaVersion sysMetaCheck) Store a system metadata record into the store.void
store
(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, SystemMetadataManager.SysMetaVersion sysMetaCheck) Store a system metadata record into the storeprotected void
updateSystemMetadata
(org.dataone.service.types.v2.SystemMetadata sm, DBConnection dbConn) Insert the system metadata fields into the db
-
Method Details
-
getInstance
Get the singleton SystemMetadataManager instance- Returns:
- the instance of SystemMetadataManager
-
get
public org.dataone.service.types.v2.SystemMetadata get(org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.ServiceFailure Get the system metadata associated with the given identifier from the store. If the returned value is null, this means the system metadata is not found- Parameters:
pid
- the identifier to determine the system metadata- Returns:
- the system metadata associated with the given identifier
- Throws:
org.dataone.service.exceptions.ServiceFailure
-
store
public void store(org.dataone.service.types.v2.SystemMetadata sysmeta) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure Store a system metadata record into the store The modification time will be changed and system metadata version will be checked during the process- Parameters:
sysmeta
- the new system metadata will be inserted- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
store
public void store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure Store a system metadata record into the store- Parameters:
sysmeta
- the new system metadata will be insertedchangeModifyTime
- if we need to change the modify timesysMetaCheck
- check whether the version of the provided '@param sysmeta' matches the version of the existing metadata- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
store
public void store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, DBConnection dbConn, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure Store a system metadata record into the store. Note: the calling code is responsible for (a) setting setAutoCommit(false) before passing the DBConnection, and (b) calling commit() after this method has finished execution.- Parameters:
sysmeta
- the new system metadata will be insertedchangeModifyTIme
- if we need to change the modify timedbConn
- the db connection will be used during storing the system metadata into dbsysMetaCheck
- if Metacat needs to check the version of the coming system metadata matching the version of the existing one.- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
delete
public void delete(org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure Delete a system metadata record from the store- Parameters:
id
- the identifier to determine the system metadata record- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
updateSystemMetadata
protected void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm, DBConnection dbConn) throws McdbDocNotFoundException, SQLException, org.dataone.service.exceptions.InvalidSystemMetadata, AccessException Insert the system metadata fields into the db- Parameters:
sm
-- Throws:
McdbDocNotFoundException
SQLException
org.dataone.service.exceptions.InvalidSystemMetadata
AccessException
-
convertPermission
public static int convertPermission(org.dataone.service.types.v1.Permission permission) Utility method to convert a permission object to an integer- Parameters:
permission
- the permission which needs to be convert- Returns:
- the integer presentation of the permission
-
delete
public void delete(org.dataone.service.types.v1.Identifier guid, DBConnection dbConn) throws org.dataone.service.exceptions.InvalidRequest, SQLException Delete the system metadata for the given guid with the DBConnection object- Parameters:
guid
- the identifier of the object whose system metadata will be deleteddbConn
- the DBConnection object which will execute the delete actions- Throws:
org.dataone.service.exceptions.InvalidRequest
SQLException
-