Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:21:55+00:00 2026-05-26T05:21:55+00:00

I have the below code, I want to transform it fully to groovy, so

  • 0

I have the below code, I want to transform it fully to groovy, so far what I came up with is shown below

def homeDir="INFA_HOME"
HashMap<String,String> params = IntermediateResults.get("userparams")
Map env=AppContext.get(AppCtxProperties.environmentVariables)

//checking if INFA_HOME is present in the map or not, I will be using INFA_HOME a lot, so can't I use homeDir istead??
boolean homeVarPresent=env.get("INFA_HOME")!=null

csm.pmserver(){
    pmserver_homevar(name:"$homeDir",set:"${homeVarPresent?'Y':'N'}",value:"${homeVarPresent?env.get('INFA_HOME'):na}")

//Instead of $env.INFA_HOME can't i use homeDir?
    pmserver_home(value:"$env.INFA_HOME/server/bin",exists:"${homeVarPresent?'Y':'N'}")
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:21:56+00:00Added an answer on May 26, 2026 at 5:21 am

    I think @tim_yates example is OK, but it over-complicates the map access and ternary operators. I’d probably do this:

    def homeDir = 'INFA_HOME'
    HashMap<String,String> params = IntermediateResults.get("userparams")
    Map env = AppContext.get( AppCtxProperties.environmentVariables )
    
    csm.pmserver {
        pmserver_homevar( name  : homeDir,
                          set   : env[homeDir] ? 'Y' : 'N',
                          value : env[homeDir] ?: 'na' )
    
        pmserver_home( value  : "${env[homeDir]}/server/bin",
                       exists : env[homeDir] ? 'Y' :'N' )
    }
    

    It’s a lot more readable to use the array access modifier with variables that to create several unnecessary GStrings. I might also be tempted to use a manual string concatenation for the path (env[homeDir] + '/server/bin'), but that’s personal preference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to open an xlsx file, I have tried the below code,but neither
I have the code below with 3 columns. I want to have the border
I have below code in C# Dictionary<string, object> dObject = new Dictionary<string, object>(); I
Okay I have the below code performing something I don't want it to do.
I have a string in the format of [text][text][text][text][text] and I want to transform
i have the below code i want to put in a global method set
i want disable statusbar in activity, i have use below code, it happen SecurityException,
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have below code behind in c# if (Session[cmpDictionaryTitle]!= null) { downloadLinks.Text += @<li><a
I have below code to insert a style into DOM (there is a use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.