Search in sources :

Example 6 with BadDataException

use of life.genny.qwanda.exception.BadDataException in project rulesservice by genny-project.

the class QRules method updateCachedBaseEntity.

public BaseEntity updateCachedBaseEntity(final Answer answer) {
    BaseEntity cachedBe = this.getBaseEntityByCode(answer.getTargetCode());
    // Add an attribute if not already there
    try {
        answer.setAttribute(RulesUtils.attributeMap.get(answer.getAttributeCode()));
        if (answer.getAttribute() == null) {
            log.error("Null Attribute");
        } else
            cachedBe.addAnswer(answer);
        VertxUtils.writeCachedJson(answer.getTargetCode(), JsonUtils.toJson(cachedBe));
    } catch (BadDataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return cachedBe;
}
Also used : BadDataException(life.genny.qwanda.exception.BadDataException) BaseEntity(life.genny.qwanda.entity.BaseEntity)

Aggregations

BaseEntity (life.genny.qwanda.entity.BaseEntity)6 BadDataException (life.genny.qwanda.exception.BadDataException)6 JsonArray (io.vertx.core.json.JsonArray)4 JsonObject (io.vertx.core.json.JsonObject)4 AttributeInteger (life.genny.qwanda.attribute.AttributeInteger)4 AttributeText (life.genny.qwanda.attribute.AttributeText)4 AttributeBoolean (life.genny.qwanda.attribute.AttributeBoolean)2 Answer (life.genny.qwanda.Answer)1 AttributeMoney (life.genny.qwanda.attribute.AttributeMoney)1