Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
How do I get the selected items in the client from the Java API?
Is there an im-command or is the only way to use System.getenv("MKSSI_ISSUE0")?
Yes, this is - to my knowledge - the way how we do it in Java.
Hello Volker,
please could you explaine how it works, maybe with some Java code?
Thanks in advance,
Bernd
Hello Bernd,
we assume that we have a custom program written in Java that is executed using the custom menu entry in Integrity.
So the call behind the custom menu will be ..\jre\bin\java -jar ..\myJavaProgram.jar
To recognize now the items or documents that we have selected before the menu call, you can write the following code:
public static String getDocumentID() {
return System.getenv("MKSSI_DOCUMENT") == null ? "" : System.getenv("MKSSI_DOCUMENT");
}
public static String getHostName() {
return System.getenv("MKSSI_HOST") == null ? "" : System.getenv("MKSSI_HOST");
}
public static String getPort() {
return System.getenv("MKSSI_PORT") == null ? "" : System.getenv("MKSSI_PORT");
}
public static String getUser() {
return System.getenv("MKSSI_USER") == null ? "" : System.getenv("MKSSI_USER");
}
public static String getIssue0() {
return System.getenv("MKSSI_ISSUE0") == null ? "0" : System.getenv("MKSSI_ISSUE0");
}
Using it, you can get the Integrity details of the items selected. MKSSI_ISSUE0 can also be a list when you have multiple items selected. (MKSSI_ISSUE1, MKSSI_ISSUE2 etc.)
Does this help?
Volker
Hello Volker,
yes, it helps.
Thanks for your help
Bernd
Hi
While selecting multiple items ( say requirement documents ) ,
System.getenv("MKSSI_ISSUE0");
How to get the list of ALL selected items ? Above i can get 1 item
If i use System.getenv("MKSSI_ISSUE1"); i get the next
Is there any api to get all the items selected ?
Best regards
Ok got it. Found it myself , can get the items selected like this
Map<String, String> env = System.getenv();
for (Map.Entry<String, String> entry : env.entrySet()) {
String k = entry.getKey();
String v = entry.getValue();
if(k.contains("MKSSI_ISSUE"))
{
System.out.println("Key: " + k + ", Value: " + v);
}
}