⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagestatus.java~

📁 Vodafone betavine java api source code, the latest snapshot.
💻 JAVA~
字号:
package com.bv.api.send;import java.io.IOException;import java.net.MalformedURLException;import java.util.Vector;import com.bv.api.Error;import com.bv.api.InvalidParameterException;import com.bv.api.ParamCall;import com.bv.api.ParamNotPresentException;import com.bv.api.response.MessageStatusResponse;/** * An API wrapper class that allows you to check the status of an SMS, Wap push or Application Trigger message. * @author C. Oattes, Kris Nobes */public class MessageStatus extends ParamCall {		private String transactionId = "";	private String messageId = "";		/**	 * Create a MessageStatus object	 */	public MessageStatus() {		super();		url = "/api/send/status";	}		/**	 * Create a MessageStatus object	 * @param transactionId The transactionID of the message to be checked	 * @param messageId The messageID of the message to be checked	 */	public MessageStatus(String transactionId, String messageId) {		this();		this.transactionId = transactionId;		this.messageId = messageId;	}		/**	 * Set the id of the message to check	 * @param id The identifier for the message	 */	public void setMessageId(String id) {		this.messageId = id;	}		/**	 * Set the transaction id of the message to check	 * @param id The transaction id for the message	 */	public void setTransactionId(String id) {		this.transactionId = id;	}		/** 	 * Get the messageID of the message to be checked	 * @return The message ID	 */	public String getMessageId() {		return messageId;	}		/** 	 * Get the transactionID of the message to be checked	 * @return The transaction ID	 */	public String getTransactionId() {		return transactionId;	}		protected boolean checkParams(String uaid) throws ParamNotPresentException, InvalidParameterException {		Vector<String> unsetParams = new Vector<String>();		if(uaid == null || uaid.equals("")) {			unsetParams.add("uaid");		} else if (uaid.length() != 32) {			throw new InvalidParameterException("UAID");		}		if(transactionId == null || transactionId.equals("")) {			unsetParams.add("transaction");		}				if(unsetParams.size() > 0) {			throw new ParamNotPresentException(unsetParams);		} else {			return true;		}	}		protected String constructParameterString(String uaid) throws InvalidParameterException{		String parameters = "";		parameters += getEncodedParams("uaid", uaid);		parameters += "&";		parameters += getEncodedParams("transaction", transactionId);		parameters += "&";		parameters += getEncodedParams("message", messageId);		return parameters;	}		/**	 * Process the response from the server and return an {@link MessageStatusResponse} object	 * @param uaid The user uaid	 * @param serverURL The server to connect to	 * @return MessageStatusResponse, with "success" set to <code>true</code> if the request was successful, <code>false</code> otherwise.	 */	public MessageStatusResponse execute(String uaid, String serverURL) throws ParamNotPresentException, InvalidParameterException {		try {			String response = connect(uaid, serverURL);			MessageStatusResponse msResponse = new MessageStatusResponse();			return msResponse.processResponse(response);		} catch (MalformedURLException mue) {			return new MessageStatusResponse(Error.ConnectionError, "Invalid server URL");		} catch (IOException ioe) {			return new MessageStatusResponse(Error.ConnectionError);		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -