Search in sources :

Example 6 with Parameter

use of org.cerberus.crud.entity.Parameter in project cerberus-source by cerberustesting.

the class FactoryParameter method create.

@Override
public Parameter create(String system, String param, String value, String description) {
    Parameter parameter = new Parameter();
    parameter.setSystem(system);
    parameter.setParam(param);
    parameter.setValue(value);
    parameter.setDescription(description);
    return parameter;
}
Also used : IFactoryParameter(org.cerberus.crud.factory.IFactoryParameter) Parameter(org.cerberus.crud.entity.Parameter)

Example 7 with Parameter

use of org.cerberus.crud.entity.Parameter in project cerberus-source by cerberustesting.

the class ParameterService method getParameterBooleanByKey.

@Override
public boolean getParameterBooleanByKey(String key, String system, boolean defaultValue) {
    Parameter myParameter;
    boolean outPutResult = defaultValue;
    try {
        myParameter = this.findParameterByKey(key, system);
        outPutResult = StringUtil.parseBoolean(myParameter.getValue());
    } catch (CerberusException | NumberFormatException ex) {
        LOG.error("Error when trying to retreive parameter : '" + key + "' for system : '" + system + "'. Default value returned : '" + defaultValue + "'. Trace : " + ex);
    }
    LOG.debug("Success loading parameter : '" + key + "' for system : '" + system + "'. Value returned : '" + outPutResult + "'");
    return outPutResult;
}
Also used : CerberusException(org.cerberus.exception.CerberusException) Parameter(org.cerberus.crud.entity.Parameter)

Example 8 with Parameter

use of org.cerberus.crud.entity.Parameter in project cerberus-source by cerberustesting.

the class ParameterService method getParameterFloatByKey.

@Override
public float getParameterFloatByKey(String key, String system, float defaultValue) {
    Parameter myParameter;
    float outPutResult = defaultValue;
    try {
        myParameter = this.findParameterByKey(key, system);
        outPutResult = Float.valueOf(myParameter.getValue());
    } catch (CerberusException | NumberFormatException ex) {
        LOG.error("Error when trying to retreive parameter : '" + key + "' for system : '" + system + "'. Default value returned : '" + defaultValue + "'. Trace : " + ex);
    }
    LOG.debug("Success loading parameter : '" + key + "' for system : '" + system + "'. Value returned : '" + outPutResult + "'");
    return outPutResult;
}
Also used : CerberusException(org.cerberus.exception.CerberusException) Parameter(org.cerberus.crud.entity.Parameter)

Example 9 with Parameter

use of org.cerberus.crud.entity.Parameter in project cerberus-source by cerberustesting.

the class ParameterService method getParameterIntegerByKey.

@Override
public Integer getParameterIntegerByKey(String key, String system, Integer defaultValue) {
    Parameter myParameter;
    Integer outPutResult = defaultValue;
    try {
        myParameter = this.findParameterByKey(key, system);
        outPutResult = Integer.valueOf(myParameter.getValue());
    } catch (CerberusException | NumberFormatException ex) {
        LOG.error("Error when trying to retreive parameter : '" + key + "' for system : '" + system + "'. Default value returned : '" + defaultValue + "'. Trace : " + ex);
    }
    LOG.debug("Success loading parameter : '" + key + "' for system : '" + system + "'. Value returned : '" + outPutResult + "'");
    return outPutResult;
}
Also used : CerberusException(org.cerberus.exception.CerberusException) Parameter(org.cerberus.crud.entity.Parameter)

Example 10 with Parameter

use of org.cerberus.crud.entity.Parameter in project cerberus-source by cerberustesting.

the class ParameterService method getParameterStringByKey.

@Override
public String getParameterStringByKey(String key, String system, String defaultValue) {
    Parameter myParameter;
    String outPutResult = defaultValue;
    try {
        myParameter = this.findParameterByKey(key, system);
        outPutResult = myParameter.getValue();
    } catch (CerberusException ex) {
        LOG.error("Error when trying to retreive parameter : '" + key + "' for system : '" + system + "'. Default value returned : '" + defaultValue + "'. Trace : " + ex);
    }
    LOG.debug("Success loading parameter : '" + key + "' for system : '" + system + "'. Value returned : '" + outPutResult + "'");
    return outPutResult;
}
Also used : CerberusException(org.cerberus.exception.CerberusException) Parameter(org.cerberus.crud.entity.Parameter)

Aggregations

Parameter (org.cerberus.crud.entity.Parameter)22 CerberusException (org.cerberus.exception.CerberusException)12 MessageEvent (org.cerberus.engine.entity.MessageEvent)9 SQLException (java.sql.SQLException)8 AnswerItem (org.cerberus.util.answer.AnswerItem)8 IFactoryParameter (org.cerberus.crud.factory.IFactoryParameter)7 FactoryParameter (org.cerberus.crud.factory.impl.FactoryParameter)7 Connection (java.sql.Connection)6 PreparedStatement (java.sql.PreparedStatement)6 ResultSet (java.sql.ResultSet)6 IParameterService (org.cerberus.crud.service.IParameterService)4 JSONObject (org.json.JSONObject)4 File (java.io.File)3 MessageGeneral (org.cerberus.engine.entity.MessageGeneral)3 AnswerList (org.cerberus.util.answer.AnswerList)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 ParameterService (org.cerberus.crud.service.impl.ParameterService)2