use of life.genny.qwanda.message.QDataSubLayoutMessage in project rulesservice by genny-project.
the class QRules method sendSublayouts.
private void sendSublayouts(final String realm) throws ClientProtocolException, IOException {
String subLayoutMap = RulesUtils.getLayout(realm + "/sublayouts");
if (subLayoutMap != null) {
JsonArray subLayouts = new JsonArray(subLayoutMap);
if (subLayouts != null) {
Layout[] layoutArray = new Layout[subLayouts.size()];
for (int i = 0; i < subLayouts.size(); i++) {
JsonObject sublayoutData = null;
try {
sublayoutData = subLayouts.getJsonObject(i);
} catch (Exception e1) {
e1.printStackTrace();
}
String url = sublayoutData.getString("download_url");
String name = sublayoutData.getString("name");
name = name.replace(".json", "");
name = name.replaceAll("\"", "");
if (url != null) {
/* grab sublayout from github */
println(i + ":" + url);
String subLayoutString = QwandaUtils.apiGet(url, null);
if (subLayoutString != null) {
try {
layoutArray[i] = new Layout(name, subLayoutString);
} catch (Exception e) {
}
}
}
}
/* send sublayout to FE */
QDataSubLayoutMessage msg = new QDataSubLayoutMessage(layoutArray, getToken());
publishCmd(msg);
}
}
}
use of life.genny.qwanda.message.QDataSubLayoutMessage in project rulesservice by genny-project.
the class QRules method sendNotification.
public void sendNotification(final String text, final String[] recipientCodes, final String style) {
Layout notificationLayout = new Layout(text, style);
QDataSubLayoutMessage data = new QDataSubLayoutMessage(notificationLayout, getToken());
data.setRecipientCodeArray(recipientCodes);
publishCmd(data);
}
Aggregations