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 directoryFileNotFoundException
FileNotFoundException
- 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 fromIOException
WTException
PropertyVetoException
WTException
public File downloadPrimary(WTDocument theDoc, File location) throws IOException, WTException, PropertyVetoException
theDoc
- - WTDocument object to download primary content fromlocation
- - an existing directory to download toIOException
WTException
PropertyVetoException
WTException
public 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 toIOException
WTException
PropertyVetoException
WTException
public static void deletePrimary(WTDocument theDoc) throws WTException, PropertyVetoException
theDoc
- - WTDocument object to download primary content fromWTException
PropertyVetoException
WTException
public static void deletePrimary(FormatContentHolder ch) throws WTException, PropertyVetoException
WTException
PropertyVetoException
public static void deletePrimary(FormatContentHolder ch, boolean resetFormat) throws WTException, PropertyVetoException
WTException
PropertyVetoException
public 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 contentWTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
ObjectNoLongerExistsException
FileNotFoundException
WTException
IOException
public static void updatePrimary(FormatContentHolder theDoc, File theFile, String filename, String categoryType) throws WTException, PropertyVetoException, ObjectNoLongerExistsException, FileNotFoundException, IOException
WTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
public static void updatePrimary(FormatContentHolder theDoc, File theFile, String filename, boolean iterate) throws WTException, PropertyVetoException, ObjectNoLongerExistsException, FileNotFoundException, IOException
WTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
public static void updatePrimary(FormatContentHolder theDoc, File theFile, String filename, boolean iterate, Map<String,String> updateIBAs) throws WTException, PropertyVetoException, ObjectNoLongerExistsException, FileNotFoundException, IOException
WTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
public static void updatePrimary(FormatContentHolder theDoc, File theFile, String filename, boolean iterate, Map<String,String> updateIBAs, String categoryType) throws WTException, PropertyVetoException, ObjectNoLongerExistsException, FileNotFoundException, IOException
WTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
public static void updatePrimary(EPMDocument epmdoc, String newAuthoringApp, File theFile, String filename, boolean iterate) throws WTException, PropertyVetoException, ObjectNoLongerExistsException, FileNotFoundException, IOException, InvocationTargetException
WTException
PropertyVetoException
ObjectNoLongerExistsException
FileNotFoundException
IOException
InvocationTargetException
public static Enumeration getContents(ContentHolder theHolder) throws WTException, PropertyVetoException
theHolder
- - any ContentHolderWTException
PropertyVetoException
WTException
public 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 foundIOException
public File downloadContent(ApplicationData theItem, String fn) throws WTException, IOException
WTException
IOException
public 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 existIOException
public static void deleteContent(ContentHolder theHolder, ContentItem theItem) throws WTException, PropertyVetoException
theHolder
- - any ContentHoldertheItem
- - a ContentItem held by theHolderWTException
- if the item can't by foundPropertyVetoException
public ContentHolder deleteAllContent(ContentHolder theHolder) throws WTException, PropertyVetoException
theHolder
- - any ContentHolderWTException
- if the item can't by foundPropertyVetoException
public 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 contentWTException
PropertyVetoException
FileNotFoundException
IOException
Exception
public 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.ContentCategoryRBWTException
PropertyVetoException
FileNotFoundException
IOException
Exception
public 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 contentWTException
PropertyVetoException
FileNotFoundException
IOException
public 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 categoryWTException
PropertyVetoException
FileNotFoundException
IOException
public static InputStream getIsFromContentHolder(ContentHolder ch, ContentRoleType crt) throws WTException
ch
- ContentHoldercrt
- ContentRoleTypeWTException
public static InputStream getIsFromContentHolder(ContentHolder ch, String contentName) throws WTException
ch
- ContentHoldercontentName
- StringWTException
public 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
Exception
public static ContentItem getPrimary(ContentHolder ch) throws Exception
Exception