use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method publishBaseEntitysByParentAndLinkCodeWithAttributes.
public void publishBaseEntitysByParentAndLinkCodeWithAttributes(final String parentCode, final String linkCode, Integer pageStart, Integer pageSize, Boolean cache) {
BaseEntity[] beArray = RulesUtils.getBaseEntitysArrayByParentAndLinkCodeWithAttributes(qwandaServiceUrl, getDecodedTokenMap(), getToken(), parentCode, linkCode);
QDataBaseEntityMessage msg = new QDataBaseEntityMessage(beArray, parentCode, linkCode);
msg.setToken(getToken());
publish("cmds", RulesUtils.toJsonObject(msg));
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method processDimensions.
public void processDimensions(QEventAttributeValueChangeMessage msg) {
Answer newAnswer = msg.getAnswer();
BaseEntity load = getBaseEntityByCode(newAnswer.getTargetCode());
println("The laod value is " + load.toString());
String value = newAnswer.getValue();
println("The load " + msg.getData().getCode() + " is ::" + value);
/* Get the sourceCode(Job code) for this LOAD */
BaseEntity job = getParent(newAnswer.getTargetCode(), "LNK_BEG");
Answer jobDimensionAnswer = new Answer(getUser().getCode(), job.getCode(), msg.getData().getCode(), value);
saveAnswer(jobDimensionAnswer);
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method getBaseEntityByCode.
public BaseEntity getBaseEntityByCode(final String code, Boolean withAttributes) {
BaseEntity be = null;
be = VertxUtils.readFromDDT(code, withAttributes, getToken());
if (be == null) {
println("ERROR - be (" + code + ") fetched is NULL ");
} else {
addAttributes(be);
}
return be;
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method publishBaseEntityByCode.
public void publishBaseEntityByCode(final BaseEntity item, final String parentCode, final String linkCode, final String[] recipientCodes) {
BaseEntity[] itemArray = new BaseEntity[1];
itemArray[0] = item;
QDataBaseEntityMessage msg = new QDataBaseEntityMessage(itemArray, parentCode, linkCode);
msg.setRecipientCodeArray(recipientCodes);
publishData(msg, recipientCodes);
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method publishBE.
public void publishBE(final BaseEntity be, String[] recipientCodes) {
addAttributes(be);
if (recipientCodes == null || recipientCodes.length == 0) {
recipientCodes = new String[1];
recipientCodes[0] = getUser().getCode();
}
println("PUBLISHBE:" + be.getCode() + " with " + be.getBaseEntityAttributes().size() + " attribute changes");
// for (EntityAttribute ea : be.getBaseEntityAttributes()) {
//
// if
// (ea.getAttribute().getDataType().getTypeName().equals("org.javamoney.moneta.Money"))
// {
// // Money mon = JsonUtils.fromJson(ea.getValueString(), Money.class);
// println("Money=" + ea.getValueMoney());
// // BigDecimal bd = new BigDecimal(mon.getNumber().toString());
// // Money hacked = Money.of(bd, mon.getCurrency());
// // ea.setValueMoney(hacked);
// break;
// }
// }
BaseEntity[] itemArray = new BaseEntity[1];
itemArray[0] = be;
QDataBaseEntityMessage msg = new QDataBaseEntityMessage(itemArray, null, null);
msg.setRecipientCodeArray(recipientCodes);
// String json = JsonUtils.toJson(msg);
publishData(msg, recipientCodes);
}
Aggregations