Populates currency settings.

@param record MPX record
@param properties project properties
972348
private void populateCurrencySettings(Record record, ProjectProperties properties)
   {
      properties.setCurrencySymbol(record.getString(0));
      properties.setSymbolPosition(record.getCurrencySymbolPosition(1));
      properties.setCurrencyDigits(record.getInteger(2));

      Character c = record.getCharacter(3);
      if (c != null)
      {
         properties.setThousandsSeparator(c.charValue());
      }

      c = record.getCharacter(4);
      if (c != null)
      {
         properties.setDecimalSeparator(c.charValue());
      }
   }
1333178
void store(final RECORD record, final String key, final String name, final Value value) {
        boolean calledASetter = false;

        if (value == null) {
            LOG.error("Got a null value to store for key={}  name={}.", key, name);
            return; // Nothing to do
        }

        final Set<Pair<Method, SetterPolicy>> methodPairs = targets.get(key);
        if (methodPairs == null) {
            LOG.error("NO methods for key={}  name={}.", key, name);
            return;
        }

        EnumSet<Casts> castsTo = castsOfTargets.get(key);
        if (castsTo == null) {
            castsTo = castsOfTargets.get(name);
            if (castsTo == null) {
                LOG.error("NO casts for \"{}\"", name);
                return;
            }
        }

        for (Pair<Method, SetterPolicy> methodPair : methodPairs) {
            Method method = methodPair.getLeft();
            if (method != null) {
                SetterPolicy setterPolicy = methodPair.getRight();
                try {
                    Class<?>[] parameters = method.getParameterTypes();
                    Class<?> valueClass = parameters[parameters.length - 1]; // Always the last one

                    if (valueClass == String.class) {
                        if (castsTo.contains(Casts.STRING)) {
                            String stringValue = value.getString();
                            if (stringValue == null) {
                                if (setterPolicy == NOT_NULL || setterPolicy == NOT_EMPTY) {
                                    calledASetter = true;
                                    continue;
                                }
                            } else {
                                if (stringValue.isEmpty() && setterPolicy == NOT_EMPTY) {
                                    calledASetter = true;
                                    continue;
                                }
                            }
                            if (parameters.length == 2) {
                                method.invoke(record, name, stringValue);
                            } else {
                                method.invoke(record, stringValue);
                            }
                            calledASetter = true;
                        }
                        continue;
                    }

                    if (valueClass == Long.class) {
                        if (castsTo.contains(Casts.LONG)) {
                            Long longValue = value.getLong();
                            if (longValue == null &&
                                (setterPolicy == NOT_NULL || setterPolicy == NOT_EMPTY)) {
                                calledASetter = true;
                                continue;
                            }
                            if (parameters.length == 2) {
                                method.invoke(record, name, longValue);
                            } else {
                                method.invoke(record, longValue);
                            }
                            calledASetter = true;
                        }
                        continue;
                    }

                    if (valueClass == Double.class) {
                        if (castsTo.contains(Casts.DOUBLE)) {
                            Double doubleValue = value.getDouble();
                            if (doubleValue == null &&
                                (setterPolicy == NOT_NULL || setterPolicy == NOT_EMPTY)) {
                                calledASetter = true;
                                continue;
                            }
                            if (parameters.length == 2) {
                                method.invoke(record, name, doubleValue);
                            } else {
                                method.invoke(record, doubleValue);
                            }
                            calledASetter = true;
                        }
                        continue;
                    }

                    throw new FatalErrorDuringCallOfSetterMethod(
                            "Tried to call setter with unsupported class :" +
                            " key = \"" + key + "\" " +
                            " name = \"" + name + "\" " +
                            " value = \"" + value + "\"" +
                            " castsTo = \"" + castsTo + "\"");

                } catch (final Exception e) {
                    throw new FatalErrorDuringCallOfSetterMethod(e.getMessage() + " caused by \"" +
                            e.getCause() + "\" when calling \"" +
                            method.toGenericString() + "\" for " +
                            " key = \"" + key + "\" " +
                            " name = \"" + name + "\" " +
                            " value = \"" + value + "\"" +
                            " castsTo = \"" + castsTo + "\"", e);
                }
            }
        }

        if (!calledASetter) {
            throw new FatalErrorDuringCallOfSetterMethod("No setter called for " +
                    " key = \"" + key + "\" " +
                    " name = \"" + name + "\" " +
                    " value = \"" + value + "\"");
        }
    }
1238426
private void addPropertyCounters(UsageStatistics usageStatistics,
			PropertyIdValue property) {
		if (!usageStatistics.propertyCountsMain.containsKey(property)) {
			usageStatistics.propertyCountsMain.put(property, 0);
			usageStatistics.propertyCountsQualifier.put(property, 0);
			usageStatistics.propertyCountsReferences.put(property, 0);
		}
	}
1026809
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint)
   {
      ProjectProperties mpxjProperties = m_projectFile.getProjectProperties();
      mpxjProperties.setName(phoenixSettings.getTitle());
      mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit());
      mpxjProperties.setStatusDate(storepoint.getDataDate());
   }
49803
private Record setDefault(Record record) {
        int size = record.size();
        for (int i = 0; i < size; i++)
            if (record.get(i) == null) {
                @SuppressWarnings("unchecked")
                Field<Object> field = (Field<Object>) record.field(i);
                if (!field.getDataType().nullable() && !field.getDataType().identity())
                    record.set(field, DSL.defaultValue());
            }
        return record;
    }
743499
private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException
   {
      properties.setProjectTitle(record.getString(0));
      properties.setCompany(record.getString(1));
      properties.setManager(record.getString(2));
      properties.setDefaultCalendarName(record.getString(3));
      properties.setStartDate(record.getDateTime(4));
      properties.setFinishDate(record.getDateTime(5));
      properties.setScheduleFrom(record.getScheduleFrom(6));
      properties.setCurrentDate(record.getDateTime(7));
      properties.setComments(record.getString(8));
      properties.setCost(record.getCurrency(9));
      properties.setBaselineCost(record.getCurrency(10));
      properties.setActualCost(record.getCurrency(11));
      properties.setWork(record.getDuration(12));
      properties.setBaselineWork(record.getDuration(13));
      properties.setActualWork(record.getDuration(14));
      properties.setWork2(record.getPercentage(15));
      properties.setDuration(record.getDuration(16));
      properties.setBaselineDuration(record.getDuration(17));
      properties.setActualDuration(record.getDuration(18));
      properties.setPercentageComplete(record.getPercentage(19));
      properties.setBaselineStart(record.getDateTime(20));
      properties.setBaselineFinish(record.getDateTime(21));
      properties.setActualStart(record.getDateTime(22));
      properties.setActualFinish(record.getDateTime(23));
      properties.setStartVariance(record.getDuration(24));
      properties.setFinishVariance(record.getDuration(25));
      properties.setSubject(record.getString(26));
      properties.setAuthor(record.getString(27));
      properties.setKeywords(record.getString(28));
   }
1329323
private void addCurrencyInfoMethod(TypeSpec.Builder type, String name, Map<String, String> mapping) {
    MethodSpec.Builder method = MethodSpec.methodBuilder(name)
        .addModifiers(PUBLIC)
        .addParameter(Types.CLDR_CURRENCY_ENUM, "code")
        .returns(String.class);

    method.beginControlFlow("if (code == null)");
    method.addStatement("return $S", "");
    method.endControlFlow();
    
    method.beginControlFlow("switch (code)");
    for (Map.Entry<String, String> entry : mapping.entrySet()) {
      String key = entry.getKey();
      String val = entry.getValue();
      if (!key.equals(val)) {
        method.addStatement("case $L: return $S", key, val);
      }
    }
    
    method.addStatement("default: return code.name()");
    method.endControlFlow();
    type.addMethod(method.build());
  }
547513
private List<Bucket> lookup(Record record) {
    List<Bucket> buckets = new ArrayList();
    for (Property p : config.getLookupProperties()) {
      String propname = p.getName();
      Collection<String> values = record.getValues(propname);
      if (values == null)
        continue;

      for (String value : values) {
        String[] tokens = StringUtils.split(value);
        for (int ix = 0; ix < tokens.length; ix++) {
          Bucket b = store.lookupToken(propname, tokens[ix]);
          if (b == null || b.records == null)
            continue;
          long[] ids = b.records;
          if (DEBUG)
            System.out.println(propname + ", " + tokens[ix] + ": " + b.nextfree + " (" + b.getScore() + ")");
          buckets.add(b);
        }
      }
    }

    return buckets;
  }
612988
private void populateDateTimeSettings(Record record, ProjectProperties properties)
   {
      properties.setDateOrder(record.getDateOrder(0));
      properties.setTimeFormat(record.getTimeFormat(1));

      Date time = getTimeFromInteger(record.getInteger(2));
      if (time != null)
      {
         properties.setDefaultStartTime(time);
      }

      Character c = record.getCharacter(3);
      if (c != null)
      {
         properties.setDateSeparator(c.charValue());
      }

      c = record.getCharacter(4);
      if (c != null)
      {
         properties.setTimeSeparator(c.charValue());
      }

      properties.setAMText(record.getString(5));
      properties.setPMText(record.getString(6));
      properties.setDateFormat(record.getDateFormat(7));
      properties.setBarTextDateFormat(record.getDateFormat(8));
   }
323262
public void setCurrency(String currency) {
		currency = StringUtils.upperCase(currency);
		if (!CurrencyUtils.getInstance().isValidCurrency(currency)) {
			currency = "EUR";
		}
		this.currency = currency;
	}
623778
public void loadFieldProperties(Field fldProperties)
    {
        if (fldProperties == null)
            return;
        boolean[] rgbEnabled = this.setEnableListeners(false);;
        try {
            this.setKeyArea(PropertiesInput.KEY_KEY);
            // First, delete the old records
            this.close();
            while (this.hasNext())
            {
                this.next();
                this.edit();
                this.remove();
            }
            // Now, add the properties to the record
            Map<String,Object> properties = ((PropertiesField)fldProperties).getProperties();
            Iterator<String> iterator = properties.keySet().iterator();
            while (iterator.hasNext())
            {
                String strKey = iterator.next();
                String strValue = (String)properties.get(strKey);
                this.addNew();
                this.getField(PropertiesInput.KEY).setString(strKey);
                if (this.seek(null))
                {
                    this.edit();
                    this.remove();
                }
                this.addNew();
                this.getField(PropertiesInput.KEY).setString(strKey);
                this.getField(PropertiesInput.VALUE).setString(strValue);
                this.add();
            }
            if (this.getRecordOwner() instanceof GridScreen)
                ((GridScreen)this.getRecordOwner()).reSelectRecords();
        } catch (DBException ex) {
            ex.printStackTrace();
        } finally {
            this.setEnableListeners(rgbEnabled);
        }
    }
926886
public static void reinitializeCurrencySettings ()
  {
    s_aRWLock.writeLocked ( () -> {
      s_aSettingsMap.clear ();
      for (final ECurrency e : ECurrency.values ())
      {
        s_aSettingsMap.put (e, new PerCurrencySettings (e));

        for (final Locale aLocale : e.matchingLocales ())
          if (!localeSupportsCurrencyRetrieval (aLocale))
            throw new IllegalArgumentException ("Passed locale " + aLocale + " does not support currency retrieval!");
      }
    });
  }
15502
void addGlobalUniqueProperties(Set<PropertyColumn> properties) {
        for (PropertyColumn property : properties) {
            property.addToGlobalUniqueIndexes(this);
        }
        this.properties = properties;
    }
967953
public void init(App app, Rec record, Map<String,Object> properties)
    {
        m_app = app;
    }
1063598
public CurrencyUnitBuilder setCurrencyCode(String currencyCode) {
        Objects.requireNonNull(currencyCode, "currencyCode required");
        this.currencyCode = currencyCode;
        this.currencyContext = CurrencyContextBuilder.of(getClass().getSimpleName()).build();
        return this;
    }
1198682
public void init(RecordOwnerParent parent, Rec recordMain, Map<String, Object> properties)
    {
        super.init(parent, recordMain, properties);
        if (properties != null)
            m_propTransport = properties;
        else
            m_propTransport = this.getTransportProperties();
    }
1117477
public void setRecords(java.util.Collection<Record> records) {
        if (records == null) {
            this.records = null;
            return;
        }

        this.records = new java.util.ArrayList<Record>(records);
    }