Revision 5115
Added by daigle over 14 years ago
XMLAccessAccess.java | ||
---|---|---|
62 | 62 |
"must be specified when selecting xml_access record"); |
63 | 63 |
} |
64 | 64 |
|
65 |
// first get the job from the db and put it into a DAO
|
|
65 |
// first get the xml access from the db and put it into a DAO list
|
|
66 | 66 |
PreparedStatement pstmt = null; |
67 | 67 |
DBConnection conn = null; |
68 | 68 |
int serialNumber = -1; |
... | ... | |
87 | 87 |
XMLAccessDAO xmlAccessDAO = populateDAO(resultSet); |
88 | 88 |
xmlAccessList.add(xmlAccessDAO); |
89 | 89 |
} |
90 |
|
|
90 |
|
|
91 |
// make sure permission orders do not conflict in the database |
|
91 | 92 |
validateDocXMLAccessList(xmlAccessList); |
92 | 93 |
|
93 | 94 |
return xmlAccessList; |
... | ... | |
128 | 129 |
"must be specified when selecting xml_access record"); |
129 | 130 |
} |
130 | 131 |
|
131 |
// first get the job from the db and put it into a DAO
|
|
132 |
// first get the xml access for this principal from the db and put it into a DAO list
|
|
132 | 133 |
PreparedStatement pstmt = null; |
133 | 134 |
DBConnection conn = null; |
134 | 135 |
int serialNumber = -1; |
... | ... | |
155 | 156 |
xmlAccessList.add(xmlAccessDAO); |
156 | 157 |
} |
157 | 158 |
|
159 |
// make sure permission orders do not conflict in the database |
|
158 | 160 |
validatePrincipalXMLAccessList(xmlAccessList); |
159 | 161 |
|
160 | 162 |
return xmlAccessList; |
... | ... | |
173 | 175 |
} |
174 | 176 |
|
175 | 177 |
/** |
176 |
* Get all xml access for a principal for a certain document |
|
178 |
* Get all xml access for a principal/permType/permOrder for a certain document
|
|
177 | 179 |
* |
178 | 180 |
* @param docId |
179 | 181 |
* the id of the document |
... | ... | |
203 | 205 |
"must be specified when selecting xml_access record"); |
204 | 206 |
} |
205 | 207 |
|
206 |
// first get the job from the db and put it into a DAO
|
|
208 |
// first get the xml access for this principal from the db and put it into a DAO list
|
|
207 | 209 |
PreparedStatement pstmt = null; |
208 | 210 |
DBConnection conn = null; |
209 | 211 |
int serialNumber = -1; |
... | ... | |
590 | 592 |
} |
591 | 593 |
|
592 | 594 |
/** |
593 |
* Delete xml access. This removes all access records from the database for a principal |
|
594 |
* for a given document, perm type and perm order |
|
595 |
* Checks to see if there is a permission order conflict for a given document. Each |
|
596 |
* document is only allowed to have a single permission order |
|
597 |
* |
|
595 | 598 |
* @param docId |
596 | 599 |
* document id |
597 | 600 |
* @param principal |
... | ... | |
644 | 647 |
/** |
645 | 648 |
* Delete xml access. This removes all access records from the database for a principal |
646 | 649 |
* for a given document, perm type and perm order |
650 |
* |
|
647 | 651 |
* @param docId |
648 | 652 |
* document id |
649 | 653 |
* @param principal |
... | ... | |
706 | 710 |
* more than one record exists, delete the existing records, consolidate the |
707 | 711 |
* permissions insert the new record. |
708 | 712 |
* |
709 |
* @param xmlAccessList |
|
710 |
* @throws AccessException |
|
713 |
* @param xmlAccessList the access dao list |
|
711 | 714 |
*/ |
712 | 715 |
private void cleanupXMLAccessForPrincipal(Vector<XMLAccessDAO> xmlAccessList) throws AccessException{ |
713 | 716 |
|
... | ... | |
793 | 796 |
} |
794 | 797 |
|
795 | 798 |
/** |
799 |
* Make sure for a given list of access DAOs that only one perm order |
|
800 |
* exists. It is assumed that all the DAOs are for the same doc |
|
796 | 801 |
* |
797 | 802 |
* @param xmlAccessList |
798 |
* @throws PermOrderException
|
|
803 |
* the access dao list
|
|
799 | 804 |
*/ |
800 | 805 |
private void validateDocXMLAccessList(Vector<XMLAccessDAO> xmlAccessList) throws PermOrderException { |
801 | 806 |
String permOrder = null; |
... | ... | |
812 | 817 |
} |
813 | 818 |
} |
814 | 819 |
|
820 |
/** |
|
821 |
* Check that only one permOrder exists for each principal. |
|
822 |
* TODO add check that one of each permType exists as well |
|
823 |
* |
|
824 |
* @param xmlAccessList |
|
825 |
* the access dao list |
|
826 |
*/ |
|
815 | 827 |
private void validatePrincipalXMLAccessList(Vector<XMLAccessDAO> xmlAccessList) |
816 | 828 |
throws PermOrderException { |
817 | 829 |
|
Also available in: Unified diff
Format and add comments.