public class ManagedFileDirectoryUtility
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
static java.lang.String |
DEFAULT_DIRECTORY_SEPARATOR
This is the directory separator used.
|
static java.lang.Long |
DEFAULT_STORE_DIRECTORY_PARENT_ID
This is the store directory's parent id in the
CMFILEDIR table. |
Constructor and Description |
---|
ManagedFileDirectoryUtility(java.sql.Connection connection)
This is the constructor for this class.
|
ManagedFileDirectoryUtility(java.sql.Connection connection,
boolean insideCommerceEnvironment)
This is the constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
createDirectory(java.lang.String astrStoreDirectory,
java.lang.String astrPathName)
This method will first check if the path name
astrPathName
already exists for the store directory astrStoreDirectory . |
int |
deleteDirectoryRecord(java.lang.Long aDirId)
This method deletes one directory record in the
CMFILEDIR table. |
java.util.ArrayList |
getAllSubDirectoryIds(java.lang.Long anParentDirectoryId)
This method gets all the ids of all the sub directories for the given parent directory id.
|
java.util.ArrayList |
getAllSubDirectoryIds(java.lang.String astrStoreDirectory,
java.lang.String astrParentPath)
This method gets all the ids of all the sub directories for the store directory and given parent directory full path.
|
java.util.ArrayList |
getChildsFromParentId(java.lang.Long anParentId)
This method returns the first level child directories of the given parent directory.
|
java.lang.Long |
getIdFromParentIdAndDirectoryName(java.lang.Long anParentId,
java.lang.String astrDirectoryName)
This method gets the id a given parent directory id and directory name.
|
java.lang.Long |
getIdFromStoreDirectoryAndPath(java.lang.String astrStoreDir,
java.lang.String astrPathName)
This method will return the content managed file directory id for a given store directory and path.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.Long DEFAULT_STORE_DIRECTORY_PARENT_ID
CMFILEDIR
table.public static final java.lang.String DEFAULT_DIRECTORY_SEPARATOR
public ManagedFileDirectoryUtility(java.sql.Connection connection) throws java.sql.SQLException
connection
- The database connection to be set.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public ManagedFileDirectoryUtility(java.sql.Connection connection, boolean insideCommerceEnvironment) throws java.sql.SQLException
connection
- The database connection to be set.insideCommerceEnvironment
- True if the utility is running inside Commerce environmentjava.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.lang.Long getIdFromParentIdAndDirectoryName(java.lang.Long anParentId, java.lang.String astrDirectoryName) throws java.sql.SQLException
astrDirectoryName
will be converted to lower case characters and use this
string to search the IDENTIFIER
column on the CMFILEDIR
table.anParentId
- The parent directory id.astrDirectoryName
- The directory name.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.lang.Long createDirectory(java.lang.String astrStoreDirectory, java.lang.String astrPathName) throws java.sql.SQLException
This method will first check if the path name astrPathName
already exists for the store directory astrStoreDirectory
.
If the path name astrPathName
already exists for the store directory astrStoreDirectory
,
this method will do nothing. It will simply return the content managed file directory id for this path.
If the path name astrPathName
does not exist for the store directory astrStoreDirectory
,
it will try to create the directory. If the store directory astrStoreDirectory
is not found,
this method will first create the store directory.
This method will then check the directory astrPathName
and its ancestor directories.
If any directory on the path is not in the database, it will be created.
Note that the astrPathName
is the directory full path name
which is the relative directory to the store directory name.
The new directory name found on the astrPathName
will be
stored as the DISPLAYNAME
field in the database. The code
will convert the directory name to lower case letters and
store it in the IDENTIFIER
field.
If the astrPathName
is an empty string and the store directory does not exist in the database,
the utility will do two things. It will create the store directory and return its directory id.
If the astrPathName
is an empty string and the store directory exists in the database,
the utility will just return its directory id.
astrStoreDirectory
- The store directory name.astrPathName
- The directory full path name.astrPathName
.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.lang.Long getIdFromStoreDirectoryAndPath(java.lang.String astrStoreDir, java.lang.String astrPathName) throws java.sql.SQLException
astrStoreDir
- The store directory.astrPathName
- The directory full path name which is the relative path to the store directory.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.util.ArrayList getChildsFromParentId(java.lang.Long anParentId) throws java.sql.SQLException
ArrayList
of CMFileDirectoryDataBean
will be returned.anParentId
- The id of the parent directory.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.util.ArrayList getAllSubDirectoryIds(java.lang.Long anParentDirectoryId) throws java.sql.SQLException
Long
objects which are content managed file directory
ids of all the sub directories.
These sub directories include all the children and grand children.anParentDirectoryId
- The id of the parent directory.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public java.util.ArrayList getAllSubDirectoryIds(java.lang.String astrStoreDirectory, java.lang.String astrParentPath) throws java.sql.SQLException
astrPathName
is the directory full path name which is the relative path to the store directory name.
This will return list of Long
objects which are content managed file directory ids
of all the sub directories.
These sub directories include all the children and grand children.astrStoreDirectory
- The store directory.astrParentPath
- The parent directory full path.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.public int deleteDirectoryRecord(java.lang.Long aDirId) throws java.sql.SQLException
CMFILEDIR
table.aDirId
- The directory id to be deleted.java.sql.SQLException
- This is thrown when an unexpected error occurs in the database.