Project

General

Profile

« Previous | Next » 

Revision 2616

Added by Jing Tao about 19 years ago

Fixed some bug in replication.

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
2103 2103
                     */
2104 2104
                    parser = initializeParser(conn, action, docid, updaterev,
2105 2105
                            user, groups, pub, serverCode, dtd, ruleBase,
2106
                            needValidation);
2106
                            needValidation, false);// false means it is not a revision doc
2107 2107
                    conn.setAutoCommit(false);
2108 2108
                    parser.parse(new InputSource(xml));
2109 2109
                    conn.commit();
......
2171 2171
        XMLReader parser = null;
2172 2172
        try {
2173 2173
            parser = initializeParser(conn, action, docid, rev, user, groups,
2174
                    pub, serverCode, dtd, ruleBase, needValidation);
2174
                    pub, serverCode, dtd, ruleBase, needValidation, false);
2175
            //false means it is not a revision doc
2175 2176

  
2176 2177
            conn.setAutoCommit(false);
2177 2178
            parser.parse(new InputSource(xml));
......
2180 2181
            
2181 2182
            // write to xml_node complete. start the indexing thread.
2182 2183
            DBSAXHandler dbx = (DBSAXHandler) parser.getContentHandler();
2183
            System.out.println("here!!!!!!!adf");
2184
            //System.out.println("here!!!!!!!adf");
2184 2185
            dbx.runIndexingThread();
2185
            System.out.println("here!!!!!!!adfadfa");
2186
            //System.out.println("here!!!!!!!adfadfa");
2186 2187
        } catch (Exception e) {
2187 2188
            e.printStackTrace();
2188 2189
            conn.rollback();
......
2310 2311
        // insert into xml_nodes table
2311 2312
        XMLReader parser = null;
2312 2313
        try {
2313

  
2314
            parser = initializeParser(conn, action, docid, rev, user, groups,
2315
                    pub, serverCode, dtd, ruleBase, needValidation);
2316
            DBSAXHandler dbx = (DBSAXHandler) parser.getContentHandler();
2314
            boolean isRevision = false;
2317 2315
            if (tableName.equals(REVISIONTABLE))
2318 2316
            {
2319
                dbx.setIsRevisionDoc(true);
2317
                isRevision = true;
2320 2318
            }
2319
            parser = initializeParser(conn, action, docid, rev, user, groups,
2320
                    pub, serverCode, dtd, ruleBase, needValidation, isRevision);
2321
         
2321 2322
            conn.setAutoCommit(false);
2322 2323
            parser.parse(new InputSource(xml));
2323 2324
            conn.commit();
......
2325 2326
            
2326 2327
            // write to xml_node complete. start the indexing thread.
2327 2328
            // this only for xml_documents
2328
            if (!tableName.equals(REVISIONTABLE))
2329
            DBSAXHandler dbx = (DBSAXHandler) parser.getContentHandler();
2330
            if (!isRevision)
2329 2331
            {
2330 2332
                dbx.runIndexingThread();
2331 2333
            }
......
2735 2737
    private static XMLReader initializeParser(DBConnection dbconn,
2736 2738
            String action, String docid, String rev, String user,
2737 2739
            String[] groups, String pub, int serverCode, Reader dtd,
2738
            String ruleBase, boolean needValidation) throws Exception
2740
            String ruleBase, boolean needValidation, boolean isRevision) throws Exception
2739 2741
    {
2740 2742
        XMLReader parser = null;
2741 2743
        try {
2742 2744
            // handler
2743
            ContentHandler chandler;
2745
            DBSAXHandler chandler;
2744 2746
            EntityResolver eresolver;
2745 2747
            DTDHandler dtdhandler;
2746 2748
            // Get an instance of the parser
......
2750 2752
                MetaCatUtil.debugMessage("eml 2.0.0 parser", 20);
2751 2753
                chandler = new Eml200SAXHandler(dbconn, action, docid, rev,
2752 2754
                        user, groups, pub, serverCode);
2755
                chandler.setIsRevisionDoc(isRevision);
2753 2756
                parser.setContentHandler((ContentHandler) chandler);
2754 2757
                parser.setErrorHandler((ErrorHandler) chandler);
2755 2758
                parser.setProperty(DECLARATIONHANDLERPROPERTY, chandler);
......
2774 2777
                MetaCatUtil.debugMessage("eml 2.1.0 parser", 20);
2775 2778
                chandler = new Eml210SAXHandler(dbconn, action, docid, rev,
2776 2779
                        user, groups, pub, serverCode);
2780
                chandler.setIsRevisionDoc(isRevision);
2777 2781
                parser.setContentHandler((ContentHandler) chandler);
2778 2782
                parser.setErrorHandler((ErrorHandler) chandler);
2779 2783
                parser.setProperty(DECLARATIONHANDLERPROPERTY, chandler);
......
2799 2803
                // specification
2800 2804
                chandler = new DBSAXHandler(dbconn, action, docid, rev, user,
2801 2805
                        groups, pub, serverCode);
2806
                chandler.setIsRevisionDoc(isRevision);
2802 2807
                parser.setContentHandler((ContentHandler) chandler);
2803 2808
                parser.setErrorHandler((ErrorHandler) chandler);
2804 2809
                parser.setProperty(DECLARATIONHANDLERPROPERTY, chandler);

Also available in: Unified diff