use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class QRules method publishData.
public void publishData(final List<BaseEntity> beList, final String parentCode, final String linkCode, String[] recipientCodes) {
QDataBaseEntityMessage msg = new QDataBaseEntityMessage(beList.toArray(new BaseEntity[0]));
msg.setParentCode(parentCode);
msg.setLinkCode(linkCode);
msg.setToken(getToken());
if (recipientCodes != null) {
msg.setRecipientCodeArray(recipientCodes);
}
publish("data", RulesUtils.toJsonObject(msg));
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class RulesUtils method getBaseEntitysByChildAndLinkCodeWithAttributes.
/**
* @param qwandaServiceUrl
* @param decodedToken
* @param token
* @param parentCode
* @param linkCode
* @return baseEntitys
*/
public static List<BaseEntity> getBaseEntitysByChildAndLinkCodeWithAttributes(final String qwandaServiceUrl, Map<String, Object> decodedToken, final String token, final String childCode, final String linkCode) {
String beJson = getBaseEntitysJsonByChildAndLinkCodeWithAttributes(qwandaServiceUrl, decodedToken, token, childCode, linkCode);
QDataBaseEntityMessage msg = JsonUtils.fromJson(beJson, QDataBaseEntityMessage.class);
BaseEntity[] beArray = msg.getItems();
ArrayList<BaseEntity> arrayList = new ArrayList<BaseEntity>(Arrays.asList(beArray));
return arrayList;
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class RulesUtils method getBaseEntitysByParentAndLinkCodeWithAttributesAndStakeholderCode.
/**
* @param qwandaServiceUrl
* @param decodedToken
* @param token
* @param parentCode
* @param linkCode
* @param stakeholderCode
* @return baseEntitys
*/
public static List<BaseEntity> getBaseEntitysByParentAndLinkCodeWithAttributesAndStakeholderCode(final String qwandaServiceUrl, Map<String, Object> decodedToken, final String token, final String parentCode, final String linkCode, final String stakeholderCode) {
if (parentCode.equalsIgnoreCase("GRP_NEW_ITEMS")) {
println("Group New Items Debug");
}
String beJson = getBaseEntitysJsonByParentAndLinkCodeWithAttributesAndStakeholderCode(qwandaServiceUrl, decodedToken, token, parentCode, linkCode, stakeholderCode);
QDataBaseEntityMessage msg = fromJson(beJson, QDataBaseEntityMessage.class);
if (msg == null) {
log.error("Error in fetching BE from Qwanda Service");
} else {
BaseEntity[] beArray = msg.getItems();
ArrayList<BaseEntity> arrayList = new ArrayList<BaseEntity>(Arrays.asList(beArray));
return arrayList;
}
// TODO get exception =s in place
return null;
}
use of life.genny.qwanda.entity.BaseEntity in project rulesservice by genny-project.
the class RulesUtils method getUser.
/**
* @param qwandaServiceUrl
* @param decodedToken
* @param token
* @return baseEntity user for the decodedToken passed
*/
public static BaseEntity getUser(final String qwandaServiceUrl, Map<String, Object> decodedToken, final String token) {
// try {
String beJson = null;
String username = (String) decodedToken.get("preferred_username");
String uname = QwandaUtils.getNormalisedUsername(username);
String code = "PER_" + uname.toUpperCase();
// CHEAT TODO
BaseEntity be = VertxUtils.readFromDDT(code, token);
return be;
// } catch (IOException e) {
// e.printStackTrace();
// }
// return null;
}
Aggregations