cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How does the Java API command to run a custom query look like?

SOLVED
Visitor

How does the Java API command to run a custom query look like?

Hi,

 

I am wondering how the Java API command for this CLI command would look like:

im issues --fields="ID,Summary" --sortField="Planned Release End Date" --queryDefinition=((field[Type]="Release")and(field[State]="Scheduled,In Progress")and(field[Project]="/some_project"))

 

I am stuck with the fields and the query definition option Man Frustrated

 

What I have so far:

Command command = new Command();
command.setApp(Command.IM);
command.setCommandName("issues");
command.addOption(new Option("sortField","Planned Release End Date"));

 

Or is there any way to run the CLI command via the Java API directly without having im.exe and IntegrityClient.exe called?

 

Regards,

Simon

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How does the Java API command to run a custom query look like?

Hello,

 

I'm running a --querydefinition in Java like that, e.g.:

List<Option> cmdOptions = new ArrayList<Option>();

cmdOptions.add(new Option("querydefinition", "((field[Project] = \"" + projectName

+ "\") and (field[Type] = RQ1_Input,RQ2_Requirement,RQ3_Design) and (item.content) and (not (field[KBRQ_Qualification Method] is unspecified)))"));

cmdOptions.add(new Option("fields", "ID,KBRQ_Qualification Method"));

 

Hint if you want to figure out the querydefintion: add a custom action to cmd.exe to your Client, define the quick query the way you want, open CMD via custom action and have a look at MKSSI_query environment variable. Hope that helps to get your java running.

3 REPLIES 3

Re: How does the Java API command to run a custom query look like?

Hello,

 

I'm running a --querydefinition in Java like that, e.g.:

List<Option> cmdOptions = new ArrayList<Option>();

cmdOptions.add(new Option("querydefinition", "((field[Project] = \"" + projectName

+ "\") and (field[Type] = RQ1_Input,RQ2_Requirement,RQ3_Design) and (item.content) and (not (field[KBRQ_Qualification Method] is unspecified)))"));

cmdOptions.add(new Option("fields", "ID,KBRQ_Qualification Method"));

 

Hint if you want to figure out the querydefintion: add a custom action to cmd.exe to your Client, define the quick query the way you want, open CMD via custom action and have a look at MKSSI_query environment variable. Hope that helps to get your java running.

Re: How does the Java API command to run a custom query look like?

ETA: or what uminet said. I should have refreshed before posting 😉

 

You would add the fields and queryDefinition options the same way as the sortField:

 

cmd.addOption(new Option("queryDefinition", "((field[Type]=Release)and(field[State]=Scheduled,In Progress)and(field[Project]=/some_project))"));
cmd.addOption(new Option("fields", "ID,Summary"));

 

 

 

 

Re: How does the Java API command to run a custom query look like?

Thanks for the reply.

In fact there was a typo in my command Robot LOL

Your example helped to figure it out.