public class AWMInternalUtility
extends java.lang.Object
| Constructor and Description |
|---|
AWMInternalUtility() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsNullByte(java.lang.String pValue)
Checks if the given string contains NULL bytes (
(byte) 0)). |
static IMassProcessingSubContext |
createMassProcessingSubcontext(IMassProcessingToolContext pParentToolContext)
This method is used to create a new
IMassProcessingSubContext. |
static <T extends IToolInputParameter> |
findInputParameter(RToolInParameter pInParameter,
IToolContext pToolContext,
java.lang.Class<T> pType)
|
static <T extends IModeledToolOutputParameter> |
findOutputParameter(RToolOutParameter pOutParm,
IToolContext pToolContext,
java.lang.Class<T> pType)
Searches for a
IModeledToolOutputParameter in the given
IToolContext based on the given RToolOutParameter. |
static java.lang.String |
getContributingHelpPlugin()
Gets contributing help plug-in of the the installed product.
|
static java.lang.String |
getDataResponseToString(IGetDataResponse pResponse)
Converts an
IGetDataResponse to a string by using a buffered
reader and IGetDataResponse.getLocalCodePage() for encoding. |
static <T extends IToolInputParameter> |
getFirstInputParameterWithFallBack(IToolContext pToolContext,
java.lang.String pName,
java.lang.Class<T> pType,
int pFallBackIndex)
Calls
ToolUtility.getInputParameter(IToolContext, String, Class)
to get a parameter. |
static <T extends IModeledToolOutputParameter> |
getFirstOutputParameterWithFallBack(IToolContext pToolContext,
java.lang.String pName,
java.lang.Class<T> pType,
int pFallBackIndex)
Calls
ToolUtility.getOutputParameter(IToolContext, String, Class)
to get a parameter. |
static <T extends IToolParameter> |
getFirstParameterFallback(java.lang.String pName,
java.lang.Class<T> pType,
int pFallBackIndex,
TaurusToolException pNotFoundException,
java.util.List<? extends IToolParameter> pAvailableParameters,
java.lang.String pParameterLabel) |
static EToolResultSeverity |
getSeverityFromReturnCode(TAURUSConfiguration pModel,
int pReturnCode)
Gets the
EToolResultSeverity from the given return code and AWM model. |
static boolean |
isCacheElement()
Gets whether AWM elements, element lists and column configurations will
be cached.
|
static java.lang.String |
replaceNullBytes(java.lang.String pValue)
Replaces
null with an empty string and removes null bytes (
(byte) 0). |
static java.lang.String |
replaceResourceInvalidCharacter(java.lang.String pResourceName)
Replaces all invalid characters from the given resource name with theirs
INTEGER values.
|
static void |
saveCachedFile(org.w3c.dom.Document doc,
org.eclipse.core.resources.IFile cacheFile)
Save the content of the given document in the given file (create the file
if it doesn't exists)
|
public static void saveCachedFile(org.w3c.dom.Document doc,
org.eclipse.core.resources.IFile cacheFile)
throws javax.xml.transform.TransformerException,
javax.xml.transform.TransformerFactoryConfigurationError
doc - The document whose content will be saved.cacheFile - The file in which the document content will be savedjavax.xml.transform.TransformerException - If an unrecoverable error occurs during the course of the
transformation what is needed for saving the file.javax.xml.transform.TransformerFactoryConfigurationError - When it is not possible to create a Transformer
instance needed to save the file.public static java.lang.String replaceNullBytes(java.lang.String pValue)
null with an empty string and removes null bytes (
(byte) 0).pValue - the valuenullpublic static <T extends IToolInputParameter> T findInputParameter(RToolInParameter pInParameter, IToolContext pToolContext, java.lang.Class<T> pType) throws TaurusToolException
pInParameter - the RToolInParameterpToolContext - the given IToolContextpType - the Class of the searched IToolInputParameterIToolInputParameter of the IToolContext which
IToolInputParameter.getModelObject() method returns an
RToolInParameter which is equal to the given
RToolInParameter.TaurusToolException - if no IToolInputParameter could be retrieved.public static <T extends IModeledToolOutputParameter> T findOutputParameter(RToolOutParameter pOutParm, IToolContext pToolContext, java.lang.Class<T> pType) throws TaurusToolException
IModeledToolOutputParameter in the given
IToolContext based on the given RToolOutParameter.pOutParm - the RToolOutParameterpToolContext - the given IToolContextpType - the Class of the searched
IModeledToolOutputParameterIToolInputParameter of the IToolContext which
IModeledToolOutputParameter.getModelObject() method
returns an RToolOutParameter which is equal to the given
RToolOutParameter.TaurusToolException - if no IToolInputParameter could be retrieved.public static boolean containsNullByte(java.lang.String pValue)
(byte) 0)).pValue - the string to checktrue if at least one NULL byte is detectedpublic static boolean isCacheElement()
true only if AWM elements will be cached.public static java.lang.String replaceResourceInvalidCharacter(java.lang.String pResourceName)
pResourceName - the resource namepublic static java.lang.String getContributingHelpPlugin()
public static java.lang.String getDataResponseToString(IGetDataResponse pResponse) throws java.io.IOException
IGetDataResponse to a string by using a buffered
reader and IGetDataResponse.getLocalCodePage() for encoding.pResponse - the response to convertjava.io.IOException - if reading the response failspublic static <T extends IToolInputParameter> T getFirstInputParameterWithFallBack(IToolContext pToolContext, java.lang.String pName, java.lang.Class<T> pType, int pFallBackIndex) throws TaurusToolException
ToolUtility.getInputParameter(IToolContext, String, Class)
to get a parameter. If that fails, we attempt to get a matching parameter
from the fall-back index.
Any fall-back attempt will log a warning message with the original exception. If the attempt also fails, a more detailed exception will be thrown.
pToolContext - the tool contextpName - expected parameter namepType - expected parameter typepFallBackIndex - index of the parameter that was used before all parameters had
extension IDsTaurusToolException - if the parameter cannot be found or its type does not matchpublic static <T extends IModeledToolOutputParameter> T getFirstOutputParameterWithFallBack(IToolContext pToolContext, java.lang.String pName, java.lang.Class<T> pType, int pFallBackIndex) throws TaurusToolException
ToolUtility.getOutputParameter(IToolContext, String, Class)
to get a parameter. If that fails, we attempt to get a matching parameter
from the fall-back index.pToolContext - the tool contextpName - expected parameter namepType - expected parameter typepFallBackIndex - index of the parameter that was used before all parameters had
extension IDsTaurusToolException - if the parameter cannot be found or its type does not matchpublic static <T extends IToolParameter> T getFirstParameterFallback(java.lang.String pName, java.lang.Class<T> pType, int pFallBackIndex, TaurusToolException pNotFoundException, java.util.List<? extends IToolParameter> pAvailableParameters, java.lang.String pParameterLabel) throws TaurusToolException
pName - expected parameter namepType - expected parameter typepFallBackIndex - fall-back indexpNotFoundException - the exception that has been thrown in the first placepAvailableParameters - the list of available parameterspParameterLabel - either input parameter or
output parameter (translated)TaurusToolException - if no matching parameter was found under the fall-back indexpublic static IMassProcessingSubContext createMassProcessingSubcontext(IMassProcessingToolContext pParentToolContext) throws TaurusToolException
IMassProcessingSubContext.
This should only be required if a mass processing context should be
overridden.
This method creates a new IExecutionContext by using the
ISystemImage (IExecutionContext.getSystemImage()) of the
parent IExecutionContext.
The newly created IExecutionContext will be initialized
(IExecutionContext.initContext(com.microfocus.awm.model.IResource))
with the IResource of the parent context.
IExecutionContext is used for the creation of the
IMassProcessingSubContext.
pParentToolContext - the parent IMassProcessingToolContextIMassProcessingSubContext initiated with a newly
created IExecutionContext.TaurusToolException - if an Exception occurs while creating the
IMassProcessingSubContextpublic static EToolResultSeverity getSeverityFromReturnCode(TAURUSConfiguration pModel, int pReturnCode)
EToolResultSeverity from the given return code and AWM model. The return code is compared to the model's maximum return code.pModel - the used modelpReturnCode - a numeric tool return codeApplicationOptions.getMaxRC()Copyright © 2015 Micro Focus GmbH. All rights reserved.