use of org.hisp.dhis.programrule.ProgramRuleAction in project dhis2-core by dhis2.
the class DhisConvenienceTest method createProgramRuleAction.
public static ProgramRuleAction createProgramRuleAction(char uniqueCharacter) {
ProgramRuleAction programRuleAction = new ProgramRuleAction();
programRuleAction.setAutoFields();
programRuleAction.setName("ProgramRuleAction" + uniqueCharacter);
programRuleAction.setProgramRuleActionType(ProgramRuleActionType.HIDEFIELD);
return programRuleAction;
}
use of org.hisp.dhis.programrule.ProgramRuleAction in project dhis2-core by dhis2.
the class ProgramRuleEngineTest method setUpNotificationForD2HasValue.
private void setUpNotificationForD2HasValue() {
ProgramNotificationTemplate pnt = new ProgramNotificationTemplate();
pnt.setName("Test-PNT");
pnt.setMessageTemplate("message_template");
pnt.setSubjectTemplate("subject_template");
pnt.setNotificationTrigger(NotificationTrigger.PROGRAM_RULE);
pnt.setRecipientProgramAttribute(attributeEmail);
pnt.setNotificationRecipient(ProgramNotificationRecipient.PROGRAM_ATTRIBUTE);
pnt.setAutoFields();
pnt.setUid("PNT-2");
programNotificationTemplateStore.save(pnt);
ProgramRuleAction programRuleActionForSendMessage = createProgramRuleAction('C', programRuleE);
programRuleActionForSendMessage.setProgramRuleActionType(ProgramRuleActionType.SENDMESSAGE);
programRuleActionForSendMessage.setTemplateUid(pnt.getUid());
programRuleActionForSendMessage.setContent("STATIC-TEXT");
programRuleActionService.addProgramRuleAction(programRuleActionForSendMessage);
programRuleE.setProgramRuleActions(Sets.newHashSet(programRuleActionForSendMessage));
programRuleService.updateProgramRule(programRuleE);
}
use of org.hisp.dhis.programrule.ProgramRuleAction in project dhis2-core by dhis2.
the class ProgramRuleEngineTest method setUpSendMessageForEnrollment.
private void setUpSendMessageForEnrollment() {
ProgramNotificationTemplate pnt = new ProgramNotificationTemplate();
pnt.setName("Test-PNT");
pnt.setMessageTemplate("message_template");
pnt.setDeliveryChannels(Sets.newHashSet(DeliveryChannel.SMS));
pnt.setSubjectTemplate("subject_template");
pnt.setNotificationTrigger(NotificationTrigger.PROGRAM_RULE);
pnt.setAutoFields();
pnt.setUid("PNT-1");
programNotificationTemplateStore.save(pnt);
ProgramRuleAction programRuleActionForSendMessage = createProgramRuleAction('C', programRuleC);
programRuleActionForSendMessage.setProgramRuleActionType(ProgramRuleActionType.SENDMESSAGE);
programRuleActionForSendMessage.setTemplateUid(pnt.getUid());
programRuleActionForSendMessage.setContent("STATIC-TEXT");
programRuleActionService.addProgramRuleAction(programRuleActionForSendMessage);
programRuleC.setProgramRuleActions(Sets.newHashSet(programRuleActionForSendMessage));
programRuleService.updateProgramRule(programRuleC);
}
use of org.hisp.dhis.programrule.ProgramRuleAction in project dhis2-core by dhis2.
the class TrackerProgramRuleBundleServiceTest method initTest.
@Override
protected void initTest() throws IOException {
ObjectBundle bundle = setUpMetadata("tracker/event_metadata.json");
ProgramRule programRule = createProgramRule('A', bundle.getPreheat().get(PreheatIdentifier.UID, Program.class, "BFcipDERJwr"));
programRuleService.addProgramRule(programRule);
ProgramRuleAction programRuleAction = createProgramRuleAction('A', programRule);
programRuleAction.setProgramRuleActionType(ProgramRuleActionType.SENDMESSAGE);
programRuleActionService.addProgramRuleAction(programRuleAction);
programRule.setProgramRuleActions(Sets.newHashSet(programRuleAction));
programRuleService.updateProgramRule(programRule);
manager.flush();
}
use of org.hisp.dhis.programrule.ProgramRuleAction in project dhis2-core by dhis2.
the class DhisConvenienceTest method createProgramRuleAction.
public static ProgramRuleAction createProgramRuleAction(char uniqueCharacter, ProgramRule parentRule) {
ProgramRuleAction programRuleAction = createProgramRuleAction(uniqueCharacter);
programRuleAction.setProgramRule(parentRule);
return programRuleAction;
}
Aggregations