Thursday, May 12, 2016

MEC : How read MEC manifest file in MEC mapper.

There are some senarios where we need to read the MEC manifest file contents . .

Lets say we want to read agreement value from the manifest . then you below method with cmn:agreement .

value =getManifestInfo(“Item”)

getManifestInfo("cmn:agreement") for this result would be EDI_940_OUT.


Wednesday, May 11, 2016

MEC Custom properties file .

There are some scenarios where we need to get constant configurable values to the MEC mapper. For example sometime we have to get email addresses, database schema, user name PW like that.

For such a scenario we have few possible options

· Hard Code.

· Read From table

· Read from external text file (referred as java properties file /in .net config file ).

Hard coding is not good option because when change is needed have to modify the map and restart the MEC environment and need to seek help from technical consultant. Reading from table also good option and need to maintain separate table and all.

But reading from external file is very easy and implementation time also short.

Step 1.

Create a text file with the information that you require. In my case I want to add some email address .So my text will be like below.I will name this file as properties will be the ext.

Then copy this file to the MEC central file location . you can keep this file anyware but when it added to the central file location its easy to access file . Other wise we have to hard code the file location .



Using below java code you can access properties file. Use this code place where you want information from properties .

String centralFileFolder ="mec.central.file.path");

String PropertiesFile = centralFileFolder+"/Properties/M3Interface";
System.out.println(getClass().getName() + "[:] PropertiesFile: '" + PropertiesFile + "'"); + "[:] PropertiesFile: '" + PropertiesFile + "'");

// Read properties file if it exists
boolean propertiesOK = false;
java.util.Properties properties = new java.util.Properties();
try {
properties.load(new + ".properties"));
    propertiesOK = true;
catch( ioe){
      System.out.println("IO Error occurred reading properties file for " + getClass() + ".\n");
      System.out.println("Default values will be used.");

// If properties ok then get each one
    oemailAddress = properties.getProperty("EMAIL.FROM");   
}"mec.central.file.path") can be used to get MEC central file location path .