Search in sources :

Example 6 with SMSSpecialCharacter

use of org.hisp.dhis.sms.command.SMSSpecialCharacter in project dhis2-core by dhis2.

the class SMSCommandServiceTest method createKeyValueCommands.

// -------------------------------------------------------------------------
// Supportive Methods
// -------------------------------------------------------------------------
private void createKeyValueCommands() {
    dataElementA = createDataElement('A');
    dataElementB = createDataElement('B');
    dataElementC = createDataElement('C');
    dataElementService.addDataElement(dataElementA);
    dataElementService.addDataElement(dataElementB);
    dataElementService.addDataElement(dataElementC);
    dataSetA = createDataSet('A');
    dataSetA.addDataSetElement(dataElementA);
    dataSetA.addDataSetElement(dataElementB);
    dataSetService.addDataSet(dataSetA);
    smsCodeA1 = new SMSCode();
    smsCodeA1.setCode("a1");
    smsCodeA1.setDataElement(dataElementA);
    smsCodeA2 = new SMSCode();
    smsCodeA2.setCode("a2");
    smsCodeA2.setDataElement(dataElementB);
    smsCodeB1 = new SMSCode();
    smsCodeB1.setCode("b1");
    smsCodeB1.setDataElement(dataElementA);
    smsCodeB2 = new SMSCode();
    smsCodeB2.setCode("b2");
    smsCodeB2.setDataElement(dataElementB);
    smsCodeC = new SMSCode();
    smsCodeC.setCode("c");
    smsCodeC.setDataElement(dataElementC);
    characterA = new SMSSpecialCharacter();
    characterA.setName("charA");
    characterA.setValue("vCharA");
    characterB = new SMSSpecialCharacter();
    characterB.setName("charB");
    characterB.setValue("vCharB");
    keyValueCommandA = new SMSCommand();
    keyValueCommandA.setName(keyValueCommandName);
    keyValueCommandA.setParserType(ParserType.KEY_VALUE_PARSER);
    keyValueCommandA.setDataset(dataSetA);
    keyValueCommandA.setCodes(Sets.newHashSet(smsCodeA1, smsCodeA2));
    keyValueCommandA.setSpecialCharacters(Sets.newHashSet(characterA));
    keyValueCommandA.setSuccessMessage(success);
    defaultMessagesA.put(SUCCESS_MESSAGE, success);
    keyValueCommandB = new SMSCommand();
    keyValueCommandB.setName(keyValueCommandNameB);
    keyValueCommandB.setParserType(ParserType.KEY_VALUE_PARSER);
    keyValueCommandB.setDataset(dataSetA);
    keyValueCommandB.setCodes(Sets.newHashSet(smsCodeB1, smsCodeB2));
}
Also used : SMSCommand(org.hisp.dhis.sms.command.SMSCommand) SMSCode(org.hisp.dhis.sms.command.code.SMSCode) SMSSpecialCharacter(org.hisp.dhis.sms.command.SMSSpecialCharacter)

Aggregations

SMSSpecialCharacter (org.hisp.dhis.sms.command.SMSSpecialCharacter)6 SMSCode (org.hisp.dhis.sms.command.code.SMSCode)4 SMSCommand (org.hisp.dhis.sms.command.SMSCommand)3 Date (java.util.Date)2 DataElement (org.hisp.dhis.dataelement.DataElement)2 DataValue (org.hisp.dhis.datavalue.DataValue)2 Period (org.hisp.dhis.period.Period)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 java.util (java.util)1 HashSet (java.util.HashSet)1 Session (org.hibernate.Session)1 CategoryOptionCombo (org.hisp.dhis.category.CategoryOptionCombo)1 DataElementCategoryOptionCombo (org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)1 CompleteDataSetRegistration (org.hisp.dhis.dataset.CompleteDataSetRegistration)1 OutboundMessageResponse (org.hisp.dhis.outboundmessage.OutboundMessageResponse)1 IncomingSms (org.hisp.dhis.sms.incoming.IncomingSms)1 SMSParserException (org.hisp.dhis.sms.parse.SMSParserException)1 Transactional (org.springframework.transaction.annotation.Transactional)1