ファイルをエクスポートしようとしていますが、次の例外が発生します。
予期しないエラーが発生しました:java.lang.Exception:sailpoint.tools.GeneralException:アプリケーションスクリプトが例外をスローしました:java.lang.ClassCastException:sailpoint.tools.xml.PersistentArrayListをjava.lang.StringにキャストできませんBSF情報:ファイルのエクスポート-行のAbc:0列:columnNo
私のコードは以下の通りです:
import java.io.FileWriter;
import java.io.File;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.*;
String appname = "Abc";
String path = "//home/exportfile//";
String filename = path+"ApplicationExport-"+appname+".txt";
String ret = "false";
QueryOptions ops = new QueryOptions();
Filter [] filters = new Filter[1];
filters[0] = Filter.eq("application.name", appname);
ops.add(filters);
List props = new ArrayList();
props.add("identity.name");
//Do search
Iterator it = context.search(Link.class, ops, props);
//Build file and export header row
BufferedWriter out = new BufferedWriter(new FileWriter(filename));
out.write("IdentityName,UserName,WorkforceID,Organization");
out.newLine();
//Iterate Search Results
if (it!=null)
{
while ( it.hasNext() ) {
//Get link and create object
Object [] record = it.next();
String identityName = (String) record[0];
Identity user = (Identity) context.getObject(Identity.class, identityName);
//Get Identity attributes for export
String workforceid = (String) user.getAttribute("workforceID");
//Get application attributes for export
String userid="";
String org="";
List links = user.getLinks();
if (links!=null)
{
Iterator lit = links.iterator();
while (lit.hasNext())
{
Link l = lit.next();
String lname = l.getApplicationName();
if (lname.equalsIgnoreCase(appname))
{
userid = (String) l.getAttribute("User Name");
org= (String) l.getAttribute("Organization");
}
}
}
//Output file
out.write(identityName+","+userid+","+workforceid+","+org);
out.newLine();
out.flush();
}
ret="true";
}
//Close file and return
out.close();
return ret;
上記のコードを実行しているときに、キャスト例外エラーが発生します。Organization属性がMultivalued.ieであるため、その属性には複数の値を含めることができます。
このコードを修正するための助けをいただければ幸いです。