Search in sources :

Example 1 with QEventAttributeValueChangeMessage

use of life.genny.qwanda.message.QEventAttributeValueChangeMessage in project rulesservice by genny-project.

the class QRules method fireAttributeChanges.

public void fireAttributeChanges(QEventAttributeValueChangeMessage m) {
    Answer a = m.getAnswer();
    BaseEntity be = m.getBe();
    for (EntityAttribute ea : be.getBaseEntityAttributes()) {
        Answer pojo = new Answer(a.getSourceCode(), a.getTargetCode(), ea.getAttributeCode(), ea.getAsLoopString());
        pojo.setWeight(ea.getWeight());
        pojo.setInferred(ea.getInferred());
        pojo.setExpired(a.getExpired());
        pojo.setRefused(a.getRefused());
        // pojo.setAskId(answer.getAskId());
        QEventAttributeValueChangeMessage msg = new QEventAttributeValueChangeMessage(pojo, m.getOldValue(), m.getToken());
        msg.getData().setCode(ea.getAttributeCode());
        msg.getData().setId(-1L);
        msg.setBe(be);
        publish("events", JsonUtils.toJson(msg));
    }
}
Also used : Answer(life.genny.qwanda.Answer) EntityAttribute(life.genny.qwanda.attribute.EntityAttribute) QEventAttributeValueChangeMessage(life.genny.qwanda.message.QEventAttributeValueChangeMessage) BaseEntity(life.genny.qwanda.entity.BaseEntity)

Aggregations

Answer (life.genny.qwanda.Answer)1 EntityAttribute (life.genny.qwanda.attribute.EntityAttribute)1 BaseEntity (life.genny.qwanda.entity.BaseEntity)1 QEventAttributeValueChangeMessage (life.genny.qwanda.message.QEventAttributeValueChangeMessage)1