Index: src/edu/ucsb/nceas/metacat/accesscontrol/XMLAccessAccess.java
===================================================================
--- src/edu/ucsb/nceas/metacat/accesscontrol/XMLAccessAccess.java	(revision 6016)
+++ src/edu/ucsb/nceas/metacat/accesscontrol/XMLAccessAccess.java	(revision 6017)
@@ -269,7 +269,7 @@
 	 *            permission order
 	 */
 	public void addXMLAccess(String docId, String principalName, Long permission, String permType, 
-			String permOrder) throws AccessException, PermOrderException {
+			String permOrder, String accessFileId, String subTreeId) throws AccessException, PermOrderException {
 		
 		permOrderConflict(docId, permOrder);
 		
@@ -280,7 +280,7 @@
 		// access type / access order combination, call cleanup to combine common access and then
 		// re-retrieve the access list.
 		if (xmlAccessList.size() == 0) {
-			insertXMLAccess(docId, principalName, permission, permType, permOrder);
+			insertXMLAccess(docId, principalName, permission, permType, permOrder, accessFileId, subTreeId);
 			return;
 		}
 		
@@ -322,7 +322,7 @@
 		// re-retrieve the access list.
 		for(XMLAccessDAO xmlAccessDAO : xmlAccessList) {
 			insertXMLAccess(docId, xmlAccessDAO.getPrincipalName(), xmlAccessDAO.getPermission(), 
-					xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder());
+					xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder(), xmlAccessDAO.getAccessFileId(), xmlAccessDAO.getSubTreeId());
 		}
 	}
 	
@@ -343,7 +343,7 @@
 	 *            permission order
 	 */
 	private void insertXMLAccess(String docId, String principalName, Long permission, String permType,
-			String permOrder) throws AccessException {
+			String permOrder, String accessFileId, String subTreeId) throws AccessException {
 	    //System.out.println("permission in insertXMLAccess: " + permission);
 	    try
 	    {
@@ -387,8 +387,8 @@
 			serialNumber = conn.getCheckOutSerialNumber();
 			
 			String sql = "INSERT INTO xml_access " +
-				"(docid, principal_name, permission, perm_type, perm_order ) " + 
-				"VALUES (?,?,?,?,?)";
+				"(docid, principal_name, permission, perm_type, perm_order, accessfileid, subtreeid ) " + 
+				"VALUES (?,?,?,?,?,?,?)";
 			pstmt = conn.prepareStatement(sql);
 
 			// Bind the values to the query
@@ -397,6 +397,8 @@
 			pstmt.setLong(3, permission);
 			pstmt.setString(4, permType);
 			pstmt.setString(5, permOrder);
+			pstmt.setString(6, accessFileId);
+			pstmt.setString(7, subTreeId);
 			
 			String sqlReport = "XMLAccessAccess.insertXMLAccess - SQL: " + sql;
 			sqlReport += " [" + docId + "," + principalName + "," +  permission + "," +  permType + "," + permOrder + "]";
@@ -746,6 +748,9 @@
 		String principalName = null;
 		String permType = null;
 		String permOrder = null;
+		// TODO: handle these fields
+		String accessFileId = null;
+		String subTreeId = null;
 	
 		
 		// iterate through the list of access dao objects and bttwise or the permissions.  Most
@@ -803,6 +808,12 @@
 				numDenyRecords++;
 				denyPermissionMask |= xmlAccessDAO.getPermission();
 			}
+			if (accessFileId == null) {
+				accessFileId = xmlAccessDAO.getAccessFileId();
+			}
+			if (subTreeId == null) {
+				subTreeId = xmlAccessDAO.getSubTreeId();
+			}
 		}
 		
 		// if there was more than one allow record, remove all allow records for this user on this doc 
@@ -809,13 +820,13 @@
 		// with this perm type and perm order then insert a single record 
 		if (numAllowRecords > 1) {
 			deleteXMLAccessForPrincipal(docId, principalName, AccessControlInterface.ALLOW, permOrder);
-			insertXMLAccess(docId, principalName, allowPermissionMask, AccessControlInterface.ALLOW, permOrder);
+			insertXMLAccess(docId, principalName, allowPermissionMask, AccessControlInterface.ALLOW, permOrder, accessFileId, subTreeId);
 		}
 		// if there was more than one deny record, remove all deny records for this user on this doc 
 		// with this perm type and perm order then insert a single record 
 		if (numDenyRecords > 1) {
 			deleteXMLAccessForPrincipal(docId, principalName, AccessControlInterface.DENY, permOrder);
-			insertXMLAccess(docId, principalName, denyPermissionMask, AccessControlInterface.DENY, permOrder);
+			insertXMLAccess(docId, principalName, denyPermissionMask, AccessControlInterface.DENY, permOrder, accessFileId, subTreeId);
 		}
 	}
 	
Index: src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlForSingleFile.java
===================================================================
--- src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlForSingleFile.java	(revision 6016)
+++ src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlForSingleFile.java	(revision 6017)
@@ -95,7 +95,7 @@
 	public void insertPermissions(XMLAccessDAO xmlAccessDAO) 
 			throws AccessControlException, PermOrderException{
 		insertPermissions(xmlAccessDAO.getPrincipalName(), xmlAccessDAO.getPermission(), 
-				xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder());
+				xmlAccessDAO.getPermType(), xmlAccessDAO.getPermOrder(), xmlAccessDAO.getAccessFileId(), xmlAccessDAO.getSubTreeId());
 	}
 
 	/**
@@ -110,7 +110,7 @@
 	 * @param permOrder
 	 *            the permission order
 	 */
-	public void insertPermissions(String principalName, Long permission, String permType, String permOrder) 
+	public void insertPermissions(String principalName, Long permission, String permType, String permOrder, String accessFileId, String subTreeId) 
 			throws AccessControlException, PermOrderException {
 		try {
 			// The addXMLAccess method will create the permission record if it does not exist.  
@@ -118,7 +118,7 @@
 			// doc id.
 			XMLAccessAccess xmlAccessAccess = new XMLAccessAccess();
 			//System.out.println("permission in accessControlForSingleFile.insertPermissions: " + permission);
-			xmlAccessAccess.addXMLAccess(_docId, principalName, new Long(permission), permType, permOrder);
+			xmlAccessAccess.addXMLAccess(_docId, principalName, new Long(permission), permType, permOrder, accessFileId, subTreeId);
 		} catch (AccessException ae) {
 			throw new AccessControlException("AccessControlForSingleFile.insertPermissions - "
 					+ "DB access error when inserting permissions: " + ae.getMessage());
@@ -196,7 +196,7 @@
 				"AND principal_name = ? " +
 				"AND permission = ? " +
 				"AND perm_type = ? " +
-				"AND perm_order =? ");
+				"AND perm_order = ? ");
      
 			// Bind the values to the query
 			pstmt.setString(1, _docId);
Index: src/edu/ucsb/nceas/metacat/MetacatHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 6016)
+++ src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 6017)
@@ -3179,7 +3179,7 @@
                         new AccessControlForSingleFile(accessionNumber);
                     //System.out.println("permission in MetacatHandler: " + l.longValue());
                     //System.out.println("permission in MetacatHandler: " + Integer.valueOf(AccessControlList.intValue(permission)).longValue());
-                    accessControl.insertPermissions(principal, Integer.valueOf(AccessControlList.intValue(permission)).longValue(), permType, permOrder);
+                    accessControl.insertPermissions(principal, Integer.valueOf(AccessControlList.intValue(permission)).longValue(), permType, permOrder, null, null);
                 } catch (Exception ee) {
                     logMetacat.error("MetaCatServlet.handleSetAccessAction - Error inserting permission: "
                             + ee.getMessage());
