com.ptc.netmarkets.projectResource
Class NmProjResourceHelper

java.lang.Object
  extended bycom.ptc.netmarkets.projectResource.NmProjResourceHelper
All Implemented Interfaces:
Externalizable, Serializable

public class NmProjResourceHelper
extends Object
implements Externalizable

Helper class for project resources.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
Constructor Summary
NmProjResourceHelper()
           
 
Method Summary
static NmProjectResource createNmProjectResource(ProjectResource resource)
          Returns a netmarkets object corresponding to a given project resource.
static String getCostPerUse(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the cost per use of the resource wt.projmgmt.util.Currency.
static NmNumber getCostPerUseNmNumber(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the cost per use of the resource wt.projmgmt.util.Currency.
static Currency getCurrency(Hashtable params, String key, Locale locale)
          Extracts the currency value associated with a given key in a Hashtable.
static CurrencyRate getCurrencyRate(Hashtable params, String key, Locale locale)
          Extracts the currency rate object associated with a given key in a Hashtable.
private static ObjectIdentifier getId(Object obj)
           
private static Object getInfoValue(ProjectResource resource, Locale locale)
           
static int getMaximumUtilization(ProjectResource resource)
          Get the maximum number of units of the resource that can be used.
static String getMaximumUtilization(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the percent utilization of the resource wt.projmgmt.util.CurrencyRate.
static NmNumber getMaximumUtilizationNmNumber(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the percent utilization of the resource wt.projmgmt.util.CurrencyRate.
static String getOvertimeRate(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the overtime rate of the resource wt.projmgmt.util.CurrencyRate.
static NmNumber getOvertimeRateNmNumber(ProjectResource resource, Locale locale, String default_value)
           
private static Object getPersonValue(ProjectResource resource, Locale locale)
           
static ProjectResource getProjectResource(ProjectPlan plan, ResourceType type)
          Returns a project resource of a given type in the plan passed as argument.
private static String getResourceLabel(ProjectResource resource, Locale locale)
           
static Object getResourceLabel(ProjectResource resource, Locale locale, Object default_value)
          Returns a localized string contained the specific entity to which the resource is associated.
static Object getResourceOrganization(ProjectResource resource, Locale locale, Object default_value)
          Returns the name of the Organization to which the resource is associated.
private static String getResourceType(ProjectResource resource)
          Resturns the resource type string for the resource passed as argument.
static String getResourceTypeView(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the type of the resource ResourceType.
private static String getRoleValue(ProjectResource resource)
           
private static String getRoleValueView(ProjectResource resource, Locale locale)
           
static String getStandardRate(ProjectResource resource, Locale locale, String default_value)
          Returns a localized string contained the standard rate of the resource wt.projmgmt.util.CurrencyRate.
static NmNumber getStandardRateNmNumber(ProjectResource resource, Locale locale, String default_value)
           
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(NmProjResourceHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

NmProjResourceHelper

public NmProjResourceHelper()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(NmProjResourceHelper thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getResourceTypeView

public static String getResourceTypeView(ProjectResource resource,
                                         Locale locale,
                                         String default_value)
Returns a localized string contained the type of the resource ResourceType. If the value is null, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
String

getResourceLabel

public static Object getResourceLabel(ProjectResource resource,
                                      Locale locale,
                                      Object default_value)
                               throws WTException
Returns a localized string contained the specific entity to which the resource is associated. The entity can be a person, a role Role or a material label. If the value is null, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
Object
Throws:
WTException

getStandardRate

public static String getStandardRate(ProjectResource resource,
                                     Locale locale,
                                     String default_value)
Returns a localized string contained the standard rate of the resource wt.projmgmt.util.CurrencyRate. If the value is null, the default value passed as argument is returned

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
String

getCostPerUse

public static String getCostPerUse(ProjectResource resource,
                                   Locale locale,
                                   String default_value)
Returns a localized string contained the cost per use of the resource wt.projmgmt.util.Currency. If the value is null, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
String

getMaximumUtilization

public static String getMaximumUtilization(ProjectResource resource,
                                           Locale locale,
                                           String default_value)
Returns a localized string contained the percent utilization of the resource wt.projmgmt.util.CurrencyRate. If the value is null, the default value passed as argument is returned

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
String

getMaximumUtilization

public static int getMaximumUtilization(ProjectResource resource)
Get the maximum number of units of the resource that can be used.

For TimeResources this returns the maxPercentUtilization. For MaterialResources this returns the maxUnits. For any other resource types this method returns 0.

Supported API: false

Parameters:
resource -
Returns:
int

getOvertimeRate

public static String getOvertimeRate(ProjectResource resource,
                                     Locale locale,
                                     String default_value)
Returns a localized string contained the overtime rate of the resource wt.projmgmt.util.CurrencyRate. If the value is null, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
String

getCurrency

public static Currency getCurrency(Hashtable params,
                                   String key,
                                   Locale locale)
                            throws WTException
Extracts the currency value associated with a given key in a Hashtable.

Supported API: false

Parameters:
params -
key -
locale -
Returns:
Currency
Throws:
WTException
See Also:
wt.projmgmt.util.Currency

getCurrencyRate

public static CurrencyRate getCurrencyRate(Hashtable params,
                                           String key,
                                           Locale locale)
                                    throws WTException
Extracts the currency rate object associated with a given key in a Hashtable.

Supported API: false

Parameters:
params -
key -
locale -
Returns:
CurrencyRate
Throws:
WTException
See Also:
wt.projmgmt.util.CurrencyRate

getProjectResource

public static ProjectResource getProjectResource(ProjectPlan plan,
                                                 ResourceType type)
                                          throws WTException
Returns a project resource of a given type in the plan passed as argument.

Supported API: false

Parameters:
plan -
type -
Returns:
ProjectResource
Throws:
WTException

createNmProjectResource

public static NmProjectResource createNmProjectResource(ProjectResource resource)
                                                 throws WTException
Returns a netmarkets object corresponding to a given project resource.

Supported API: false

Parameters:
resource -
Returns:
NmProjectResource
Throws:
WTException

getResourceOrganization

public static Object getResourceOrganization(ProjectResource resource,
                                             Locale locale,
                                             Object default_value)
                                      throws WTException
Returns the name of the Organization to which the resource is associated. If their is no related Organization, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
Object
Throws:
WTException

getId

private static ObjectIdentifier getId(Object obj)

getPersonValue

private static Object getPersonValue(ProjectResource resource,
                                     Locale locale)
                              throws WTException
Throws:
WTException

getRoleValue

private static String getRoleValue(ProjectResource resource)
                            throws WTException
Throws:
WTException

getRoleValueView

private static String getRoleValueView(ProjectResource resource,
                                       Locale locale)
                                throws WTException
Throws:
WTException

getInfoValue

private static Object getInfoValue(ProjectResource resource,
                                   Locale locale)
                            throws WTException
Throws:
WTException

getResourceLabel

private static String getResourceLabel(ProjectResource resource,
                                       Locale locale)
                                throws WTException
Throws:
WTException

getResourceType

private static String getResourceType(ProjectResource resource)
Resturns the resource type string for the resource passed as argument.

Supported API: false

Parameters:
resource -
Returns:
String

getStandardRateNmNumber

public static NmNumber getStandardRateNmNumber(ProjectResource resource,
                                               Locale locale,
                                               String default_value)

getCostPerUseNmNumber

public static NmNumber getCostPerUseNmNumber(ProjectResource resource,
                                             Locale locale,
                                             String default_value)
Returns a localized string contained the cost per use of the resource wt.projmgmt.util.Currency. If the value is null, the default value passed as argument is returned.

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
NmNumber

getMaximumUtilizationNmNumber

public static NmNumber getMaximumUtilizationNmNumber(ProjectResource resource,
                                                     Locale locale,
                                                     String default_value)
Returns a localized string contained the percent utilization of the resource wt.projmgmt.util.CurrencyRate. If the value is null, the default value passed as argument is returned

Supported API: false

Parameters:
resource -
locale -
default_value -
Returns:
NmNumber

getOvertimeRateNmNumber

public static NmNumber getOvertimeRateNmNumber(ProjectResource resource,
                                               Locale locale,
                                               String default_value)