PageRenderTime 19ms CodeModel.GetById 7ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/ss7/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/dialog/MAPUserAbortChoiceImpl.java

http://mobicents.googlecode.com/
Java | 124 lines | 71 code | 23 blank | 30 comment | 8 complexity | 906784735a34933206a69f1382e7a113 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.dialog;
 24
 25import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
 26import org.mobicents.protocols.ss7.map.api.dialog.ProcedureCancellationReason;
 27import org.mobicents.protocols.ss7.map.api.dialog.ResourceUnavailableReason;
 28
 29/**
 30 * MAP-UserAbortChoice ::= CHOICE {
 31 *   userSpecificReason               [0] NULL,
 32 *   userResourceLimitation           [1] NULL,
 33 *   resourceUnavailable              [2] ResourceUnavailableReason,
 34 *   applicationProcedureCancellation [3] ProcedureCancellationReason}
 35 * @author amit bhayani
 36 * 
 37 */
 38public class MAPUserAbortChoiceImpl implements MAPUserAbortChoice {
 39	
 40	protected static final int USER_SPECIFIC_REASON_TAG = 0;
 41	protected static final int USER_RESOURCE_LIMITATION_TAG = 1;
 42	protected static final int RESOURCE_UNAVAILABLE = 2;
 43	protected static final int APPLICATION_PROCEDURE_CANCELLATION = 3;
 44
 45	private ProcedureCancellationReason procedureCancellationReason = null;
 46	private boolean isProcedureCancellationReason = false;
 47
 48	private ResourceUnavailableReason resourceUnavailableReason = null;
 49	private boolean isResourceUnavailableReason = false;
 50
 51	private boolean isUserResourceLimitation = false;
 52
 53	private boolean isUserSpecificReason = false;
 54
 55	public ProcedureCancellationReason getProcedureCancellationReason() {
 56		return this.procedureCancellationReason;
 57	}
 58
 59	public ResourceUnavailableReason getResourceUnavailableReason() {
 60		return this.resourceUnavailableReason;
 61	}
 62
 63	public boolean isProcedureCancellationReason() {
 64		return this.isProcedureCancellationReason;
 65	}
 66
 67	public boolean isResourceUnavailableReason() {
 68		return this.isResourceUnavailableReason;
 69	}
 70
 71	public boolean isUserResourceLimitation() {
 72		return this.isUserResourceLimitation;
 73	}
 74
 75	public boolean isUserSpecificReason() {
 76		return this.isUserSpecificReason;
 77	}
 78
 79	public void setProcedureCancellationReason(
 80			ProcedureCancellationReason procCanReasn) {
 81		this.procedureCancellationReason = procCanReasn;
 82		this.isProcedureCancellationReason = true;
 83	}
 84
 85	public void setResourceUnavailableReason(
 86			ResourceUnavailableReason resUnaReas) {
 87		this.resourceUnavailableReason = resUnaReas;
 88		this.isResourceUnavailableReason = true;
 89	}
 90
 91	public void setUserResourceLimitation() {
 92		this.isUserResourceLimitation = true;
 93	}
 94
 95	public void setUserSpecificReason() {
 96		this.isUserSpecificReason = true;
 97	}
 98
 99	@Override
100	public String toString() {
101		
102		StringBuilder sb = new StringBuilder(); 
103
104		sb.append("MAPUserAbortChoice [");
105		if (this.isUserSpecificReason)
106			sb.append(" UserSpecificReason");
107		if (this.isUserResourceLimitation)
108			sb.append(" UserResourceLimitation");
109		if (this.isResourceUnavailableReason) {
110			sb.append(" ResourceUnavailableReason=");
111			if (this.resourceUnavailableReason != null)
112				sb.append(this.resourceUnavailableReason.toString());
113		}
114		if (this.isProcedureCancellationReason) {
115			sb.append(" ProcedureCancellationReason=");
116			if (this.procedureCancellationReason != null)
117				sb.append(this.procedureCancellationReason.toString());
118		}
119		sb.append("]");
120		
121		return sb.toString();
122	}
123	
124}