lumis.service.portalmanagement.audit
Class StringReplacePostLoadProcessor

Package class diagram package StringReplacePostLoadProcessor
java.lang.Object
  extended by lumis.service.portalmanagement.audit.StringReplacePostLoadProcessor
All Implemented Interfaces:
IPostLoadProcessor

public class StringReplacePostLoadProcessor
extends Object
implements IPostLoadProcessor

A post load processor that replaces strings in the fields of the source. The StringReplacePostLoadProcessor uses 3 parameters: - from the string that will be replaced - to the string that will replace - fieldId the field id where the replace will occur StringReplacePostLoadProcessor has some constants. To use them, the attribute useConstant must be used with true and the parameter's value must be the constant name.

Example usage:

<postLoadProcessor className="lumis.service.portalmanagement.systeminfo.StringReplacePostLoadProcessor"> <parameters> <parameter name="from">rigth</parameter> <parameter name="to">right</parameter> <parameter name="fieldId">fieldId</parameter> </parameters> </postLoadProcessor>

Example to use StringReplacePostLoadProcessor's constants:

<postLoadProcessor className="lumis.service.portalmanagement.systeminfo.StringReplacePostLoadProcessor"> <parameters> <parameter name="from" useConstant="true">SYSTEM_NEW_LINE</parameter> <parameter name="to" useConstant="true">HTML_BR</parameter> <parameter name="fieldId">fieldId</parameter> </parameters> </postLoadProcessor>

Since:
6.0.0

Nested Class Summary
static class StringReplacePostLoadProcessor.StringConstant
          Enum containing the constants.
 
Constructor Summary
StringReplacePostLoadProcessor()
           
 
Method Summary
 void processSource(SessionConfig sessionConfig, Source source, Node parametersNode, ITransaction transaction)
           
protected  String readParameterValue(String parameterName, Node parametersNode)
          Reads the value of a given parameter using its name.
protected  void replaceStrings(Source<?> source, String fieldId, String from, String to)
          Replace the from string by the to string in a field of a source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringReplacePostLoadProcessor

public StringReplacePostLoadProcessor()
Method Detail

processSource

public void processSource(SessionConfig sessionConfig,
                          Source source,
                          Node parametersNode,
                          ITransaction transaction)
                   throws PortalException
Specified by:
processSource in interface IPostLoadProcessor
Throws:
PortalException

readParameterValue

protected String readParameterValue(String parameterName,
                                    Node parametersNode)
                             throws PortalException
Reads the value of a given parameter using its name.

Parameters:
parameterName - parameter's name.
parametersNode - parent node.
Returns:
the string value of the parameter.
Throws:
PortalException - whenever an error occur.
Since:
6.0.0

replaceStrings

protected void replaceStrings(Source<?> source,
                              String fieldId,
                              String from,
                              String to)
                       throws PortalException
Replace the from string by the to string in a field of a source.

Parameters:
source - the source instance.
fieldId - the id of the desired field.
from - the string that will be replaced.
to - the string that will replace.
Throws:
PortalException - whenever an error occur.
Since:
6.0.0


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.