Project

General

Profile

« Previous | Next » 

Revision 2620

Added by Jing Tao about 19 years ago

Add code to get date info

View differences:

src/edu/ucsb/nceas/metacat/DBSAXHandler.java
63 63
    protected String docname = null;
64 64

  
65 65
    protected String doctype;
66
    
67
    protected String catalogid = null;
66 68

  
67 69
    protected String systemid;
68 70

  
......
75 77
    protected DBConnection connection = null;
76 78

  
77 79
    protected DocumentImpl currentDocument;
80
    
81
    protected String createDate = null;
82
    
83
    protected String updateDate = null;
78 84

  
79 85
    protected DBSAXNode rootNode;
80 86

  
......
135 141
     *
136 142
     * @param conn the JDBC connection to which information is written
137 143
     */
138
    private DBSAXHandler(DBConnection conn)
144
    private DBSAXHandler(DBConnection conn, String createDate, String updateDate)
139 145
    {
140 146
        this.connection = conn;
141 147
        this.atFirstElement = true;
142 148
        this.processingDTD = false;
149
        this.createDate = createDate;
150
        this.updateDate = updateDate;
143 151

  
144 152
        // Create the stack for keeping track of node context
145 153
        // if it doesn't already exist
......
194 202
     */
195 203
    public DBSAXHandler(DBConnection conn, String action, String docid,
196 204
            String revision, String user, String[] groups, String pub,
197
            int serverCode)
205
            int serverCode, String createDate, String updateDate)
198 206
    {
199
        this(conn);
207
        this(conn, createDate, updateDate);
200 208
        this.action = action;
201 209
        this.docid = docid;
202 210
        this.revision = revision;
......
327 335
                // insert document action fialed.
328 336
                // In order to decrease DBConnection usage count, we get a new
329 337
                // dbconnection from pool
330
                String catalogid = null;
338
               
331 339
                DBConnection dbConn = null;
332 340
                int serialNumber = -1;
333 341
               
......
365 373
                  //System.out.println("here!!!!!!!!!!!3");
366 374
                  currentDocument = new DocumentImpl(connection, rootNode
367 375
                        .getNodeID(), docname, doctype, docid, revision,
368
                        action, user, this.pub, catalogid, this.serverCode);
376
                        action, user, this.pub, catalogid, this.serverCode, 
377
                        createDate, updateDate);
369 378
                  //System.out.println("here!!!!!!!!!!!4");
370 379
                }
371
                else
372
                {
373
                    //System.out.println("here!!!!!!!!!!!5");
374
                    currentDocument = new DeletedDocumentImpl(connection, rootNode
375
                            .getNodeID(), docname, doctype, docid, revision,
376
                            action, user, this.pub, catalogid, this.serverCode);
377
                    //System.out.println("here!!!!!!!!!!!6");
378
                }
379
                //System.out.println("here!!!!!!!!!!!7");
380
               
380 381

  
381 382
            } catch (Exception ane) {
382 383
                ane.printStackTrace();
......
462 463
    public void run()
463 464
    {
464 465
        try {
465
            // stop 5 second
466
            Thread.sleep(5000);
467
            //make sure record is done
468
            checkDocumentTable();
469
            // Build the index for this document
470
            currentDocument.buildIndex();
466
            if (!isRevisionDoc)
467
            {
468
             // stop 5 second
469
             Thread.sleep(5000);
470
             //make sure record is done
471
             checkDocumentTable();
472
             // Build the index for this document
473
             currentDocument.buildIndex();
474
            }
471 475
        } catch (Exception e) {
472 476
            MetaCatUtil.debugMessage("Error in DBSAXHandler.run "
473 477
                    + e.getMessage(), 30);
......
921 925
    {
922 926
        return rootNode.getNodeID();
923 927
    }
928
    
929
    public String getDocumentType()
930
    {
931
        return doctype;
932
    }
933
    
934
    public String getDocumentName()
935
    {
936
        return docname;
937
    }
938
    
939
    public String getCatalogId()
940
    {
941
        return catalogid;
942
    }
924 943
}

Also available in: Unified diff