/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/message/DataSMResp.java
http://mobicents.googlecode.com/ · Java · 108 lines · 56 code · 17 blank · 35 comment · 2 complexity · 91b75f95605deccac46bf4cbff5662eb MD5 · raw file
- /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
- package org.mobicents.protocols.smpp.message;
- import java.io.IOException;
- import org.mobicents.protocols.smpp.util.PacketDecoder;
- import org.mobicents.protocols.smpp.util.PacketEncoder;
- import org.mobicents.protocols.smpp.version.SMPPVersion;
- /**
- * Response to a data_sm.
- * @version $Id: DataSMResp.java 457 2009-01-15 17:37:42Z orank $
- */
- public class DataSMResp extends SMPPPacket {
- private static final long serialVersionUID = 2L;
- private String messageId;
-
- /**
- * Construct a new DataSMResp.
- */
- public DataSMResp() {
- super(CommandId.DATA_SM_RESP);
- }
- /**
- * Create a new DataSMResp packet in response to a DataSM. This constructor
- * will set the sequence number to it's expected value.
- *
- * @param request
- * The Request packet the response is to
- */
- public DataSMResp(SMPPPacket request) {
- super(request);
- }
- public String getMessageId() {
- return messageId;
- }
- public void setMessageId(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public boolean equals(Object obj) {
- boolean equals = super.equals(obj);
- if (equals) {
- DataSMResp other = (DataSMResp) obj;
- equals |= safeCompare(messageId, other.messageId);
- }
- return equals;
- }
-
- @Override
- public int hashCode() {
- int hc = super.hashCode();
- hc += (messageId != null) ? messageId.hashCode() : 0;
- return hc;
- }
- @Override
- protected void toString(StringBuilder buffer) {
- buffer.append("messageId=").append(messageId);
- }
- @Override
- protected void validateMandatory(SMPPVersion smppVersion) {
- smppVersion.validateMessageId(messageId);
- }
- @Override
- protected void readMandatory(PacketDecoder decoder) {
- messageId = decoder.readCString();
- }
-
- @Override
- protected void writeMandatory(PacketEncoder encoder) throws IOException {
- encoder.writeCString(messageId);
- }
-
- @Override
- protected int getMandatorySize() {
- return 1 + sizeOf(messageId);
- }
- }