Project

General

Profile

« Previous | Next » 

Revision 887

Added by berkley over 22 years ago

made it so we can now use multiple accessfilestypes and packagdfiletypes in the metacat.properties file. Also fixed a bug introduced when the 'http://' was removed from behind the server name in the loaddtd.sql script and the knb.xml file

View differences:

RelationHandler.java
147 147
  public String getAccessFileID(String docid) throws SQLException
148 148
  {
149 149
    String aclid = null;
150
    
151
    StringBuffer sql = new StringBuffer();
152
    sql.append("SELECT docid FROM xml_documents WHERE docid in (SELECT subject ");
153
    sql.append("FROM xml_relation WHERE docid='").append(docid);
154
    sql.append("' AND (");
155
    Vector accessdoctypes = MetaCatUtil.getOptionList(
156
                              MetaCatUtil.getOption("accessdoctype"));
157
    for(int i=0; i<accessdoctypes.size(); i++)
158
    {
159
      String atype = (String)accessdoctypes.elementAt(i);
160
      sql.append("doctype='").append(atype).append("'");
161
      if(i < accessdoctypes.size()-1)
162
      {
163
        sql.append(" OR ");
164
      }
165
    }
166
    sql.append("))");
167
    //System.out.println("new sql script: " + sql.toString());
168
    
169
    /*
150 170
    PreparedStatement pstmt = 
151 171
      conn.prepareStatement("SELECT docid FROM xml_documents " +
152 172
                            "WHERE docid in " +
......
155 175
                            "AND doctype = ?");
156 176
    pstmt.setString(1, docid);
157 177
    pstmt.setString(2, MetaCatUtil.getOption("accessdoctype"));
178
    */
179
    PreparedStatement pstmt = conn.prepareStatement(sql.toString());
158 180
    pstmt.execute();
159 181
    ResultSet rs = pstmt.getResultSet();
160 182
    boolean hasRow = rs.next();

Also available in: Unified diff