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

  • SEARCH
  • Home
  • 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 6652985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:12:40+00:00 2026-05-26T01:12:40+00:00

I have a soft HP BSM. Actions for operators will write in Groovy script.

  • 0

I have a soft HP BSM.
Actions for operators will write in Groovy script.

this is example:

import java.util.List;
import com.hp.opr.api.scripting.Action;
import com.hp.opr.api.scripting.Event;
import com.hp.opr.api.scripting.EventActionFlag;
import com.hp.opr.api.scripting.LifecycleState;
import com.hp.opr.api.scripting.MatchInfo;
import com.hp.opr.api.scripting.NodeInfo;
import com.hp.opr.api.scripting.PolicyType;
import com.hp.opr.api.scripting.Priority;
import com.hp.opr.api.scripting.ResolutionHints;
import com.hp.opr.api.scripting.Severity;

/*
 * This example set all possible event attribute to some example values.
 */

class SimpleExample_new
{
  def init()
  {

    }

    def destroy()
    {

    }

    def process(List<Event> events)
    {
          events.each {
              event -> modifyEvent(event); 
"cmd.exe /c C:\\test\\sd_event.exe -f C:\\test\\sd_event.ini -v event_id=2 description='$description' status=Registered priority=low".execute().text

            }
    }

    def modifyEvent(Event event)
    {
// "cmd.exe /c C:\\test\\sd_event.exe -f C:\\test\\sd_event.ini -v event_id=10 description='$description' status=Registered priority=low".execute().text

    String application = event.getApplication();
    event.setApplication("Modified by ostap: " + application);

    String description = event.getDescription();
    event.setDescription("Modified by ostap: " + description);

    long groupId = event.getAssignedGroupId();
    event.setAssignedGroupId(groupId);

    int assignedUserId = event.getAssignedUserId();
    event.setAssignedUserId(assignedUserId);

     String category = event.getCategory();
    event.setCategory("Modified by EPI: " + category);

    String correlationKeyPattern = event.getCloseKeyPattern();
    event.setCloseKeyPattern("Modified by EPI: " + correlationKeyPattern);

    String etiInfo = event.getEtiHint();
    event.setEtiHint(etiInfo);

    String correlationKey = event.getKey();
    event.setKey("Modified by EPI: " + correlationKey);

    MatchInfo matchInfo = createSampleMatchInfo();
    event.setMatchInfo(matchInfo);

    event.setNoDedup(true);

    ResolutionHints hints = createSampleResolutionHints();

    event.setNodeHints(hints);

    String object = event.getObject();
    event.setObject("Modified by EPI: " + object);

    String omServiceId = event.getOmServiceId();
    event.setOmServiceId(omServiceId);

    String omUser = event.getOmUser();
    event.setOmUser(omUser);

    String originalText = event.getOriginalData();
    event.setOriginalData("Modified by EPI: " + originalText);

    String originalId = event.getOriginalId();
    event.setOriginalId(originalId);

    event.setSeverity(Severity.MINOR);

    String solution = event.getSolution();
    event.setSolution("Modified by ostap: " + solution);

    ResolutionHints sourceCiHints = createSampleResolutionHints();
    event.setSourceCiHints(sourceCiHints);

    event.setState(LifecycleState.IN_PROGRESS);

    String subCategory = event.getSubCategory();
    event.setSubCategory("Modified by EPI: " + subCategory);

    event.setTimeReceived(new Date());

    String title = event.getTitle();
    event.setTitle("Modified by EPI: " + title);

    String type = event.getType();
    event.setType("Modified by EPI: " + type);

    }

  def ResolutionHints createSampleResolutionHints()
  {
    ResolutionHints hints = new ResolutionHints(false);

    hints.setCoreId("CoreId");
    hints.setDnsName("mydqdn.com");
    hints.setHint("My Hint");
    hints.setIpAddress("0.0.0.0");
    return hints;
  }

  def MatchInfo createSampleMatchInfo()
  {
    MatchInfo matchInfo = new MatchInfo(false);

    matchInfo.setConditionId("conditionId");
    matchInfo.setPolicyName("policyName");
    matchInfo.setPolicyType(PolicyType.CONSOLE);
    return matchInfo;
  }

}

And I want modify example.

I want get “description” and set(put) this “description” to external command (sd_event.exe)

cmd.exe /c C:\\test\\sd_event.exe -f C:\\test\\sd_event.ini -v event_id=50 description=____  status=Registered priority=low".execute().text

I try also run:

cmd.exe /c C:\\test\\mybatch.bat".execute().text  

but i don’t know how to put parametres to bat file

mybatch.bat:

C:\test\sd_event.exe -f sd_event.ini -v event_id=5 description=%1 status="Registered" priority=low
  • 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-26T01:12:41+00:00Added an answer on May 26, 2026 at 1:12 am

    Due to the formatting and errors in your code, it’s hard to see what is going on, or what you are asking…

    When you have:

    String description = event.getDescription();
    

    What is event? I can only see a List of events in that function…

    Assuming this is just a problem with cut and paste, I think the answer you are looking for is:

    "cmd.exe /c C:\test\sd_event.exe -f C:\test\sd_event.ini -v event_id=50 description='$description' status=Registered priority=low".execute().text
    

    But as I said, I’m not sure… You will have to write the output of that function to result.txt yourself, as you cannot do redirection that way when calling the shell from Java/Groovy

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

Sidebar

Related Questions

I have been following this example, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm , as it is just what I
I have overridden the default NHibernate DefaultDeleteEventListener according to this source: http://nhibernate.info/blog/2008/09/06/soft-deletes.html so I
I'd be happy to have very soft character >> instead of white-space, like this:
I have an issue with a virtual keyboard. This Soft Keyboard Covers Data Fields
I have one question: How can I select what soft-keyboard an edittext will load?
Working on a project at the moment and we have to implement soft deletion
I have a cache which has soft references to the cached objects. I am
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have soft real-time .NET application run on W2008R2. I just realised that I
I have a computing map (with soft values ) that I am using to

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.