web stats
Unable to get ChannelName in Deploy Script - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-03-2014, 08:20 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default Unable to get ChannelName in Deploy Script

Similar query to Anirudh in http://www.mirthcorp.com/community/f...ad.php?t=10809

I have a code template function that I wish to run in the deploy script of channels:

Code:
 
 function Load_Mappings(csvpath,mapname) {
 // write code here.
 //var channelName = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance().getDeployedChannelById(channelId).getName();
 //var channelName = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance().getDeployedChannelById(channelId).getName(); 
 //var channelName = "";
 //var channelName = ChannelUtil.getDeployedChannelName(channelId);
 var channelName = channelId;
  logger.info(channelName + " - Loading mappings for " + mapname + " from " + csvpath);
 globalChannelMap.put(mapname,{})
  for each (pair in org.apache.commons.io.FileUtils.readFileToString(new java.io.File(csvpath)).split('\r\n|\r|\n')) {
  if (!(pair.substring(0,1) == "#")) {
   //logger.info("first char = " + pair.substring(0,1));
   var newvalue = pair.split(',')[1];
   if (!newvalue) newvalue = ""; // convert undefined to empty string
   $gc(mapname)[pair.split(',')[0]] = newvalue;
   logger.info(channelName + " - Mapping " + mapname + " item [" + pair.split(',')[0] + "] to [" + newvalue + "]");
  }
 }
 return;
}
I know that the channelId is available here, but when I attempt to set

Code:
var channelName = ChannelUtil.getDeployedChannelName(channelId);
the channelName is returned back as null, presumably because the channel has not actually been deployed at that point.

Any idea how I can pull in the name of the channel?

Simon
Reply With Quote
 

Tags
channelid, deploy

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:46 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation