Examples of InboundSMSMessageList


Examples of org.gsm.oneapi.responsebean.sms.InboundSMSMessageList

          new ValidationRule(ValidationRule.VALIDATION_TYPE_MANDATORY, "registrationId", registrationId),
          new ValidationRule(ValidationRule.VALIDATION_TYPE_OPTIONAL_INT_GE_ZERO, "maxBatchSize", Integer.valueOf(maxBatchSize)),
      };

      if (checkRequestParameters(response, rules)) {     
        InboundSMSMessageList inboundSMSMessageList=new InboundSMSMessageList();
       
        String resourceURL=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/inbound/registrations/"+urlEncode(registrationId)+"/messages";

        inboundSMSMessageList.setResourceURL(resourceURL);
       
        java.util.Date message1DT=makeUTCDateTime(2009, Calendar.NOVEMBER, 19, 12, 0, 0);
        String messageId1="msg1";
        String resourceURL1=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/inbound/registrations/"+urlEncode(registrationId)+"/messages/"+urlEncode(messageId1);
        InboundSMSMessage message1=new InboundSMSMessage(message1DT, "3456", messageId1, "Come on Barca!", resourceURL1, "+447825123456");
       
        java.util.Date message2DT=makeUTCDateTime(2009, Calendar.NOVEMBER, 19, 14, 30, 25);
        String messageId2="msg2";
        String resourceURL2=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/smsmessaging/inbound/registrations/"+urlEncode(registrationId)+"/messages/"+urlEncode(messageId2);
        InboundSMSMessage message2=new InboundSMSMessage(message2DT, "3456", messageId2, "Great goal by Messi", resourceURL2, "+447825789123");
       
        if (maxBatchSize==1) {
          InboundSMSMessage[] messages={message1};
          inboundSMSMessageList.setNumberOfMessagesInThisBatch(1);
          inboundSMSMessageList.setInboundSMSMessage(messages);
        } else {
          InboundSMSMessage[] messages={message1, message2};
          inboundSMSMessageList.setNumberOfMessagesInThisBatch(2);
          inboundSMSMessageList.setInboundSMSMessage(messages);         
        }
        inboundSMSMessageList.setTotalNumberOfPendingMessages(2);
       
        ObjectMapper mapper=new ObjectMapper();     
        String jsonResponse="{\"inboundSMSMessageList\":"+mapper.writeValueAsString(inboundSMSMessageList)+"}";
 
        sendJSONResponse(response, jsonResponse, OK, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.