Friday, September 30, 2016

Send multiple attachments in one mail streamserve

Background

I have a MOM report (PPS601) in which I generate PO data as a CSV apart from the standard PDF layout. So in order to do that I use StreamOut process type in Stream Server.

clip_image001_thumb[1][1]

Since my client wants output as a MAIL I used default mail connector to send the PDF layout and created a new connector copying the default mail connector to send CSV with TXT driver since PDF driver not support the CSV files.

clip_image003_thumb[2]

Problem

But the problem is that CSV and PDF are sent in a two separate mails as single attachments. But my requirement is to have two files in one mail thread as two attachments.

clip_image004_thumb[1]

Solution

Solution is to use attachment connector to send CSV file and attach attachment connector to the mail connector .

Step 1:

Create Attachment connector:

clip_image006_thumb[1]

clip_image008_thumb[1]

For attachment connector no need to specify the driver settings. In order to see the setting panel in attachment connector need to the switch to the generic platform view. In physical platform level attachment connector settings can’t be seen.

Step 2:

Go to the Mail Connector settings relevant runtime and click edit mail

clip_image009_thumb[1]

Step 3

In Edit Mail window click the attachment Icon.

clip_image011_thumb[1]

Then below window will appeared.

clip_image012_thumb[1]

Step 4:

In that popup change the attachment type to “Output from attachment connector” and give the attachment name for attachment connector. (Attachment connector which was created in platform previously).

Give attachment name(name for the CSV attachment )  to the “Attachment name” text box (even possible to use a variable)

clip_image013_thumb[1]

Step 5:

Now make CSV process delivery media as the attachment connector that was created previously. To change the delivery media dynamically I used below code snipped in before process event. There is a nice article with detail explanation about changing delivery media in the StreamShare forum by Andreas Hjelle. Please read it.

http://streamshare.streamserve.com/Articles/Article/?articleId=325

$que = "ATTA";
callproc("CSVO");

Now all good , export the project.

Output

clip_image015_thumb[1]

You can see two attachment were attached in to one email.

Useful links

· http://streamshare.streamserve.com/Forum/Topic/?topicID=9731

· http://streamshare.streamserve.com/Forum/Topic/?topicID=7482

· http://streamshare.streamserve.com/Articles/Article/?articleId=325

Wednesday, July 27, 2016

MEC repository functions

Repository Functions are reusable Java and Boolean functions stored in Function Repository that is part of a Mapper database. Usage of repository function in MEC reduce the development time and increases the reusability.

For an example we can write a java function to send emails and add it to the mapper database as repository function. Then that function can be used in every maps those are in same mapper database.

Create repository function.

Step 1: First create your java or Boolean function.

image

Step 2: right click on function and press add to repository.

clip_image003

Step 3:

Select the location(MEC mapper database) where, repository function need be saved and click finish.

clip_image004

Now you repository function has been successfully added to mapper database and it ready to use.

Use repository functions:

Step 1:

From the Palette tab, select the Repository function element. Drag and drop it to the space between the input and output document trees. After that new reusable function window is displayed.

Select the Mapper Database location to use.

clip_image005

Step 2: Select a reusable function.

clip_image006

Once you clicked the finish the selected function is inserted to the mapping

Thursday, July 14, 2016

MEC :add values to the manifest file .

For some MEC developments we need to add some usefull information to the MEC manifest file. Then you can use below function.

setManifestInfo("map:myvalue", “test”);

After execution of this function test will be added to the MEC manifest table under map:myvalue key .

Tuesday, July 12, 2016

MEC : Use External jar files in old MEC mapper

Even though this is very straight forward I thought its worth to share with all because it can save time when it need to used external Jar files inside the  old MEC mapper. In new MEC mapper we can do this easily but old MEC mapper we can’t do it directly (Old mapper is Windows based version and if you interested about old MEC mapper my colleague has written overview about it http://warnajith.blogspot.com/2016/06/development-with-mec-older-version.html.). In this case we need to copy external jar files to MEC server manually.

There two places to copy Jar files in MEC server. If there are multiple MEC environments, jar files needs to be copied each environment as well.

· ~\MecMapGen\lib folder

· ~\MECServer\lib folder

MecMapGen and MECServer folders are located inside MEC installation folder.

Please remember to restart the MEC environment after copying the file. Otherwise changes will not be reflected.

Tuesday, June 28, 2016

ServiceManger:The “start request” timed out in StreamServe Control Center.

I have enabled document archiving in stream server and so for that have to change the control center running account to some other account. After that all of sudden my all instance were stopped and could not start it back.
clip_image001
After I investigate this deeper and found that newly changed user acoount should be listed under MOM server Administrative users . Once it did it worked fine .Smile

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.

image

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 M3Properties.properties. 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 .

 

image

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

String centralFileFolder = com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path");

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


// Read properties file if it exists
boolean propertiesOK = false;
java.util.Properties properties = new java.util.Properties();
try {
properties.load(new java.io.FileInputStream(PropertiesFile + ".properties"));
    propertiesOK = true;
}
catch(java.io.IOException 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
if(propertiesOK){
    oemailAddress = properties.getProperty("EMAIL.FROM");   
}

com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path") can be used to get MEC central file location path .

Tuesday, February 2, 2016

How to configure java in streamserve control center

In some senarios we want to call external jar files via streamserve direclty . By doing that we can extending the functionally . There is a  nice article about calling java programs throguh streamserve in streamshare by Stefan Cohen. please read it . it explains in details the process of calling the jar file .
http://streamshare.streamserve.com/Articles/Article/?articleId=559
So for that as a prerequisite we need to configure java in control center . Even though control center admin guide has been explained the process, i thought its worth the explain here again with pictures.
First install the java.
https://www.java.com/en/download/
Right click on the application what ever you want to configure java.
image
Then change vender to the Oracle .Thats all for the control center .
image
Then we need to set STRS_JVM and STRS_JAVA_HOME variables in .environment file so for that navigate to the streamserver installation folder .
In my case its like below
C:\Program Files (x86)\OpenText\StreamServe\Applications\StreamServer\5.6.1\Server\bin and open .environment file under admin mode. Other wise it will not allow to save.
image
Set STRS_JVM  and  STRS_JAVA_HOME accroding to the your java installtion .
We are done now . then resrat the service. if there are no issues service will be started .other wise errors will be deplayed on strs_boot.log file .

Enable log in streamserve(dsrv.log)

In some senarios control center application log file (dsrv.log) missing . dsrv.log is very important to the mom developer as it contains the all the project related errors, warning and information .without that very hard to do the developments .
image
In order to display dsrv log we should activate logging  in the relevent platform file .
Go the relevent platform in the design center .
image
right click on the platform and go to the configure platform option.
image
Here after below dialog will be displayed . under log tab check the enable logging check box and there are fiew other options whci you can configure .
image
You can define the name for log file and specifiy the log level as well.
If these setting are ok drsv log should be diplayed on your control center .
Apart from above fact there may be few another cases where dsrv log not displayed in the control center . please refer the below url for that .(from steamshare forum)
http://streamshare.streamserve.com/Forum/Topic/?topicID=4313

Tuesday, January 26, 2016

How to configure mail in StreamServer project(5.x)

one of my customer wants to the deliver his purchase order as email .These email address are defined in the stream file header. These entries are based on the CRS945 and MNS205.
image_thumb9_thumb[1]
According to the above example Mail should goes to the fromMailAddres@test.lk and from address should be tomail@test.lk.
As first step Mail server settings should be defined in the relevant Platform settings in the design center.
Go to the relevant platform .
image_thumb11_thumb[2]
Then right click on the mail settings and go to the settings tab and click the connector .
image_thumb13_thumb[1]
Then need to select the Connector type .There are several inbuilt connects types available with streamserver . For this case I'm use the STMP(MIME)(Legacy) connector .
Please note that by default this connector use the 25 as the mail port for sending emails and if your client use separate port then you have to you another connector . Ideally STMP MIME connector.
then provide relevant mail server address and UN and PW based on the customer site mail configuration .You can ask these information for IT administrator of the customer site.
After configuring the platform we need to configure the Runtime settings .
Below is the runtime settings for my PO.In run time we need to set from email /to email /subject and other required settings for the email.
When stream serve begin the execution, stream server agent create some set of initial variables for all the entries which stated with * sign in the streamfile and assign values .
image_thumb15_thumb[1]
For my case below are the variables generated by the agent.Please refer the below url for all agent generated values .(http://streamshare.streamserve.com/Forum/Topic/?topicID=990).
Stream File Name
Agent Generated Name
Value
*TOMAIL1
$mvx_tomail
fromMailAddres@test.lk
*FRMAIL1
$mvx_frmail
tomail@test.lk
*SUBJECT1
$mvx_subject
M3 output
image_thumb28_thumb[1]
right click on mail settings and go the settings and select respective platform .
image_thumb30_thumb[1]
And then go the Edit mail.
image_thumb32_thumb[1]
And fill the From/to/subject etc based on the agent generated variable  and click ok .
Then you are good to go. Save export and deploy the project.