PageRenderTime 119ms CodeModel.GetById 74ms app.highlight 40ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/ss7/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/lsm/SubscriberLocationReportRequestIndicationImpl.java

http://mobicents.googlecode.com/
Java | 975 lines | 613 code | 74 blank | 288 comment | 120 complexity | 0c8b15e199c1546b1ce62b839eefe34b MD5 | raw file
  1/*
  2 * JBoss, Home of Professional Open Source
  3 * Copyright 2011, Red Hat, Inc. and individual contributors
  4 * by the @authors tag. See the copyright.txt in the distribution for a
  5 * full listing of individual contributors.
  6 *
  7 * This is free software; you can redistribute it and/or modify it
  8 * under the terms of the GNU Lesser General Public License as
  9 * published by the Free Software Foundation; either version 2.1 of
 10 * the License, or (at your option) any later version.
 11 *
 12 * This software is distributed in the hope that it will be useful,
 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 15 * Lesser General Public License for more details.
 16 *
 17 * You should have received a copy of the GNU Lesser General Public
 18 * License along with this software; if not, write to the Free
 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 21 */
 22
 23package org.mobicents.protocols.ss7.map.service.lsm;
 24
 25import java.io.IOException;
 26
 27import org.mobicents.protocols.asn.AsnException;
 28import org.mobicents.protocols.asn.AsnInputStream;
 29import org.mobicents.protocols.asn.AsnOutputStream;
 30import org.mobicents.protocols.asn.Tag;
 31import org.mobicents.protocols.ss7.map.api.MAPException;
 32import org.mobicents.protocols.ss7.map.api.MAPMessageType;
 33import org.mobicents.protocols.ss7.map.api.MAPOperationCode;
 34import org.mobicents.protocols.ss7.map.api.MAPParsingComponentException;
 35import org.mobicents.protocols.ss7.map.api.MAPParsingComponentExceptionReason;
 36import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdOrLAI;
 37import org.mobicents.protocols.ss7.map.api.primitives.IMEI;
 38import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
 39import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
 40import org.mobicents.protocols.ss7.map.api.service.lsm.AccuracyFulfilmentIndicator;
 41import org.mobicents.protocols.ss7.map.api.service.lsm.DeferredmtlrData;
 42import org.mobicents.protocols.ss7.map.api.service.lsm.LCSClientID;
 43import org.mobicents.protocols.ss7.map.api.service.lsm.LCSEvent;
 44import org.mobicents.protocols.ss7.map.api.service.lsm.LCSLocationInfo;
 45import org.mobicents.protocols.ss7.map.api.service.lsm.SLRArgExtensionContainer;
 46import org.mobicents.protocols.ss7.map.api.service.lsm.SubscriberLocationReportRequestIndication;
 47import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdOrLAIImpl;
 48import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
 49import org.mobicents.protocols.ss7.map.primitives.IMSIImpl;
 50import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl;
 51
 52/**
 53 * TODO add unit test
 54 * 
 55 * @author amit bhayani
 56 * 
 57 */
 58public class SubscriberLocationReportRequestIndicationImpl extends LsmMessageImpl implements SubscriberLocationReportRequestIndication {
 59
 60	private static final int _TAG_MSISDN = 0;
 61	private static final int _TAG_IMSI = 1;
 62	private static final int _TAG_IMEI = 2;
 63	private static final int _TAG_NA_ESRD = 3;
 64	private static final int _TAG_NA_ESRK = 4;
 65	private static final int _TAG_LOCATION_ESTIMATE = 5;
 66	private static final int _TAG_AGE_OF_LOCATION_ESTIMATE = 6;
 67	private static final int _TAG_SLR_ARG_EXTENSION_CONTAINER = 7;
 68	private static final int _TAG_ADD_LOCATION_ESTIMATE = 8;
 69	private static final int _TAG_DEFERRED_MT_LR_DATA = 9;
 70	private static final int _TAG_LCS_REFERENCE_NUMBER = 10;
 71	private static final int _TAG_GERAN_POSITIONING_DATA = 11;
 72	private static final int _TAG_UTRAN_POSITIONING_DATA = 12;
 73	private static final int _TAG_CELL_ID_OR_SAI = 13;
 74	private static final int _TAG_H_GMLC_ADDRESS = 14;
 75	private static final int _TAG_LCS_SERVICE_TYPE_ID = 15;
 76	private static final int _TAG_SAI_PRESENT = 17;
 77	private static final int _TAG_PSEUDONYM_INDICATOR = 18;
 78	private static final int _TAG_ACCURACY_FULFILMENT_INDICATOR = 19;
 79
 80	private LCSEvent lcsEvent = null;
 81	private LCSClientID lcsClientID = null;
 82	private LCSLocationInfo lcsLocationInfo = null;
 83	private ISDNAddressString msisdn = null;
 84	private IMSI imsi = null;
 85	private IMEI imei = null;
 86	private ISDNAddressString naEsrd = null;
 87	private ISDNAddressString naEsrk = null;
 88	private byte[] locationEstimate = null;
 89	private Integer ageOfLocationEstimate = null;
 90	private SLRArgExtensionContainer slrArgExtensionContainer = null;
 91	private byte[] addLocationEstimate = null;
 92	private DeferredmtlrData deferredmtlrData = null;
 93	private Byte lcsReferenceNumber = null;
 94	private byte[] geranPositioningData = null;
 95	private byte[] utranPositioningData = null;
 96	private CellGlobalIdOrServiceAreaIdOrLAI cellIdOrSai = null;
 97	private byte[] hgmlcAddress = null;
 98	private Integer lcsServiceTypeID = null;
 99	private Boolean saiPresent = null;
100	private Boolean pseudonymIndicator = null;
101	private AccuracyFulfilmentIndicator accuracyFulfilmentIndicator = null;
102
103	/**
104	 * 
105	 */
106	public SubscriberLocationReportRequestIndicationImpl() {
107		super();
108	}
109
110	/**
111	 * @param lcsEvent
112	 * @param lcsClientID
113	 * @param lcsLocationInfo
114	 * @param msisdn
115	 * @param imsi
116	 * @param imei
117	 * @param naEsrd
118	 * @param naEsrk
119	 * @param locationEstimate
120	 * @param ageOfLocationEstimate
121	 * @param slrArgExtensionContainer
122	 * @param addLocationEstimate
123	 * @param deferredmtlrData
124	 * @param lcsReferenceNumber
125	 * @param geranPositioningData
126	 * @param utranPositioningData
127	 * @param cellIdOrSai
128	 * @param hgmlcAddress
129	 * @param lcsServiceTypeID
130	 * @param saiPresent
131	 * @param pseudonymIndicator
132	 * @param accuracyFulfilmentIndicator
133	 */
134	public SubscriberLocationReportRequestIndicationImpl(LCSEvent lcsEvent, LCSClientID lcsClientID, LCSLocationInfo lcsLocationInfo, ISDNAddressString msisdn,
135			IMSI imsi, IMEI imei, ISDNAddressString naEsrd, ISDNAddressString naEsrk, byte[] locationEstimate, Integer ageOfLocationEstimate,
136			SLRArgExtensionContainer slrArgExtensionContainer, byte[] addLocationEstimate, DeferredmtlrData deferredmtlrData, Byte lcsReferenceNumber,
137			byte[] geranPositioningData, byte[] utranPositioningData, CellGlobalIdOrServiceAreaIdOrLAI cellIdOrSai, byte[] hgmlcAddress,
138			Integer lcsServiceTypeID, Boolean saiPresent, Boolean pseudonymIndicator, AccuracyFulfilmentIndicator accuracyFulfilmentIndicator) {
139		super();
140		this.lcsEvent = lcsEvent;
141		this.lcsClientID = lcsClientID;
142		this.lcsLocationInfo = lcsLocationInfo;
143		this.msisdn = msisdn;
144		this.imsi = imsi;
145		this.imei = imei;
146		this.naEsrd = naEsrd;
147		this.naEsrk = naEsrk;
148		this.locationEstimate = locationEstimate;
149		this.ageOfLocationEstimate = ageOfLocationEstimate;
150		this.slrArgExtensionContainer = slrArgExtensionContainer;
151		this.addLocationEstimate = addLocationEstimate;
152		this.deferredmtlrData = deferredmtlrData;
153		this.lcsReferenceNumber = lcsReferenceNumber;
154		this.geranPositioningData = geranPositioningData;
155		this.utranPositioningData = utranPositioningData;
156		this.cellIdOrSai = cellIdOrSai;
157		this.hgmlcAddress = hgmlcAddress;
158		this.lcsServiceTypeID = lcsServiceTypeID;
159		this.saiPresent = saiPresent;
160		this.pseudonymIndicator = pseudonymIndicator;
161		this.accuracyFulfilmentIndicator = accuracyFulfilmentIndicator;
162	}
163
164	@Override
165	public MAPMessageType getMessageType() {
166		return MAPMessageType.subscriberLocationReport_Request;
167	}
168
169	@Override
170	public int getOperationCode() {
171		return MAPOperationCode.subscriberLocationReport;
172	}
173
174	/*
175	 * (non-Javadoc)
176	 * 
177	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
178	 * SubscriberLocationReportRequestIndication#getLCSEvent()
179	 */
180	@Override
181	public LCSEvent getLCSEvent() {
182		return this.lcsEvent;
183	}
184
185	/*
186	 * (non-Javadoc)
187	 * 
188	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
189	 * SubscriberLocationReportRequestIndication#getLCSClientID()
190	 */
191	@Override
192	public LCSClientID getLCSClientID() {
193		return this.lcsClientID;
194	}
195
196	/*
197	 * (non-Javadoc)
198	 * 
199	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
200	 * SubscriberLocationReportRequestIndication#getLCSLocationInfo()
201	 */
202	@Override
203	public LCSLocationInfo getLCSLocationInfo() {
204		return this.lcsLocationInfo;
205	}
206
207	/*
208	 * (non-Javadoc)
209	 * 
210	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
211	 * SubscriberLocationReportRequestIndication#getMSISDN()
212	 */
213	@Override
214	public ISDNAddressString getMSISDN() {
215		return this.msisdn;
216	}
217
218	/*
219	 * (non-Javadoc)
220	 * 
221	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
222	 * SubscriberLocationReportRequestIndication#getIMSI()
223	 */
224	@Override
225	public IMSI getIMSI() {
226		return this.imsi;
227	}
228
229	/*
230	 * (non-Javadoc)
231	 * 
232	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
233	 * SubscriberLocationReportRequestIndication#getIMEI()
234	 */
235	@Override
236	public IMEI getIMEI() {
237		return this.imei;
238	}
239
240	/*
241	 * (non-Javadoc)
242	 * 
243	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
244	 * SubscriberLocationReportRequestIndication#getNaESRD()
245	 */
246	@Override
247	public ISDNAddressString getNaESRD() {
248		return this.naEsrd;
249	}
250
251	/*
252	 * (non-Javadoc)
253	 * 
254	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
255	 * SubscriberLocationReportRequestIndication#getNaESRK()
256	 */
257	@Override
258	public ISDNAddressString getNaESRK() {
259		return this.naEsrk;
260	}
261
262	/*
263	 * (non-Javadoc)
264	 * 
265	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
266	 * SubscriberLocationReportRequestIndication#getLocationEstimate()
267	 */
268	@Override
269	public byte[] getLocationEstimate() {
270		return this.locationEstimate;
271	}
272
273	/*
274	 * (non-Javadoc)
275	 * 
276	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
277	 * SubscriberLocationReportRequestIndication#getAgeOfLocationEstimate()
278	 */
279	@Override
280	public Integer getAgeOfLocationEstimate() {
281		return this.ageOfLocationEstimate;
282	}
283
284	/*
285	 * (non-Javadoc)
286	 * 
287	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
288	 * SubscriberLocationReportRequestIndication#getSLRArgExtensionContainer()
289	 */
290	@Override
291	public SLRArgExtensionContainer getSLRArgExtensionContainer() {
292		return this.slrArgExtensionContainer;
293	}
294
295	/*
296	 * (non-Javadoc)
297	 * 
298	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
299	 * SubscriberLocationReportRequestIndication#getAdditionalLocationEstimate()
300	 */
301	@Override
302	public byte[] getAdditionalLocationEstimate() {
303		return this.addLocationEstimate;
304	}
305
306	/*
307	 * (non-Javadoc)
308	 * 
309	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
310	 * SubscriberLocationReportRequestIndication#getDeferredmtlrData()
311	 */
312	@Override
313	public DeferredmtlrData getDeferredmtlrData() {
314		return this.deferredmtlrData;
315	}
316
317	/*
318	 * (non-Javadoc)
319	 * 
320	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
321	 * SubscriberLocationReportRequestIndication#getLCSReferenceNumber()
322	 */
323	@Override
324	public Byte getLCSReferenceNumber() {
325		return this.lcsReferenceNumber;
326	}
327
328	/*
329	 * (non-Javadoc)
330	 * 
331	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
332	 * SubscriberLocationReportRequestIndication#getGeranPositioningData()
333	 */
334	@Override
335	public byte[] getGeranPositioningData() {
336		return this.geranPositioningData;
337	}
338
339	/*
340	 * (non-Javadoc)
341	 * 
342	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
343	 * SubscriberLocationReportRequestIndication#getUtranPositioningData()
344	 */
345	@Override
346	public byte[] getUtranPositioningData() {
347		return this.utranPositioningData;
348	}
349
350	/*
351	 * (non-Javadoc)
352	 * 
353	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
354	 * SubscriberLocationReportRequestIndication
355	 * #getCellGlobalIdOrServiceAreaIdOrLAI()
356	 */
357	@Override
358	public CellGlobalIdOrServiceAreaIdOrLAI getCellGlobalIdOrServiceAreaIdOrLAI() {
359		return this.cellIdOrSai;
360	}
361
362	/*
363	 * (non-Javadoc)
364	 * 
365	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
366	 * SubscriberLocationReportRequestIndication#getSaiPresent()
367	 */
368	@Override
369	public Boolean getSaiPresent() {
370		return this.saiPresent;
371	}
372
373	/*
374	 * (non-Javadoc)
375	 * 
376	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
377	 * SubscriberLocationReportRequestIndication#getHGMLCAddress()
378	 */
379	@Override
380	public byte[] getHGMLCAddress() {
381		return this.hgmlcAddress;
382	}
383
384	/*
385	 * (non-Javadoc)
386	 * 
387	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
388	 * SubscriberLocationReportRequestIndication#getLCSServiceTypeID()
389	 */
390	@Override
391	public Integer getLCSServiceTypeID() {
392		return this.lcsServiceTypeID;
393	}
394
395	/*
396	 * (non-Javadoc)
397	 * 
398	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
399	 * SubscriberLocationReportRequestIndication#getPseudonymIndicator()
400	 */
401	@Override
402	public Boolean getPseudonymIndicator() {
403		return this.pseudonymIndicator;
404	}
405
406	/*
407	 * (non-Javadoc)
408	 * 
409	 * @see org.mobicents.protocols.ss7.map.api.service.lsm.
410	 * SubscriberLocationReportRequestIndication
411	 * #getAccuracyFulfilmentIndicator()
412	 */
413	@Override
414	public AccuracyFulfilmentIndicator getAccuracyFulfilmentIndicator() {
415		return this.accuracyFulfilmentIndicator;
416	}
417
418	/*
419	 * (non-Javadoc)
420	 * 
421	 * @see
422	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getTag()
423	 */
424	@Override
425	public int getTag() throws MAPException {
426		return Tag.SEQUENCE;
427	}
428
429	/*
430	 * (non-Javadoc)
431	 * 
432	 * @see
433	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getTagClass
434	 * ()
435	 */
436	@Override
437	public int getTagClass() {
438		return Tag.CLASS_UNIVERSAL;
439	}
440
441	/*
442	 * (non-Javadoc)
443	 * 
444	 * @see
445	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getIsPrimitive
446	 * ()
447	 */
448	@Override
449	public boolean getIsPrimitive() {
450		return false;
451	}
452
453	/*
454	 * (non-Javadoc)
455	 * 
456	 * @see
457	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#decodeAll
458	 * (org.mobicents.protocols.asn.AsnInputStream)
459	 */
460	@Override
461	public void decodeAll(AsnInputStream ansIS) throws MAPParsingComponentException {
462		try {
463			int length = ansIS.readLength();
464			this._decode(ansIS, length);
465		} catch (IOException e) {
466			throw new MAPParsingComponentException("IOException when decoding ProvideSubscriberLocationRequestIndication: ", e,
467					MAPParsingComponentExceptionReason.MistypedParameter);
468		} catch (AsnException e) {
469			throw new MAPParsingComponentException("AsnException when decoding ProvideSubscriberLocationRequestIndication: ", e,
470					MAPParsingComponentExceptionReason.MistypedParameter);
471		}
472	}
473
474	/*
475	 * (non-Javadoc)
476	 * 
477	 * @see
478	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#decodeData
479	 * (org.mobicents.protocols.asn.AsnInputStream, int)
480	 */
481	@Override
482	public void decodeData(AsnInputStream ansIS, int length) throws MAPParsingComponentException {
483		try {
484			this._decode(ansIS, length);
485		} catch (IOException e) {
486			throw new MAPParsingComponentException("IOException when decoding ProvideSubscriberLocationRequestIndication: ", e,
487					MAPParsingComponentExceptionReason.MistypedParameter);
488		} catch (AsnException e) {
489			throw new MAPParsingComponentException("AsnException when decoding ProvideSubscriberLocationRequestIndication: ", e,
490					MAPParsingComponentExceptionReason.MistypedParameter);
491		}
492	}
493
494	private void _decode(AsnInputStream ansIS, int length) throws MAPParsingComponentException, IOException, AsnException {
495
496		AsnInputStream ais = ansIS.readSequenceStreamData(length);
497		int tag = ais.readTag();
498		// Decode mandatory lcs-Event LCS-Event,
499		if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || !ais.isTagPrimitive() || tag != Tag.ENUMERATED) {
500			throw new MAPParsingComponentException(
501					"Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-Event LCS-Event] bad tag class or not primitive",
502					MAPParsingComponentExceptionReason.MistypedParameter);
503		}
504		int length1 = ais.readLength();
505		int event = (int) ais.readIntegerData(length1);
506		this.lcsEvent = LCSEvent.getLCSEvent(event);
507
508		tag = ais.readTag();
509		// Decode mandatory lcs-ClientID LCS-ClientID
510		if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || ais.isTagPrimitive() || ais.getTag() != Tag.SEQUENCE) {
511			throw new MAPParsingComponentException(
512					"Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-ClientID LCS-ClientID] bad tag class or not primitive or not Sequence",
513					MAPParsingComponentExceptionReason.MistypedParameter);
514		}
515		this.lcsClientID = new LCSClientIDImpl();
516		((LCSClientIDImpl)this.lcsClientID).decodeAll(ais);
517
518		tag = ais.readTag();
519		// Decode mandatory lcsLocationInfo LCSLocationInfo
520		if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || ais.isTagPrimitive() || ais.getTag() != Tag.SEQUENCE) {
521			throw new MAPParsingComponentException(
522					"Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcsLocationInfo LCSLocationInfo] bad tag class or not primitive or not Sequence",
523					MAPParsingComponentExceptionReason.MistypedParameter);
524		}
525		this.lcsLocationInfo = new LCSLocationInfoImpl();
526		((LCSLocationInfoImpl)this.lcsLocationInfo).decodeAll(ais);
527
528		while (true) {
529			if (ais.available() == 0)
530				break;
531
532			tag = ais.readTag();
533			switch (tag) {
534			case _TAG_MSISDN:
535				// msisdn [0] ISDN-AddressString OPTIONAL,
536				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
537					throw new MAPParsingComponentException(
538							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [msisdn [0] ISDN-AddressString] bad tag class or not primitive or not Sequence",
539							MAPParsingComponentExceptionReason.MistypedParameter);
540				}
541				this.msisdn = new ISDNAddressStringImpl();
542				((ISDNAddressStringImpl)this.msisdn).decodeAll(ais);
543				break;
544			case _TAG_IMSI:
545				// imsi [1] IMSI OPTIONAL,
546				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
547					throw new MAPParsingComponentException(
548							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [imsi [2] IMSI ] bad tag class or not primitive or not Sequence",
549							MAPParsingComponentExceptionReason.MistypedParameter);
550				}
551				this.imsi = new IMSIImpl();
552				((IMSIImpl)this.imsi).decodeAll(ais);
553				break;
554			case _TAG_IMEI:
555				// imei [2] IMEI OPTIONAL,
556				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
557					throw new MAPParsingComponentException(
558							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [imei [2] IMEI OPTIONAL, ] bad tag class or not primitive or not Sequence",
559							MAPParsingComponentExceptionReason.MistypedParameter);
560				}
561				this.imei = new IMEIImpl();
562				((IMEIImpl)this.imei).decodeAll(ais);
563				break;
564			case _TAG_NA_ESRD:
565				// na-ESRD [3] ISDN-AddressString OPTIONAL,
566				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
567					throw new MAPParsingComponentException(
568							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [na-ESRD [3] ISDN-AddressString] bad tag class or not primitive or not Sequence",
569							MAPParsingComponentExceptionReason.MistypedParameter);
570				}
571				this.naEsrd = new ISDNAddressStringImpl();
572				((ISDNAddressStringImpl)this.naEsrd).decodeAll(ais);
573				break;
574			case _TAG_NA_ESRK:
575				// na-ESRK [4] ISDN-AddressString OPTIONAL,
576				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
577					throw new MAPParsingComponentException(
578							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [na-ESRK [4] ISDN-AddressString] bad tag class or not primitive or not Sequence",
579							MAPParsingComponentExceptionReason.MistypedParameter);
580				}
581				this.naEsrk = new ISDNAddressStringImpl();
582				((ISDNAddressStringImpl)this.naEsrk).decodeAll(ais);
583				break;
584			case _TAG_LOCATION_ESTIMATE:
585				// locationEstimate [5] Ext-GeographicalInformation OPTIONAL
586				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
587					throw new MAPParsingComponentException(
588							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [locationEstimate [5] Ext-GeographicalInformation OPTIONAL] bad tag class or not primitive or not Sequence",
589							MAPParsingComponentExceptionReason.MistypedParameter);
590				}
591				length1 = ais.readLength();
592				this.locationEstimate = ais.readOctetStringData(length1);
593				break;
594			case _TAG_AGE_OF_LOCATION_ESTIMATE:
595				// ageOfLocationEstimate [6] AgeOfLocationInformation OPTIONAL,
596				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
597					throw new MAPParsingComponentException(
598							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [ageOfLocationEstimate [6] AgeOfLocationInformation] bad tag class or not primitive or not Sequence",
599							MAPParsingComponentExceptionReason.MistypedParameter);
600				}
601				length1 = ais.readLength();
602				this.ageOfLocationEstimate = (int) ais.readIntegerData(length1);
603				break;
604			case _TAG_SLR_ARG_EXTENSION_CONTAINER:
605				// slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer
606				// OPTIONAL,
607				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
608					throw new MAPParsingComponentException(
609							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer] bad tag class or not primitive or not Sequence",
610							MAPParsingComponentExceptionReason.MistypedParameter);
611				}
612				this.slrArgExtensionContainer = new SLRArgExtensionContainerImpl();
613				((SLRArgExtensionContainerImpl)this.slrArgExtensionContainer).decodeAll(ais);
614				break;
615			case _TAG_ADD_LOCATION_ESTIMATE:
616				// add-LocationEstimate [8] Add-GeographicalInformation
617				// OPTIONAL,
618				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
619					throw new MAPParsingComponentException(
620							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [add-LocationEstimate [8] Add-GeographicalInformation] bad tag class or not primitive or not Sequence",
621							MAPParsingComponentExceptionReason.MistypedParameter);
622				}
623				length1 = ais.readLength();
624				this.addLocationEstimate = ais.readOctetStringData(length1);
625				break;
626			case _TAG_DEFERRED_MT_LR_DATA:
627				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
628					throw new MAPParsingComponentException(
629							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [deferredmt-lrData [9] Deferredmt-lrData ] bad tag class or not primitive or not Sequence",
630							MAPParsingComponentExceptionReason.MistypedParameter);
631				}
632				this.deferredmtlrData = new DeferredmtlrDataImpl();
633				((DeferredmtlrDataImpl)this.deferredmtlrData).decodeAll(ais);
634				break;
635			case _TAG_LCS_REFERENCE_NUMBER:
636				// lcs-ReferenceNumber [10] LCS-ReferenceNumber OPTIONAL,
637				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
638					throw new MAPParsingComponentException(
639							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-ReferenceNumber [10] LCS-ReferenceNumber] bad tag class or not primitive or not Sequence",
640							MAPParsingComponentExceptionReason.MistypedParameter);
641				}
642				length1 = ais.readLength();
643				this.lcsReferenceNumber = ais.readOctetStringData(length1)[0];
644				break;
645			case _TAG_GERAN_POSITIONING_DATA:
646				// geranPositioningData [11] PositioningDataInformation
647				// OPTIONAL,
648				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
649					throw new MAPParsingComponentException(
650							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [geranPositioningData [11] PositioningDataInformation OPTIONAL,] bad tag class or not primitive or not Sequence",
651							MAPParsingComponentExceptionReason.MistypedParameter);
652				}
653				length1 = ais.readLength();
654				this.geranPositioningData = ais.readOctetStringData(length1);
655				break;
656			case _TAG_UTRAN_POSITIONING_DATA:
657				// utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,
658				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
659					throw new MAPParsingComponentException(
660							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,] bad tag class or not primitive or not Sequence",
661							MAPParsingComponentExceptionReason.MistypedParameter);
662				}
663				length1 = ais.readLength();
664				this.utranPositioningData = ais.readOctetStringData(length1);
665				break;
666			case _TAG_CELL_ID_OR_SAI:
667				// cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI OPTIONAL,
668				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
669					throw new MAPParsingComponentException(
670							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI] bad tag class or not primitive or not Sequence",
671							MAPParsingComponentExceptionReason.MistypedParameter);
672				}
673				this.cellIdOrSai = new CellGlobalIdOrServiceAreaIdOrLAIImpl();
674				AsnInputStream ais2 = ais.readSequenceStream();
675				ais2.readTag();
676				((CellGlobalIdOrServiceAreaIdOrLAIImpl)this.cellIdOrSai).decodeAll(ais2);
677				break;
678			case _TAG_H_GMLC_ADDRESS:
679				// h-gmlc-Address [14] GSN-Address
680				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
681					throw new MAPParsingComponentException(
682							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [h-gmlc-Address [14] GSN-Address] bad tag class or not primitive or not Sequence",
683							MAPParsingComponentExceptionReason.MistypedParameter);
684				}
685				length1 = ais.readLength();
686				this.hgmlcAddress = ais.readOctetStringData(length1);
687				break;
688			case _TAG_LCS_SERVICE_TYPE_ID:
689				// lcsServiceTypeID [15] LCSServiceTypeID OPTIONAL,
690				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
691					throw new MAPParsingComponentException(
692							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcsServiceTypeID [15] LCSServiceTypeID] bad tag class or not primitive or not Sequence",
693							MAPParsingComponentExceptionReason.MistypedParameter);
694				}
695				length1 = ais.readLength();
696				this.lcsServiceTypeID = (int) ais.readIntegerData(length1);
697				break;
698			case _TAG_SAI_PRESENT:
699				// sai-Present [17] NULL OPTIONAL,
700				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
701					throw new MAPParsingComponentException(
702							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [sai-Present [17]] bad tag class or not primitive or not Sequence",
703							MAPParsingComponentExceptionReason.MistypedParameter);
704				}
705				length1 = ais.readLength();
706				this.saiPresent = true;
707				break;
708			case _TAG_PSEUDONYM_INDICATOR:
709				// pseudonymIndicator [18] NULL OPTIONAL,
710				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
711					throw new MAPParsingComponentException(
712							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [pseudonymIndicator [18] NULL] bad tag class or not primitive or not Sequence",
713							MAPParsingComponentExceptionReason.MistypedParameter);
714				}
715				length1 = ais.readLength();
716				this.pseudonymIndicator = true;
717				break;
718			case _TAG_ACCURACY_FULFILMENT_INDICATOR:
719				// accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator
720				// OPTIONAL,
721				if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
722					throw new MAPParsingComponentException(
723							"Error while decoding SubscriberLocationReportRequestIndication: Parameter [accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator] bad tag class or not primitive or not Sequence",
724							MAPParsingComponentExceptionReason.MistypedParameter);
725				}
726				length1 = ais.readLength();
727				int indicator = (int) ais.readIntegerData(length1);
728				this.accuracyFulfilmentIndicator = AccuracyFulfilmentIndicator.getAccuracyFulfilmentIndicator(indicator);
729				break;
730			default:
731				ais.advanceElement();
732				break;
733			}
734		}
735
736	}
737
738	/*
739	 * (non-Javadoc)
740	 * 
741	 * @see
742	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll
743	 * (org.mobicents.protocols.asn.AsnOutputStream)
744	 */
745	@Override
746	public void encodeAll(AsnOutputStream asnOs) throws MAPException {
747		this.encodeAll(asnOs, Tag.CLASS_UNIVERSAL, Tag.SEQUENCE);
748	}
749
750	/*
751	 * (non-Javadoc)
752	 * 
753	 * @see
754	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll
755	 * (org.mobicents.protocols.asn.AsnOutputStream, int, int)
756	 */
757	@Override
758	public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {
759		try {
760			asnOs.writeTag(tagClass, false, tag);
761			int pos = asnOs.StartContentDefiniteLength();
762			this.encodeData(asnOs);
763			asnOs.FinalizeContent(pos);
764		} catch (AsnException e) {
765			throw new MAPException("AsnException when encoding MWStatus: " + e.getMessage(), e);
766		}
767	}
768
769	/*
770	 * (non-Javadoc)
771	 * 
772	 * @see
773	 * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeData
774	 * (org.mobicents.protocols.asn.AsnOutputStream)
775	 */
776	@Override
777	public void encodeData(AsnOutputStream asnOs) throws MAPException {
778		if (this.lcsEvent == null) {
779			throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsEvent is not defined");
780		}
781
782		if (this.lcsClientID == null) {
783			throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsClientID is not defined");
784		}
785
786		if (this.lcsLocationInfo == null) {
787			throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsLocationInfo is not defined");
788		}
789
790		try {
791			asnOs.writeInteger(Tag.CLASS_UNIVERSAL, Tag.ENUMERATED, this.lcsEvent.getEvent());
792		} catch (IOException e) {
793			throw new MAPException("IOException while encoding parameter lcsEvent", e);
794		} catch (AsnException e) {
795			throw new MAPException("AsnException while encoding parameter lcsEvent", e);
796		}
797
798		((LCSClientIDImpl)this.lcsClientID).encodeAll(asnOs);
799
800		((LCSLocationInfoImpl)this.lcsLocationInfo).encodeAll(asnOs);
801
802		if (this.msisdn != null) {
803			// msisdn [0] ISDN-AddressString OPTIONAL,
804			((ISDNAddressStringImpl)this.msisdn).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_MSISDN);
805		}
806
807		if (this.imsi != null) {
808			// imsi [1] IMSI OPTIONAL,
809			((IMSIImpl)this.imsi).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMSI);
810		}
811
812		if (this.imei != null) {
813			// imei [2] IMEI OPTIONAL,
814			((IMEIImpl)this.imei).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMEI);
815		}
816
817		if (this.naEsrd != null) {
818			// na-ESRD [3] ISDN-AddressString OPTIONAL,
819			((ISDNAddressStringImpl)this.naEsrd).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_NA_ESRD);
820		}
821
822		if (this.naEsrk != null) {
823			// na-ESRK [4] ISDN-AddressString OPTIONAL
824			((ISDNAddressStringImpl)this.naEsrk).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_NA_ESRK);
825		}
826
827		if (this.locationEstimate != null) {
828			// locationEstimate [5] Ext-GeographicalInformation OPTIONAL,
829			try {
830				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LOCATION_ESTIMATE, this.locationEstimate);
831			} catch (IOException e) {
832				throw new MAPException("IOException while encoding parameter locationEstimate", e);
833			} catch (AsnException e) {
834				throw new MAPException("AsnException while encoding parameter locationEstimate", e);
835			}
836		}
837
838		// ageOfLocationEstimate [6] AgeOfLocationInformation OPTIONAL,
839		if (this.ageOfLocationEstimate != null) {
840			try {
841				asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_AGE_OF_LOCATION_ESTIMATE, this.ageOfLocationEstimate);
842			} catch (IOException e) {
843				throw new MAPException("IOException while encoding parameter ageOfLocationEstimate", e);
844			} catch (AsnException e) {
845				throw new MAPException("AsnException while encoding parameter ageOfLocationEstimate", e);
846			}
847		}
848
849		if (this.slrArgExtensionContainer != null) {
850			// slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer
851			((SLRArgExtensionContainerImpl)this.slrArgExtensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SLR_ARG_EXTENSION_CONTAINER);
852		}
853
854		if (this.addLocationEstimate != null) {
855			// add-LocationEstimate [8] Add-GeographicalInformation OPTIONAL,
856			try {
857				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ADD_LOCATION_ESTIMATE, this.addLocationEstimate);
858			} catch (IOException e) {
859				throw new MAPException("IOException while encoding parameter addLocationEstimate", e);
860			} catch (AsnException e) {
861				throw new MAPException("AsnException while encoding parameter addLocationEstimate", e);
862			}
863		}
864
865		if (this.deferredmtlrData != null) {
866			// deferredmt-lrData [9] Deferredmt-lrData
867			((DeferredmtlrDataImpl)this.deferredmtlrData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_DEFERRED_MT_LR_DATA);
868		}
869
870		if (this.lcsReferenceNumber != null) {
871			// lcs-ReferenceNumber [10] LCS-ReferenceNumber
872			try {
873				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_REFERENCE_NUMBER, new byte[] { this.lcsReferenceNumber });
874			} catch (IOException e) {
875				throw new MAPException("IOException while encoding parameter lcs-ReferenceNumber", e);
876			} catch (AsnException e) {
877				throw new MAPException("AsnException while encoding parameter lcs-ReferenceNumber", e);
878			}
879		}
880
881		if (this.geranPositioningData != null) {
882			// geranPositioningData [11] PositioningDataInformation OPTIONAL,
883			try {
884				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_GERAN_POSITIONING_DATA, this.geranPositioningData);
885			} catch (IOException e) {
886				throw new MAPException("IOException while encoding parameter geranPositioningData", e);
887			} catch (AsnException e) {
888				throw new MAPException("AsnException while encoding parameter geranPositioningData", e);
889			}
890		}
891
892		if (this.utranPositioningData != null) {
893			// utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,
894			try {
895				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_UTRAN_POSITIONING_DATA, this.utranPositioningData);
896			} catch (IOException e) {
897				throw new MAPException("IOException while encoding parameter utranPositioningData", e);
898			} catch (AsnException e) {
899				throw new MAPException("AsnException while encoding parameter utranPositioningData", e);
900			}
901		}
902
903		if (this.cellIdOrSai != null) {
904			// cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI OPTIONAL,
905			try {
906				asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_CELL_ID_OR_SAI);
907				int pos = asnOs.StartContentDefiniteLength();
908				((CellGlobalIdOrServiceAreaIdOrLAIImpl) this.cellIdOrSai).encodeAll(asnOs);
909				asnOs.FinalizeContent(pos);
910			} catch (AsnException e) {
911				throw new MAPException("AsnException while encoding parameter cellIdOrSai", e);
912			}
913
914			((CellGlobalIdOrServiceAreaIdOrLAIImpl)this.cellIdOrSai).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_CELL_ID_OR_SAI);
915		}
916
917		if (this.hgmlcAddress != null) {
918			// h-gmlc-Address [14] GSN-Address OPTIONAL,
919			try {
920				asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_H_GMLC_ADDRESS, this.hgmlcAddress);
921			} catch (IOException e) {
922				throw new MAPException("IOException while encoding parameter h-gmlc-Address", e);
923			} catch (AsnException e) {
924				throw new MAPException("AsnException while encoding parameter h-gmlc-Address", e);
925			}
926		}
927
928		if (this.lcsServiceTypeID != null) {
929			// lcsServiceTypeID [15] LCSServiceTypeID OPTIONAL,
930			try {
931				asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_SERVICE_TYPE_ID, this.lcsServiceTypeID);
932			} catch (IOException e) {
933				throw new MAPException("IOException while encoding parameter lcsServiceTypeID", e);
934			} catch (AsnException e) {
935				throw new MAPException("AsnException while encoding parameter lcsServiceTypeID", e);
936			}
937		}
938
939		if (this.saiPresent != null) {
940			// sai-Present [17] NULL OPTIONAL,
941			try {
942				asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SAI_PRESENT);
943			} catch (IOException e) {
944				throw new MAPException("IOException while encoding parameter sai-Present", e);
945			} catch (AsnException e) {
946				throw new MAPException("AsnException while encoding parameter sai-Present", e);
947			}
948		}
949
950		if (this.pseudonymIndicator != null) {
951			// pseudonymIndicator [18] NULL OPTIONAL,
952			try {
953				asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_PSEUDONYM_INDICATOR);
954			} catch (IOException e) {
955				throw new MAPException("IOException while encoding parameter sai-Present", e);
956			} catch (AsnException e) {
957				throw new MAPException("AsnException while encoding parameter sai-Present", e);
958			}
959		}
960
961		if (this.accuracyFulfilmentIndicator != null) {
962			// accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator
963			// OPTIONAL
964			try {
965				asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ACCURACY_FULFILMENT_INDICATOR, this.accuracyFulfilmentIndicator.getIndicator());
966			} catch (IOException e) {
967				throw new MAPException("IOException while encoding parameter accuracyFulfilmentIndicator", e);
968			} catch (AsnException e) {
969				throw new MAPException("AsnException while encoding parameter accuracyFulfilmentIndicator", e);
970			}
971		}
972
973	}
974
975}