Search in sources :

Example 1 with QDataAnswerMessage

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

the class QRules method publishData.

public void publishData(final Answer answer, final String[] recipientsCode) {
    QDataAnswerMessage msg = new QDataAnswerMessage(answer);
    msg.setRecipientCodeArray(recipientsCode);
    msg.setToken(getToken());
    publish("data", RulesUtils.toJsonObject(msg));
}
Also used : QDataAnswerMessage(life.genny.qwanda.message.QDataAnswerMessage)

Example 2 with QDataAnswerMessage

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

the class QRules method publishData.

public void publishData(final Answer answer) {
    QDataAnswerMessage msg = new QDataAnswerMessage(answer);
    msg.setToken(getToken());
    publish("data", JsonUtils.toJson(msg));
}
Also used : QDataAnswerMessage(life.genny.qwanda.message.QDataAnswerMessage)

Example 3 with QDataAnswerMessage

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

the class QRules method publishCmd.

public void publishCmd(final Answer answer) {
    QDataAnswerMessage msg = new QDataAnswerMessage(answer);
    msg.setToken(getToken());
    publish("cmds", JsonUtils.toJson(msg));
}
Also used : QDataAnswerMessage(life.genny.qwanda.message.QDataAnswerMessage)

Example 4 with QDataAnswerMessage

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

the class QRules method saveAnswers.

/**
 * @param answers
 */
public void saveAnswers(List<Answer> answers, final boolean changeEvent) {
    if (!changeEvent) {
        for (Answer answer : answers) {
            answer.setChangeEvent(false);
        }
    }
    Answer[] items = new Answer[answers.size()];
    items = answers.toArray(items);
    QDataAnswerMessage msg = new QDataAnswerMessage(items);
    updateCachedBaseEntity(answers);
    String jsonAnswer = RulesUtils.toJson(msg);
    jsonAnswer.replace("\\\"", "\"");
    try {
        QwandaUtils.apiPostEntity(getQwandaServiceUrl() + "/qwanda/answers/bulk2", jsonAnswer, token);
    } catch (IOException e) {
        log.error("Socket error trying to post answer");
    }
}
Also used : Answer(life.genny.qwanda.Answer) QDataAnswerMessage(life.genny.qwanda.message.QDataAnswerMessage) IOException(java.io.IOException)

Example 5 with QDataAnswerMessage

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

the class QRules method publishData.

public void publishData(final List<Answer> answerList) {
    Answer[] answerArray = answerList.toArray(new Answer[answerList.size()]);
    QDataAnswerMessage msg = new QDataAnswerMessage(answerArray);
    msg.setToken(getToken());
    publish("data", JsonUtils.toJson(msg));
}
Also used : Answer(life.genny.qwanda.Answer) QDataAnswerMessage(life.genny.qwanda.message.QDataAnswerMessage)

Aggregations

QDataAnswerMessage (life.genny.qwanda.message.QDataAnswerMessage)7 Answer (life.genny.qwanda.Answer)2 Tuple3 (io.vavr.Tuple3)1 JsonArray (io.vertx.core.json.JsonArray)1 JsonObject (io.vertx.core.json.JsonObject)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 GPS (life.genny.qwanda.GPS)1 QDataGPSMessage (life.genny.qwanda.message.QDataGPSMessage)1 QDataPaymentsCallbackMessage (life.genny.qwanda.message.QDataPaymentsCallbackMessage)1 QEventAttributeValueChangeMessage (life.genny.qwanda.message.QEventAttributeValueChangeMessage)1 QEventLinkChangeMessage (life.genny.qwanda.message.QEventLinkChangeMessage)1 QEventMessage (life.genny.qwanda.message.QEventMessage)1 Rule (life.genny.qwanda.rule.Rule)1