ConfigSrv
getString
Description:
Method | Return values | Description |
---|---|---|
getString(String key, String defaultValue) |
String |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getText(String key, String defaultValue) |
String |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getBoolean(String key, String defaultValue) |
boolean |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getInteger(String key, String defaultValue) |
Integer |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getLong(String key, String defaultValue) |
long |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getHtml(String key, String defaultValue) |
String |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getPassword(String key, String defaultValue) |
String |
Find the config parameter (as 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
Description:
Method | Return values | Description |
---|---|---|
getList(String key, String defaultValue) |
List<String> |
Find the config parameter (as 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();
}
}
}