PreparedStatement psFragmentRestr =
con.prepareStatement("DELETE FROM UP_FRAGMENT_RESTRICTIONS"+
" WHERE FRAGMENT_ID=? AND NODE_ID=? AND RESTRICTION_NAME=? AND RESTRICTION_TREE_PATH=?");
Enumeration restrictions = restrHash.elements();
for ( ;restrictions.hasMoreElements(); ) {
IUserLayoutRestriction restriction = (IUserLayoutRestriction) restrictions.nextElement();
psFragmentRestr.setInt(1,fragmentId);
psFragmentRestr.setInt(2,nodeId);
psFragmentRestr.setString(3,restriction.getName());
String path = restriction.getRestrictionPath();
psFragmentRestr.setString(4,path);
//execute update restrictions
count += psFragmentRestr.executeUpdate();
} // end for
psFragmentRestr.close();
// fragment ID is null
} else if ( fragmentId <= 0 ){
PreparedStatement psRestr =
con.prepareStatement("DELETE FROM UP_LAYOUT_RESTRICTIONS"+
" WHERE LAYOUT_ID=? AND USER_ID=? AND NODE_ID=? AND RESTRICTION_NAME=? AND RESTRICTION_TREE_PATH=?");
Enumeration restrictions = restrHash.elements();
for ( ;restrictions.hasMoreElements(); ) {
IUserLayoutRestriction restriction = (IUserLayoutRestriction) restrictions.nextElement();
psRestr.setInt(1,layoutId);
psRestr.setInt(2,userId);
psRestr.setInt(3,nodeId);
psRestr.setString(4,restriction.getName());
String path = restriction.getRestrictionPath();
psRestr.setString(5,path);
//execute update restrictions
count += psRestr.executeUpdate();