edu.ucsb.nceas.metacat.accesscontrol
Class XMLAccessAccess

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

public class XMLAccessAccess
extends BaseAccess


Constructor Summary
XMLAccessAccess()
           
 
Method Summary
 void addXMLAccess(java.lang.String docId, 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 docId)
          Delete xml access.
 java.util.Vector<XMLAccessDAO> getXMLAccessForDoc(java.lang.String docId)
          Get all xml access for a document
 java.util.Vector<XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String docId, java.lang.String principalName)
          Get all xml access for a principal for a certain document
 java.util.Vector<XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String docId, 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
protected  XMLAccessDAO populateDAO(java.sql.ResultSet resultSet)
          Populate a job data object with the current row in a resultset
 void removeXMLAccessForPrincipal(java.lang.String docId, java.lang.String principalName, java.lang.Long permission)
          Remove xml access.
 void replaceAccess(java.lang.String docId, java.util.Vector<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<XMLAccessDAO> getXMLAccessForDoc(java.lang.String docId)
                                                  throws AccessException
Get all xml access for a document

Parameters:
docId - the id of the document
Returns:
an xml access DAO list
Throws:
AccessException

getXMLAccessForPrincipal

public java.util.Vector<XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String docId,
                                                               java.lang.String principalName)
                                                        throws AccessException
Get all xml access for a principal for a certain document

Parameters:
docId - 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<XMLAccessDAO> getXMLAccessForPrincipal(java.lang.String docId,
                                                               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:
docId - 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 docId,
                         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:
docId - document id
principalName - principal credentials
permission - permission bitmap
permType - permission type
permOrder - permission order
Throws:
AccessException
PermOrderException

replaceAccess

public void replaceAccess(java.lang.String docId,
                          java.util.Vector<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:
docId - 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 docId,
                                        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:
docId - document id
principalName - principal credentials
Throws:
AccessException

deleteXMLAccessForDoc

public void deleteXMLAccessForDoc(java.lang.String docId)
                           throws AccessException
Delete xml access. This removes all access records from the database for a given document

Parameters:
docId - document id
Throws:
AccessException

populateDAO

protected 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 © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.