Convert Fathom Settings into PippoSettings

@param settings
@return PippoSettings
352867
public static PippoSettings getPippoSettings(Settings settings) {
        RuntimeMode runtimeMode = RuntimeMode.PROD;
        for (RuntimeMode mode : RuntimeMode.values()) {
            if (mode.name().equalsIgnoreCase(settings.getMode().toString())) {
                runtimeMode = mode;
            }
        }

        final Properties properties = settings.toProperties();

        final PippoSettings pippoSettings = new PippoSettings(runtimeMode);
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            Object value = entry.getValue();
            String propertyValue;
            if (value instanceof Collection) {
                // strip brackets from collection [en,de,ru]
                propertyValue = Optional.fromNullable(value).or("").toString();
                propertyValue = propertyValue.substring(1, propertyValue.length() - 1);
            } else {
                // Object.toString()
                propertyValue = Optional.fromNullable(value).or("").toString();
            }
            String propertyName = entry.getKey().toString();
            pippoSettings.overrideSetting(propertyName, propertyValue);
        }

        return pippoSettings;
    }
1341876
public static Map<String, ISettings> makeDefaultSettings()
  {
    Map<String, ISettings> settings = new TreeMap<>();

    AppearanceSettings appearanceSettings = new AppearanceSettings();
    appearanceSettings.resetToDefaultSettings( null );
    settings.put( appearanceSettings.getPath(), appearanceSettings );

    return settings;
  }
800452
function buildSettings() {
  var pf32Path = process.env['ProgramFiles(x86)'],
      pf64Path = process.env.ProgramFiles,
      settings,
      tfPath = '/Common7/IDE/TF.exe';

  switch (true) {
    case fileExists(pf32Path + '/Microsoft Visual Studio/2017/Enterprise', true):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/TF.exe',
        vsArchitecture: 32,
        vsVersion: 2017
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio/2017/Professional', true):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/TF.exe',
        vsArchitecture: 32,
        vsVersion: 2017
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio/2017/Community', true):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/TF.exe',
        vsArchitecture: 32,
        vsVersion: 2017
      };
      break;

    case fileExists(pf64Path + '/Microsoft Visual Studio 14.0' + tfPath):
      settings = {
        tfPath: pf64Path + '/Microsoft Visual Studio 14.0' + tfPath,
        vsArchitecture: 64,
        vsVersion: 2015
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio 14.0' + tfPath):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio 14.0' + tfPath,
        vsArchitecture: 32,
        vsVersion: 2015
      };
      break;

    case fileExists(pf64Path + '/Microsoft Visual Studio 12.0' + tfPath):
      settings = {
        tfPath: pf64Path + '/Microsoft Visual Studio 12.0' + tfPath,
        vsArchitecture: 64,
        vsVersion: 2013
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio 12.0' + tfPath):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio 12.0' + tfPath,
        vsArchitecture: 32,
        vsVersion: 2013
      };
      break;

    case fileExists(pf64Path + '/Microsoft Visual Studio 11.0' + tfPath):
      settings = {
        tfPath: pf64Path + '/Microsoft Visual Studio 11.0' + tfPath,
        vsArchitecture: 64,
        vsVersion: 2012
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio 11.0' + tfPath):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio 11.0' + tfPath,
        vsArchitecture: 32,
        vsVersion: 2012
      };
      break;

    case fileExists(pf64Path + '/Microsoft Visual Studio 10.0' + tfPath):
      settings = {
        tfPath: pf64Path + '/Microsoft Visual Studio 10.0' + tfPath,
        vsArchitecture: 64,
        vsVersion: 2010
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio 10.0' + tfPath):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio 10.0' + tfPath,
        vsArchitecture: 32,
        vsVersion: 2010
      };
      break;

    case fileExists(pf64Path + '/Microsoft Visual Studio 9.0' + tfPath):
      settings = {
        tfPath: pf64Path + '/Microsoft Visual Studio 9.0' + tfPath,
        vsArchitecture: 64,
        vsVersion: 2008
      };
      break;

    case fileExists(pf32Path + '/Microsoft Visual Studio 9.0' + tfPath):
      settings = {
        tfPath: pf32Path + '/Microsoft Visual Studio 9.0' + tfPath,
        vsArchitecture: 32,
        vsVersion: 2008
      };
      break;

    case fileExists(__dirname + '/../test/.mock'):
      settings = {};
      break;

    default:
      output.error('Impossible to find you TF.exe');
      break;
  }

  output.info('Writing ' + settingsPath);

  var fileSource = JSON.stringify(settings, null, 2);
  fs.writeFileSync(settingsPath, fileSource, 'utf8');
}
507806
private static Map<String, CmsHtmlList> getListObjectMap(CmsWorkplaceSettings settings) {

        Map<String, CmsHtmlList> objects = CmsCollectionsGenericWrapper.map(settings.getListObject());
        if (objects == null) {
            // using hashtable as most efficient version of a synchronized map
            objects = new Hashtable<String, CmsHtmlList>();
            settings.setListObject(objects);
        }
        return objects;
    }
417130
public Service setSupportedServiceProfiles(Iterable<ServiceProfile> profiles)
    {
        if (profiles == null)
        {
            this.supportedServiceProfiles = null;

            return this;
        }

        Set<ServiceProfile> set = new TreeSet<ServiceProfile>();

        for (ServiceProfile profile : profiles)
        {
            if (profile != null)
            {
                set.add(profile);
            }
        }

        int size = set.size();

        if (size == 0)
        {
            this.supportedServiceProfiles = null;

            return this;
        }

        ServiceProfile[] array = new ServiceProfile[size];
        this.supportedServiceProfiles = set.toArray(array);

        return this;
    }
167152
public static Map<String,List<Long>> mergeHints(
      Collection<ResourceCollection> resources, Collection<String> suiteNames) {
    final Map<String,List<Long>> hints = new HashMap<>();
    for (ResourceCollection rc : resources) {
      Iterator<Resource> i = rc.iterator();
      while (i.hasNext()) {
        InputStream is = null;
        Resource r = i.next();
        try {
          is = r.getInputStream();
          mergeHints(is, hints);

          // Early prune the hints to those we have on the list.
          if (suiteNames != null) {
            hints.keySet().retainAll(suiteNames);
          }
        } catch (IOException e) {
          throw new BuildException("Could not read hints from resource: "
              + r.getDescription(), e);
        } finally {
          try {
            if (is != null) is.close();
          } catch (IOException e) {
            throw new BuildException("Could not close hints file: " + r.getDescription());
          }
        }
      }
    }
    return hints;
  }
952109
@SuppressWarnings("unchecked")
    public void setSettings(Object presets) {

        if (presets == null) {
            m_settingPresets = null;
        } else if (!(presets instanceof Map)) {
            throw new IllegalArgumentException(
                "cms:container -- value of 'settings' attribute  should be a map, but is "
                    + ClassUtils.getCanonicalName(presets));
        } else {
            m_settingPresets = new HashMap<>((Map<String, String>)presets);
        }
    }
726991
protected final PrcSettingsAddSave<RS> lazyGetPrcSettingsAddSave(final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrcSettingsAddSave.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrcSettingsAddSave<RS> proc = (PrcSettingsAddSave<RS>) this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrcSettingsAddSave<RS>();
      proc.setSrvSettingsAdd(getSrvSettingsAdd());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnTradeEntitiesProcessors.class, beanName + " has been created.");
    }
    return proc;
  }
1279123
public static SettingsMode get(Map<String, String[]> clArgs)
    {
        String[] params = clArgs.remove("-mode");
        if (params == null)
        {
            Cql3NativeOptions opts = new Cql3NativeOptions();
            opts.accept("cql3");
            opts.accept("native");
            opts.accept("prepared");
            return new SettingsMode(opts);
        }

        GroupedOptions options = GroupedOptions.select(params, new ThriftOptions(), new Cql3NativeOptions(), new Cql3ThriftOptions(), new Cql3SimpleNativeOptions(), new Cql2ThriftOptions());
        if (options == null)
        {
            printHelp();
            System.out.println("Invalid -mode options provided, see output for valid options");
            System.exit(1);
        }
        return new SettingsMode(options);
    }
524088
@Override
  public final synchronized SettingsAdd lazyGetSettingsAdd(
    final Map<String, Object> pAddParam) throws Exception {
    if (this.settingsAdd == null) {
      this.settingsAdd = getSrvOrm()
        .retrieveEntityById(pAddParam, SettingsAdd.class, 1L);
      if (this.settingsAdd == null) {
        throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
          "There is no trading settings!!!");
      }
    }
    return this.settingsAdd;
  }
1100177
public void setEditorSettings(Map<String, String> settings) {

        m_editorSettings = new TreeMap<String, String>(settings);
    }
749937
public static function mergeWithDefaultSettings($settings)
    {
        if (empty($settings)) {
            return static::getDefaultSettings();
        }
        if (is_array($settings)) {
            return array_merge(static::getDefaultSettings(), $settings);
        }
        throw new Exception("Argument must be an array.");
    }
1295301
private static Properties overrideDockerPropertiesWithSettingsFromUserHome(Properties p, Properties systemProperties) {
        Properties overriddenProperties = new Properties();
        overriddenProperties.putAll(p);

        final File usersDockerPropertiesFile = new File(systemProperties.getProperty("user.home"),
                "." + DOCKER_JAVA_PROPERTIES);
        if (usersDockerPropertiesFile.isFile()) {
            try (FileInputStream in = new FileInputStream(usersDockerPropertiesFile)) {
                overriddenProperties.load(in);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return overriddenProperties;
    }
569046
public void setSettings(java.util.Collection<OutputDestinationSettings> settings) {
        if (settings == null) {
            this.settings = null;
            return;
        }

        this.settings = new java.util.ArrayList<OutputDestinationSettings>(settings);
    }
392331
public JRecordExtractor<T, FloatNamedSparseArray>
  extractWithSubsetSettingsFloatNamedSparseArray(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSubsetSettingsFloatNamedSparseArray(self, settings));
  }
1120201
private void setSettings(Map<String, String> settings) {

        if (settings == null) {
            m_settings = null;
        } else {
            m_settings = new CmsNullIgnoringConcurrentMap<String, String>(settings);
        }
    }
180165
public static Map<String, String> convertPropertiesToClientFormat(
        CmsObject cms,
        Map<String, String> props,
        Map<String, CmsXmlContentProperty> propConfig) {

        return convertProperties(cms, props, propConfig, true);
    }