edu.ucsb.nceas.metacat.accesscontrol

## Class XMLAccessAccess

- java.lang.Object
- - edu.ucsb.nceas.metacat.shared.BaseAccess
  - - edu.ucsb.nceas.metacat.accesscontrol.XMLAccessAccess

-     public class XMLAccessAccess
      extends BaseAccess

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLAccessAccess()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addXMLAccess(java.lang.String guid, java.lang.String principalName, java.lang.Long permission, java.lang.String permType, java.lang.String permOrder, java.lang.String accessFileId, java.lang.String subTreeId)` Add permissions for a given principal on a given document.
    `void` | `deleteXMLAccessForDoc(java.lang.String guid)` Delete xml access.
    `void` | `deleteXMLAccessForDoc(java.lang.String guid, java.lang.String permType)` Delete xml access.
    `java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>` | `getXMLAccessForDoc(java.lang.String guid)` Get all xml access for a document
    `java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>` | `getXMLAccessForPrincipal(java.lang.String guid, java.lang.String principalName)` Get all xml access for a principal for a certain document
    `java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>` | `getXMLAccessForPrincipal(java.lang.String guid, java.lang.String principalName, java.lang.String permType, java.lang.String permOrder)` Get all xml access for a principal/permType/permOrder for a certain document
    `void` | `insertAccess(java.lang.String guid, java.util.List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList)` Set permissions for a given document.
    `protected edu.ucsb.nceas.utilities.access.XMLAccessDAO` | `populateDAO(java.sql.ResultSet resultSet)` Populate a job data object with the current row in a resultset
    `void` | `removeXMLAccessForPrincipal(java.lang.String guid, java.lang.String principalName, java.lang.Long permission)` Remove xml access.
    `void` | `replaceAccess(java.lang.String guid, java.util.List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList)` Set permissions for a given document.

    - ### Methods inherited from class edu.ucsb.nceas.metacat.shared.BaseAccess

      `closeDBObjects`

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

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

- - ### Constructor Detail

    - #### XMLAccessAccess

          public XMLAccessAccess()
                          throws AccessException

      Throws:
        `AccessException`

  - ### Method Detail

    - #### getXMLAccessForDoc

          public java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForDoc(java.lang.String guid)
                                                                                            throws AccessException

      Get all xml access for a document
      Parameters:
        `id` - the id of the document
      Returns:
        an xml access DAO list
      Throws:
        `AccessException`

    - #### getXMLAccessForPrincipal

          public java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String guid,
                                                                                                         java.lang.String principalName)
                                                                                                  throws AccessException

      Get all xml access for a principal for a certain document
      Parameters:
        `id` - the id of the document
        `principalName` - the credentials of the principal in the database
      Returns:
        an xml access DAO list
      Throws:
        `AccessException`

    - #### getXMLAccessForPrincipal

          public java.util.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String guid,
                                                                                                         java.lang.String principalName,
                                                                                                         java.lang.String permType,
                                                                                                         java.lang.String permOrder)
                                                                                                  throws AccessException

      Get all xml access for a principal/permType/permOrder for a certain document
      Parameters:
        `guid` - the id of the document
        `principalName` - the credentials of the principal in the database
      Returns:
        an xml access DAO list
      Throws:
        `AccessException`

    - #### addXMLAccess

          public void addXMLAccess(java.lang.String guid,
                                   java.lang.String principalName,
                                   java.lang.Long permission,
                                   java.lang.String permType,
                                   java.lang.String permOrder,
                                   java.lang.String accessFileId,
                                   java.lang.String subTreeId)
                            throws AccessException,
                                   PermOrderException

      Add permissions for a given principal on a given document. If the principal already exists, bitwise OR the permission to the existing permission and update.
      Parameters:
        `guid` - document id
        `principalName` - principal credentials
        `permission` - permission bitmap
        `permType` - permission type
        `permOrder` - permission order
      Throws:
        `AccessException`
        `PermOrderException`

    - #### replaceAccess

          public void replaceAccess(java.lang.String guid,
                                    java.util.List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList)
                             throws AccessException

      Set permissions for a given document. This means first removing all access control for the document and then adding the given rules.
      Parameters:
        `id` - document id
        `xmlAccessList` - list of xml access dao objects that hold new access for the document
      Throws:
        `AccessException`

    - #### insertAccess

          public void insertAccess(java.lang.String guid,
                                   java.util.List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList)
                            throws AccessException

      Set permissions for a given document. This means first removing all access control for the document and then adding the given rules.
      Parameters:
        `id` - document id
        `xmlAccessList` - list of xml access dao objects that hold new access for the document
      Throws:
        `AccessException`

    - #### removeXMLAccessForPrincipal

          public void removeXMLAccessForPrincipal(java.lang.String guid,
                                                  java.lang.String principalName,
                                                  java.lang.Long permission)
                                           throws AccessException

      Remove xml access. This modifies the access in the database for a principal for a given document. If the provided permission is exactly the same as what the principal has, the record is deleted from the database.
      Parameters:
        `guid` - document id
        `principalName` - principal credentials
      Throws:
        `AccessException`

    - #### deleteXMLAccessForDoc

          public void deleteXMLAccessForDoc(java.lang.String guid)
                                     throws AccessException

      Delete xml access. This removes all access records from the database for a given document
      Parameters:
        `id` - document id
      Throws:
        `AccessException`

    - #### deleteXMLAccessForDoc

          public void deleteXMLAccessForDoc(java.lang.String guid,
                                            java.lang.String permType)
                                     throws AccessException

      Delete xml access. This removes all access records from the database for a principal for a given document
      Parameters:
        `guid` - document id
        `principal` - principal credentials
      Throws:
        `AccessException`

    - #### populateDAO

          protected edu.ucsb.nceas.utilities.access.XMLAccessDAO populateDAO(java.sql.ResultSet resultSet)
                                                                      throws java.sql.SQLException

      Populate a job data object with the current row in a resultset
      Specified by:
        `populateDAO` in class `BaseAccess`
      Parameters:
        `resultSet` - the result set which is already pointing to the desired row.
      Returns:
        a scheduled job data object
      Throws:
        `java.sql.SQLException`

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