Project

General

Profile

« Previous | Next » 

Revision 2045

Added by Jing Tao about 20 years ago

Fixed the bug for sessionid storing, revision couldn't be zero and Ldap DN is case sensitive.

View differences:

MetaCatUtil.java
419 419

  
420 420
    return docId;
421 421
  }//getDocIdFromString
422
  
422 423

  
424

  
423 425
  /**
424 426
   * Utility method to get version number from a given string
425 427
   * @param string, the given string should be these two format:
......
516 518
  }//getVersionFromString
517 519

  
518 520
  /**
521
   * This method will get docid from an AccessionNumber. There is no assumption
522
   * the accessnumber will be str1.str2.str3. It can be more. So we think
523
   * the docid will be get rid of last part
524
   */
525
   public static String getDocIdFromAccessionNumber(String accessionNumber)
526
   {
527
     String docid = null;
528
     if (accessionNumber == null)
529
     {
530
       return docid;
531
     }
532
     String seperator=getOption("accNumSeparator");
533
     int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
534
     docid=accessionNumber.substring(0, indexOfLastSeperator);
535
     MetaCatUtil.debugMessage("after parsing accessionnumber, docid is " + 
536
                              docid, 30);
537
     return docid;
538
   }
539
   
540
   /**
541
    * This method will call both getDocIdFromString and
542
    * getDocIdFromAccessionNumber. So first, if the string looks
543
    * str1.str2, the docid will be str1.str2.
544
    * If the string is str1.str2.str3, the docid will be str1.str2.
545
    * If the string is str1.str2.str3.str4 or more, the docid will be
546
    * str1.str2.str3.
547
    * If the string look like str1, null will be returned
548
    *
549
    */
550
    public static String getSmartDocId(String str)
551
    {
552
      String docid = null;
553
      //call geDocIdFromString first. 
554
      docid = getDocIdFromString(str);
555
      // If docid is null, try to call getDocIdFromAccessionNumber
556
      // it will handle the seperator more than2
557
      if (docid == null)
558
      {
559
         docid = getDocIdFromAccessionNumber(str);        
560
      }
561
      MetaCatUtil.debugMessage("The docid get from smart docid getor is " +
562
                                docid, 30);
563
      return docid;
564
    }
565
   
566
    /**
567
   * This method will get revision from an AccessionNumber. There is no assumption
568
   * the accessnumber will be str1.str2.str3. It can be more. So we think
569
   * the docid will be get rid of last part
570
   */
571
   public static int getRevisionFromAccessionNumber(String accessionNumber)
572
                                        throws NumberFormatException
573
   {
574
     String rev = null;
575
     int revNumber =-1;
576
     if (accessionNumber == null)
577
     {
578
       return revNumber;
579
     }
580
     String seperator=getOption("accNumSeparator");
581
     int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
582
     rev =accessionNumber.substring(indexOfLastSeperator+1, 
583
                                    accessionNumber.length());
584
     revNumber = Integer.parseInt(rev);
585
     MetaCatUtil.debugMessage("after parsing accessionnumber, rev is " + 
586
                               revNumber, 30);
587
     return revNumber;
588
   }
589
   
590
  
591
  /**
519 592
   * Method to get the name of local replication server
520 593
   */
521 594
   public static String getLocalReplicationServerName()

Also available in: Unified diff