use of life.genny.qwanda.message.QDataBaseEntityMessage 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.message.QDataBaseEntityMessage 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.message.QDataBaseEntityMessage in project rulesservice by genny-project.
the class QRules method publishData.
public void publishData(final BaseEntity be, final String[] recipientsCode) {
QDataBaseEntityMessage msg = new QDataBaseEntityMessage(be, null);
msg.setRecipientCodeArray(recipientsCode);
msg.setToken(getToken());
publish("data", RulesUtils.toJsonObject(msg));
}
use of life.genny.qwanda.message.QDataBaseEntityMessage 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);
}
use of life.genny.qwanda.message.QDataBaseEntityMessage in project rulesservice by genny-project.
the class QRules method clearBaseEntityAttr.
public void clearBaseEntityAttr(String userCode) {
BaseEntity be = getBaseEntityByCode(userCode);
println("be :: " + be);
Set<EntityAttribute> attributes = be.getBaseEntityAttributes();
println("Size all :: " + attributes.size());
Set<EntityAttribute> removeAttributes = new HashSet<EntityAttribute>();
for (EntityAttribute attribute : attributes) {
switch(attribute.getAttributeCode()) {
case ("PRI_UUID"):
removeAttributes.add(attribute);
break;
case ("PRI_FIRSTNAME"):
removeAttributes.add(attribute);
break;
case ("PRI_LASTNAME"):
removeAttributes.add(attribute);
break;
case ("PRI_EMAIL"):
removeAttributes.add(attribute);
break;
case ("PRI_USERNAME"):
removeAttributes.add(attribute);
break;
case ("PRI_KEYCLOAK_UUID"):
removeAttributes.add(attribute);
break;
case ("PRI_FB_BASIC"):
removeAttributes.add(attribute);
break;
}
}
println("before removing :: " + attributes.toString());
println("Size toRemove :: " + removeAttributes.size());
println("Removing attrs :: " + removeAttributes.toString());
attributes.removeAll(removeAttributes);
println("after removing :: " + attributes.toString());
println("Size afterRemoved :: " + attributes.size());
be.setBaseEntityAttributes(attributes);
QDataBaseEntityMessage beMsg = new QDataBaseEntityMessage(be);
beMsg.setDelete(true);
publishData(beMsg);
}
Aggregations