/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/message/ssnm/SignallingCongestionImpl.java
Java | 137 lines | 87 code | 24 blank | 26 comment | 16 complexity | 1d76bc3101310024b84ff8ad9253c772 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.ssnm; 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.ssnm.SignallingCongestion; 32import org.mobicents.protocols.ss7.m3ua.parameter.AffectedPointCode; 33import org.mobicents.protocols.ss7.m3ua.parameter.ConcernedDPC; 34import org.mobicents.protocols.ss7.m3ua.parameter.CongestedIndication; 35import org.mobicents.protocols.ss7.m3ua.parameter.InfoString; 36import org.mobicents.protocols.ss7.m3ua.parameter.NetworkAppearance; 37import org.mobicents.protocols.ss7.m3ua.parameter.Parameter; 38import org.mobicents.protocols.ss7.m3ua.parameter.RoutingContext; 39 40/** 41 * 42 * @author amit bhayani 43 * 44 */ 45public class SignallingCongestionImpl extends M3UAMessageImpl implements SignallingCongestion { 46 47 public SignallingCongestionImpl() { 48 super(MessageClass.SIGNALING_NETWORK_MANAGEMENT, MessageType.SIGNALING_CONGESTION, 49 MessageType.S_SIGNALING_CONGESTION); 50 } 51 52 public AffectedPointCode getAffectedPointCodes() { 53 return (AffectedPointCode) parameters.get(Parameter.Affected_Point_Code); 54 } 55 56 public InfoString getInfoString() { 57 return (InfoString) parameters.get(Parameter.INFO_String); 58 } 59 60 public NetworkAppearance getNetworkAppearance() { 61 return (NetworkAppearance) parameters.get(Parameter.Network_Appearance); 62 } 63 64 public RoutingContext getRoutingContexts() { 65 return (RoutingContext) parameters.get(Parameter.Routing_Context); 66 } 67 68 public void setAffectedPointCodes(AffectedPointCode afpc) { 69 parameters.put(Parameter.Affected_Point_Code, afpc); 70 } 71 72 public void setInfoString(InfoString str) { 73 if (str != null) { 74 parameters.put(Parameter.INFO_String, str); 75 } 76 } 77 78 public void setNetworkAppearance(NetworkAppearance p) { 79 if (p != null) { 80 parameters.put(Parameter.Network_Appearance, p); 81 } 82 } 83 84 public void setRoutingContexts(RoutingContext routingCntx) { 85 if (routingCntx != null) { 86 parameters.put(Parameter.Routing_Context, routingCntx); 87 } 88 } 89 90 public ConcernedDPC getConcernedDPC() { 91 return (ConcernedDPC) parameters.get(Parameter.Concerned_Destination); 92 } 93 94 public CongestedIndication getCongestedIndication() { 95 return (CongestedIndication) parameters.get(Parameter.Congestion_Indications); 96 } 97 98 public void setConcernedDPC(ConcernedDPC dpc) { 99 if (dpc != null) { 100 parameters.put(Parameter.Concerned_Destination, dpc); 101 } 102 } 103 104 public void setCongestedIndication(CongestedIndication congInd) { 105 if (congInd != null) { 106 parameters.put(Parameter.Congestion_Indications, congInd); 107 } 108 } 109 110 @Override 111 protected void encodeParams(ByteBuffer buffer) { 112 if (parameters.containsKey(Parameter.Network_Appearance)) { 113 ((ParameterImpl) parameters.get(Parameter.Network_Appearance)).write(buffer); 114 } 115 116 if (parameters.containsKey(Parameter.Routing_Context)) { 117 ((ParameterImpl) parameters.get(Parameter.Routing_Context)).write(buffer); 118 } 119 if (parameters.containsKey(Parameter.Affected_Point_Code)) { 120 ((ParameterImpl) parameters.get(Parameter.Affected_Point_Code)).write(buffer); 121 } 122 123 if (parameters.containsKey(Parameter.Concerned_Destination)) { 124 ((ParameterImpl) parameters.get(Parameter.Concerned_Destination)).write(buffer); 125 } 126 127 if (parameters.containsKey(Parameter.Congestion_Indications)) { 128 ((ParameterImpl) parameters.get(Parameter.Congestion_Indications)).write(buffer); 129 } 130 131 if (parameters.containsKey(Parameter.INFO_String)) { 132 ((ParameterImpl) parameters.get(Parameter.INFO_String)).write(buffer); 133 } 134 135 } 136 137}