Revision: 2933db026ec8
Author:   baranowb <[email protected]>
Date:     Sun Nov 25 05:21:36 2012
Log:      Changes required for MAP.NTFY

http://code.google.com/p/jss7/source/detail?r=2933db026ec8

Modified:
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPApplicationContext.java /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/SupplementaryMessageImpl.java /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/UnstructuredSSNotifyResponseImpl.java

=======================================
--- /map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPApplicationContext.java Wed Aug 1 05:39:20 2012 +++ /map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPApplicationContext.java Sun Nov 25 05:21:36 2012
@@ -22,6 +22,8 @@

 package org.mobicents.protocols.ss7.map.api;

+import java.io.Serializable;
+
 import javolution.util.FastMap;

 /**
@@ -30,7 +32,7 @@
  * @author sergey vetyutnev
  *
  */
-public class MAPApplicationContext {
+public class MAPApplicationContext implements Serializable {

        private static long[] oidTemplate = new long[] { 0, 4, 0, 0, 1, 0, 0, 0 
};

=======================================
--- /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/SupplementaryMessageImpl.java Fri Sep 28 07:31:01 2012 +++ /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/SupplementaryMessageImpl.java Sun Nov 25 05:21:36 2012
@@ -105,27 +105,33 @@
                @Override
public void read(javolution.xml.XMLFormat.InputElement xml, SupplementaryMessageImpl ussdMessage) throws XMLStreamException {
                        MAP_MESSAGE_XML.read(xml, ussdMessage);
+                       //TODO: this is wrong, if no CBS, this will set default.
ussdMessage.ussdDataCodingSch = new CBSDataCodingSchemeImpl(xml.getAttribute(DATA_CODING_SCHEME, DEFAULT_DATA_CODING_SCHEME));

                        String encodedString = xml.getAttribute(STRING, 
DEFAULT_USSD_STRING);
-                       try {
- ussdMessage.ussdString = new USSDStringImpl(encodedString, ussdMessage.ussdDataCodingSch, null);
-                       } catch (MAPException e) {
-                               logger.error("Error while trying to read ussd 
string", e);
-                       }
+                       if(encodedString!=null)
+                       try {
+ ussdMessage.ussdString = new USSDStringImpl(encodedString, ussdMessage.ussdDataCodingSch, null);
+                       } catch (MAPException e) {
+                               logger.error("Error while trying to read ussd 
string", e);
+                       }
                }

                @Override
public void write(SupplementaryMessageImpl ussdMessage, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException {
                        MAP_MESSAGE_XML.write(ussdMessage, xml);
- xml.setAttribute(DATA_CODING_SCHEME, ussdMessage.ussdDataCodingSch.getCode());
-                       String ussdStr = "";
-                       try {
-                               ussdStr = 
ussdMessage.ussdString.getString(null);
-                       } catch (MAPException e) {
-                               logger.error("Error while trying to write ussd 
string", e);
-                       }
-                       xml.setAttribute(STRING, ussdStr);
+                       if(ussdMessage.ussdDataCodingSch!=null)
+ xml.setAttribute(DATA_CODING_SCHEME, ussdMessage.ussdDataCodingSch.getCode());
+
+                       if(ussdMessage.ussdString!=null)
+                       try {
+                           String ussdStr = 
ussdMessage.ussdString.getString(null);
+                           if(ussdStr!=null)
+                               xml.setAttribute(STRING, ussdStr);
+                       } catch (MAPException e) {
+                               logger.error("Error while trying to write ussd 
string", e);
+                       }
+
                }
        };
 }
=======================================
--- /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/UnstructuredSSNotifyResponseImpl.java Mon May 28 10:21:49 2012 +++ /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/UnstructuredSSNotifyResponseImpl.java Sun Nov 25 05:21:36 2012
@@ -21,6 +21,9 @@
  */
 package org.mobicents.protocols.ss7.map.service.supplementary;

+import javolution.xml.XMLFormat;
+import javolution.xml.stream.XMLStreamException;
+
 import org.mobicents.protocols.asn.AsnInputStream;
 import org.mobicents.protocols.asn.AsnOutputStream;
 import org.mobicents.protocols.asn.Tag;
@@ -31,6 +34,8 @@
import org.mobicents.protocols.ss7.map.api.MAPParsingComponentExceptionReason; import org.mobicents.protocols.ss7.map.api.service.supplementary.MAPDialogSupplementary; import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponse;
+import org.mobicents.protocols.ss7.map.primitives.AlertingPatternImpl;
+import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl;
 import org.mobicents.protocols.ss7.map.primitives.MAPAsnPrimitive;

 /**
@@ -150,4 +155,20 @@

                return sb.toString();
        }
+
+ protected static final XMLFormat<UnstructuredSSNotifyResponseImpl> UNSTRUCTURED_SS_NOTIFY_RESPONSE_XML = new XMLFormat<UnstructuredSSNotifyResponseImpl>(
+               UnstructuredSSNotifyResponseImpl.class) {
+
+        @Override
+        public void read(javolution.xml.XMLFormat.InputElement xml,
+ UnstructuredSSNotifyResponseImpl ussdMessage) throws XMLStreamException {
+            USSD_MESSAGE_XML.read(xml, ussdMessage);
+        }
+
+        @Override
+        public void write(UnstructuredSSNotifyResponseImpl ussdMessage,
+ javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException {
+            USSD_MESSAGE_XML.write(ussdMessage, xml);
+        }
+    };
 }

Reply via email to