com.ptc.wvs.server.publish
Class ConvertDocument

java.lang.Object
  extended bycom.ptc.wvs.server.publish.ConvertDocument
All Implemented Interfaces:
FileConvert, Serializable

public class ConvertDocument
extends Object
implements FileConvert

See Also:
Serialized Form

Field Summary
private static String ATTRIBUTE_KEY
           
private  String charset
           
private  WTDocument document
           
private  ContentItem documentContentItem
           
private  String documentFile
           
private  String documentWorker
           
private  String documentWorkerOptions
           
private  String downloadedFileName
           
private  ArrayList dtiWorkers
           
private  boolean encodeFilename
           
private  boolean fileNameEncoded
           
private static String options
           
private  Representable part
           
private  String preconvertedFileName
           
private  PublishJob publishJob
           
private  String rawFileName
           
private static String TAG_ATTRIBUTE
           
private static String TAG_MSOIMIME
           
private static String TAG_WCFILE
           
private static boolean VERBOSE
           
private static WVSProperties wvsProperties
           
 
Constructor Summary
ConvertDocument(PublishJob publishJob, WTDocument document, Representable part, String documentFile)
           
 
Method Summary
private  void decodeEDFileContent()
           
private  String doDocumentConversion(boolean doConversion)
           
private  String doEncodeFileName(String f)
           
 String getAuthenticationString(URLData urlData)
          Gets a encrypted authentication string for the specified url data This is will be passed to the distributed CadAgent to allow it to retieve file from the source, typicall ProIntralink Called by file download for URLData items

Supported API: false
private  int getDocumentContent(boolean getContent)
           
private  String getDocumentWindchillName()
           
 boolean getLocalFileContentFromContentItem(ContentItem ci, File localFile)
          Downloads the ContentItem for this CAD system to the local file specified.
 String getLocalFileNameFromContentItem(ContentItem ci)
          Returns the local file name for a ContentItem of this CAD system Called by file download for both ApplicationData and URLData items

Supported API: false
 URLConnection getURLDataConnection(URLData urlData)
          Gets a URLConnection for the default mechanisn to download file content.
private  boolean processZIPFile()
           
 int publishDocument(boolean getContent, boolean doConversion, boolean store, boolean doChildren)
           
private  void setDocumentWorker(String in)
           
private  int storeDocumentRepresentation(boolean store, boolean doChildren, File outDir)
           
 boolean useDistributedCadAgent(String url)
          Returns if a distributed CadAgent could service the conversion of the url data.
private  void writeDocumentXML(WTDocument d, ContentItem ci, File tempDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_MSOIMIME

private static final String TAG_MSOIMIME
See Also:
Constant Field Values

TAG_WCFILE

private static final String TAG_WCFILE
See Also:
Constant Field Values

ATTRIBUTE_KEY

private static final String ATTRIBUTE_KEY
See Also:
Constant Field Values

TAG_ATTRIBUTE

private static final String TAG_ATTRIBUTE
See Also:
Constant Field Values

wvsProperties

private static WVSProperties wvsProperties

VERBOSE

private static boolean VERBOSE

options

private static String options

publishJob

private PublishJob publishJob

document

private WTDocument document

part

private Representable part

documentFile

private String documentFile

documentContentItem

private ContentItem documentContentItem

documentWorker

private String documentWorker

documentWorkerOptions

private String documentWorkerOptions

downloadedFileName

private String downloadedFileName

rawFileName

private String rawFileName

fileNameEncoded

private boolean fileNameEncoded

preconvertedFileName

private String preconvertedFileName

charset

private String charset

encodeFilename

private boolean encodeFilename

dtiWorkers

private ArrayList dtiWorkers
Constructor Detail

ConvertDocument

public ConvertDocument(PublishJob publishJob,
                       WTDocument document,
                       Representable part,
                       String documentFile)
Method Detail

publishDocument

public int publishDocument(boolean getContent,
                           boolean doConversion,
                           boolean store,
                           boolean doChildren)

getLocalFileNameFromContentItem

public String getLocalFileNameFromContentItem(ContentItem ci)
Description copied from interface: FileConvert
Returns the local file name for a ContentItem of this CAD system Called by file download for both ApplicationData and URLData items

Supported API: false

Specified by:
getLocalFileNameFromContentItem in interface FileConvert
Parameters:
ci - the ContentItem
Returns:
String local file name

getLocalFileContentFromContentItem

public boolean getLocalFileContentFromContentItem(ContentItem ci,
                                                  File localFile)
Description copied from interface: FileConvert
Downloads the ContentItem for this CAD system to the local file specified. The local file will be the full path, an the file name portion of this will have been determined by a call to getLocalFileNameFromContentItem This method can decide if it will download the file, and return true. if this method decides not to download the file it should return false. The download mechanism will then use ContentServerHelper.service.writeContentStream for Application data and a read of the URL (see getURLDataConnection) for URLData. It is expected that most CAD conveters will simply return false for this method and allow the default mechanism to be used. Called by file download for both ApplicationData and URLData items

Supported API: false

Specified by:
getLocalFileContentFromContentItem in interface FileConvert
Parameters:
ci - the ContentItem
localFile - the local file name
Returns:
true this the file has been downloaded, false if not

getURLDataConnection

public URLConnection getURLDataConnection(URLData urlData)
Description copied from interface: FileConvert
Gets a URLConnection for the default mechanisn to download file content. If getLocalFileContentFRomContentItem has returned true, then that will have downloaded the data and this method will not be called. Typically this method would deal with authentication. Called by file download for URLData items

Supported API: false

Specified by:
getURLDataConnection in interface FileConvert
Parameters:
urlData - the URLData
Returns:
URLConnection

getAuthenticationString

public String getAuthenticationString(URLData urlData)
Description copied from interface: FileConvert
Gets a encrypted authentication string for the specified url data This is will be passed to the distributed CadAgent to allow it to retieve file from the source, typicall ProIntralink Called by file download for URLData items

Supported API: false

Specified by:
getAuthenticationString in interface FileConvert
Parameters:
urlData - the URLData
Returns:
String

useDistributedCadAgent

public boolean useDistributedCadAgent(String url)
Description copied from interface: FileConvert
Returns if a distributed CadAgent could service the conversion of the url data. Although this will be called for each url assocaited to the content of the object, the first takes precedence Currently only Gateway data will return true. Called by file download for URLData items

Supported API: false

Specified by:
useDistributedCadAgent in interface FileConvert
Parameters:
url - the url String
Returns:
boolean

getDocumentWindchillName

private String getDocumentWindchillName()

getDocumentContent

private int getDocumentContent(boolean getContent)

doDocumentConversion

private String doDocumentConversion(boolean doConversion)

storeDocumentRepresentation

private int storeDocumentRepresentation(boolean store,
                                        boolean doChildren,
                                        File outDir)

setDocumentWorker

private void setDocumentWorker(String in)

processZIPFile

private boolean processZIPFile()

decodeEDFileContent

private void decodeEDFileContent()

doEncodeFileName

private String doEncodeFileName(String f)

writeDocumentXML

private void writeDocumentXML(WTDocument d,
                              ContentItem ci,
                              File tempDir)