public final class ResourceUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addObjectNameToPath(java.lang.String relativePath)
Adds an object name to the path, for example:
input: /Company ABC/AsiaPac
output: /Company ABC/AsiaPac/AsiaPac
See unit test for more details.
|
static java.lang.String |
getBundleName(java.lang.String bundleFieldPath)
Gets the name of the Bundle from the bundleFieldPath.
|
static java.lang.String |
getFieldName(java.lang.String bundleFieldPath)
Gets the name of the Field from the bundleFieldPath.
|
static java.lang.String |
getFullPath(ContentType contentType,
java.lang.String rawPath) |
static java.lang.String |
getFullPath(java.lang.String relativePath,
boolean isFolder,
ITypeDefinition typeDefinition)
Returns full resource path provided relative path, boolean isFolder and
the ITypeDefinition for the GRCObject.
|
static java.lang.String |
getFullPath(java.lang.String path,
boolean isFolder,
java.util.List<ITypeDefinition> typeDefinitions)
Returns full resource path provided relative path, boolean isFolder, and
list of all ITypeDefinitions.
|
static java.util.List<IField> |
getModifiedFields(IGRCObject grcObject)
Gets a list of Fields that have been modified on the GRCObject before it is saved (committed).
|
static java.lang.Object |
getOriginalValueForField(java.lang.String bundleFieldPath,
IGRCObject object)
Gets the original value of an IField object by using bundleFieldPath.
|
static java.lang.String |
getRelativePath(java.lang.String fullPath,
ITypeDefinition typeDefinition)
Returns relative path of the IResource provided full path and
ITypedefinition.
|
static java.lang.String |
getRelativePath(java.lang.String fullPath,
java.util.List<ITypeDefinition> typeDefinitions)
Returns relative path of the IResource provided full path and List of all
ITypeDefinitions.
|
static java.lang.String |
getRelativePath(java.lang.String fullPath,
java.lang.String rootFolderPath)
Returns relative path of the IResource provided full path, and root
folder path.
|
static java.lang.String |
getRelativePath(java.lang.String fullPath,
java.lang.String rootFolderPath,
boolean excludeFolderName)
Returns relative path of the IResource provided full path, and root
folder path.
|
static int |
getResourceLevel(ContentType contentType,
Resource resource)
Global Financial Services / Corporate / HR --> 3
Global Financial Services / Corporate --> 2
|
static void |
setFieldValue(IField field,
java.lang.Object value)
Sets the value of the Field with the object specified.
|
static java.lang.String |
trimPathWhitespace(java.lang.String path)
Trims whitespace around path delimiters, i.e.
|
public static void setFieldValue(IField field, java.lang.Object value)
Sets the value of the Field with the object specified. The Field should be of Type ICurrencyField, IBooleanField, IReferenceField, IIntegerField, IDateField, IEnumField, IFloatField, IMultiEnumField, or IStringField.
CurrencyField The value object should be a String array. object[0] should have com.ibm.openpages.api.configuration.ICurrency Metadata. object[1] should have local amount. object[2] should have exchange rate (optional).
BooleanField Value object should be of type Boolean.
IntegerField Value object should be of type Integer.
StringField Value object should be of type String.
DateField Value object should of of type Date.
FloatField Value object should be of type Float.
EnumField Value object should be of type String.
MultiEnumField Value object should be String array.
IReferenceField Value object should be of type String, representing an Id.
field - (required)
field whose value needs to be changedvalue - the value of the fieldpublic static java.lang.String getRelativePath(java.lang.String fullPath,
java.util.List<ITypeDefinition> typeDefinitions)
Returns relative path of the IResource provided full path and List of all ITypeDefinitions. If IGRCObject or IFolder, relative path will be returned; otherwise, full path is returned.
fullPath - the full pathtypeDefinitions - the List of ITypeDefinitionpublic static java.lang.String getRelativePath(java.lang.String fullPath,
ITypeDefinition typeDefinition)
Returns relative path of the IResource provided full path and ITypedefinition. If IGRCObject or IFolder, relative path will be returned; otherwise, full path is returned.
fullPath - the full pathtypeDefinition - the ITypeDefinitionpublic static java.lang.String getRelativePath(java.lang.String fullPath,
java.lang.String rootFolderPath)
Returns relative path of the IResource provided full path, and root folder path. If IGRCObject or IFolder, relative path will be returned; otherwise, full path is returned.
fullPath - the full pathrootFolderPath - the root folder pathpublic static java.lang.String getRelativePath(java.lang.String fullPath,
java.lang.String rootFolderPath,
boolean excludeFolderName)
Returns relative path of the IResource provided full path, and root folder path. If IGRCObject or IFolder, relative path will be returned; otherwise, full path is returned.
fullPath - the full pathrootFolderPath - the root folder pathexcludeFolderName - if 'true' will exclude the root Object Type folder name from the relative path.public static java.lang.String getFullPath(java.lang.String path,
boolean isFolder,
java.util.List<ITypeDefinition> typeDefinitions)
Returns full resource path provided relative path, boolean isFolder, and list of all ITypeDefinitions. Parameters are used to match the relative path against a particular type, which is used to construct the actual Full path for the resource. If the relative path belongs to a folder, then the isFolder value is true.
path - the relative path including the type's root folder without a
leading folder separator '/'. e.g.
"BusinessEntity/Company ABC/AsiaPac/AsiaPac"isFolder - typeDefinitions - the List of possible ITypeDefinition to try to match the
relative path againstIMetaDataService#getTypes()}public static java.lang.String addObjectNameToPath(java.lang.String relativePath)
relativePath - (required)public static java.lang.String trimPathWhitespace(java.lang.String path)
path - A path delimited by StringUtil.PATH_DELIMITERpublic static java.lang.String getFullPath(ContentType contentType,
java.lang.String rawPath)
contentType - Usually the Business Entity content typerawPath - Example: "Global Financial Services / Corporate / HR"public static int getResourceLevel(ContentType contentType,
Resource resource)
contentTypeFullPath - resource - A resource with a path like: "Global Financial Services / Corporate / HR"public static java.lang.String getFullPath(java.lang.String relativePath,
boolean isFolder,
ITypeDefinition typeDefinition)
Returns full resource path provided relative path, boolean isFolder and the ITypeDefinition for the GRCObject. Parameters are used to construct the actual Full path for the resource. If the relative path belongs to a folder, then the isFolder value is true.
This method does not validate whether the path is for an actual GRCObject.
relativePath - (required)
the relative path including a
leading folder separator '/'. e.g.
"/Company ABC/AsiaPac/AsiaPac", Note, it does not include extensions for GRCObjectsisFolder - (required)
true if the path is for a folder and false if the path is for a GRCObjecttypeDefinition - (required)
the TypeDefinition for the object being retrievedpublic static java.util.List<IField> getModifiedFields(IGRCObject grcObject) throws java.lang.Exception
grcObject - the GRC Objectjava.lang.Exceptionpublic static java.lang.Object getOriginalValueForField(java.lang.String bundleFieldPath,
IGRCObject object)
throws java.lang.Exception
bundleFieldPath - (required) colon-separated path of bundle and fieldobject - IGRCObject which has the bundle and field identified in bundleFieldPathjava.lang.Exceptionpublic static java.lang.String getBundleName(java.lang.String bundleFieldPath)
bundleFieldPath - (required) colon-separated bundle field path. i.e. Bundle:Fieldpublic static java.lang.String getFieldName(java.lang.String bundleFieldPath)
bundleFieldPath - (required) colon-separated bundle field path. i.e. Bundle:Field
Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2020. All Rights Reserved.
US Government Users Restricted Rights -
Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.