protected Resource updateResourceVersion(Resource resource,BigDecimal oldVersion,BigDecimal newVersion){
  Preconditions.checkNotNull(resource);
  Preconditions.checkNotNull(oldVersion);
  Preconditions.checkNotNull(newVersion);
  if (!oldVersion.equals(newVersion)) {
    try {
      File oldEml=dataDir.resourceEmlFile(resource.getShortname(),oldVersion);
      File newEml=dataDir.resourceEmlFile(resource.getShortname(),newVersion);
      if (oldEml.exists() && !newEml.exists()) {
        Files.move(oldEml,newEml);
      }
      File oldRtf=dataDir.resourceRtfFile(resource.getShortname(),oldVersion);
      File newRtf=dataDir.resourceRtfFile(resource.getShortname(),newVersion);
      if (oldRtf.exists() && !newRtf.exists()) {
        Files.move(oldRtf,newRtf);
      }
      File oldDwca=dataDir.resourceDwcaFile(resource.getShortname(),oldVersion);
      File newDwca=dataDir.resourceDwcaFile(resource.getShortname(),newVersion);
      if (oldDwca.exists() && !newDwca.exists()) {
        Files.move(oldDwca,newDwca);
      }
      resource.setEmlVersion(newVersion);
    }
 catch (    IOException e) {
      log.error("Failed to update version number for " + resource.getShortname(),e);
      throw new InvalidConfigException(TYPE.CONFIG_WRITE,"Failed to update version number for " + resource.getShortname() + ": "+ e.getMessage());
    }
  }
  return resource;
}

protected Resource updateResourceVersion ( Resource resource , BigDecimal oldVersion , BigDecimal newVersion ) { Preconditions . checkNotNull ( resource ) ; Preconditions . checkNotNull ( oldVersion ) ; Preconditions . checkNotNull ( newVersion ) ; if ( ! oldVersion . equals ( newVersion ) ) { try { File oldEml = dataDir . resourceEmlFile ( resource . getShortname ( ) , oldVersion ) ; File newEml = dataDir . resourceEmlFile ( resource . getShortname ( ) , newVersion ) ; if ( oldEml . exists ( ) && ! newEml . exists ( ) ) { Files . move ( oldEml , newEml ) ; } File oldRtf = dataDir . resourceRtfFile ( resource . getShortname ( ) , oldVersion ) ; File newRtf = dataDir . resourceRtfFile ( resource . getShortname ( ) , newVersion ) ; if ( oldRtf . exists ( ) && ! newRtf . exists ( ) ) { Files . move ( oldRtf , newRtf ) ; } File oldDwca = dataDir . resourceDwcaFile ( resource . getShortname ( ) , oldVersion ) ; File newDwca = dataDir . resourceDwcaFile ( resource . getShortname ( ) , newVersion ) ; if ( oldDwca . exists ( ) && ! newDwca . exists ( ) ) { Files . move ( oldDwca , newDwca ) ; } resource . setEmlVersion ( newVersion ) ; } catch ( IOException e ) { log . error ( "Failed to update version number for " + resource . getShortname ( ) , e ) ; throw new InvalidConfigException ( TYPE . CONFIG_WRITE , "Failed to update version number for " + resource . getShortname ( ) + ": " + e . getMessage ( ) ) ; } } return resource ; }
update a resource ' s version , and rename its eml , rtf , and dwca versioned files to have the new version also .
