Project

General

Profile

« Previous | Next » 

Revision 5319

Added by Matt Jones about 14 years ago

Modifications to support the DataONE service API version 0.1.0. For DataONE, the get() and
create() services are partially complete. Several more functions and checks need to be added to
create() before it is viable. This DataONE support is not complete, and the current support breaks the MetacatRestClientTest for the time being (this client will eventually be removed).

View differences:

DocumentImpl.java
485 485
      
486 486
      PreparedStatement pstmt = null;
487 487
      int revision = (new Integer(rev)).intValue();
488
      String sqlDateString = DatabaseService.getDBAdapter().getDateTimeFunction();
488
      String sqlDateString = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
489 489
      if (createDate == null)
490 490
      {
491 491
          createDate = sqlDateString;
492 492
      }
493 493
      else
494 494
      {
495
          createDate = DatabaseService.getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
495
          createDate = DatabaseService.getInstance().getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
496 496
      }
497 497
      
498 498
      if (updateDate == null)
......
501 501
      }
502 502
      else
503 503
      {
504
          updateDate = DatabaseService.getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
504
          updateDate = DatabaseService.getInstance().getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
505 505
      }
506 506
      try
507 507
      {
......
549 549
    }
550 550
    catch(Exception e) 
551 551
    {
552
     
552
        logMetacat.debug("Caught a general exception: " + e.getMessage());
553 553
        throw e;
554 554
    }
555 555
    finally 
......
2273 2273
            String catalogid, int serverCode, String createDate, String updateDate) throws SQLException, Exception
2274 2274
    {
2275 2275
        //System.out.println("!!!!!!!!1write document to db  " +docid +"."+rev);
2276
        String sysdate = DatabaseService.getDBAdapter().getDateTimeFunction();
2276
        String sysdate = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
2277 2277
        if (createDate == null)
2278 2278
        {
2279 2279
            createDate = sysdate;
2280 2280
        }
2281 2281
        else
2282 2282
        {
2283
            createDate = DatabaseService.getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
2283
            createDate = DatabaseService.getInstance().getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
2284 2284
        }
2285 2285
        if (updateDate == null)
2286 2286
        {
......
2288 2288
        }
2289 2289
        else
2290 2290
        {
2291
            updateDate = DatabaseService.getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
2291
            updateDate = DatabaseService.getInstance().getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
2292 2292
        }
2293 2293
        DocumentImpl thisdoc = null;
2294 2294

  
......
3551 3551
    private static void archiveDocAndNodesRevison(DBConnection dbconn, String docid, 
3552 3552
                                     String user, long rootNodeId) throws Exception
3553 3553
    {
3554
        String sysdate = DatabaseService.getDBAdapter().getDateTimeFunction();
3554
        String sysdate = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
3555 3555
        //DBConnection conn = null;
3556 3556
        //int serialNumber = -1;
3557 3557
        PreparedStatement pstmt = null;
......
3637 3637
    /** Save a document entry in the xml_revisions table */
3638 3638
    private static void archiveDocRevision(String docid, String user, DBConnection conn) throws Exception
3639 3639
    {
3640
        String sysdate = DatabaseService.getDBAdapter().getDateTimeFunction();
3640
        String sysdate = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
3641 3641
        PreparedStatement pstmt = null;
3642 3642

  
3643 3643
        // create a record in xml_revisions table
......
3882 3882
                        .prepareStatement("INSERT INTO xml_replication "
3883 3883
                                + "(server, last_checked, replicate, datareplicate, hub) "
3884 3884
                                + "VALUES ('" + server + "', "
3885
                                + DatabaseService.getDBAdapter().toDate("01/01/1980", "MM/DD/YYYY")
3885
                                + DatabaseService.getInstance().getDBAdapter().toDate("01/01/1980", "MM/DD/YYYY")
3886 3886
                                + ", '" + replicate + "', '" + dataReplicate
3887 3887
                                + "','" + hub + "')");
3888 3888

  
......
4078 4078
            
4079 4079
            if (createDate == null)
4080 4080
            {
4081
                createDate = DatabaseService.getDBAdapter().getDateTimeFunction();
4081
                createDate = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
4082 4082
            }
4083 4083
            else
4084 4084
            {
4085
                createDate = DatabaseService.getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
4085
                createDate = DatabaseService.getInstance().getDBAdapter().toDate(createDate, "YYYY-MM-DD HH24:MI:SS");
4086 4086
            }
4087 4087
            logMetacat.debug("DocumentImpl.writeDocumentToRevisionTable - the create date is "+createDate);
4088 4088
            if (updateDate == null)
4089 4089
            {
4090
                updateDate = DatabaseService.getDBAdapter().getDateTimeFunction();
4090
                updateDate = DatabaseService.getInstance().getDBAdapter().getDateTimeFunction();
4091 4091
            }
4092 4092
            else
4093 4093
            {
4094
                updateDate = DatabaseService.getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
4094
                updateDate = DatabaseService.getInstance().getDBAdapter().toDate(updateDate, "YYYY-MM-DD HH24:MI:SS");
4095 4095
            }
4096 4096
            logMetacat.debug("DocumentImpl.writeDocumentToRevisionTable - the update date is "+updateDate);
4097 4097
            PreparedStatement pstmt = null;

Also available in: Unified diff