Skip to content

Commit

Permalink
Use defaults from loaded configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Jan 4, 2024
1 parent df5d47c commit 0bab180
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,21 @@ public static Document toBson (@Nonnull final ISMPSettings aValue)
public static void toDomain (@Nonnull final Document aDoc, @Nonnull final SMPSettings aTarget)
{
aTarget.setRESTWritableAPIDisabled (aDoc.getBoolean (BSON_SMP_REST_WRITABLE_API_DISABLED,
SMPSettings.DEFAULT_SMP_REST_WRITABLE_API_DISABLED));
aTarget.setDirectoryIntegrationRequired (aDoc.getBoolean (BSON_DIRECTORY_INTEGRATION_REQUIRED,
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_REQUIRED));
aTarget.isRESTWritableAPIDisabled ()));
aTarget.setDirectoryIntegrationEnabled (aDoc.getBoolean (BSON_DIRECTORY_INTEGRATION_ENABLED,
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_ENABLED));
aTarget.isDirectoryIntegrationEnabled ()));
aTarget.setDirectoryIntegrationRequired (aDoc.getBoolean (BSON_DIRECTORY_INTEGRATION_REQUIRED,
aTarget.isDirectoryIntegrationRequired ()));
aTarget.setDirectoryIntegrationAutoUpdate (aDoc.getBoolean (BSON_DIRECTORY_INTEGRATION_AUTO_UPDATE,
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_AUTO_UPDATE));
aTarget.setDirectoryHostName (aDoc.getString (BSON_DIRECTORY_HOSTNAME));
aTarget.setSMLRequired (aDoc.getBoolean (BSON_SML_REQUIRED, SMPSettings.DEFAULT_SML_REQUIRED));
aTarget.setSMLEnabled (aDoc.getBoolean (BSON_SML_ENABLED, SMPSettings.DEFAULT_SML_ENABLED));
aTarget.isDirectoryIntegrationAutoUpdate ()));
String sDirectoryHostName = aDoc.getString (BSON_DIRECTORY_HOSTNAME);
if (sDirectoryHostName == null)
{
sDirectoryHostName = aTarget.getDirectoryHostName ();
}
aTarget.setDirectoryHostName (sDirectoryHostName);
aTarget.setSMLEnabled (aDoc.getBoolean (BSON_SML_ENABLED, aTarget.isSMLEnabled ()));
aTarget.setSMLRequired (aDoc.getBoolean (BSON_SML_REQUIRED, aTarget.isSMLRequired ()));
aTarget.setSMLInfoID (aDoc.getString (BSON_SML_INFO_ID));
}

Expand All @@ -100,7 +105,7 @@ public SMPSettingsManagerMongoDB ()
}

@Nonnull
@ReturnsMutableObject
@aTargeturnsMutableObject
public final CallbackList <ISMPSettingsCallback> callbacks ()
{
return m_aCallbacks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,23 @@ private ISMPSettings _getSettingsFromDB (@Nonnull final SMPSettingsManagerJDBC a
// Queries DB
final ICommonsMap <String, String> aValues = aMgr.getAllSettingsValuesFromDB ();

final SMPSettings ret = new SMPSettings (false);
final SMPSettings ret = new SMPSettings (true);
ret.setRESTWritableAPIDisabled (StringParser.parseBool (aValues.get (SMP_REST_WRITABLE_API_DISABLED),
SMPSettings.DEFAULT_SMP_REST_WRITABLE_API_DISABLED));
ret.isRESTWritableAPIDisabled ()));
ret.setDirectoryIntegrationEnabled (StringParser.parseBool (aValues.get (DIRECTORY_INTEGRATION_ENABLED),
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_ENABLED));
ret.isDirectoryIntegrationEnabled ()));
ret.setDirectoryIntegrationRequired (StringParser.parseBool (aValues.get (DIRECTORY_INTEGRATION_REQUIRED),
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_REQUIRED));
ret.isDirectoryIntegrationRequired ()));
ret.setDirectoryIntegrationAutoUpdate (StringParser.parseBool (aValues.get (DIRECTORY_INTEGRATION_AUTO_UPDATE),
SMPSettings.DEFAULT_SMP_DIRECTORY_INTEGRATION_AUTO_UPDATE));
ret.setDirectoryHostName (aValues.get (DIRECTORY_HOSTNAME));
ret.setSMLEnabled (StringParser.parseBool (aValues.get (SML_ENABLED), SMPSettings.DEFAULT_SML_ENABLED));
ret.setSMLRequired (StringParser.parseBool (aValues.get (SML_REQUIRED), SMPSettings.DEFAULT_SML_REQUIRED));
ret.isDirectoryIntegrationAutoUpdate ()));
String sDirectoryHostName = aValues.get (DIRECTORY_HOSTNAME);
if (sDirectoryHostName == null)
{
sDirectoryHostName = ret.getDirectoryHostName ();
}
ret.setDirectoryHostName (sDirectoryHostName);
ret.setSMLEnabled (StringParser.parseBool (aValues.get (SML_ENABLED), ret.isSMLEnabled ()));
ret.setSMLRequired (StringParser.parseBool (aValues.get (SML_REQUIRED), ret.isSMLRequired ()));
ret.setSMLInfoID (aValues.get (SML_INFO_ID));
return ret;
}
Expand Down

0 comments on commit 0bab180

Please sign in to comment.