public Environment importEnvironment(Environment environment) throws BusinessException, JAXBException, IOException {
  if (null == environment.getId()) {
    throw new BusinessException("Import the environment '" + environment.getName() + "'.",ConfigurationInterfaceErrorCodeEnum.IMPORT_DATA_NOT_VALID);
  }
  environment.setImportDate(new Date());
  if (existingEnvironments.containsKey(environment.getId())) {
    Environment old=existingEnvironments.replace(environment.getId(),environment);
    Files.deleteIfExists(pathResolver.getEnvironmentFilePath(old));
  }
 else {
    existingEnvironments.put(environment.getId(),environment);
  }
  checkProfiles(environment);
  saveEnvironment(environment);
  return environment;
}

public Environment importEnvironment ( Environment environment ) throws BusinessException , JAXBException , IOException { if ( null == environment . getId ( ) ) { throw new BusinessException ( "Import the environment '" + environment . getName ( ) + "'." , ConfigurationInterfaceErrorCodeEnum . IMPORT_DATA_NOT_VALID ) ; } environment . setImportDate ( new Date ( ) ) ; if ( existingEnvironments . containsKey ( environment . getId ( ) ) ) { Environment old = existingEnvironments . replace ( environment . getId ( ) , environment ) ; Files . deleteIfExists ( pathResolver . getEnvironmentFilePath ( old ) ) ; } else { existingEnvironments . put ( environment . getId ( ) , environment ) ; } checkProfiles ( environment ) ; saveEnvironment ( environment ) ; return environment ; }
imports the environment . note that if environment with the same id already exists it will be overwritten .
