com.ibm.commerce.collaboration.workspaces.helper
Class CollabCommandHelper

java.lang.Object
  |
  +--com.ibm.commerce.collaboration.workspaces.helper.CollabCommandHelper

public class CollabCommandHelper
extends java.lang.Object

A set of helper methods that are used by the collaborative workspace controller commands.


Field Summary
static java.lang.String className
          The name of this class
static java.lang.String COPYRIGHT
          Copyright statement
 
Method Summary
static boolean checkUserAccessForCollabSpace(java.lang.String userDN, java.lang.String collabSpaceId, CommandContext context)
          Verifies that a user has the Manager role in the collaborative workspace or has the Site Administrator role in the seller organization.
static java.lang.String DNtoUid(java.lang.String DN)
          Returns uid part of a given distinguished name (DN)
static java.lang.String getNLName(java.lang.String firstName, java.lang.String lastName, int langId)
          Gets and formats the name of a user based on the preferred language.
static java.lang.String getRequesterDN( CommandContext commandContext)
          Extracts the requester's distinguished name from the command context object.
static java.lang.String getRequesterUid( CommandContext commandContext)
          Extracts the requester's logon id from the command context object.
static java.lang.String getUserDN(java.lang.String origDN)
          Modifies a user's distinguished name so that the Root Organization field is in lowercase.
static java.lang.String getUserEmailAddress(java.lang.Long userId)
          Gets the e-mail address associated with a given user.
static boolean isEmailAddressValid(java.lang.String emailAddress)
          Returns if the e-mail address is an valid one
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
Copyright statement
See Also:
Constant Field Values

className

public static final java.lang.String className
The name of this class
See Also:
Constant Field Values
Method Detail

checkUserAccessForCollabSpace

public static boolean checkUserAccessForCollabSpace(java.lang.String userDN,
                                                    java.lang.String collabSpaceId,
CommandContext context)
Verifies that a user has the Manager role in the collaborative workspace or has the Site Administrator role in the seller organization.
Parameters:
userDN - The distinguished name (DN) of a user (ex. uid=demoUser,o=Root Organization)
collabSpaceId - The unique identifier of the collaborative workspace.
context - The command context of the request object.
Returns:
true if the user specified has a Manager role in the collaborative workspace or has the Site Administrator role in the seller organization, false otherwise.

getRequesterDN

public static java.lang.String getRequesterDN(CommandContext commandContext)
Extracts the requester's distinguished name from the command context object.
Parameters:
commandContext - The command context from the request object.
Returns:
The distinguished name of the requester in the command context (ex. uid=demoUser,o=Root Organization)

getRequesterUid

public static java.lang.String getRequesterUid(CommandContext commandContext)
Extracts the requester's logon id from the command context object.
Parameters:
commandContext - The command context from the request object.
Returns:
The logon ID of the requester in the command context (ex. demoUser)

getUserDN

public static final java.lang.String getUserDN(java.lang.String origDN)
Modifies a user's distinguished name so that the Root Organization field is in lowercase.
Parameters:
origDN - The user's original distinguished name.
Returns:
The user's distinguished name with Root Organization in lowercase.

getNLName

public static java.lang.String getNLName(java.lang.String firstName,
                                         java.lang.String lastName,
                                         int langId)
Gets and formats the name of a user based on the preferred language.

For Asian languages, the name will be LastName FirstName.

For non-Asian languages, the name will be FirstName space LastName.

Parameters:
firstName - The user's first name.
lastName - The user's last name or family name.
langId - The language ID which specifies the format of the name that is returned.
Returns:
The language-specific name of the user.

DNtoUid

public static java.lang.String DNtoUid(java.lang.String DN)
Returns uid part of a given distinguished name (DN)
Parameters:
DN - The DN
Returns:
uid part of the DN

getUserEmailAddress

public static java.lang.String getUserEmailAddress(java.lang.Long userId)
Gets the e-mail address associated with a given user. If no e-mail address is associated with the user, the method returns null.
Parameters:
userId - The ID of the user
Returns:
The e-mail address associated with the user if it is specified in the database.

isEmailAddressValid

public static boolean isEmailAddressValid(java.lang.String emailAddress)
Returns if the e-mail address is an valid one
Parameters:
emailAddress - The e-mail address to be validated
Returns:
true if the e-mail address is valid, false otherwise