Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Database Properties are available via the getDatabaseProperties and setDatabaseProperties methods. The getter returns a List<DatabaseProperties> List<DbProperties> object and the setter takes a Map<DatabasePropertiesMap<DbProperties, boolean>Boolean>. However, some Database Properties cannot be set because they have specific setter methods (template name) or need to be enabled via server commands (e.g. DAOS). Below are the details of all the Database Properties available, where they appear on the Database Properties infobox and setter information.

...

To set database properties that only take a boolean value, create a DbProperties Map and pass it into setDatabaseProperties() method. Properties that cannot be set or properties that have a specific setter will throw a runtime error with the relevant message. After setting any database properties you need to call DatabaseDesign.save(). If items in the Icon note have been updated, that will automatically get saved.

Code Block
languagejava
themeEclipse
titleExample
Session s = Factory.getSession();

Database db = s.getDatabase("", "yourdb.nsf");
DatabaseDesign dbDesign = db.getDesign();

Map<DbProperties, Boolean> settings = new HashMap<DbProperties, Boolean>();
settings.put(DbProperties.DONT_MAINTAIN_UNREAD, false);  // note: will 'check' the property
settings.put(DbProperties.ALLOW_STORED_FORMS, false);  // note: will 'uncheck' the property

dbDesign.setDatabaseProperties(settings);
dbDesign.save();

The Icon note appears to get cached by the session. So there is no point calling the relevant getters to check if a database property like $AllowRESTDbAPIhas been updated - you'll get the value from the start of the request. If you want to check, run a separate subsequent request to the server.

...