com.ptc.netmarkets.msproject
Class NmMsProjectCommands

java.lang.Object
  extended bycom.ptc.netmarkets.msproject.NmMsProjectCommands
All Implemented Interfaces:
Externalizable, Serializable

public class NmMsProjectCommands
extends Object
implements Externalizable



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private static String CONTENT_DISPOSITION
           
private static String CONTENT_LENGTH
           
private static String DEFAULT_DOWNLOAD_FILENAME
           
private static int DEFAULT_DOWNLOAD_TIMEOUT
           
private static String DEFAULT_IMPORT_ACTION
           
private static String DEFAULT_REQUEST_IMPORT_ACTION
           
private static boolean DELETE_TEMP_FILES
           
private static int DOWNLOAD_TIMEOUT
           
static long EXTERNALIZATION_VERSION_UID
           
private static String IMPORT_ACTION
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String REQUEST_IMPORT_ACTION
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static String USER_AGENT
           
 
Constructor Summary
NmMsProjectCommands()
           
 
Method Summary
private static String addQueryParam(String url, String name, Hashtable values, EncodingConverter encoder, boolean first)
          Adds the parameter named name to the specified url.
private static void downloadFile(NmCommandBean cb, File file, String downloadFilename, String encoding)
          Write the contents of the specified File onto the response's writer.
static void editProjectPlan(NmCommandBean cb)
          Export the project plan as XML that conforms to the Microsoft Project XML Schema.
private static void export(NmCommandBean cb, Hashtable params, ImportExportInfo info)
          Export XML to a temporary file.
static void exportProjectPlan(NmCommandBean cb)
          Export the project plan as XML that conforms to the Microsoft Project XML Schema.
static void generateImportRequest(NmCommandBean cb)
          Generate the XML that is sent to the client as a request to import a file into a ProjectPlan or SummaryActivity.
private static String getFilename(WfContainer c, Locale locale)
          Get an appropriate XML filename based on the name of the specified WfContainer.
private static ImportInfo getImportInfo(Hashtable params)
          Create an ImportInfo object based on the values in the specified Hashtable.
private static String getImportRequestURL(Hashtable params)
          Create the URL that can be used to generate the import project plan request XML.
static NmChangeModel[] importProjectPlan(NmCommandBean cb)
          Update the project plan using the specified XML file.
private static void initializeInfo(ImportExportInfo info)
          Set the locale and the preferred time zone of the current user as the local and time zone of the specified ImportExportInfo.
 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(NmMsProjectCommands thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
static NmChangeModel[] requestImportProjectPlan(NmCommandBean cb)
          Update the project plan using the specified file.
 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

CONTENT_DISPOSITION

private static final String CONTENT_DISPOSITION
See Also:
Constant Field Values

CONTENT_LENGTH

private static final String CONTENT_LENGTH
See Also:
Constant Field Values

IMPORT_ACTION

private static final String IMPORT_ACTION

DEFAULT_IMPORT_ACTION

private static final String DEFAULT_IMPORT_ACTION
See Also:
Constant Field Values

REQUEST_IMPORT_ACTION

private static final String REQUEST_IMPORT_ACTION

DEFAULT_REQUEST_IMPORT_ACTION

private static final String DEFAULT_REQUEST_IMPORT_ACTION
See Also:
Constant Field Values

DOWNLOAD_TIMEOUT

private static final int DOWNLOAD_TIMEOUT

DEFAULT_DOWNLOAD_TIMEOUT

private static final int DEFAULT_DOWNLOAD_TIMEOUT
See Also:
Constant Field Values

DELETE_TEMP_FILES

private static final boolean DELETE_TEMP_FILES

DEFAULT_DOWNLOAD_FILENAME

private static final String DEFAULT_DOWNLOAD_FILENAME
See Also:
Constant Field Values

USER_AGENT

private static final String USER_AGENT
See Also:
Constant Field Values
Constructor Detail

NmMsProjectCommands

public NmMsProjectCommands()
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(NmMsProjectCommands 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

importProjectPlan

public static NmChangeModel[] importProjectPlan(NmCommandBean cb)
                                         throws WTException,
                                                WTPropertyVetoException,
                                                IOException
Update the project plan using the specified XML file. The XML file should conform to the Microsoft Project XML Schema.

Since an import will usually cause substantial changes and occurs infrequently, return a NmChangeModel that invalidates all the caches.

Supported API: false

Parameters:
cb -
Returns:
NmChangeModel[]
Throws:
WTException
WTPropertyVetoException
IOException

exportProjectPlan

public static void exportProjectPlan(NmCommandBean cb)
                              throws WTException,
                                     IOException
Export the project plan as XML that conforms to the Microsoft Project XML Schema.

Supported API: false

Parameters:
cb -
Throws:
WTException
IOException

requestImportProjectPlan

public static NmChangeModel[] requestImportProjectPlan(NmCommandBean cb)
                                                throws WTException,
                                                       WTPropertyVetoException,
                                                       IOException
Update the project plan using the specified file. The file may be either a MPP file or an XML file.

If the file is a MPP file then generate a request for the client to import the file into a ProjectPlan or SummaryActivity. The client should use the information in the generated XML to send an importProjectPlan request to the server. The generated XML conforms to the Existing Project XML Schema.

If the file is an XML file then the call is redirected to importProjectPlan. This call will import the XML directly.

Supported API: false

Parameters:
cb -
Returns:
NmChangeModel[]
Throws:
WTException
WTPropertyVetoException
IOException

generateImportRequest

public static void generateImportRequest(NmCommandBean cb)
                                  throws WTException,
                                         IOException
Generate the XML that is sent to the client as a request to import a file into a ProjectPlan or SummaryActivity.

The client should use the information in the generated XML to send an importProjectPlan request to the server.

The generated XML conforms to the Existing Project XML Schema.

Supported API: false

Parameters:
cb -
Throws:
WTException
IOException

editProjectPlan

public static void editProjectPlan(NmCommandBean cb)
                            throws WTException,
                                   IOException
Export the project plan as XML that conforms to the Microsoft Project XML Schema.

Additional information is included in the XML file that identifies the Windchill objects that the data corresponds to. This allows the client to save changes back to the server.

Supported API: false

Parameters:
cb -
Throws:
WTException
IOException

getFilename

private static final String getFilename(WfContainer c,
                                        Locale locale)
                                 throws WTException
Get an appropriate XML filename based on the name of the specified WfContainer.

Throws:
WTException

getImportRequestURL

private static final String getImportRequestURL(Hashtable params)
Create the URL that can be used to generate the import project plan request XML.

Parameters:
params - the request parameters
Returns:
the URL to generate the import request XML

addQueryParam

private static final String addQueryParam(String url,
                                          String name,
                                          Hashtable values,
                                          EncodingConverter encoder,
                                          boolean first)
Adds the parameter named name to the specified url. The new url is returned.


export

private static final void export(NmCommandBean cb,
                                 Hashtable params,
                                 ImportExportInfo info)
                          throws WTException,
                                 IOException
Export XML to a temporary file. The XML is produced using thea specified op: export, edit or request. After the XML is generated to the temporary file, download the file by writing its contents to the response's writer.

Parameters:
cb - the command bean
Throws:
WTException
IOException
See Also:
downloadFile(com.ptc.netmarkets.util.beans.NmCommandBean, java.io.File, java.lang.String, java.lang.String)

downloadFile

private static final void downloadFile(NmCommandBean cb,
                                       File file,
                                       String downloadFilename,
                                       String encoding)
                                throws IOException
Write the contents of the specified File onto the response's writer.

Parameters:
cb - the command bean
file - the file to whose content should be written to the response
encoding - the character encoding to use
Throws:
IOException

getImportInfo

private static final ImportInfo getImportInfo(Hashtable params)
                                       throws WTException
Create an ImportInfo object based on the values in the specified Hashtable.

Returns:
a populated ImportInfo object
Throws:
WTException

initializeInfo

private static void initializeInfo(ImportExportInfo info)
                            throws WTException
Set the locale and the preferred time zone of the current user as the local and time zone of the specified ImportExportInfo.

Parameters:
info - the import-export info object to be initialized
Throws:
WTException