Example #1
0
  @Override
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    try {
      if (this.cgiList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_cgiList);
        int pos = asnOs.StartContentDefiniteLength();
        for (GlobalCellId globalCellId : this.cgiList) {
          ((GlobalCellIdImpl) globalCellId).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.eUtranCgiList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_eUtranCgiList);
        int pos = asnOs.StartContentDefiniteLength();
        for (EUtranCgi eUtranCgi : this.eUtranCgiList) {
          ((EUtranCgiImpl) eUtranCgi).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.routingAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_routingAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (RAIdentity raIdentity : this.routingAreaIdList) {
          ((RAIdentityImpl) raIdentity).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.locationAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_locationAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (LAIFixedLength laiFixedLength : this.locationAreaIdList) {
          ((LAIFixedLengthImpl) laiFixedLength).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.trackingAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_trackingAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (TAId taId : this.trackingAreaIdList) {
          ((TAIdImpl) taId).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }

      if (this.extensionContainer != null)
        ((MAPExtensionContainerImpl) this.extensionContainer)
            .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_extensionContainer);

    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }
Example #2
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.cgiList = null;
    this.eUtranCgiList = null;
    this.routingAreaIdList = null;
    this.locationAreaIdList = null;
    this.trackingAreaIdList = null;
    this.extensionContainer = null;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);

    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      switch (ais.getTagClass()) {
        case Tag.CLASS_CONTEXT_SPECIFIC:
          {
            switch (tag) {
              case _ID_cgiList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".cgiList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                AsnInputStream ais2 = ais.readSequenceStream();
                GlobalCellId globalCellId = null;
                this.cgiList = new ArrayList<GlobalCellId>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding cgiList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  globalCellId = new GlobalCellIdImpl();
                  ((GlobalCellIdImpl) globalCellId).decodeAll(ais2);
                  this.cgiList.add(globalCellId);
                }
                if (this.cgiList.size() < 1 && this.cgiList.size() > 32) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter cgiList size must be from 1 to 32, found: "
                          + this.cgiList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_eUtranCgiList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".eUtranCgiList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                EUtranCgi eUtranCgi = null;
                this.eUtranCgiList = new ArrayList<EUtranCgi>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding eUtranCgiList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  eUtranCgi = new EUtranCgiImpl();
                  ((EUtranCgiImpl) eUtranCgi).decodeAll(ais2);
                  this.eUtranCgiList.add(eUtranCgi);
                }
                if (this.eUtranCgiList.size() < 1 && this.eUtranCgiList.size() > 32) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter eUtranCgiList size must be from 1 to 32, found: "
                          + this.eUtranCgiList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_routingAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".routingAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                RAIdentity raIdentity = null;
                this.routingAreaIdList = new ArrayList<RAIdentity>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding routingAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  raIdentity = new RAIdentityImpl();
                  ((RAIdentityImpl) raIdentity).decodeAll(ais2);
                  this.routingAreaIdList.add(raIdentity);
                }
                if (this.routingAreaIdList.size() < 1 && this.routingAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter routingAreaIdList size must be from 1 to 8, found: "
                          + this.routingAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_locationAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".locationAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                LAIFixedLength laiFixedLength = null;
                this.locationAreaIdList = new ArrayList<LAIFixedLength>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding locationAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  laiFixedLength = new LAIFixedLengthImpl();
                  ((LAIFixedLengthImpl) laiFixedLength).decodeAll(ais2);
                  this.locationAreaIdList.add(laiFixedLength);
                }
                if (this.locationAreaIdList.size() < 1 && this.locationAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter locationAreaIdList size must be from 1 to 8, found: "
                          + this.locationAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_trackingAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".trackingAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                TAId taId = null;
                this.trackingAreaIdList = new ArrayList<TAId>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding trackingAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  taId = new TAIdImpl();
                  ((TAIdImpl) taId).decodeAll(ais2);
                  this.trackingAreaIdList.add(taId);
                }
                if (this.trackingAreaIdList.size() < 1 && this.trackingAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter trackingAreaIdList size must be from 1 to 8, found: "
                          + this.trackingAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_extensionContainer:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".extensionContainer: Parameter extensionContainer is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                this.extensionContainer = new MAPExtensionContainerImpl();
                ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
                break;
              default:
                ais.advanceElement();
                break;
            }
          }
          break;
        default:
          ais.advanceElement();
          break;
      }
    }
  }