75_removingrichtext

2
Integration Framework – Support for removing Rich Text Tags from an outbound integration message in release 7.5 With release 7.5, the Maximo applications provide support for Rich Text editing of selected data fields, such as Long Descriptions. For integration scenarios where Maximo data, including Long Description fields, are sent to an external application there may be a need to strip out Rich Text Tags from the Long Description field. This case will arise when the consuming system cannot handle XML data which contains Rich text tags embedded in it. In this case though the resulting xml is valid (by xml standards) the consuming system might have trouble processing a valid xml which has Rich text tags embedded inside it. To strip out these tags you can implement the following java code in the definition class of the Object Structure that is processing the message to be sent. Note this same code can be done from the user exit too. If the object structure already has a definition class then this new class should extend the existing class. If no definition class exists on the object structure then this class should extend psdi.iface.mic.MicSetOut. Sample Java Code package psdi.iface.mos; import java.rmi.RemoteException; import java.util.Map; import psdi.iface.mic.MicSetOut; import psdi.mbo.MboRemote; import psdi.util.MXException; public class RichTextDefnImpl extends MicSetOut { public RichTextDefnImpl() throws MXException, RemoteException { super(); // TODO Auto-generated constructor stub Page 1 of 2

Upload: soo7cs

Post on 06-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

maximo

TRANSCRIPT

Page 1: 75_RemovingRichText

Integration Framework – Support for removing Rich Text Tags from an outbound inte-gration message in release 7.5

With release 7.5, the Maximo applications provide support for Rich Text editing of se-lected data fields, such as Long Descriptions. For integration scenarios where Maximo data, including Long Description fields, are sent to an external application there may be a need to strip out Rich Text Tags from the Long Description field. This case will arise when the consuming system cannot handle XML data which contains Rich text tags embedded in it. In this case though the resulting xml is valid (by xml standards) the con-suming system might have trouble processing a valid xml which has Rich text tags em-bedded inside it.

To strip out these tags you can implement the following java code in the definition class of the Object Structure that is processing the message to be sent. Note this same code can be done from the user exit too.

If the object structure already has a definition class then this new class should extend the existing class. If no definition class exists on the object structure then this class should extend psdi.iface.mic.MicSetOut.

Sample Java Code

package psdi.iface.mos;

import java.rmi.RemoteException;import java.util.Map;

import psdi.iface.mic.MicSetOut;import psdi.mbo.MboRemote;import psdi.util.MXException;

public class RichTextDefnImpl extends MicSetOut {

public RichTextDefnImpl() throws MXException, RemoteException {

super();// TODO Auto-generated constructor stub

}

public int checkBusinessRules(MboRemote mbo, MosDetailInfo mosDet-Info, Map<String, Object> ovrdColValueMap)

throws MXException, RemoteException{

if(((psdi.mbo.Mbo)mbo).getThisMboSet().getMboSetInfo().getMbo-ValueInfo("description_longdescription") != null) { try {

javax.swing.text.html.HTMLEditorKit kit = new javax.swing.text.html.HTMLEditorKit();

javax.swing.text.html.HTMLDocument styledDocument = new javax.swing.text.html.HTMLDocument();

Page 1 of 2

Page 2: 75_RemovingRichText

java.io.StringReader reader = new ja-va.io.StringReader(mbo.getString("description_longdescription"));//.init(arguments.richText);

kit.read(reader,styledDocument,0); ovrdColValueMap.put("description_longdescription",

styledDocument.getText(0,styledDocument.getLength())); } catch(Exception e) { e.printStackTrace(); } }

return MosConstants.PROCESS;}

}

The object structure definition class (with the code listed above) must be compiled, in-cluded in the application EAR file (rebuild and re-deploy EAR file) and registered on the applicable Object Structure.

Page 2 of 2