|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.4) E14255-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.content.federated.ContentHelper
public class ContentHelper
Helper class for dealing with Content
Field Summary | |
---|---|
static String |
NODE_REQUEST_ATTRIBUTE_NAME
A name to be used for a common request attribute that a content node can be placed under. |
Constructor Summary | |
---|---|
ContentHelper()
|
Method Summary | |
---|---|
static Node |
addFolder(ContentContext context,
ObjectClass objectClass,
String relPath,
Property[] properties)
This method adds a new node to the repository of type folder. |
static Node |
addFolder(ContentContext context,
String relPath)
This method adds a new node to the repository of type ObjectClass.FOLDER. |
static String |
pathInfoEncode(String pathInfo)
Correctly URLEncode a path-info string. |
static byte[] |
toByteArray(InputStream inputStream)
Converts an InputStream to a byte[]. |
static byte[] |
toByteArray(InputStream inputStream,
int maxSize)
Converts an InputStream to a byte[]. |
static byte[] |
toByteArray(InputStream inputStream,
long start,
long length)
Converts an InputStream to a byte[]. |
static String |
toHTML(String in)
Convert an arbitrary string to HTML which will display as the original string intended. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NODE_REQUEST_ATTRIBUTE_NAME
Constructor Detail |
---|
public ContentHelper()
Method Detail |
---|
public static Node addFolder(ContentContext context, String relPath) throws AuthorizationException, NodeExistsException, NoSuchObjectClassException, RepositoryException
context
- The ContentContext ObjectrelPath
- The absolute path to this node, appended with the node's name. For example /A/B/C indicates a
node C being added under the parent node B.
AuthorizationException
- - if the user does not have CREATE capability on the parent node, or if the user does not have
INSTANTIATE capability on the type of the node. This exception will also be thrown if the user is not authorizated by the repository.
NodeExistsException
- - if the parent Node already has a child with the same name.
NoSuchObjectClassException
- - if the node's ObjectClass doesn't exist.
RepositoryException
- - for any other exceptionpublic static Node addFolder(ContentContext context, ObjectClass objectClass, String relPath, Property[] properties) throws AuthorizationException, NodeExistsException, NoSuchObjectClassException, RepositoryException
This type must be derived from ObjectClass.FOLDER if this is a WLP repository, or must be declared in content-config.xml with the RepositoryConfig.FOLDER_BADGES_KEY property on the repository . todo: add an example
context
- The ContentContext ObjectobjectClass
- The ObjectClass of this folder. If it's ObjectClass.FOLDER, then use addFolder(ContentContext context, String relPath).
Otherwise, this ObjectClass must be a child of NT_FOLDER relPath
- The absolute path to this node, appended with the node's name. For example /A/B/C indicates a
node C being added under the parent node B.properties
- The properties of the node, which can be null
AuthorizationException
- - if the user does not have CREATE capability on the parent node, or if the user does not have
INSTANTIATE capability on the type of the node. This exception will also be thrown if the user is not authorizated by the repository.
NodeExistsException
- - if the parent Node already has a child with the same name.
NoSuchObjectClassException
- - if the node's ObjectClass doesn't exist.
RepositoryException
- - for any other exceptionpublic static String pathInfoEncode(String pathInfo)
This can be used to pass a contentId as Path-Info to the ShowDocServlet.
This will url encode the pathInfo, but will leave "/"'s alone.
pathInfo
- The path-info string.
public static String toHTML(String in)
This will replace the characters '&', '"', '<', and '>' with '&', "', '<', and '>', respectively.
in
- The string to convert to HTML.
public static byte[] toByteArray(InputStream inputStream)
inputStream
- - the InputStream to convert to the byte[].
public static byte[] toByteArray(InputStream inputStream, int maxSize) throws RepositoryException
Otherwise, we can fit the InputStream data into the cache, and will return that byte array instead of the InputStream. In this case, the InputStream will be consumed and closed.
inputStream
- - the InputStream to convert to the byte[].maxSize
- The maximum size to convert.
RepositoryException
- if the conversion fails.public static byte[] toByteArray(InputStream inputStream, long start, long length)
inputStream
- - the InputStream to convert to the byte[].start
- - the index to start at.length
- - the index to end at.
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.4) E14255-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |