Data Formatter

In addition to mappings, you might need to format data coming from the published value object. For example, the JD Edwards EnterpriseOne database stores fields such as company (CO) and business unit (MCU) with preceding spaces or zeros. These fields should be formatted so that the preceding spaces and zeros are hidden from the published business service. The business service foundation utilities package provides formatting methods that enable you to pass in a value, and based on the data dictionary rules for the data dictionary item being passed in, formats the value accordingly.

You can use the code template E1DF – EnterpriseOne Data Formatter to generate code for data that requires formatting. The formatter code template generates the code and highlights variable names that you must change.

This sample code is generated by the EnterpriseOne Data formatter code template:

//format business unit coming from published vo.
        String formattedMCU = null;
        String bu = this.getBusinessUnit();
        if(bu!=null && !bu.equals("")){
           try {
             formattedMCU = context.getBSSVDataFormatter().format(
this.getBusinesUnit(),"MCU");
             vo.setSzBusinessUnit(formattedMCU);
           }
           catch (BSSVDataFormatterException e) {
             context.getBSSVLogger().app(context,"Error when 
formatting BusinessUnit.",null,vo,e);
             //Create new E1 Message with error from exception
             messages.addMessage(new E1Message(context, 
"002FIS",this.getBusinessUnit()));
          }
        }