PageRenderTime 72ms CodeModel.GetById 60ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/message/mgmt/ErrorImpl.java

http://mobicents.googlecode.com/
Java | 113 lines | 66 code | 21 blank | 26 comment | 6 complexity | 6072f1562660000d422652b569260f16 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.m3ua.impl.message.mgmt;
 24
 25import java.nio.ByteBuffer;
 26
 27import org.mobicents.protocols.ss7.m3ua.impl.message.M3UAMessageImpl;
 28import org.mobicents.protocols.ss7.m3ua.impl.parameter.ParameterImpl;
 29import org.mobicents.protocols.ss7.m3ua.message.MessageClass;
 30import org.mobicents.protocols.ss7.m3ua.message.MessageType;
 31import org.mobicents.protocols.ss7.m3ua.message.mgmt.Error;
 32import org.mobicents.protocols.ss7.m3ua.parameter.AffectedPointCode;
 33import org.mobicents.protocols.ss7.m3ua.parameter.DiagnosticInfo;
 34import org.mobicents.protocols.ss7.m3ua.parameter.ErrorCode;
 35import org.mobicents.protocols.ss7.m3ua.parameter.NetworkAppearance;
 36import org.mobicents.protocols.ss7.m3ua.parameter.Parameter;
 37import org.mobicents.protocols.ss7.m3ua.parameter.RoutingContext;
 38
 39/**
 40 * 
 41 * @author amit bhayani
 42 * 
 43 */
 44public class ErrorImpl extends M3UAMessageImpl implements Error {
 45
 46	public ErrorImpl() {
 47		super(MessageClass.MANAGEMENT, MessageType.ERROR, MessageType.S_ERROR);
 48	}
 49
 50	@Override
 51	protected void encodeParams(ByteBuffer buffer) {
 52		((ParameterImpl) parameters.get(Parameter.Error_Code)).write(buffer);
 53
 54		if (parameters.containsKey(Parameter.Routing_Context)) {
 55			((ParameterImpl) parameters.get(Parameter.Routing_Context)).write(buffer);
 56		}
 57
 58		if (parameters.containsKey(Parameter.Affected_Point_Code)) {
 59			((ParameterImpl) parameters.get(Parameter.Affected_Point_Code)).write(buffer);
 60		}
 61
 62		if (parameters.containsKey(Parameter.Network_Appearance)) {
 63			((ParameterImpl) parameters.get(Parameter.Network_Appearance)).write(buffer);
 64		}
 65
 66		if (parameters.containsKey(Parameter.Diagnostic_Information)) {
 67			((ParameterImpl) parameters.get(Parameter.Diagnostic_Information)).write(buffer);
 68		}
 69	}
 70
 71	public AffectedPointCode getAffectedPointCode() {
 72		return ((AffectedPointCode) parameters.get(Parameter.Affected_Point_Code));
 73	}
 74
 75	public DiagnosticInfo getDiagnosticInfo() {
 76		return ((DiagnosticInfo) parameters.get(Parameter.Diagnostic_Information));
 77	}
 78
 79	public ErrorCode getErrorCode() {
 80		return ((ErrorCode) parameters.get(Parameter.Error_Code));
 81	}
 82
 83	public NetworkAppearance getNetworkAppearance() {
 84		return ((NetworkAppearance) parameters.get(Parameter.Network_Appearance));
 85	}
 86
 87	public RoutingContext getRoutingContext() {
 88		return ((RoutingContext) parameters.get(Parameter.Routing_Context));
 89	}
 90
 91	public void setAffectedPointCode(AffectedPointCode affPc) {
 92		parameters.put(Parameter.Affected_Point_Code, affPc);
 93	}
 94
 95	public void setDiagnosticInfo(DiagnosticInfo diagInfo) {
 96		parameters.put(Parameter.Diagnostic_Information, diagInfo);
 97	}
 98
 99	public void setErrorCode(ErrorCode code) {
100		parameters.put(Parameter.Error_Code, code);
101	}
102
103	public void setNetworkAppearance(NetworkAppearance netApp) {
104		parameters.put(Parameter.Network_Appearance, netApp);
105	}
106
107	public void setRoutingContext(RoutingContext rc) {
108		if (rc != null) {
109			parameters.put(Parameter.Routing_Context, rc);
110		}
111	}
112
113}