免責事項:Javaは私がよく知っている言語ではありません。
私はアイデンティティプラットフォームのプロジェクトに取り組んでいます。エンタイトルメントクラスを使用してエンタイトルメントのリストを取得しようとしていますが、私の関数を呼び出すときにデータを出力できません。以下は私が現在持っているコードです。Javaからの戻り値
import sailpoint.api.SailPointContext;
import sailpoint.tools.Util;
import sailpoint.object.*;
import sailpoint.api.*;
import sailpoint.workflow.*;
import java.util.*;
QueryOptions ops = new QueryOptions(); //This creates the Query Options
ops.addFilter(Filter.eq("identity.name", "UserNAME")); //Defines the Identity/IdentityName that we are searching for
Iterator itr = context.search(IdentityEntitlement.class, ops, "id"); //Java iterator is an interface belongs to collection framework allow us to traverse the collection and access the data element of collection without bothering the user about specific implementation of that collection it. Basically List and set collection provides the iterator. You can get Iterator from ArrayList, LinkedList, and TreeSet etc.
while (null != itr && itr.hasNext()) { //Run this this iteration while not null
String id = ((Object[]) itr.next())[0].toString(); //collect the object as a string
IdentityEntitlement identEnt = context.getObjectById(IdentityEntitlement.class, id); //define the IdentityEntitlement from (IdentityEntitlement.class, id);
System.out.println("identEnt: "+identEnt.toXml()); //Print the results
}
Util.flushIterator(itr); //End the Iterator
[最初にコードを書いてください](https://stackoverflow.com/posts/44722411/edit) –
メソッドが定義されていません。あなたは何の「機能」を呼んでいますか?そして、これが "function"内のコード(Javaのメソッドと呼ばれます)の場合、呼び出し側のアクションに何かが返されていることを示す 'return'ステートメントはありません。 – Gregg
私はギラードのためにそれを修正していただきありがとうございます。それは実際にはこれです:itr &&:これはbeanshell特有の問題です。 – jmsahearn