IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.ras.profile.core.util
Class ProfileIDHelper

java.lang.Object
  extended bycom.ibm.xtools.ras.profile.core.util.ProfileIDHelper

public class ProfileIDHelper
extends Object

ProfileIDHelper is a utility class containing a collection of methods that parse and construct profile IDs.


Field Summary
static String PROFILE_DELIMITER
          Represents the delimiter between segments of a profile ID
 
Constructor Summary
ProfileIDHelper()
           
 
Method Summary
static String createID(String[] idSegments)
          Creates a propely formated profile ID given a specified number of segments.
static String[] getIDSegments(String profileID)
          Retrieves the segments that make up the profile ID.The specified profile ID is first validated using isValid(String).
static String getParentProfileID(String profileID, boolean validateId)
          Retrieves the parent profile id for the specified profile.
static String[] getProfileIDs(String profileID)
          Retrieves the profile IDs from least to most derived profile.
static boolean isValid(String profileID)
          Validates that the profile ID is valid by insuring the following after trimming the profile ID of all whitespace: The ID length can not be 0 The ID does not begin with the delimiter The ID does not end with the delimiter The ID does not contain any consecutive delimiter sequence The ID does not contain any individual character that denotes the beginning of the delimiter that is not part of the delimiter The ID does not contain any segment that when trimmed of all whitespace the segment length is 0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_DELIMITER

public static final String PROFILE_DELIMITER
Represents the delimiter between segments of a profile ID

See Also:
Constant Field Values
Constructor Detail

ProfileIDHelper

public ProfileIDHelper()
Method Detail

createID

public static String createID(String[] idSegments)
Creates a propely formated profile ID given a specified number of segments. After creation validation of profile ID occurs using isValid(String). If the profile ID is deemed invalid null is returned.

Parameters:
idSegments - the segments to use to construct a profile ID.
Returns:
a properly formatted profile ID or null if the created ID is deemed invalid

getProfileIDs

public static String[] getProfileIDs(String profileID)
Retrieves the profile IDs from least to most derived profile. The specified profile ID is first validated using isValid(String). If the profile is deemed invalid an empty array is returned.

Parameters:
profileID - to profile ID to retrieve the profile IDs from
Returns:
the profile IDs from least to most derived profile or an empty array if the profile is invalid.

getParentProfileID

public static String getParentProfileID(String profileID,
                                        boolean validateId)
Retrieves the parent profile id for the specified profile. If validateId is specified, the profile ID is first validated using isValid(String). Setting validateId to false indicates that Id has been previously validated. The result of passing an invalid id with validateId set to false is undefined.

Parameters:
profileID - the profile for which to retrieve the parent profile id
validateId - set to false if the id has already been validated and is known to be welformed.
Returns:
the String representing the parent profile ID for profileId

getIDSegments

public static String[] getIDSegments(String profileID)
Retrieves the segments that make up the profile ID.The specified profile ID is first validated using isValid(String). If the profile is deemed invalid an empty array is returned.

Parameters:
profileID - to retrieve the segments from
Returns:
the segments that make up the profile ID.

isValid

public static boolean isValid(String profileID)
Validates that the profile ID is valid by insuring the following after trimming the profile ID of all whitespace:
  1. The ID length can not be 0
  2. The ID does not begin with the delimiter
  3. The ID does not end with the delimiter
  4. The ID does not contain any consecutive delimiter sequence
  5. The ID does not contain any individual character that denotes the beginning of the delimiter that is not part of the delimiter
  6. The ID does not contain any segment that when trimmed of all whitespace the segment length is 0

Parameters:
profileID - the profile ID to validate
Returns:
true if the profile ID is valid

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.