ConfigSrv
getString
Section titled “getString”Description:
| Method | Return values | Description |
|---|---|---|
| getString(String key, String defaultValue) | String | Finds the config parameter (as a string type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getString("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getText
Section titled “getText”Description:
| Method | Return values | Description |
|---|---|---|
| getText(String key, String defaultValue) | String | Finds the config parameter (as a text type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getText("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getBoolean
Section titled “getBoolean”Description:
| Method | Return values | Description |
|---|---|---|
| getBoolean(String key, String defaultValue) | boolean | Finds the config parameter (as a boolean type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getBoolean("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getInteger
Section titled “getInteger”Description:
| Method | Return values | Description |
|---|---|---|
| getInteger(String key, String defaultValue) | Integer | Finds the config parameter (as a integer type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getInteger("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getLong
Section titled “getLong”Description:
| Method | Return values | Description |
|---|---|---|
| getLong(String key, String defaultValue) | long | Finds the config parameter (as a long type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getLong("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getHtml
Section titled “getHtml”Description:
| Method | Return values | Description |
|---|---|---|
| getHtml(String key, String defaultValue) | String | Finds the config parameter (as a html type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getHtml("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getPassword
Section titled “getPassword”Description:
| Method | Return values | Description |
|---|---|---|
| getPassword(String key, String defaultValue) | String | Finds the config parameter (as a password type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); System.out.println("Config parameter: " + configSrv.getPassword("paramKey", "defaultValue")); } catch (Exception e) { e.printStackTrace(); } }}getList
Section titled “getList”Description:
| Method | Return values | Description |
|---|---|---|
| getList(String key, String defaultValue) | List |
Finds the config parameter (as a list type) by pk with a default value |
Example:
package com.openkm;
import com.openkm.db.service.ConfigSrv;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { ConfigSrv configSrv = ContextWrapper.getContext().getBean(ConfigSrv.class); for (String listElement : configSrv.getList("paramKey", "defaultValue")) { System.out.println(listElement); } } catch (Exception e) { e.printStackTrace(); } }}