Ignore:
Timestamp:
2004-11-03T14:33:35+13:00 (20 years ago)
Author:
kjdon
Message:

added a new function to check whether a document is hierarchical or not - its hierarchical if there is a structure named Section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/SQLQuery.java

    r6865 r8438  
    9999    }
    100100
     101    // does the document have sections, or is it just a single page document?
     102    public boolean isHierarchicalDocument(String oid) {
     103    // first just check the OID - it may already have section info in it
     104    if (!GS3OID.isDocTop(oid)) {
     105        return true;
     106    }
     107
     108    // now we need to check the database
     109    String query = "select * "+
     110        " from "+GSSQL.STRUCTURE_TABLE +
     111        " where "+ GSSQL.DOCUMENT_ID +GSSQL.EQUALS_QUOTE + oid + GSSQL.QUOTE +
     112        " and "+ GSSQL.STRUCTURE_ID +GSSQL.EQUALS_QUOTE + "Section" + GSSQL.QUOTE +
     113        GSSQL.END;
     114   
     115    connection.execute(query);
     116    ResultSet results = null;
     117    try {
     118        results = connection.getResultSet();
     119        if (results.next()) {
     120        return true;
     121        }
     122    } catch (java.sql.SQLException e) {
     123        return false;
     124    }
     125
     126    return false;
     127    }
     128   
    101129    // classifier metadata is not actually metadata
    102130    public String getClassifierMetadata(String oid, String full_meta_name) {
Note: See TracChangeset for help on using the changeset viewer.