Project

General

Profile

« Previous | Next » 

Revision 9284

Added by Jing Tao over 9 years ago

The code was added to compare the serial version in the updateSystemMetadata method. If the serial version in the new system metadata is less than or equals previous version, an exception will be thrown.

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
1628 1628
      logMetacat.debug("The current dateUploaded is (by time) ============"+currentSysmeta.getDateUploaded().getTime());
1629 1629
      logMetacat.debug("the dateUploaded in the new system metadata is (by time) "+sysmeta.getDateUploaded().getTime());
1630 1630
      if(currentSysmeta == null ) {
1631
          //do we need throw an exception
1631
          //do we need throw an exception?
1632
          
1632 1633
      } else {
1634
          
1635
          BigInteger newVersion = sysmeta.getSerialVersion();
1636
          if(newVersion == null) {
1637
              throw new InvalidSystemMetadata("4956", "The serial version can't be null in the new system metadata");
1638
          }
1639
          BigInteger currentVersion = currentSysmeta.getSerialVersion();
1640
          if(currentVersion != null && newVersion.compareTo(currentVersion) <= 0) {
1641
              throw new InvalidSystemMetadata("4956", "The serial version in the new system metadata is "+newVersion.toString()+
1642
                      " which is less than or equals the previous version "+currentVersion.toString()+". This is illegal in the updateSystemMetadata method.");
1643
          }
1633 1644
          Identifier currentSid = currentSysmeta.getSeriesId();
1634 1645
          if(currentSid != null) {
1635 1646
              //new sid must match the current sid

Also available in: Unified diff