edu.ucsb.nceas.metacat.dataone

## Class D1NodeService

- java.lang.Object
- - edu.ucsb.nceas.metacat.dataone.D1NodeService

- Direct Known Subclasses:
    CNodeService, MNodeService

      public abstract class D1NodeService
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DELETEDMESSAGE`
    `protected MetacatHandler` | `handler`
    `protected static int` | `MAXIMUM_DB_RECORD_COUNT` limit paged results sets to a configured maximum
    `protected javax.servlet.http.HttpServletRequest` | `request` For logging the operations
    `protected org.dataone.service.types.v1.Session` | `session2` out-of-band session object to be used when not passed in as a method parameter

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `D1NodeService(javax.servlet.http.HttpServletRequest request)` Constructor - used to set the metacatUrl from a subclass extending D1NodeService

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `archiveCNObject(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needModifyDate)` Archive a object on cn and notify the replica.
    `protected org.dataone.service.types.v1.Identifier` | `archiveObject(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needModifyDate)` Archives an object, where the object is either a data object or a science metadata object.
    `protected boolean` | `checkSidInModifyingSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta, java.lang.String invalidSystemMetadataCode, java.lang.String serviceFailureCode)`
    `void` | `checkV1SystemMetaPidExist(org.dataone.service.types.v1.Identifier identifier, java.lang.String serviceFailureCode, java.lang.String serviceFailureMessage, java.lang.String noFoundCode, java.lang.String notFoundMessage)` A utility method for v1 api to check the specified identifier exists as a pid Uses the IdentifierManager to call the Identifier table directly - this detects Identifiers for deleted objects (where the SystemMetadata doesn't exist, but the Identifier remains)
    `org.dataone.service.types.v1.Identifier` | `create(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, java.io.InputStream object, org.dataone.service.types.v2.SystemMetadata sysmeta)` Adds a new object to the Node, where the object is either a data object or a science metadata object.
    `org.dataone.service.types.v1.Identifier` | `delete(java.lang.String username, org.dataone.service.types.v1.Identifier pid)` Deletes an object from the Member Node, where the object is either a data object or a science metadata object.
    `org.dataone.service.types.v1.DescribeResponse` | `describe(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id)` This method provides a lighter weight mechanism than getSystemMetadata() for a client to determine basic properties of the referenced object.
    `protected java.lang.String` | `existsInObsoletedBy(org.dataone.service.types.v1.Identifier id)`
    `protected java.lang.String` | `existsInObsoletes(org.dataone.service.types.v1.Identifier id)`
    `protected static java.util.List<org.dataone.service.types.v1.Permission>` | `expandPermissions(org.dataone.service.types.v1.Permission permission)` Given a Permission, returns a list of all permissions that it encompasses Permissions are hierarchical so that WRITE also allows READ.
    `java.io.InputStream` | `get(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid)` Return the object identified by the given object identifier
    `protected org.dataone.service.types.v2.NodeList` | `getCNNodeList()` A centralized point for accessing the CN Nodelist, to make it easier to cache the nodelist in the future, if it's seen as helpful performance-wise
    `org.dataone.service.types.v2.Log` | `getLogRecords(org.dataone.service.types.v1.Session session, java.util.Date fromDate, java.util.Date toDate, java.lang.String event, java.lang.String pidFilter, java.lang.Integer start, java.lang.Integer count)` Return the log records associated with a given event between the start and end dates listed given a particular Subject listed in the Session
    `protected org.dataone.service.types.v1.Identifier` | `getPIDForSID(org.dataone.service.types.v1.Identifier sid, java.lang.String serviceFailureCode)` Utility method to get the PID for an SID.
    `org.dataone.service.types.v1.Session` | `getSession()` retrieve the out-of-band session
    `org.dataone.service.types.v2.SystemMetadata` | `getSystemMetadata(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id)` Return the system metadata for a given object
    `protected org.dataone.service.types.v2.SystemMetadata` | `getSystemMetadataForPID(org.dataone.service.types.v1.Identifier pid, java.lang.String serviceFailureCode, java.lang.String invalidRequestCode, java.lang.String notFoundCode, boolean needDeleteInfo)` Get the system metadata for the given PID (not a sid).
    `java.lang.String` | `insertDataObject(java.io.InputStream object, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Checksum checksum)` Insert a data document
    `java.lang.String` | `insertOrUpdateDocument(java.io.InputStream xmlStream, java.lang.String encoding, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v1.Session session, java.lang.String insertOrUpdate, java.lang.String formatId, org.dataone.service.types.v1.Checksum checksum)` Insert or update an XML document into Metacat
    `void` | `insertSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)` Insert a systemMetadata document and return its localId
    `boolean` | `isAuthorized(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id, org.dataone.service.types.v1.Permission permission)` Test if the user identified by the provided token has authorization for the operation on the specified object.
    `static boolean` | `isScienceMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)` Determine if a given object should be treated as an XML science metadata object.
    `static boolean` | `isValidIdentifier(org.dataone.service.types.v1.Identifier pid)` Check for whitespace in the given pid.
    `protected java.util.List<org.dataone.service.types.v2.Node>` | `listNodesBySubject(org.dataone.service.types.v1.Subject subject, org.dataone.service.types.v2.NodeList nodelist)` Calls CN.listNodes() to assemble a list of nodes that have been registered with the DataONE infrastructure that match the given session subject
    `org.dataone.service.types.v1.ObjectList` | `listObjects(org.dataone.service.types.v1.Session session, java.util.Date startTime, java.util.Date endTime, org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId, org.dataone.service.types.v1.Identifier identifier, org.dataone.service.types.v1.NodeReference nodeId, java.lang.Integer start, java.lang.Integer count)` Retrieve the list of objects present on the MN that match the calling parameters
    `org.dataone.service.types.v2.OptionList` | `listViews()`
    `org.dataone.service.types.v2.OptionList` | `listViews(org.dataone.service.types.v1.Session arg0)`
    `protected static void` | `objectExists(org.dataone.service.types.v1.Identifier id)` Determine if an object with the given identifier already exists or not.
    `java.util.Date` | `ping()` Low level, "are you alive" operation.
    `protected void` | `removeSolrIndex(org.dataone.service.types.v2.SystemMetadata sysMeta)`
    `protected void` | `removeSystemMetaAndIdentifier(org.dataone.service.types.v1.Identifier id)`
    `void` | `setSession(org.dataone.service.types.v1.Session session)` Set the out-of-band session
    `protected boolean` | `updateSystemMetadata(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysmeta, boolean needUpdateModificationDate, org.dataone.service.types.v2.SystemMetadata currentSysmeta, boolean fromCN)` Update the system metadata of the specified pid.
    `protected void` | `updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysMeta)` Update a systemMetadata document
    `java.io.InputStream` | `view(org.dataone.service.types.v1.Session session, java.lang.String format, org.dataone.service.types.v1.Identifier id)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DELETEDMESSAGE

          public static final java.lang.String DELETEDMESSAGE

      See Also:
        Constant Field Values

    - #### request

          protected javax.servlet.http.HttpServletRequest request

      For logging the operations

    - #### handler

          protected MetacatHandler handler

    - #### MAXIMUM_DB_RECORD_COUNT

          protected static int MAXIMUM_DB_RECORD_COUNT

      limit paged results sets to a configured maximum

    - #### session2

          protected org.dataone.service.types.v1.Session session2

      out-of-band session object to be used when not passed in as a method parameter

  - ### Constructor Detail

    - #### D1NodeService

          public D1NodeService(javax.servlet.http.HttpServletRequest request)

      Constructor - used to set the metacatUrl from a subclass extending D1NodeService
      Parameters:
        `metacatUrl` - - the URL of the metacat service, including the ending /d1

  - ### Method Detail

    - #### getSession

          public org.dataone.service.types.v1.Session getSession()

      retrieve the out-of-band session
      Returns:

    - #### setSession

          public void setSession(org.dataone.service.types.v1.Session session)

      Set the out-of-band session
      Parameters:
        `session` -

    - #### getCNNodeList

          protected org.dataone.service.types.v2.NodeList getCNNodeList()
                                                                 throws org.dataone.service.exceptions.ServiceFailure,
                                                                        org.dataone.service.exceptions.NotImplemented

      A centralized point for accessing the CN Nodelist, to make it easier to cache the nodelist in the future, if it's seen as helpful performance-wise
      Returns:
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotImplemented`

    - #### describe

          public org.dataone.service.types.v1.DescribeResponse describe(org.dataone.service.types.v1.Session session,
                                                                        org.dataone.service.types.v1.Identifier id)
                                                                 throws org.dataone.service.exceptions.InvalidToken,
                                                                        org.dataone.service.exceptions.ServiceFailure,
                                                                        org.dataone.service.exceptions.NotAuthorized,
                                                                        org.dataone.service.exceptions.NotFound,
                                                                        org.dataone.service.exceptions.NotImplemented

      This method provides a lighter weight mechanism than getSystemMetadata() for a client to determine basic properties of the referenced object.
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `pid` - - the identifier of the object to be described
      Returns:
        describeResponse - A set of values providing a basic description of the object.
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### delete

          public org.dataone.service.types.v1.Identifier delete(java.lang.String username,
                                                                org.dataone.service.types.v1.Identifier pid)
                                                         throws org.dataone.service.exceptions.InvalidToken,
                                                                org.dataone.service.exceptions.ServiceFailure,
                                                                org.dataone.service.exceptions.NotAuthorized,
                                                                org.dataone.service.exceptions.NotFound,
                                                                org.dataone.service.exceptions.NotImplemented

      Deletes an object from the Member Node, where the object is either a data object or a science metadata object. No access checking.
      Parameters:
        `username` - - the name of the user who calls the method. This is only for logging.
        `pid` - - The object identifier to be deleted
      Returns:
        pid - the identifier of the object used for the deletion
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### ping

          public java.util.Date ping()
                              throws org.dataone.service.exceptions.NotImplemented,
                                     org.dataone.service.exceptions.ServiceFailure,
                                     org.dataone.service.exceptions.InsufficientResources

      Low level, "are you alive" operation. A valid ping response is indicated by a HTTP status of 200.
      Returns:
        true if the service is alive
      Throws:
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.InsufficientResources`

    - #### create

          public org.dataone.service.types.v1.Identifier create(org.dataone.service.types.v1.Session session,
                                                                org.dataone.service.types.v1.Identifier pid,
                                                                java.io.InputStream object,
                                                                org.dataone.service.types.v2.SystemMetadata sysmeta)
                                                         throws org.dataone.service.exceptions.InvalidToken,
                                                                org.dataone.service.exceptions.ServiceFailure,
                                                                org.dataone.service.exceptions.NotAuthorized,
                                                                org.dataone.service.exceptions.IdentifierNotUnique,
                                                                org.dataone.service.exceptions.UnsupportedType,
                                                                org.dataone.service.exceptions.InsufficientResources,
                                                                org.dataone.service.exceptions.InvalidSystemMetadata,
                                                                org.dataone.service.exceptions.NotImplemented,
                                                                org.dataone.service.exceptions.InvalidRequest

      Adds a new object to the Node, where the object is either a data object or a science metadata object. This method is called by clients to create new data objects on Member Nodes or internally for Coordinating Nodes
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `pid` - - The object identifier to be created
        `object` - - the object bytes
        `sysmeta` - - the system metadata that describes the object
      Returns:
        pid - the object identifier created
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.IdentifierNotUnique`
        `org.dataone.service.exceptions.UnsupportedType`
        `org.dataone.service.exceptions.InsufficientResources`
        `org.dataone.service.exceptions.InvalidSystemMetadata`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### objectExists

          protected static void objectExists(org.dataone.service.types.v1.Identifier id)
                                      throws org.dataone.service.exceptions.ServiceFailure,
                                             org.dataone.service.exceptions.IdentifierNotUnique

      Determine if an object with the given identifier already exists or not. (Using IdentityManager. Works for SID or PID)
      Parameters:
        `id` - - the ID to be checked.
      Throws:
        `org.dataone.service.exceptions.ServiceFailure` - if the system can't fulfill the check process
        `org.dataone.service.exceptions.IdentifierNotUnique` - if the object with the identifier does exist

    - #### removeSystemMetaAndIdentifier

          protected void removeSystemMetaAndIdentifier(org.dataone.service.types.v1.Identifier id)

    - #### removeSolrIndex

          protected void removeSolrIndex(org.dataone.service.types.v2.SystemMetadata sysMeta)

    - #### getLogRecords

          public org.dataone.service.types.v2.Log getLogRecords(org.dataone.service.types.v1.Session session,
                                                                java.util.Date fromDate,
                                                                java.util.Date toDate,
                                                                java.lang.String event,
                                                                java.lang.String pidFilter,
                                                                java.lang.Integer start,
                                                                java.lang.Integer count)
                                                         throws org.dataone.service.exceptions.InvalidToken,
                                                                org.dataone.service.exceptions.ServiceFailure,
                                                                org.dataone.service.exceptions.NotAuthorized,
                                                                org.dataone.service.exceptions.InvalidRequest,
                                                                org.dataone.service.exceptions.NotImplemented

      Return the log records associated with a given event between the start and end dates listed given a particular Subject listed in the Session
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `fromDate` - - the start date of the desired log records
        `toDate` - - the end date of the desired log records
        `event` - - restrict log records of a specific event type
        `start` - - zero based offset from the first record in the set of matching log records. Used to assist with paging the response.
        `count` - - maximum number of log records to return in the response. Used to assist with paging the response.
      Returns:
        the desired log records
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`

    - #### get

          public java.io.InputStream get(org.dataone.service.types.v1.Session session,
                                         org.dataone.service.types.v1.Identifier pid)
                                  throws org.dataone.service.exceptions.InvalidToken,
                                         org.dataone.service.exceptions.ServiceFailure,
                                         org.dataone.service.exceptions.NotAuthorized,
                                         org.dataone.service.exceptions.NotFound,
                                         org.dataone.service.exceptions.NotImplemented

      Return the object identified by the given object identifier
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `id` - - the identifier for the given object TODO: The D1 Authorization API doesn't provide information on which authentication system the Subject belongs to, and so it's not possible to discern which Person or Group is a valid KNB LDAP DN. Fix this.
      Returns:
        inputStream - the input stream of the given object
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.NotFound`

    - #### getSystemMetadata

          public org.dataone.service.types.v2.SystemMetadata getSystemMetadata(org.dataone.service.types.v1.Session session,
                                                                               org.dataone.service.types.v1.Identifier id)
                                                                        throws org.dataone.service.exceptions.InvalidToken,
                                                                               org.dataone.service.exceptions.ServiceFailure,
                                                                               org.dataone.service.exceptions.NotAuthorized,
                                                                               org.dataone.service.exceptions.NotFound,
                                                                               org.dataone.service.exceptions.NotImplemented

      Return the system metadata for a given object
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `pid` - - the object identifier for the given object
      Returns:
        inputStream - the input stream of the given system metadata object
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`

    - #### isAuthorized

          public boolean isAuthorized(org.dataone.service.types.v1.Session session,
                                      org.dataone.service.types.v1.Identifier id,
                                      org.dataone.service.types.v1.Permission permission)
                               throws org.dataone.service.exceptions.ServiceFailure,
                                      org.dataone.service.exceptions.InvalidToken,
                                      org.dataone.service.exceptions.NotFound,
                                      org.dataone.service.exceptions.NotAuthorized,
                                      org.dataone.service.exceptions.NotImplemented,
                                      org.dataone.service.exceptions.InvalidRequest

      Test if the user identified by the provided token has authorization for the operation on the specified object. Allowed subjects include: 1. CNs 2. Authoritative node 3. Owner of the object 4. Users with the specified permission in the access rules.
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `pid` - - The identifer of the resource for which access is being checked
        `operation` - - The type of operation which is being requested for the given pid
      Returns:
        true if the operation is allowed
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### isScienceMetadata

          public static boolean isScienceMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)

      Determine if a given object should be treated as an XML science metadata object.
      Parameters:
        `sysmeta` - - the SystemMetadata describing the object
      Returns:
        true if the object should be treated as science metadata

    - #### isValidIdentifier

          public static boolean isValidIdentifier(org.dataone.service.types.v1.Identifier pid)

      Check for whitespace in the given pid. null pids are also invalid by default
      Parameters:
        `pid` -
      Returns:

    - #### insertOrUpdateDocument

          public java.lang.String insertOrUpdateDocument(java.io.InputStream xmlStream,
                                                         java.lang.String encoding,
                                                         org.dataone.service.types.v1.Identifier pid,
                                                         org.dataone.service.types.v1.Session session,
                                                         java.lang.String insertOrUpdate,
                                                         java.lang.String formatId,
                                                         org.dataone.service.types.v1.Checksum checksum)
                                                  throws org.dataone.service.exceptions.ServiceFailure,
                                                         java.io.IOException,
                                                         edu.ucsb.nceas.utilities.PropertyNotFoundException

      Insert or update an XML document into Metacat
      Parameters:
        `xml` - - the XML document to insert or update
        `pid` - - the identifier to be used for the resulting object
      Returns:
        localId - the resulting docid of the document created or updated
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `java.io.IOException`
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`

    - #### insertDataObject

          public java.lang.String insertDataObject(java.io.InputStream object,
                                                   org.dataone.service.types.v1.Identifier pid,
                                                   org.dataone.service.types.v1.Session session,
                                                   org.dataone.service.types.v1.Checksum checksum)
                                            throws org.dataone.service.exceptions.ServiceFailure,
                                                   org.dataone.service.exceptions.InvalidSystemMetadata,
                                                   org.dataone.service.exceptions.NotAuthorized

      Insert a data document
      Parameters:
        `object` -
        `pid` -
        `sessionData` -
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidSystemMetadata`

    - #### insertSystemMetadata

          public void insertSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)
                                    throws org.dataone.service.exceptions.ServiceFailure

      Insert a systemMetadata document and return its localId
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`

    - #### listObjects

          public org.dataone.service.types.v1.ObjectList listObjects(org.dataone.service.types.v1.Session session,
                                                                     java.util.Date startTime,
                                                                     java.util.Date endTime,
                                                                     org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId,
                                                                     org.dataone.service.types.v1.Identifier identifier,
                                                                     org.dataone.service.types.v1.NodeReference nodeId,
                                                                     java.lang.Integer start,
                                                                     java.lang.Integer count)
                                                              throws org.dataone.service.exceptions.NotAuthorized,
                                                                     org.dataone.service.exceptions.InvalidRequest,
                                                                     org.dataone.service.exceptions.NotImplemented,
                                                                     org.dataone.service.exceptions.ServiceFailure,
                                                                     org.dataone.service.exceptions.InvalidToken

      Retrieve the list of objects present on the MN that match the calling parameters
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `startTime` - - Specifies the beginning of the time range from which to return object (>=)
        `endTime` - - Specifies the beginning of the time range from which to return object (>=)
        `objectFormat` - - Restrict results to the specified object format
        `replicaStatus` - - Indicates if replicated objects should be returned in the list
        `start` - - The zero-based index of the first value, relative to the first record of the resultset that matches the parameters.
        `count` - - The maximum number of entries that should be returned in the response. The Member Node may return less entries than specified in this value.
      Returns:
        objectList - the list of objects matching the criteria
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`

    - #### updateSystemMetadata

          protected void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysMeta)
                                       throws org.dataone.service.exceptions.ServiceFailure

      Update a systemMetadata document
      Parameters:
        `sysMeta` - - the system metadata object in the system to update
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`

    - #### updateSystemMetadata

          protected boolean updateSystemMetadata(org.dataone.service.types.v1.Session session,
                                                 org.dataone.service.types.v1.Identifier pid,
                                                 org.dataone.service.types.v2.SystemMetadata sysmeta,
                                                 boolean needUpdateModificationDate,
                                                 org.dataone.service.types.v2.SystemMetadata currentSysmeta,
                                                 boolean fromCN)
                                          throws org.dataone.service.exceptions.NotImplemented,
                                                 org.dataone.service.exceptions.NotAuthorized,
                                                 org.dataone.service.exceptions.ServiceFailure,
                                                 org.dataone.service.exceptions.InvalidRequest,
                                                 org.dataone.service.exceptions.InvalidSystemMetadata,
                                                 org.dataone.service.exceptions.InvalidToken

      Update the system metadata of the specified pid. The caller of this method should lock the system metadata in hazelcast server.
      Parameters:
        `session` - - the identity of the client which calls the method
        `pid` - - the identifier of the object which will be updated
        `sysmeta` - - the new system metadata
      Returns:
      Throws:
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.InvalidSystemMetadata`
        `org.dataone.service.exceptions.InvalidToken`

    - #### expandPermissions

          protected static java.util.List<org.dataone.service.types.v1.Permission> expandPermissions(org.dataone.service.types.v1.Permission permission)

      Given a Permission, returns a list of all permissions that it encompasses Permissions are hierarchical so that WRITE also allows READ.
      Parameters:
        `permission` -
      Returns:
        list of included Permissions for the given permission

    - #### listNodesBySubject

          protected java.util.List<org.dataone.service.types.v2.Node> listNodesBySubject(org.dataone.service.types.v1.Subject subject,
                                                                                         org.dataone.service.types.v2.NodeList nodelist)
                                                                                  throws org.dataone.service.exceptions.ServiceFailure,
                                                                                         org.dataone.service.exceptions.NotImplemented

      Calls CN.listNodes() to assemble a list of nodes that have been registered with the DataONE infrastructure that match the given session subject
      Parameters:
        `subject` - - the subject serving as the filter.
      Returns:
        nodes - List of nodes from the registry with a matching session subject
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotImplemented`

    - #### archiveObject

          protected org.dataone.service.types.v1.Identifier archiveObject(boolean log,
                                                                          org.dataone.service.types.v1.Session session,
                                                                          org.dataone.service.types.v1.Identifier pid,
                                                                          org.dataone.service.types.v2.SystemMetadata sysMeta,
                                                                          boolean needModifyDate)
                                                                   throws org.dataone.service.exceptions.InvalidToken,
                                                                          org.dataone.service.exceptions.ServiceFailure,
                                                                          org.dataone.service.exceptions.NotAuthorized,
                                                                          org.dataone.service.exceptions.NotFound,
                                                                          org.dataone.service.exceptions.NotImplemented

      Archives an object, where the object is either a data object or a science metadata object. Note: it doesn't check the authorization; it doesn't lock the system metadata;it only accept pid.
      Parameters:
        `session` - - the Session object containing the credentials for the Subject
        `pid` - - The object identifier to be archived
      Returns:
        pid - the identifier of the object used for the archiving
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### archiveCNObject

          protected void archiveCNObject(boolean log,
                                         org.dataone.service.types.v1.Session session,
                                         org.dataone.service.types.v1.Identifier pid,
                                         org.dataone.service.types.v2.SystemMetadata sysMeta,
                                         boolean needModifyDate)
                                  throws org.dataone.service.exceptions.InvalidToken,
                                         org.dataone.service.exceptions.ServiceFailure,
                                         org.dataone.service.exceptions.NotAuthorized,
                                         org.dataone.service.exceptions.NotFound,
                                         org.dataone.service.exceptions.NotImplemented

      Archive a object on cn and notify the replica. This method doesn't lock the system metadata map. The caller should lock it. This method doesn't check the authorization; this method only accept a pid. It wouldn't notify the replca that the system metadata has been changed.
      Parameters:
        `session` -
        `pid` -
        `sysMeta` -
        `notifyReplica` -
      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.NotImplemented`

    - #### checkV1SystemMetaPidExist

          public void checkV1SystemMetaPidExist(org.dataone.service.types.v1.Identifier identifier,
                                                java.lang.String serviceFailureCode,
                                                java.lang.String serviceFailureMessage,
                                                java.lang.String noFoundCode,
                                                java.lang.String notFoundMessage)
                                         throws org.dataone.service.exceptions.ServiceFailure,
                                                org.dataone.service.exceptions.NotFound

      A utility method for v1 api to check the specified identifier exists as a pid Uses the IdentifierManager to call the Identifier table directly - this detects Identifiers for deleted objects (where the SystemMetadata doesn't exist, but the Identifier remains)
      Parameters:
        `identifier` - the specified identifier
        `serviceFailureCode` - the detail error code for the service failure exception
        `noFoundCode` - the detail error code for the not found exception
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotFound`

    - #### getPIDForSID

          protected org.dataone.service.types.v1.Identifier getPIDForSID(org.dataone.service.types.v1.Identifier sid,
                                                                         java.lang.String serviceFailureCode)
                                                                  throws org.dataone.service.exceptions.ServiceFailure

      Utility method to get the PID for an SID. If the specified identifier is not an SID , null will be returned.
      Parameters:
        `sid` - the specified sid
        `serviceFailureCode` - the detail error code for the service failure exception
      Returns:
        the pid for the sid. If the specified identifier is not an SID, null will be returned.
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
      See Also:
        `as well for situations where you need the SystemMetadata. The advantage of this method is that it doesn't unmarshall systemmetadata, and doesn't throw NotFound exceptions.`

    - #### getSystemMetadataForPID

          protected org.dataone.service.types.v2.SystemMetadata getSystemMetadataForPID(org.dataone.service.types.v1.Identifier pid,
                                                                                        java.lang.String serviceFailureCode,
                                                                                        java.lang.String invalidRequestCode,
                                                                                        java.lang.String notFoundCode,
                                                                                        boolean needDeleteInfo)
                                                                                 throws org.dataone.service.exceptions.ServiceFailure,
                                                                                        org.dataone.service.exceptions.InvalidRequest,
                                                                                        org.dataone.service.exceptions.NotFound

      Get the system metadata for the given PID (not a sid).
      Parameters:
        `pid` -
        `serviceFailureCode` -
        `invalidRequestCode` -
      Returns:
        the system metadata associated with the pid
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotFound`
        `org.dataone.service.exceptions.InvalidRequest`

    - #### checkSidInModifyingSystemMetadata

          protected boolean checkSidInModifyingSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta,
                                                              java.lang.String invalidSystemMetadataCode,
                                                              java.lang.String serviceFailureCode)
                                                       throws org.dataone.service.exceptions.InvalidSystemMetadata,
                                                              org.dataone.service.exceptions.ServiceFailure

      Throws:
        `org.dataone.service.exceptions.InvalidSystemMetadata`
        `org.dataone.service.exceptions.ServiceFailure`

    - #### listViews

          public org.dataone.service.types.v2.OptionList listViews(org.dataone.service.types.v1.Session arg0)
                                                            throws org.dataone.service.exceptions.InvalidToken,
                                                                   org.dataone.service.exceptions.ServiceFailure,
                                                                   org.dataone.service.exceptions.NotAuthorized,
                                                                   org.dataone.service.exceptions.InvalidRequest,
                                                                   org.dataone.service.exceptions.NotImplemented

      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`

    - #### listViews

          public org.dataone.service.types.v2.OptionList listViews()
                                                            throws org.dataone.service.exceptions.InvalidToken,
                                                                   org.dataone.service.exceptions.ServiceFailure,
                                                                   org.dataone.service.exceptions.NotAuthorized,
                                                                   org.dataone.service.exceptions.InvalidRequest,
                                                                   org.dataone.service.exceptions.NotImplemented

      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`

    - #### view

          public java.io.InputStream view(org.dataone.service.types.v1.Session session,
                                          java.lang.String format,
                                          org.dataone.service.types.v1.Identifier id)
                                   throws org.dataone.service.exceptions.InvalidToken,
                                          org.dataone.service.exceptions.ServiceFailure,
                                          org.dataone.service.exceptions.NotAuthorized,
                                          org.dataone.service.exceptions.InvalidRequest,
                                          org.dataone.service.exceptions.NotImplemented,
                                          org.dataone.service.exceptions.NotFound

      Throws:
        `org.dataone.service.exceptions.InvalidToken`
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.NotAuthorized`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.NotFound`

    - #### existsInObsoletes

          protected java.lang.String existsInObsoletes(org.dataone.service.types.v1.Identifier id)
                                                throws org.dataone.service.exceptions.InvalidRequest,
                                                       org.dataone.service.exceptions.ServiceFailure

      Throws:
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.ServiceFailure`

    - #### existsInObsoletedBy

          protected java.lang.String existsInObsoletedBy(org.dataone.service.types.v1.Identifier id)
                                                  throws org.dataone.service.exceptions.InvalidRequest,
                                                         org.dataone.service.exceptions.ServiceFailure

      Throws:
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.ServiceFailure`

Copyright © 2020 Regents of the University of California. All Rights Reserved.