com.arunta.app.bom
Class AuthorisedExtensionsSet

java.lang.Object
  extended by com.arunta.app.bom.AuthorisedExtensionsSet
All Implemented Interfaces:
java.io.Serializable

public class AuthorisedExtensionsSet
extends java.lang.Object
implements java.io.Serializable

Bean for extension access control.

This bean captures a set of extensions, and/or ExtensionRange, which can be used to control access to records or operations on a Total Recall VR system. This set does not define the meaning of access, rather it is a mechanisam that remote clients can use to control access to Total Recall VR system resources and functions.

The set can specify that:

See Also:
Serialized Form

Field Summary
static int ALL
          All extensions are authorised.
static int EXCEPT_SPECIFIED
          All extensions, except those specified in this set, are authorised.
static int SPECIFIED
          Only the extensions specified in this set are authorised.
 
Constructor Summary
AuthorisedExtensionsSet()
          Creates a set which makes all extensions authorised.
AuthorisedExtensionsSet(AuthorisedExtensionsSet other)
          Creates a set which is a (deep) copy of the specified set.
 
Method Summary
 void addExtension(java.lang.String ext)
          Adds an individual extension to the set.
 void addExtensionRange(java.lang.String first, java.lang.String last)
          Adds an extension range to the set.
 java.lang.String getExtension(int index)
          Returns the individual extension at the specified index in the set.
 int getExtensionCnt()
           
 ExtensionRange getExtensionRange(int index)
          Returns the extension range at the specified index position in the set
 int getExtensionRangeCnt()
           
 int getMode()
           
 java.lang.String getStringRepresentation()
          Creates a string representation of the set content.
 boolean isAllAuthorized()
          Query for all extensions authorised.
 boolean isAuthorized(Recording rec)
          Query for recording authorisation.
 boolean isAuthorized(java.lang.String extension)
          Query for extension authorisation.
 boolean isNoneAuthorized()
          Query for no extension is authorised.
 void removeExtension(int index)
          Removes the individual extension at the specified index in the set.
 void removeExtensionRange(int index)
          Removes the extension range at the specified index in the set.
 void setFromStringRepresentation(java.lang.String stringRepresentation)
          Initialises this instance of teh bean from the string representation of the set content.
 void setMode(int mode)
          Sets the autorisation mode for thsi instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final int ALL
All extensions are authorised.

See Also:
Constant Field Values

SPECIFIED

public static final int SPECIFIED
Only the extensions specified in this set are authorised.

See Also:
Constant Field Values

EXCEPT_SPECIFIED

public static final int EXCEPT_SPECIFIED
All extensions, except those specified in this set, are authorised.

See Also:
Constant Field Values
Constructor Detail

AuthorisedExtensionsSet

public AuthorisedExtensionsSet()
Creates a set which makes all extensions authorised.


AuthorisedExtensionsSet

public AuthorisedExtensionsSet(AuthorisedExtensionsSet other)
Creates a set which is a (deep) copy of the specified set.

Parameters:
other - The set to copy.
Method Detail

getStringRepresentation

public java.lang.String getStringRepresentation()
Creates a string representation of the set content.

Returns:
A string which describes the content of the set.

setFromStringRepresentation

public void setFromStringRepresentation(java.lang.String stringRepresentation)
Initialises this instance of teh bean from the string representation of the set content.

Use getStringRepresentation() to create a string representation of another instance.

Parameters:
stringRepresentation - Valid string representation of a another instance of this bean.

getMode

public int getMode()
Returns:
The current authorisation mode of this instance. One of ALL, SPECIFIED or EXCEPT_SPECIFIED.

setMode

public void setMode(int mode)
Sets the autorisation mode for thsi instance.

Parameters:
mode - One of ALL, SPECIFIED or EXCEPT_SPECIFIED.

isAllAuthorized

public boolean isAllAuthorized()
Query for all extensions authorised.

Returns:
true if all extensions are authorised. false otherwise.

isNoneAuthorized

public boolean isNoneAuthorized()
Query for no extension is authorised.

Returns:
true if all extensions are NOT authorised. false otherwise.

isAuthorized

public boolean isAuthorized(java.lang.String extension)
Query for extension authorisation.

Parameters:
extension - An extension to check.
Returns:
true if the extensions authorised. false otherwise.

isAuthorized

public boolean isAuthorized(Recording rec)
Query for recording authorisation.

Parameters:
rec - A recording to check.
Returns:
true if the recording authorised. false otherwise.

getExtensionCnt

public int getExtensionCnt()
Returns:
The total number of individual extensions in the set.

getExtensionRangeCnt

public int getExtensionRangeCnt()
Returns:
The total number of extension ranges in the set.

addExtension

public void addExtension(java.lang.String ext)
Adds an individual extension to the set.

Note that if the authorisation mode of the set is ALL before this request, then after this request the authorisation mode will be SPECIFIED.

Parameters:
ext - The extension to add to the set. For example: 2000.

removeExtension

public void removeExtension(int index)
Removes the individual extension at the specified index in the set.

For example:

      AuthorisedExtensionsSet set = new AuthorisedExtensionsSet();
      
      set.addExtension("2000"); // this extension is at index 0
      set.addExtension("2001"); // this extension is at index 1
      set.addExtension("2002"); // this extension is at index 2
      
      set.removeExtension(2);   // removes extension 2002 from the set
      
 

Parameters:
index - The index, in the set, of the extension to remove.

addExtensionRange

public void addExtensionRange(java.lang.String first,
                              java.lang.String last)
Adds an extension range to the set.

Note that if the authorisation mode of the set is ALL before this request, then after this request the authorisation mode will be SPECIFIED.

Parameters:
first - The first extension in the range. For example: 2000.
last - The last extension in the range. For example: 2999.

removeExtensionRange

public void removeExtensionRange(int index)
Removes the extension range at the specified index in the set.

For example:

      AuthorisedExtensionsSet set = new AuthorisedExtensionsSet();
      
      set.addExtensionRange("2000", "2999"); // this range is at index 0
      set.addExtensionRange("4001", "4010"); // this range is at index 1
      set.addExtensionRange("6002", "6300"); // this range is at index 2
      
      set.removeExtensionRange(2);   // removes range 6002-6300 from the set
      
 

Parameters:
index - The index, in the set, of the extension to remove.

getExtension

public java.lang.String getExtension(int index)
Returns the individual extension at the specified index in the set.

For example:

      AuthorisedExtensionsSet set = new AuthorisedExtensionsSet();
      
      set.addExtension("2000"); // this extension is at index 0
      set.addExtension("2001"); // this extension is at index 1
      set.addExtension("2002"); // this extension is at index 2
      
      String ext = set.getExtension(2);
      // ext is 2002
      
 

Parameters:
index - An index, in the set, of an extension.
Returns:
String value of the extension.

getExtensionRange

public ExtensionRange getExtensionRange(int index)
Returns the extension range at the specified index position in the set

For example:

      AuthorisedExtensionsSet set = new AuthorisedExtensionsSet();
      
      set.addExtensionRange("2000", "2999"); // this range is at index 0
      set.addExtensionRange("4001", "4010"); // this range is at index 1
      set.addExtensionRange("6002", "6300"); // this range is at index 2
      
      ExtensionRage er = set.getExtensionRange(2);
      // er is a set representing 6002-6300.
      
 

Parameters:
index - An index, in the set, of an extension range.
Returns:
Instance of an extension range bean.


Copyright ©, 2005-2012 Prolancer Pty Ltd, Sydney Australia.