public class ContentToolbox
extends Object
implements RemoteAccess
| Modifier and Type | Field and Description |
|---|---|
static DataFormatReference |
formatRef |
static int |
MAJOR |
static int |
MINOR |
| Constructor and Description |
|---|
ContentToolbox() |
ContentToolbox(boolean warn) |
| Modifier and Type | Method and Description |
|---|---|
void |
createTempDir()
Creates a temporary directoy under Windchill/temp for use with this ContentToolbox object.
|
File |
createTempDir(File parentDir)
Creates a temporary directoy under a given parent dir for use with this ContentToolbox object.
|
String |
createTempDir(String parentDir)
Creates a temporary directoy under a given parent dir for use with this ContentToolbox object.
|
ContentHolder |
deleteAllContent(ContentHolder theHolder)
Deletes all ContentItems (including Primary) from the ContentHolder.
|
static void |
deleteContent(ContentHolder theHolder,
ContentItem theItem)
Deletes the specified ContentItem from the ContentHolder.
|
static void |
deletePrimary(FormatContentHolder ch) |
static void |
deletePrimary(FormatContentHolder ch,
boolean resetFormat) |
static void |
deletePrimary(WTDocument theDoc)
Deletes the primary content of a WTDocument.
|
boolean |
deleteTempDir() |
boolean |
deleteTempDirectory()
Deletes the temporary directory associated with this toolbox.
|
static File |
doUncompressFile(String inFileName,
String outFileName)
Uncompress the incoming file.
|
File |
downloadContent(ApplicationData theItem)
Download the specified ContentItem from the ContentHolder to the temp directory and return it as a File.
|
File |
downloadContent(ApplicationData theItem,
File location)
Download the specified ContentItem from the ContentHolder to the temp directory and return it as a File.
|
File |
downloadContent(ApplicationData theItem,
String fn) |
File |
downloadPrimary(FormatContentHolder theDoc)
Downloads and returns the primary content of the WTDocument.
|
File |
downloadPrimary(FormatContentHolder theDoc,
String fileName)
Downloads and returns the primary content of the WTDocument to the specified file.
|
File |
downloadPrimary(WTDocument theDoc,
File location)
Downloads and returns the primary content of the WTDocument to the specified location.
|
static Enumeration |
getContents(ContentHolder theHolder)
Returns all secondary contents for an object as an Enumeration.
|
static String |
getExtension(String f)
Used to extract and return the extension of a given file.
|
static String |
getFileName(String f)
Used to extract the filename without its extension.
|
static InputStream |
getIsFromContentHolder(ContentHolder ch,
ContentRoleType crt)
Method getIsFromContentHolder.
|
static InputStream |
getIsFromContentHolder(ContentHolder ch,
String contentName)
Method getIsFromContentHolder.
|
static ContentItem |
getPrimary(ContentHolder ch) |
File |
getTempDir()
Returns the currently assigned temporary directory or null if it hasn't been assigned.
|
String |
getTempDirName() |
static void |
main(String[] args) |
void |
setTempDir(File theDirectory)
Assigns the temporary directory for this toolbox to the specified directory.
|
static ContentHolder |
updateContent(ContentHolder theHolder,
File theFile,
String filename)
Replaces an existing secondary ContentItem with the specified File if it has the same name or creates a new ContentItem
if it does not.
|
static ContentHolder |
updateContent(ContentHolder theHolder,
File theFile,
String filename,
String category)
Replaces an existing secondary ContentItem with the specified File if it has the same name or creates a new ContentItem
if it does not.
|
static ContentHolder |
updateContent(ContentHolder theHolder,
String theFile,
String filename)
Replaces an existing secondary ContentItem with the specified File if it has the same name or creates a new ContentItem
if it does not.
|
static ContentHolder |
updateContent(ContentHolder theHolder,
String theFile,
String filename,
String category)
Replaces an existing secondary ContentItem with the specified File if it has the same name or creates a new ContentItem
if it does not.
|
static void |
updatePrimary(EPMDocument epmdoc,
String newAuthoringApp,
File theFile,
String filename,
boolean iterate) |
static void |
updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename)
Creates or Updates the primary content of a WTDocument using the specified file.
|
static void |
updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate) |
static void |
updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate,
Map<String,String> updateIBAs) |
static void |
updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate,
Map<String,String> updateIBAs,
String categoryType) |
static void |
updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
String categoryType) |
public static final int MAJOR
public static final int MINOR
public static final DataFormatReference formatRef
public ContentToolbox(boolean warn)
public ContentToolbox()
public void createTempDir()
throws IOException
IOException - if there is a problem reading WTPropertiespublic String createTempDir(String parentDir)
throws IOException
IOException - if there is a problempublic File createTempDir(File parentDir)
throws IOException
IOException - if there is a problempublic File getTempDir()
public String getTempDirName()
public void setTempDir(File theDirectory)
throws FileNotFoundException
theDirectory - - existing directoryFileNotFoundExceptionFileNotFoundException - if the directory does not existpublic boolean deleteTempDirectory()
public boolean deleteTempDir()
public File downloadPrimary(FormatContentHolder theDoc)
throws IOException,
WTException,
PropertyVetoException
theDoc - - WTDocument object to download primary content fromIOExceptionWTExceptionPropertyVetoExceptionWTExceptionpublic File downloadPrimary(WTDocument theDoc,
File location)
throws IOException,
WTException,
PropertyVetoException
theDoc - - WTDocument object to download primary content fromlocation - - an existing directory to download toIOExceptionWTExceptionPropertyVetoExceptionWTExceptionpublic File downloadPrimary(FormatContentHolder theDoc,
String fileName)
throws IOException,
WTException,
PropertyVetoException
theDoc - - WTDocument object to download primary content fromfile - - a file (within an existing directory) to download toIOExceptionWTExceptionPropertyVetoExceptionWTExceptionpublic static void deletePrimary(WTDocument theDoc)
throws WTException,
PropertyVetoException
theDoc - - WTDocument object to download primary content fromWTExceptionPropertyVetoExceptionWTExceptionpublic static void deletePrimary(FormatContentHolder ch)
throws WTException,
PropertyVetoException
WTExceptionPropertyVetoExceptionpublic static void deletePrimary(FormatContentHolder ch,
boolean resetFormat)
throws WTException,
PropertyVetoException
WTExceptionPropertyVetoExceptionpublic static void updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException
theDoc - - WTDocument object to download primary content fromtheFile - - the new primary contentfilename - - the filename to use when creating the contentWTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionWTExceptionIOExceptionpublic static void updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
String categoryType)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException
WTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionpublic static void updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException
WTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionpublic static void updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate,
Map<String,String> updateIBAs)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException
WTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionpublic static void updatePrimary(FormatContentHolder theDoc,
File theFile,
String filename,
boolean iterate,
Map<String,String> updateIBAs,
String categoryType)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException
WTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionpublic static void updatePrimary(EPMDocument epmdoc,
String newAuthoringApp,
File theFile,
String filename,
boolean iterate)
throws WTException,
PropertyVetoException,
ObjectNoLongerExistsException,
FileNotFoundException,
IOException,
InvocationTargetException
WTExceptionPropertyVetoExceptionObjectNoLongerExistsExceptionFileNotFoundExceptionIOExceptionInvocationTargetExceptionpublic static Enumeration getContents(ContentHolder theHolder)
throws WTException,
PropertyVetoException
theHolder - - any ContentHolderWTExceptionPropertyVetoExceptionWTExceptionpublic File downloadContent(ApplicationData theItem)
throws WTException,
IOException
theItem - - an ApplicationData held by theHolder (remember ApplicationData is a type of ContentItem that represents a file)WTException - if the item can't by foundIOExceptionpublic File downloadContent(ApplicationData theItem,
String fn)
throws WTException,
IOException
WTExceptionIOExceptionpublic File downloadContent(ApplicationData theItem,
File location)
throws WTException,
FileNotFoundException,
IOException
theItem - - an ApplicationData held by theHolder (remember ApplicationData is a type of ContentItem that represents a file)location - - an existing directory to download toWTException - if the item can't by foundFileNotFoundException - if the file doesn't existIOExceptionpublic static void deleteContent(ContentHolder theHolder,
ContentItem theItem)
throws WTException,
PropertyVetoException
theHolder - - any ContentHoldertheItem - - a ContentItem held by theHolderWTException - if the item can't by foundPropertyVetoExceptionpublic ContentHolder deleteAllContent(ContentHolder theHolder)
throws WTException,
PropertyVetoException
theHolder - - any ContentHolderWTException - if the item can't by foundPropertyVetoExceptionpublic static ContentHolder updateContent(ContentHolder theHolder,
String theFile,
String filename)
throws Exception
theHolder - - any ContentHoldertheFile - - theFile on the server to uploadfilename - - the filename to use when adding the contentWTExceptionPropertyVetoExceptionFileNotFoundExceptionIOExceptionExceptionpublic static ContentHolder updateContent(ContentHolder theHolder,
String theFile,
String filename,
String category)
throws Exception
theHolder - - any ContentHoldertheFile - - theFile on the server to uploadfilename - - the filename to use when adding the contentfilename - - content category from com.ptc.windchill.cadx.editattachments.ContentCategoryRBWTExceptionPropertyVetoExceptionFileNotFoundExceptionIOExceptionExceptionpublic static ContentHolder updateContent(ContentHolder theHolder,
File theFile,
String filename)
throws WTException,
PropertyVetoException,
FileNotFoundException,
IOException
theHolder - - any ContentHoldertheFile - - theFile on the server to uploadfilename - - the filename to use when adding the contentWTExceptionPropertyVetoExceptionFileNotFoundExceptionIOExceptionpublic static ContentHolder updateContent(ContentHolder theHolder,
File theFile,
String filename,
String category)
throws WTException,
PropertyVetoException,
FileNotFoundException,
IOException
theHolder - - any ContentHoldertheFile - - theFile on the server to uploadfilename - - the filename to use when adding the contentfilename - - application data categoryWTExceptionPropertyVetoExceptionFileNotFoundExceptionIOExceptionpublic static InputStream getIsFromContentHolder(ContentHolder ch,
ContentRoleType crt)
throws WTException
ch - ContentHoldercrt - ContentRoleTypeWTExceptionpublic static InputStream getIsFromContentHolder(ContentHolder ch,
String contentName)
throws WTException
ch - ContentHoldercontentName - StringWTExceptionpublic static File doUncompressFile(String inFileName,
String outFileName)
inFileName - Name of the file to be uncompressedoutFileName - New file name, if null old - gz is usedpublic static String getExtension(String f)
f - Incoming file to get the extension ofString representing the extension of the incoming
file.public static String getFileName(String f)
f - Incoming file to get the filenameString representing the filename without its
extension.public static void main(String[] args)
throws Exception
Exceptionpublic static ContentItem getPrimary(ContentHolder ch)
throws Exception
Exception