method2testcases stringlengths 118 6.63k |
|---|
### Question:
PingLoopbackLinkFactory implements LinkFactory { @Override public boolean supports(LinkType linkType) { return PingLoopbackLink.LINK_TYPE.equals(linkType); } Link<?> constructLink(
final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings
); @Override boolean sup... |
### Question:
AsnInterledgerAddressCodec extends AsnIA5StringBasedObjectCodec<InterledgerAddress> { @Override public void encode(InterledgerAddress value) { setCharString(value == null ? "" : value.getValue()); } AsnInterledgerAddressCodec(); @Override InterledgerAddress decode(); @Override void encode(InterledgerAddre... |
### Question:
PingLoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "... |
### Question:
AbstractStatefulLink extends AbstractLink<L> implements StatefulLink<L> { @Override public final CompletableFuture<Void> connect() { try { if (this.connected.compareAndSet(NOT_CONNECTED, CONNECTED)) { logger.debug("[linktype={}] (operatorIlpAddress={}) connecting to linkId={}...", this.getLinkSettings().g... |
### Question:
AbstractStatefulLink extends AbstractLink<L> implements StatefulLink<L> { @Override public void close() { this.disconnect().join(); } protected AbstractStatefulLink(
final Supplier<InterledgerAddress> operatorAddressSupplier,
final L linkSettings,
final LinkConnectionEventEmitter linkCo... |
### Question:
AbstractStatefulLink extends AbstractLink<L> implements StatefulLink<L> { @Override public final CompletableFuture<Void> disconnect() { try { if (this.connected.compareAndSet(CONNECTED, NOT_CONNECTED)) { logger.debug("[linktype={}] (ILPAddress={}) disconnecting from linkId={}...", this.getLinkSettings().g... |
### Question:
AbstractStatefulLink extends AbstractLink<L> implements StatefulLink<L> { @Override public void addLinkEventListener(final LinkConnectionEventListener linkConnectionEventListener) { Objects.requireNonNull(linkConnectionEventListener); this.linkConnectionEventEmitter.addLinkConnectionEventListener(linkConn... |
### Question:
AbstractStatefulLink extends AbstractLink<L> implements StatefulLink<L> { @Override public void removeLinkEventListener(final LinkConnectionEventListener linkConnectionEventListener) { Objects.requireNonNull(linkConnectionEventListener); this.linkConnectionEventEmitter.removeLinkConnectionEventListener(li... |
### Question:
AsnBtpErrorDataCodec extends AsnBtpPacketDataCodec<BtpError> { @Override public BtpError decode() { return BtpError.builder() .requestId(getRequestId()) .errorCode(BtpErrorCode.fromCodeAsString(getValueAt(0))) .triggeredAt(getValueAt(2)) .errorData(getValueAt(3)) .subProtocols(getValueAt(4)) .build(); } A... |
### Question:
LoopbackLink extends AbstractLink<LinkSettings> implements Link<LinkSettings> { @Override public void registerLinkHandler(LinkHandler ilpDataHandler) throws LinkHandlerAlreadyRegisteredException { throw new RuntimeException( "Loopback links never have incoming data, and thus should not have a registered D... |
### Question:
LoopbackLink extends AbstractLink<LinkSettings> implements Link<LinkSettings> { @VisibleForTesting InterledgerResponsePacket sleepAndReject(InterledgerPreparePacket preparePacket, int sleepDuraction) { try { Thread.sleep(sleepDuraction); } catch (InterruptedException e) { throw new RuntimeException(e); } ... |
### Question:
AbstractLink implements Link<L> { @Override public LinkId getLinkId() { if (linkId.get() == null) { throw new IllegalStateException("The LinkId must be set before using a Link"); } return linkId.get(); } protected AbstractLink(
final Supplier<InterledgerAddress> operatorAddressSupplier,
final... |
### Question:
AsnBtpErrorDataCodec extends AsnBtpPacketDataCodec<BtpError> { @Override public void encode(final BtpError value) { Objects.requireNonNull(value); setValueAt(0, value.getErrorCode().getCodeIdentifier()); setValueAt(1, value.getErrorCode().getCodeName()); setValueAt(2, value.getTriggeredAt()); setValueAt(3... |
### Question:
AbstractLink implements Link<L> { @Override public void setLinkId(final LinkId linkId) { if (!this.linkId.compareAndSet(null, Objects.requireNonNull(linkId))) { throw new IllegalStateException("LinkId may only be set once"); } } protected AbstractLink(
final Supplier<InterledgerAddress> operatorAdd... |
### Question:
AbstractLink implements Link<L> { @Override public Supplier<InterledgerAddress> getOperatorAddressSupplier() { return operatorAddressSupplier; } protected AbstractLink(
final Supplier<InterledgerAddress> operatorAddressSupplier,
final L linkSettings
); @Override LinkId getLinkId(); @Overrid... |
### Question:
AbstractLink implements Link<L> { @Override public L getLinkSettings() { return this.linkSettings; } protected AbstractLink(
final Supplier<InterledgerAddress> operatorAddressSupplier,
final L linkSettings
); @Override LinkId getLinkId(); @Override void setLinkId(final LinkId linkId); @Over... |
### Question:
LinkFactoryProvider { public LinkFactory getLinkFactory(final LinkType linkType) { Objects.requireNonNull(linkType, "linkType must not be null"); return Optional.ofNullable(this.linkFactories.get(linkType)) .orElseThrow(() -> new LinkException( String.format("No registered LinkFactory linkType=%s", linkTy... |
### Question:
LinkFactoryProvider { public LinkFactory registerLinkFactory(final LinkType linkType, final LinkFactory linkFactory) { Objects.requireNonNull(linkType, "linkType must not be null"); Objects.requireNonNull(linkFactory, "linkFactory must not be null"); return this.linkFactories.put(linkType, linkFactory); }... |
### Question:
LoopbackLinkFactory implements LinkFactory { @Override public boolean supports(LinkType linkType) { return LoopbackLink.LINK_TYPE.equals(linkType); } LoopbackLinkFactory(final PacketRejector packetRejector); Link<?> constructLink(
final Supplier<InterledgerAddress> operatorAddressSupplier, final Lin... |
### Question:
LoopbackLinkFactory implements LinkFactory { public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonNull(linkSettings, "link... |
### Question:
AsnIldcpResponseCodec extends AsnSequenceCodec<IldcpResponse> { @Override public IldcpResponse decode() { return IldcpResponse.builder() .clientAddress(getValueAt(0)) .assetScale(getValueAt(1)) .assetCode(getValueAt(2)) .build(); } AsnIldcpResponseCodec(); @Override IldcpResponse decode(); @Override void ... |
### Question:
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override public boolean supports(LinkType linkType) { return StatelessSpspReceiverLink.LINK_TYPE.equals(linkType); } StatelessSpspReceiverLinkFactory(
final PacketRejector packetRejector, final StatelessStreamReceiver statelessStreamReceiver... |
### Question:
StatelessSpspReceiverLinkFactory implements LinkFactory { @Override public Link<?> constructLink( final Supplier<InterledgerAddress> operatorAddressSupplier, final LinkSettings linkSettings ) { Objects.requireNonNull(operatorAddressSupplier, "operatorAddressSupplier must not be null"); Objects.requireNonN... |
### Question:
StatelessSpspReceiverLink extends AbstractLink<StatelessSpspReceiverLinkSettings> implements Link<StatelessSpspReceiverLinkSettings> { @Override public void registerLinkHandler(final LinkHandler ilpDataHandler) throws LinkHandlerAlreadyRegisteredException { throw new RuntimeException( "StatelessSpspReceiv... |
### Question:
StatelessSpspReceiverLink extends AbstractLink<StatelessSpspReceiverLinkSettings> implements Link<StatelessSpspReceiverLinkSettings> { @Override public InterledgerResponsePacket sendPacket(final InterledgerPreparePacket preparePacket) { Objects.requireNonNull(preparePacket, "preparePacket must not be null... |
### Question:
AsnIldcpResponseCodec extends AsnSequenceCodec<IldcpResponse> { @Override public void encode(IldcpResponse value) { setValueAt(0, value.getClientAddress()); setValueAt(1, value.getAssetScale()); setValueAt(2, value.getAssetCode()); } AsnIldcpResponseCodec(); @Override IldcpResponse decode(); @Override voi... |
### Question:
AsnIldcpResponsePacketDataCodec extends AsnSequenceCodec<IldcpResponsePacket> { @Override public void encode(IldcpResponsePacket value) { final ByteArrayOutputStream os = new ByteArrayOutputStream(); try { IldcpCodecContextFactory.oer().write(value.getIldcpResponse(), os); } catch (IOException e) { throw ... |
### Question:
JsonParser { public static String serialize(Object object) { try { return new ObjectMapper().writeValueAsString(object); } catch (JsonProcessingException ex) { log.error(ex.getMessage(),ex); } return null; } static String serialize(Object object); static T deserialize(String json, Class<T> type); static ... |
### Question:
WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) en... |
### Question:
WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowSe... |
### Question:
JsonParser { public static <T> T deserialize(String json, Class<T> type) { try { return new ObjectMapper().readValue(json,type); } catch (Exception ex) { log.error(ex.getMessage(),ex); } return null; } static String serialize(Object object); static T deserialize(String json, Class<T> type); static T dese... |
### Question:
IncomingMessageFormDefinitionDAOImpl extends HibernateGenericDAOImpl<IncomingMessageFormDefinitionImpl> implements IncomingMessageFormDefinitionDAO<IncomingMessageFormDefinitionImpl> { public IncomingMessageFormDefinition getByCode(String formCode) { logger.debug("variable passed to getByCode: " + formCod... |
### Question:
RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpt... |
### Question:
DummyGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if(message == null) return null; if(gatewayResponse.isEmpty()) return null; Set<GatewayResponse> responseList = new HashSet<GatewayResponse>(... |
### Question:
DummyGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 4){ status = responseParts[3]; } else{ status = ""; } return lookupStatus(status); } ... |
### Question:
DummyGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus lookupStatus(String code) { if(code.isEmpty()){ return MStatus.PENDING; } for(Entry<MStatus, String> entry: codeStatusMap.entrySet()){ if(entry.getValue().contains(code)){ return entry.getKey(); } } return MStatus.PENDING; } ... |
### Question:
DummyGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus lookupResponse(String code) { if(code.isEmpty()){ return MStatus.SCHEDULED; } for(Entry<MStatus, String> entry: codeResponseMap.entrySet()){ if(entry.getValue().contains(code)){ return entry.getKey(); } } return MStatus.SCHED... |
### Question:
IVRNotificationMapping { public void setType(String type) { this.type = null; if ( type.equalsIgnoreCase(INFORMATIONAL) || type.equalsIgnoreCase(REMINDER) ) this.type = type; } long getId(); void setId(long id); String getType(); void setType(String type); String getIvrEntityName(); void setIvrEntityName... |
### Question:
IMPManagerImpl implements ApplicationContextAware, IMPManager { public CommandAction createCommandAction() { return (CommandAction)context.getBean("formCmdAxn"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLParser()... |
### Question:
IntellIVRGatewayMessageHandler implements GatewayMessageHandler { public MStatus lookupStatus(String code) { MStatus status = responseMap.get(code); return status != null ? status : defaultStatus; } Set<GatewayResponse> parseMessageResponse(GatewayRequest gatewayRequest,
String statusMessage); MStatus... |
### Question:
IntellIVRGatewayMessageHandler implements GatewayMessageHandler { public MStatus lookupResponse(String code) { MStatus responseStatus = responseMap.get(code); return responseStatus != null ? responseStatus : defaultResponse; } Set<GatewayResponse> parseMessageResponse(GatewayRequest gatewayRequest,
St... |
### Question:
IntellIVRGatewayMessageHandler implements GatewayMessageHandler { public MStatus parseMessageStatus(String messageStatus) { return lookupStatus(messageStatus); } Set<GatewayResponse> parseMessageResponse(GatewayRequest gatewayRequest,
String statusMessage); MStatus parseMessageStatus(String messageSta... |
### Question:
IntellIVRGatewayMessageHandler implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest gatewayRequest, String statusMessage) { Set<GatewayResponse> responses = new HashSet<GatewayResponse>(); GatewayResponse gwResponse = coreManager.createGatewayResponse(); gwRes... |
### Question:
OMPManagerImpl implements OMPManager, ApplicationContextAware { public GatewayMessageHandler createGatewayMessageHandler() { try{ return (GatewayMessageHandler)context.getBean("orserveHandler"); } catch(Exception ex){ logger.error("GatewayMessageHandler creation failed", ex); return null; } } void setApp... |
### Question:
OMPManagerImpl implements OMPManager, ApplicationContextAware { public GatewayManager createGatewayManager() { try{ return (GatewayManager)context.getBean("orserveGateway"); } catch(Exception ex){ logger.fatal("GatewayManager creation failed", ex); throw new RuntimeException("Unable to create gateway"); }... |
### Question:
FormDefinitionServiceImpl implements FormDefinitionService,
StudyDefinitionService, UserDefinitionService { public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> f... |
### Question:
OMPManagerImpl implements OMPManager, ApplicationContextAware { public CacheService createCacheService() { try{ return (CacheService)context.getBean("smsCache"); } catch(Exception ex){ logger.fatal("CacheService creation failed", ex); throw new RuntimeException("Unable to initialize cache"); } } void set... |
### Question:
OMPManagerImpl implements OMPManager, ApplicationContextAware { public MobileMessagingService createMessagingService() { try{ return (MobileMessagingService)context.getBean("smsService"); } catch(Exception ex){ logger.fatal("MobileMessagingService creation failed", ex); throw new RuntimeException("Unable ... |
### Question:
CompositeGatewayMessageHandler implements GatewayMessageHandler { @SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResp... |
### Question:
DummyGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { if (log.isInfoEnabled()) { log.info(messageDetails.getId() + "|" + messageDetails.getRecipientsNumber() + "|" + messageDetails.getMessage()); } String msgResponse = (messageDetails.... |
### Question:
DummyGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { return "004"; } Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); void setSleepTime(long sleepTime); long getSleepTime(); String getMessageStatus(GatewayResponse response); MStatu... |
### Question:
DummyGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); void setSleepTime(long sleepTime); long getSleepTime(); ... |
### Question:
PostData { public String toString(){ StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ builder.append("&").append(key).append("=").append(data.get(key)); } return builder.toString(); } void add(String attribute, String value, String urlEncoding); void add(String attribute, Str... |
### Question:
PostData { public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(... |
### Question:
InMemoryMessageStatusStore implements MessageStatusStore { public void updateStatus(String id, String status) { try { if (status == null) { statusMap.remove(id); return; } MessageStatusEntry statusEntry = statusMap.get(id); if (statusEntry == null) statusMap.put(id, statusEntry = new MessageStatusEntry())... |
### Question:
InMemoryMessageStatusStore implements MessageStatusStore { public String getStatus(String id) { try { MessageStatusEntry statusEntry = statusMap.get(id); return statusEntry == null ? null : statusEntry.getStatus(); } finally { requestCleanup(); } } void setTtl(long ttl); long getTtl(); long getCleanupInt... |
### Question:
CompositeGatewayManager implements GatewayManager { public String getMessageStatus(GatewayResponse response) { if ( response .getGatewayRequest() .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.getMessageStatus(response); } if ( response .getGatewayRequest() .get... |
### Question:
CompositeGatewayManager implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { if ( response .getGatewayRequest() .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.mapMessageStatus(response); } if ( response .getGatewayRequest() .ge... |
### Question:
CompositeGatewayManager implements GatewayManager { @Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayReque... |
### Question:
ORServeGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { String gatewayResponse; if(messageDetails == null) return null; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new UR... |
### Question:
ORServeGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { String gatewayResponse; logger.debug("Building ORServe message gateway webservice proxy class"); URL wsdlURL = null; try { wsdlURL = new URL("http: } catch ( MalformedURLException e ) { logger.... |
### Question:
ORServeGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageStatus(GatewayResponse response); MSt... |
### Question:
ORServeGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpt... |
### Question:
ORServeGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 4){ status = responseParts... |
### Question:
ORServeGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus lookupStatus(String code){ if(code.isEmpty()){ return MStatus.PENDING; } for(Entry<MStatus, String> entry: codeStatusMap.entrySet()){ if(entry.getValue().contains(code)){ return entry.getKey(); } } return MStatus.PENDING; }... |
### Question:
ORServeGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus lookupResponse(String code){ if(code.isEmpty()){ return MStatus.SCHEDULED; } for(Entry<MStatus, String> entry: codeResponseMap.entrySet()){ if(entry.getValue().contains(code)){ return entry.getKey(); } } return MStatus.SCHE... |
### Question:
SMSCacheServiceImpl implements CacheService { public void saveMessage(GatewayRequest gatewayRequest) { logger.debug("Initializing DAO"); GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); logger.debug("Caching message"); logger.debug(gatewayRequest); gatewayRequestDAO.save(gatewa... |
### Question:
SMSCacheServiceImpl implements CacheService { public void saveResponse(GatewayResponse gatewayResponse) { logger.debug("Initializing DAO"); GatewayResponseDAO gatewayResponseDAO = coreManager.createGatewayResponseDAO(); logger.debug("Caching response"); logger.debug(gatewayResponse); gatewayResponseDAO.me... |
### Question:
SMSCacheServiceImpl implements CacheService { public List<GatewayRequest> getMessages(GatewayRequest gatewayRequest) { GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); return gatewayRequestDAO.findByExample(gatewayRequest); } void saveMessage(GatewayRequest gatewayRequest); vo... |
### Question:
SMSCacheServiceImpl implements CacheService { public List<GatewayResponse> getResponses(GatewayResponse gatewayResponse) { GatewayResponseDAO responseDao = coreManager.createGatewayResponseDAO(); return responseDao.findByExample(gatewayResponse); } void saveMessage(GatewayRequest gatewayRequest); void me... |
### Question:
SMSCacheServiceImpl implements CacheService { public List<GatewayRequest> getMessagesByStatus(MStatus mStatus) { GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); return gatewayRequestDAO.getByStatus(mStatus); } void saveMessage(GatewayRequest gatewayRequest); void mergeMessage... |
### Question:
SMSCacheServiceImpl implements CacheService { public List<GatewayRequest> getMessagesByStatusAndSchedule(MStatus mStatus, Date date) { GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); return gatewayRequestDAO.getByStatusAndSchedule(mStatus, date); } void saveMessage(GatewayReq... |
### Question:
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional public void scheduleMessage(GatewayRequest gatewayRequest) { cache.saveMessage(gatewayRequest.getGatewayRequestDetails()); } @Transactional void scheduleMessage(GatewayRequest gatewayRequest); @Transactional void scheduleMessage(G... |
### Question:
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void sendScheduledMessages() { logger.info("Fetching cached GatewayRequests"); List<GatewayRequest> scheduledMessages = cache.getMessagesByStatusAndSchedule(MStatus.SCHEDULED, new Date()); if (scheduledMessa... |
### Question:
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional public Map<Boolean, Set<GatewayResponse>> sendMessage(GatewayRequest gatewayRequest) { logger.debug("Sending message to gateway"); Set<GatewayResponse> responseList = null; Map<Boolean, Set<GatewayResponse>> result = new HashMap<Bo... |
### Question:
SMSMessagingServiceImpl implements MobileMessagingService { @Transactional(readOnly = true) public void updateMessageStatuses() { logger.info("Updating GatewayResponse objects"); GatewayResponse gwResp = coreManager.createGatewayResponse(); gwResp.setMessageStatus(MStatus.PENDING); List<GatewayResponse> p... |
### Question:
SMSMessagingServiceImpl implements MobileMessagingService { String getMessageStatus(GatewayResponse response) { logger.info("Calling GatewayManager.getMessageStatus"); return gatewayManager.getMessageStatus(response); } @Transactional void scheduleMessage(GatewayRequest gatewayRequest); @Transactional vo... |
### Question:
IMPServiceImpl implements IMPService { public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryC... |
### Question:
IncomingMessageFormParameterValidatorImpl implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { if (!param.getMessageFormParamStatus().equals(IncMessageFormParameterStatus.NEW)) { return param.getMessageFormParamStatus().equals(IncMessageFormParam... |
### Question:
MotechIDGenerator { public static Long generateID(int length) { logger.info("Calling generateID with specify length"); Long result = null; if (length > 0) { StringBuilder id = new StringBuilder(length); for (int i = 0; i < length; i++) { id.append(NUMS[(int) Math.floor(Math.random() * 20)]); } result = Lo... |
### Question:
GatewayResponseDAOImpl extends HibernateGenericDAOImpl<GatewayResponseImpl> implements GatewayResponseDAO<GatewayResponseImpl> { public GatewayResponse getMostRecentResponseByMessageId(Long messageId) { logger.debug("variable passed to getMostRecentResponseByRequestId: " + messageId); try { GatewayRespons... |
### Question:
GatewayRequestDAOImpl extends HibernateGenericDAOImpl<GatewayRequestImpl> implements GatewayRequestDAO<GatewayRequestImpl> { public List<GatewayRequest> getByStatusAndSchedule(MStatus status, Date schedule) { logger.debug("variables passed to getByStatusAndSchedule. status: " + status + "And schedule: " +... |
### Question:
LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.cla... |
### Question:
FormProcessorImpl implements FormProcessor { public void parseValidationErrors(IncomingMessageForm form, ValidationException ex) { List<String> errors = ex.getFaultInfo().getErrors(); form.setErrors(errors); } String processForm(IncomingMessageForm form); void parseValidationErrors(IncomingMessageForm fo... |
### Question:
ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.se... |
### Question:
ConditionalRequirementValidator { public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFor... |
### Question:
ParamValueValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param... |
### Question:
ParamSizeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinit... |
### Question:
FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext... |
### Question:
FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMes... |
### Question:
IncomingMessageParserImpl implements IncomingMessageParser { public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return in... |
### Question:
IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } I... |
### Question:
IncomingMessageParserImpl implements IncomingMessageParser { public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] for... |
### Question:
IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != n... |
### Question:
XMLUtil { public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e... |
### Question:
IncomingMessageXMLParserImpl implements IncomingMessageXMLParser { public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = ... |
### Question:
RetryStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ } void doAction(GatewayResponse response); }### Answer:
@Test public void testDoAction() { } |
### Question:
OMIManagerImpl implements OMIManager, ApplicationContextAware { public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable... |
### Question:
MessageTemplateDAOImpl extends HibernateGenericDAOImpl<MessageTemplateImpl> implements MessageTemplateDAO<MessageTemplateImpl> { public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. lang... |
### Question:
OMIManagerImpl implements OMIManager, ApplicationContextAware { public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } void setApplicationCo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.