public class ProductLocation extends DBPersist
Product Location
Location semantics depend upon what Product is used for.Modifier and Type | Field and Description |
---|---|
static short |
ClassId |
static int |
CONTAINER_FILE |
static int |
CONTAINER_FTP |
static int |
CONTAINER_HTTP |
static int |
CONTAINER_HTTPS |
static int |
CONTAINER_JDBC |
static int |
CONTAINER_LOTUS |
static int |
CONTAINER_ODBC |
static int |
CONTAINER_WARE |
Constructor and Description |
---|
ProductLocation() |
ProductLocation(JDCConnection oConn,
java.lang.String iIdLocation)
Load ProductLocation from database
|
Modifier and Type | Method and Description |
---|---|
boolean |
delete(JDCConnection oConn)
Delete Productocation
If ProductLocation URL point to a file that does not exist then an SQLException will be raised.
|
int |
getContainerType()
Get numeric identifier for container type.
|
java.lang.String |
getPath()
Get Path to URL or file
|
java.lang.String |
getProductType()
Get product type from file path.
|
java.lang.String |
getURL()
Get URL for ProductLocation
|
boolean |
rename(JDCConnection oConn,
FileSystem oFileSys,
java.lang.String sNewFile)
Rename a Product Location
This method updates the xfile value from table k_prod_locats and changes the physical file name accordingly
|
void |
setLength(int iLen)
Set file length in bytes
|
void |
setLength(long lLen)
Set file length in bytes
Max file length is 2147483647 bytes
|
void |
setPath(java.lang.String sHost,
java.lang.String sLocalPath)
Set Local Path for ProductLocation
File Separator is taken from System.getProperty("file.separator") method.
|
void |
setPath(java.lang.String sProtocol,
java.lang.String sHost,
java.lang.String sPath,
java.lang.String sFile,
java.lang.String sOriginalFile)
Set File Path
|
void |
setPath(java.lang.String sProtocol,
java.lang.String sHost,
java.lang.String sPath,
java.lang.String sFile,
java.lang.String sOriginalFile,
java.lang.String sAnchor)
Set File Path
|
void |
setURL(java.lang.String sURL)
Set URL for ProductLocation
|
boolean |
store(JDCConnection oConn)
Store ProductLocation
Properties gu_location, dt_uploaded, dt_modified, id_cont_type,
id_prod_type, pg_prod_locat and status are automatically set if not present
at internal properties colelction when calling store().
|
void |
upload(com.knowgate.storage.Table oConn,
FileSystem oFileSys,
java.lang.String sSourcePath,
java.lang.String sSourceFile,
java.lang.String sTargetPath,
java.lang.String sTargetFile)
Move a File from a temporary directory up to the final location referenced
by ProductLocation URL.
|
allcaps, allcaps, clear, clone, columns, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getIntArray, getInteger, getIntegerArray, getIntervalPart, getItemMap, getItems, getMoney, getPrimaryKey, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTime, getTimeOfDay, getTimestamp, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, setPrimaryKey, size, toLowerCase, toUpperCase, toXML, toXML, toXML, values
public static final short ClassId
public static final int CONTAINER_FILE
public static final int CONTAINER_HTTP
public static final int CONTAINER_HTTPS
public static final int CONTAINER_FTP
public static final int CONTAINER_ODBC
public static final int CONTAINER_LOTUS
public static final int CONTAINER_JDBC
public static final int CONTAINER_WARE
public ProductLocation()
public ProductLocation(JDCConnection oConn, java.lang.String iIdLocation) throws java.sql.SQLException
oConn
- Database ConenctioniIdLocation
- GUID of ProductLocation to be loadedjava.sql.SQLException
public java.lang.String getPath()
Get Path to URL or file
public java.lang.String getURL()
public int getContainerType()
Get numeric identifier for container type.
Usually, container type is computed from protocol.Protocol | Container Type |
file:// | CONTAINER_FILE |
http:// | CONTAINER_HTTP |
https:// | CONTAINER_HTTPS |
ftp:// | CONTAINER_FTP |
odbc:// | CONTAINER_ODBC |
lotus:// | CONTAINER_LOTUS |
jdbc:// | CONTAINER_JDBC |
ware:// | CONTAINER_WARE |
public java.lang.String getProductType()
Get product type from file path.
public void setURL(java.lang.String sURL) throws java.net.MalformedURLException
Set URL for ProductLocation
java.net.MalformedURLException
public void setLength(long lLen) throws java.lang.IllegalArgumentException
Set file length in bytes
Max file length is 2147483647 byteslLen
- Length of file pointed by ProductLocation URLjava.lang.IllegalArgumentException
- If lLen > 2147483647public void setLength(int iLen)
Set file length in bytes
lLen
- Length of file pointed by ProductLocation URLpublic void setPath(java.lang.String sProtocol, java.lang.String sHost, java.lang.String sPath, java.lang.String sFile, java.lang.String sOriginalFile)
Set File Path
sProtocol
- Protocol. One of { "file://", "http://", "https://", "ftp://", "odbc://", "jdbc://", "ware://" }sHost
- Host Name for electronic Products or WareHouse Name for physical Products. Example: "www.hipergate.org"sPath
- Absolute Access Path. Example: "/opt/knowgate/users/"sFile
- Uploaded File NamesOriginalFile
- Original File Name before uploading.
In some cases, files may be renamed upon upload and then renamed again to their original names when downloaded.public void setPath(java.lang.String sProtocol, java.lang.String sHost, java.lang.String sPath, java.lang.String sFile, java.lang.String sOriginalFile, java.lang.String sAnchor)
Set File Path
sProtocol
- Protocol. One of { "file://", "http://", "https://", "ftp://", "odbc://", "jdbc://", "ware://" }sHost
- Host Name for electronic Products or WareHouse Name for physical Products. Example: "www.hipergate.org"sPath
- Absolute Access Path. Example: "/opt/knowgate/users/"sFile
- Uploaded File NamesOriginalFile
- Original File Name before uploading.
In some cases, files may be renamed upon upload and then renamed again to their original names when downloaded.sAnchor
- Anchorpublic void setPath(java.lang.String sHost, java.lang.String sLocalPath)
Set Local Path for ProductLocation
File Separator is taken from System.getProperty("file.separator") method.sHost
- Host NamesLocalPath
- Full Local Path and File Name.public boolean store(JDCConnection oConn) throws java.sql.SQLException
Store ProductLocation
Properties gu_location, dt_uploaded, dt_modified, id_cont_type, id_prod_type, pg_prod_locat and status are automatically set if not present at internal properties colelction when calling store().public boolean rename(JDCConnection oConn, FileSystem oFileSys, java.lang.String sNewFile) throws java.lang.Exception, java.io.IOException, java.sql.SQLException, java.lang.SecurityException
Rename a Product Location
This method updates the xfile value from table k_prod_locats and changes the physical file name accordinglyoConn
- Database connectionoFileSys
- FileSystem Object for accessing physical filesNewFile
- New file namejava.lang.Exception
java.io.IOException
java.sql.SQLException
java.lang.SecurityException
public void upload(com.knowgate.storage.Table oConn, FileSystem oFileSys, java.lang.String sSourcePath, java.lang.String sSourceFile, java.lang.String sTargetPath, java.lang.String sTargetFile) throws java.lang.Exception, java.io.IOException, com.knowgate.storage.StorageException
oConn
- DataSource ConnectionoFileSys
- FileSystem object used for moving the file.sSourcePath
- Source Directory. For example: "file:///tmp/archives/"sSourceFile
- Original File Name. For example: "notes.pdf"sTargetPath
- Target Directory. For example: "ftp://saturno/opt/storage/"sTargetFile
- Final File Name. For Example: "notes-13-05-03.pdf"java.lang.Exception
java.io.IOException
com.knowgate.storage.StorageException
Environment
public boolean delete(JDCConnection oConn) throws java.sql.SQLException
Delete Productocation
If ProductLocation URL point to a file that does not exist then an SQLException will be raised.