Search in sources :

Example 31 with DatabaseService

use of org.structr.api.DatabaseService in project structr by structr.

the class StructrApp method getGlobalSetting.

@Override
public <T> T getGlobalSetting(final String key, final T defaultValue) throws FrameworkException {
    final DatabaseService service = getDatabaseService();
    if (service != null) {
        final GraphProperties config = service.getGlobalProperties();
        T value = null;
        if (config != null) {
            value = (T) config.getProperty(key);
        }
        if (value == null) {
            return defaultValue;
        }
        return value;
    }
    return defaultValue;
}
Also used : GraphProperties(org.structr.api.graph.GraphProperties) DatabaseService(org.structr.api.DatabaseService)

Aggregations

DatabaseService (org.structr.api.DatabaseService)31 SecurityContext (org.structr.common.SecurityContext)12 FrameworkException (org.structr.common.error.FrameworkException)12 AbstractNode (org.structr.core.entity.AbstractNode)8 Node (org.structr.api.graph.Node)7 GraphObject (org.structr.core.GraphObject)7 Tx (org.structr.core.graph.Tx)7 Relationship (org.structr.api.graph.Relationship)6 PropertyKey (org.structr.core.property.PropertyKey)6 StructrAndSpatialPredicate (org.structr.common.StructrAndSpatialPredicate)5 App (org.structr.core.app.App)5 StructrApp (org.structr.core.app.StructrApp)5 AbstractRelationship (org.structr.core.entity.AbstractRelationship)5 LinkedHashSet (java.util.LinkedHashSet)4 LinkedList (java.util.LinkedList)4 Entry (java.util.Map.Entry)4 Test (org.junit.Test)4 List (java.util.List)3 Label (org.structr.api.graph.Label)3 StructrTest (org.structr.common.StructrTest)3