ALBPM Process API

fuego.papi
Class InstanceId

java.lang.Object
  extended by fuego.papi.InstanceId
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
InstanceInfo

public class InstanceId
extends Object
implements Comparable, Serializable

Contains the declaration of an instance.

An instance is formed by: the process identification number, the instance identification number, and the thread identification number.

Here are available all those operations over an instance id, such as obtaining the process in, or the thread in from it.

See Also:
Serialized Form

Field Summary
static String NAME_SEPARATOR
           
static String ORGANIZATION_SEPARATOR
           
 
Constructor Summary
InstanceId(int processIn, int instanceIn, int threadIn)
          Simple constructor for using key.
 
Method Summary
static int compare(InstanceId leftInstanceId, InstanceId rightInstanceId)
          Compares one InstanceId with other InstanceId.
 int compareTo(Object obj)
          Compares this object with the specified object for order.
static boolean equals(InstanceId leftInstanceId, InstanceId rightInstanceId)
          Returns if the one InstanceId is equals to other InstanceId.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
static InstanceId getInstanceId(InstanceInfo instanceInfo)
          Generate a new InstanceId from an InstanceInfo.
static String getInstanceId(String globalInstanceId)
          Returns the Instance Id without the organization
 int getInstanceIn()
          Gets the instance identification number in the process where this instance has been created.
static int getInstanceIn(String instanceId)
          Returns the Instance IN from a specific Instance Id
static String getOrganization(String globalInstanceId)
          Returns the Organization from a specific GlobalInstanceId
static String getProcessId(String instanceId)
          Returns the Process Identification from a specific Instance identification.
 int getProcessIn()
          Gets the process identification number where this instance has been created
 int getThreadIn()
          Gets the instance thread/copy identification number.
static int getThreadIn(String instanceId)
          Returns the Instance Thread from a specific Instance Id.
 int hashCode()
          Returns a hash code value for the object.
static boolean isProcessId(String instanceOrProcessId)
          Returns if a specific string could be a process identification or not.
static boolean isValidInstanceId(String instanceId)
          Validates the correct sintax of a specific Instance Id.
static String makeGlobalId(String organization, String processId, int instanceIn)
          Through this method a new global instance id will be created
static String makeGlobalId(String organization, String processId, int instanceIn, int threadIn)
          Through this method a new global instance id will be created
 String makeId(String processId)
          Through this method a new instance id will be retrieved for the given process id
static String makeId(String processId, int instanceIn)
          Through this method a new instance id will be created
static String makeId(String processId, int instanceIn, int threadIn)
          Through this method a new instance id will be created
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_SEPARATOR

public static final String NAME_SEPARATOR
See Also:
Constant Field Values

ORGANIZATION_SEPARATOR

public static final String ORGANIZATION_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

InstanceId

public InstanceId(int processIn,
                  int instanceIn,
                  int threadIn)
Simple constructor for using key.

Parameters:
processIn - Process identification number where the instance has been created.
instanceIn - Instance identification number in the process where the instance has been created.
threadIn - Instance copy/thread number of the instance (if the instance does not have parent the value is 0).
Method Detail

getInstanceId

public static InstanceId getInstanceId(InstanceInfo instanceInfo)
Generate a new InstanceId from an InstanceInfo.

Parameters:
instanceInfo - InstanceInfo whose will use to create the new InstanceId.

compare

public static int compare(InstanceId leftInstanceId,
                          InstanceId rightInstanceId)
Compares one InstanceId with other InstanceId. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
leftInstanceId - InstanceId to be compared.
rightInstanceId - InstanceId to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

equals

public static boolean equals(InstanceId leftInstanceId,
                             InstanceId rightInstanceId)
Returns if the one InstanceId is equals to other InstanceId.

Parameters:
leftInstanceId - InstanceId to be compared.
rightInstanceId - InstanceId to be compared.
Returns:
true if both InstanceId are equals and false if not.

getInstanceId

public static String getInstanceId(String globalInstanceId)
Returns the Instance Id without the organization

Parameters:
globalInstanceId - String Global Instance Identification.
Returns:
Instance Id without the organization
Throws:
NullPointerException - when globalInstanceId is null.

getInstanceIn

public static int getInstanceIn(String instanceId)
Returns the Instance IN from a specific Instance Id

Parameters:
instanceId - String Instance Identification.
Returns:
Returns an Instance Identification Number if exist and -1 if not exist.
Throws:
NullPointerException - when instanceId is null.

getOrganization

public static String getOrganization(String globalInstanceId)
Returns the Organization from a specific GlobalInstanceId

Parameters:
globalInstanceId - Global Instance Id (Instance Id with the Organization)

getProcessId

public static String getProcessId(String instanceId)
Returns the Process Identification from a specific Instance identification.

Parameters:
instanceId - String instance identification.
Returns:
Process identification for the instance id.

isProcessId

public static boolean isProcessId(String instanceOrProcessId)
Returns if a specific string could be a process identification or not.

Parameters:
instanceOrProcessId - String to check.
Returns:
true if the String could be a process identification.

getThreadIn

public static int getThreadIn(String instanceId)
Returns the Instance Thread from a specific Instance Id.

Parameters:
instanceId - Instance Id. Note: this parameter must not be null.
Returns:
Returns an Instance Thread if exist and -1 if not exist.
Throws:
NullPointerException - when instanceId is null.

isValidInstanceId

public static boolean isValidInstanceId(String instanceId)
Validates the correct sintax of a specific Instance Id.

Parameters:
instanceId - It must not be null.
Throws:
NullPointerException - when instanceId is null.

makeGlobalId

public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn)
Through this method a new global instance id will be created

Parameters:
organization - Organization where the instance has been created.
processId - The process identification where the instance has been created.
instanceIn - The instance identification numbre in the process where the instance has been created.
Returns:
an Instance Id for specified Organization, Process Id and Instance Identification Number.

makeGlobalId

public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn,
                                  int threadIn)
Through this method a new global instance id will be created

Parameters:
organization - Organization where the instance has been created.
processId - The process identification where the instance has been created.
instanceIn - The instance identification numbre in the process where the instance has been created.
threadIn - The copy/thread of the instance (0 if the parent instance).
Returns:
an Instance Id for specified Organization, Process Id, Instance Identification Number and Thread Identification Number.

makeId

public static String makeId(String processId,
                            int instanceIn)
Through this method a new instance id will be created

Parameters:
processId - The process identification where the instance has been created.
instanceIn - The instance identification numbre in the process where the instance has been created.
Returns:
an instance id for specific Process Id and Instance Identification Number.

makeId

public static String makeId(String processId,
                            int instanceIn,
                            int threadIn)
Through this method a new instance id will be created

Parameters:
processId - The process identification where the instance has been created.
instanceIn - The instance identification numbre in the process where the instance has been created.
threadIn - The copy/thread of the instance (0 if the parent instance).
Returns:
an Instance Id for specified Process Id, Instance Identification Number and Thread Identification Number.

getInstanceIn

public final int getInstanceIn()
Gets the instance identification number in the process where this instance has been created.


getProcessIn

public final int getProcessIn()
Gets the process identification number where this instance has been created


getThreadIn

public final int getThreadIn()
Gets the instance thread/copy identification number.

If the instance has a father, the thread in is the number of child the instance is. Otherwise this number is 0.


equals

public final boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

compareTo

public final int compareTo(Object obj)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface Comparable
Parameters:
obj - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class Object

makeId

public String makeId(String processId)
Through this method a new instance id will be retrieved for the given process id


toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.

Overrides:
toString in class Object

ALBPM Process API

© Copyright 1996/2005 Fuego Inc. All Rights Reserved