private ExtensionMapping migrateExtensionMapping(ExtensionMapping extensionMapping,Extension newer,Set<ExtensionProperty> deprecated){
  log.debug("Migrating extension mapping...");
  extensionMapping.setExtension(newer);
  for (  ExtensionProperty deprecatedProperty : deprecated) {
    Term replacedBy=TERMS_REPLACED_BY_ANOTHER_TERM.get(deprecatedProperty.qualifiedName());
    if (replacedBy != null && newer.getProperty(replacedBy) != null && !extensionMapping.isMapped(replacedBy)) {
      PropertyMapping pm=extensionMapping.getField(deprecatedProperty.qualifiedName());
      ExtensionProperty ep=newer.getProperty(replacedBy);
      if (pm != null && ep != null) {
        pm.setTerm(ep);
        log.debug("Mapping to deprecated term " + deprecatedProperty.qualifiedName() + " has been migrated to term "+ replacedBy.qualifiedName());
      }
    }
 else {
      log.debug("Mapping to deprecated term " + deprecatedProperty.qualifiedName() + " cannot be migrated therefore it is being removed!");
      removePropertyMapping(extensionMapping,deprecatedProperty.qualifiedName());
    }
  }
  return extensionMapping;
}

private ExtensionMapping migrateExtensionMapping ( ExtensionMapping extensionMapping , Extension newer , Set < ExtensionProperty > deprecated ) { log . debug ( "Migrating extension mapping..." ) ; extensionMapping . setExtension ( newer ) ; for ( ExtensionProperty deprecatedProperty : deprecated ) { Term replacedBy = TERMS_REPLACED_BY_ANOTHER_TERM . get ( deprecatedProperty . qualifiedName ( ) ) ; if ( replacedBy != null && newer . getProperty ( replacedBy ) != null && ! extensionMapping . isMapped ( replacedBy ) ) { PropertyMapping pm = extensionMapping . getField ( deprecatedProperty . qualifiedName ( ) ) ; ExtensionProperty ep = newer . getProperty ( replacedBy ) ; if ( pm != null && ep != null ) { pm . setTerm ( ep ) ; log . debug ( "Mapping to deprecated term " + deprecatedProperty . qualifiedName ( ) + " has been migrated to term " + replacedBy . qualifiedName ( ) ) ; } } else { log . debug ( "Mapping to deprecated term " + deprecatedProperty . qualifiedName ( ) + " cannot be migrated therefore it is being removed!" ) ; removePropertyMapping ( extensionMapping , deprecatedProperty . qualifiedName ( ) ) ; } } return extensionMapping ; }
migrate an extensionmapping to use a newer version of that extension : 1 . migrate property mappings for deprecated terms that have been replaced by another term . careful , the replacing term must be included in the newer extension version , and cannot already be mapped 2 . remove property mappings for deprecated terms that have not been replaced by another term
