Project

General

Profile

« Previous | Next » 

Revision 774

Added by bojilova almost 23 years ago

use the non-null function name from db adapter

View differences:

src/edu/ucsb/nceas/metacat/AccessControlList.java
47 47
import org.xml.sax.helpers.XMLReaderFactory;
48 48
import org.xml.sax.helpers.DefaultHandler;
49 49

  
50
import edu.ucsb.nceas.dbadapter.DBAdapter;
51

  
50 52
/** 
51 53
 * A Class that loads eml-access.xml file containing ACL for a metadata
52 54
 * document into relational DB. It extends DefaultHandler class to handle
......
54 56
 */
55 57
public class AccessControlList extends DefaultHandler {
56 58

  
57
  static final int ALL = 1;
58
  static final int WRITE = 2;
59
  static final int READ = 4;
59
  private static final int ALL = 1;
60
  private static final int WRITE = 2;
61
  private static final int READ = 4;
62
  private static String sysdate = MetaCatUtil.dbAdapter.getDateTimeFunction();
63
  private static String isnull = MetaCatUtil.dbAdapter.getIsNULLFunction();
60 64

  
61 65
  private Connection conn;
62 66
  private String parserName;
......
700 704
                "WHERE docid = ? " + 
701 705
                "AND principal_name = ? " +
702 706
                "AND perm_type = ? " +
703
                "AND sysdate BETWEEN nvl(begin_time,sysdate) " +
704
                                "AND nvl(end_time,sysdate)");
707
                "AND " + sysdate + 
708
                " BETWEEN " + isnull + "(begin_time," + sysdate + ") " +
709
                     "AND " + isnull + "(end_time," + sysdate + ")");
705 710
        // check if it is "deny" with "allowFirst" first
706 711
        // Bind the values to the query
707 712
        pstmt.setString(1, resourceID);
......
808 813
            "AND permission = ? " +
809 814
            "AND perm_type = ? " +
810 815
            "AND perm_order = ? " +
811
            "AND sysdate BETWEEN nvl(begin_time,sysdate) " +
812
                            "AND nvl(end_time,sysdate)");
816
            "AND " + sysdate + 
817
            " BETWEEN " + isnull + "(begin_time," + sysdate + ") " +
818
                 "AND " + isnull + "(end_time," + sysdate + ")");
813 819
    // Bind the values to the query
814 820
    pstmt.setString(1, resourceID);
815 821
    pstmt.setString(2, principal);

Also available in: Unified diff