public class IdentifierManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TYPE_IDENTIFIER |
static java.lang.String |
TYPE_SYSTEM_METADATA |
Modifier and Type | Method and Description |
---|---|
java.util.List<org.dataone.service.types.v1.Permission> |
convertPermission(int permission) |
int |
convertPermission(org.dataone.service.types.v1.Permission permission) |
void |
createMapping(java.lang.String guid,
java.lang.String localId)
create a mapping in the identifier table
|
boolean |
deleteSystemMetadata(java.lang.String guid) |
boolean |
existsInIdentifierTable(org.dataone.service.types.v1.Identifier pid)
Determine if the given pid exists on the identifier table.
|
boolean |
existsInXmlLRevisionTable(java.lang.String docid,
int rev)
IF the given localId exists on the xml_revisions table
|
java.lang.String |
generateLocalId(java.lang.String guid,
int rev) |
java.lang.String |
generateLocalId(java.lang.String guid,
int rev,
boolean isSystemMetadata)
Given a global identifier (guid), create a suitable local identifier that
follows Metacat's docid semantics and format (scope.id.rev), and create
a mapping between these two identifiers.
|
org.dataone.service.types.v1.AccessPolicy |
getAccessPolicy(java.lang.String guid)
Lookup access policy from Metacat
|
java.util.List<java.lang.String> |
getAllLocalIds()
return a listing of all local ids in the object store
|
java.util.List<java.lang.String> |
getAllSystemMetadataGUIDs()
return a listing of all guids in the object store
|
java.lang.String |
getGUID(java.lang.String docid,
int rev)
given a local identifer, look up the guid.
|
java.util.List<java.lang.String> |
getGUIDs(java.lang.String formatId,
java.lang.String nodeId,
java.lang.String scheme)
Get the list of identifiers which system metadata matches the given format id and original member node id and guid or series id start with the scheme (doi for example).
|
org.dataone.service.types.v1.Identifier |
getHeadPID(org.dataone.service.types.v1.Identifier sid)
Get the pid of the head (current) version of objects match the specified sid.
|
static IdentifierManager |
getInstance()
Return the single instance of the manager after initializing it if it
wasn't previously initialized.
|
java.util.Date |
getLastModifiedDate()
returns a list of system metadata-only guids since the given date
|
int |
getLatestRevForLocalId(java.lang.String localId)
return the newest rev for a given localId
|
java.lang.String |
getLocalId(java.lang.String guid)
Lookup a localId given the GUID.
|
java.util.List<java.lang.String> |
getLocalIdsWithNoSystemMetadata(boolean includeRevisions,
int serverLocation)
return all local ids in the object store that do not have associated
system metadata
|
java.lang.String |
getObjectFilePath(java.lang.String localId,
boolean isScienceMetadata)
Get the the file path for the given object local id
|
org.dataone.service.types.v2.SystemMetadata |
getSystemMetadata(java.lang.String guid)
return a hash of all of the info that is in the systemmetadata table
|
java.util.List<java.lang.String> |
getUpdatedSystemMetadataIds(java.util.Date since)
returns a list of system metadata-only guids since the given date
|
boolean |
identifierExists(java.lang.String guid)
Determine if an identifier exists already, returning true if so.
|
void |
insertOrUpdateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)
creates a system metadata mapping and adds additional fields from sysmeta
to the table for quick searching.
|
boolean |
mappingExists(java.lang.String guid)
Determine if an identifier mapping exists already,
returning true if so.
|
boolean |
objectFileExists(java.lang.String localId,
boolean isScienceMetadata)
Determine if the object file exist for the given localId.
|
org.dataone.service.types.v1.ObjectList |
querySystemMetadata(java.util.Date startTime,
java.util.Date endTime,
org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId,
org.dataone.service.types.v1.NodeReference nodeId,
int start,
int count,
org.dataone.service.types.v1.Identifier identifier,
boolean isSID)
query the systemmetadata table based on the given parameters
|
void |
removeMapping(java.lang.String guid,
java.lang.String localId)
remove a mapping in the identifier table
|
boolean |
systemMetadataPIDExists(org.dataone.service.types.v1.Identifier pid)
Determine if the specified identifier object exists or not.
|
boolean |
systemMetadataPIDExists(java.lang.String guid) |
boolean |
systemMetadataSIDExists(org.dataone.service.types.v1.Identifier sid)
Check if the specified sid object exists on the serial id field on the system metadata table
|
boolean |
systemMetadataSIDExists(java.lang.String sid)
Check if the specified sid exists on the serial id field on the system metadata table
|
void |
updateAuthoritativeMemberNodeId(java.lang.String existingMemberNodeId,
java.lang.String newMemberNodeId) |
void |
updateMapping(java.lang.String guid,
java.lang.String localId)
update a mapping
|
void |
updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm,
DBConnection dbConn)
Insert the system metadata fields into the db
|
public static final java.lang.String TYPE_SYSTEM_METADATA
public static final java.lang.String TYPE_IDENTIFIER
public static IdentifierManager getInstance()
public org.dataone.service.types.v2.SystemMetadata getSystemMetadata(java.lang.String guid) throws McdbDocNotFoundException
guid
- McdbDocNotFoundException
public int getLatestRevForLocalId(java.lang.String localId) throws McdbDocNotFoundException
localId
- McdbDocNotFoundException
public java.util.List<java.lang.String> getLocalIdsWithNoSystemMetadata(boolean includeRevisions, int serverLocation)
public java.util.List<java.lang.String> getAllLocalIds()
public java.util.List<java.lang.String> getAllSystemMetadataGUIDs()
public java.util.List<java.lang.String> getUpdatedSystemMetadataIds(java.util.Date since) throws java.lang.Exception
java.lang.Exception
public java.util.Date getLastModifiedDate() throws java.lang.Exception
java.lang.Exception
public boolean identifierExists(java.lang.String guid) throws java.sql.SQLException
guid
- the global identifier to look upjava.sql.SQLException
public boolean mappingExists(java.lang.String guid) throws java.sql.SQLException
guid
- the global identifier to look upjava.sql.SQLException
public java.lang.String generateLocalId(java.lang.String guid, int rev)
guid
- rev
- public java.lang.String generateLocalId(java.lang.String guid, int rev, boolean isSystemMetadata)
guid
- the global string identifierrev
- the revision number to be used in the localIdpublic java.lang.String getGUID(java.lang.String docid, int rev) throws McdbDocNotFoundException
docid
- the docid to look uprev
- the revision of the docid to look upMcdbDocNotFoundException
- if the docid, rev is not foundpublic java.util.List<java.lang.String> getGUIDs(java.lang.String formatId, java.lang.String nodeId, java.lang.String scheme)
formatId
- the format id of the identifier must match the given formatId.nodeId
- the original member node of the identifier must match the given nodeId.scheme
- the guid or series id must start with the given scheme (doi for exampe)public org.dataone.service.types.v1.Identifier getHeadPID(org.dataone.service.types.v1.Identifier sid) throws java.sql.SQLException
sid
- specified sid which should match.java.sql.SQLException
public boolean systemMetadataSIDExists(org.dataone.service.types.v1.Identifier sid) throws java.sql.SQLException
sid
- java.sql.SQLException
public boolean systemMetadataSIDExists(java.lang.String sid) throws java.sql.SQLException
id
- java.sql.SQLException
public boolean systemMetadataPIDExists(org.dataone.service.types.v1.Identifier pid) throws java.sql.SQLException
pid
- - the specified identifierjava.sql.SQLException
java.lang.NullPointerException
public boolean systemMetadataPIDExists(java.lang.String guid) throws java.sql.SQLException
java.sql.SQLException
public void insertOrUpdateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta) throws McdbDocNotFoundException, java.sql.SQLException, org.dataone.service.exceptions.InvalidSystemMetadata
guid
- the id to insertlocalId
- the systemMetadata object to get the local id forMcdbDocNotFoundException
java.sql.SQLException
org.dataone.service.exceptions.InvalidSystemMetadata
public void updateMapping(java.lang.String guid, java.lang.String localId)
guid
- localId
- public void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm, DBConnection dbConn) throws McdbDocNotFoundException, java.sql.SQLException, org.dataone.service.exceptions.InvalidSystemMetadata, AccessException
sm
- McdbDocNotFoundException
java.sql.SQLException
org.dataone.service.exceptions.InvalidSystemMetadata
AccessException
public org.dataone.service.types.v1.AccessPolicy getAccessPolicy(java.lang.String guid) throws McdbDocNotFoundException, AccessException
guid
- McdbDocNotFoundException
AccessException
public int convertPermission(org.dataone.service.types.v1.Permission permission)
public java.util.List<org.dataone.service.types.v1.Permission> convertPermission(int permission)
public java.lang.String getLocalId(java.lang.String guid) throws McdbDocNotFoundException, java.sql.SQLException
guid
- the global identifier to look upMcdbDocNotFoundException
- if the identifier is not foundjava.sql.SQLException
public org.dataone.service.types.v1.ObjectList querySystemMetadata(java.util.Date startTime, java.util.Date endTime, org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId, org.dataone.service.types.v1.NodeReference nodeId, int start, int count, org.dataone.service.types.v1.Identifier identifier, boolean isSID) throws java.sql.SQLException, edu.ucsb.nceas.utilities.PropertyNotFoundException, ServiceException
startTime
- endTime
- objectFormat
- nodeId
- start
- count
- java.sql.SQLException
ServiceException
edu.ucsb.nceas.utilities.PropertyNotFoundException
public void createMapping(java.lang.String guid, java.lang.String localId)
guid
- localId
- public void removeMapping(java.lang.String guid, java.lang.String localId)
guid
- localId
- public boolean deleteSystemMetadata(java.lang.String guid)
public void updateAuthoritativeMemberNodeId(java.lang.String existingMemberNodeId, java.lang.String newMemberNodeId)
public boolean objectFileExists(java.lang.String localId, boolean isScienceMetadata) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
localId
- isScienceMetadata
- edu.ucsb.nceas.utilities.PropertyNotFoundException
public java.lang.String getObjectFilePath(java.lang.String localId, boolean isScienceMetadata) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
localId
- isScienceMetadata
- edu.ucsb.nceas.utilities.PropertyNotFoundException
public boolean existsInXmlLRevisionTable(java.lang.String docid, int rev) throws java.sql.SQLException
localId
- java.sql.SQLException
public boolean existsInIdentifierTable(org.dataone.service.types.v1.Identifier pid) throws java.sql.SQLException
pid
- must be a PIDjava.sql.SQLException
Copyright © 2020 Regents of the University of California. All Rights Reserved.