public void write(GlobalTitle0001Impl ai, OutputElement xml) throws XMLStreamException { // xml.setAttribute(GLOBALTITLE_INDICATOR, ai.gti.getValue()); xml.setAttribute(NATURE_OF_ADDRESS_INDICATOR, ai.natureOfAddress.getValue()); xml.setAttribute(DIGITS, ai.digits); }
@Override public void decode(final InputStream in, final ParameterFactory factory, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try { int b = in.read() & 0xff; this.natureOfAddress = NatureOfAddress.valueOf(b & 0x7f); if((b & 0x80) >0){ super.encodingScheme = BCDOddEncodingScheme.INSTANCE; } else { super.encodingScheme = BCDEvenEncodingScheme.INSTANCE; } super.digits = this.encodingScheme.decode(in); } catch (IOException e) { throw new ParseException(e); } }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((natureOfAddress == null) ? 0 : natureOfAddress.hashCode()); return result; }
@Override public String getNatureOfAddress_Value() { return this.testerHost.getConfigurationData().getSccpConfigurationData().getNatureOfAddress().toString(); }
public void write(SccpConfigurationData sccp, OutputElement xml) throws XMLStreamException { xml.setAttribute(REMOTE_ON_GT_MODE, sccp.isRouteOnGtMode()); xml.setAttribute(REMOTE_SPC, sccp.getRemoteSpc()); xml.setAttribute(LOCAL_SPC, sccp.getLocalSpc()); xml.setAttribute(NI, sccp.getNi()); xml.setAttribute(REMOTE_SSN, sccp.getRemoteSsn()); xml.setAttribute(LOCAL_SSN, sccp.getLocalSsn()); xml.setAttribute(LOCAL_SSN2, sccp.getLocalSsn2()); xml.setAttribute(TRANSLATION_TYTE, sccp.getTranslationType()); xml.add(sccp.getGlobalTitleType().toString(), GLOBAL_TITLE_TYPE, String.class); xml.add(sccp.getNatureOfAddress().toString(), ADDRESS_NATURE, String.class); xml.add(sccp.getNumberingPlan().toString(), NUMBERING_PLAN, String.class); xml.add(sccp.getSccpProtocolVersion().toString(), SCCP_PROTOCOL_VERSION, String.class); xml.add(sccp.getCallingPartyAddressDigits(), CALLING_PARTY_ADDRESS_DIGITS, String.class); }
@Override public void encode(final OutputStream out, final boolean removeSpc, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try { if (this.natureOfAddress == null) { throw new IllegalStateException(); } boolean odd = (super.digits.length() % 2) != 0; // encoding first byte int b = 0x00; if (odd) { b = b | (byte) 0x80; } // adding nature of address indicator b = b | (byte) this.natureOfAddress.getValue(); // write first byte out.write((byte) b); // encode digits if(super.digits == null){ throw new IllegalStateException(); } this.encodingScheme.encode(digits, out); } catch (IOException e) { throw new ParseException(e); } }
@Override public void decode(final InputStream in,final ParameterFactory factory, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try{ this.translationType = in.read() & 0xff; int b = in.read() & 0xff; this.encodingScheme = factory.createEncodingScheme((byte) (b & 0x0f)); this.numberingPlan = NumberingPlan.valueOf((b & 0xf0) >> 4); b = in.read() & 0xff; this.natureOfAddress = NatureOfAddress.valueOf(b); super.digits = this.encodingScheme.decode(in); } catch (IOException e) { throw new ParseException(e); } }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((natureOfAddress == null) ? 0 : natureOfAddress.hashCode()); result = prime * result + ((numberingPlan == null) ? 0 : numberingPlan.hashCode()); result = prime * result + translationType; return result; }
@Override public void encode(OutputStream out, final boolean removeSpc, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try{ if(super.digits == null){ throw new IllegalStateException(); } out.write(this.translationType); out.write((this.numberingPlan.getValue() << 4) | this.encodingScheme.getSchemeCode()); out.write(this.natureOfAddress.getValue()); this.encodingScheme.encode(digits, out); } catch (IOException e) { throw new ParseException(e); } }
public void read(InputElement xml, GlobalTitle0001Impl ai) throws XMLStreamException { // ai.gti = GlobalTitleIndicator.valueOf(xml.getAttribute(GLOBALTITLE_INDICATOR).toInt()); try { ai.natureOfAddress = NatureOfAddress.valueOf(xml.getAttribute(NATURE_OF_ADDRESS_INDICATOR).toInt()); } catch (IllegalArgumentException e) { throw new XMLStreamException(e); } ai.digits = xml.getAttribute(DIGITS).toString(); } };
public static NatureOfAddressType createInstance(String s) { Integer i1 = doCreateInstance(s, stringMap, intMap); if (i1 == null) return new NatureOfAddressType(NatureOfAddress.UNKNOWN.getValue()); else return new NatureOfAddressType(i1); }
@Override public void setNatureOfAddress(NatureOfAddressType val) { this.testerHost.getConfigurationData().getSccpConfigurationData() .setNatureOfAddress(NatureOfAddress.valueOf(val.intValue())); this.testerHost.markStore(); }
@Override public NatureOfAddressType getNatureOfAddress() { return new NatureOfAddressType(this.testerHost.getConfigurationData().getSccpConfigurationData().getNatureOfAddress() .getValue()); }
NatureOfAddress naiObj = NatureOfAddress.valueOf(nao);
M3uaForm.setEnumeratedBaseComboBox(cbAddressNature, new NatureOfAddressType(NatureOfAddress.INTERNATIONAL.getValue())); M3uaForm.setEnumeratedBaseComboBox(cbNumberingPlan, new NumberingPlanSccpType(NumberingPlan.ISDN_TELEPHONY.getValue())); M3uaForm.setEnumeratedBaseComboBox(cbSccpProtocolVersion, new SccpProtocolVersionType(SccpProtocolVersion.ITU.getValue()));
NatureOfAddress nai = NatureOfAddress.valueOf(naiValue);
M3uaForm.setEnumeratedBaseComboBox(cbAddressNature, new NatureOfAddressType(NatureOfAddress.INTERNATIONAL.getValue())); M3uaForm.setEnumeratedBaseComboBox(cbNumberingPlan, new NumberingPlanSccpType(NumberingPlan.ISDN_TELEPHONY.getValue())); M3uaForm.setEnumeratedBaseComboBox(cbSccpProtocolVersion, new SccpProtocolVersionType(SccpProtocolVersion.ITU.getValue()));
public void read(InputElement xml, GlobalTitle0100Impl ai) throws XMLStreamException { try { ai.translationType = xml.getAttribute(TRANSLATION_TYPE).toInt(); //wrong... final byte esCode = (byte) xml.getAttribute(ENCODING_SCHEME).toInt(); ai.encodingScheme = factory.createEncodingScheme(esCode); ai.numberingPlan = NumberingPlan.valueOf(xml.getAttribute(NUMBERING_PLAN).toInt()); ai.natureOfAddress = NatureOfAddress.valueOf(xml.getAttribute(NATURE_OF_ADDRESS_INDICATOR).toInt()); ai.digits = xml.getAttribute(DIGITS).toString(); } catch (Exception e) { throw new XMLStreamException(e); } } };
public void write(GlobalTitle0100Impl ai, OutputElement xml) throws XMLStreamException { xml.setAttribute(TRANSLATION_TYPE, ai.translationType); xml.setAttribute(ENCODING_SCHEME, ai.encodingScheme.getSchemeCode()); xml.setAttribute(NUMBERING_PLAN, ai.numberingPlan.getValue()); xml.setAttribute(NATURE_OF_ADDRESS_INDICATOR, ai.natureOfAddress.getValue()); xml.setAttribute(DIGITS, ai.digits); }
public void read(InputElement xml, SccpConfigurationData_OldFormat sccp) throws XMLStreamException { sccp.setRouteOnGtMode(xml.getAttribute(REMOTE_ON_GT_MODE).toBoolean()); sccp.setRemoteSpc(xml.getAttribute(REMOTE_SPC).toInt()); sccp.setLocalSpc(xml.getAttribute(LOCAL_SPC).toInt()); sccp.setNi(xml.getAttribute(NI).toInt()); sccp.setRemoteSsn(xml.getAttribute(REMOTE_SSN).toInt()); sccp.setLocalSsn(xml.getAttribute(LOCAL_SSN).toInt()); sccp.setTranslationType(xml.getAttribute(TRANSLATION_TYTE).toInt()); String gtt = (String) xml.get(GLOBAL_TITLE_TYPE, String.class); sccp.setGlobalTitleType(GlobalTitleType.createInstance(gtt)); String an = (String) xml.get(ADDRESS_NATURE, String.class); sccp.setNatureOfAddress(NatureOfAddress.valueOf(an)); String np = (String) xml.get(NUMBERING_PLAN, String.class); sccp.setNumberingPlan(NumberingPlan.valueOf(np)); sccp.setCallingPartyAddressDigits((String) xml.get(CALLING_PARTY_ADDRESS_DIGITS, String.class)); // for skipping previous data String extraLocalAddressDigits = (String) xml.get(EXTRA_LOCAL_ADDRESS_DIGITS, String.class); } };