選択リストの操作
選択リストの作成
選択リストを作成するには、以下の手順に従います。
- Factory.Choice.createInstance メソッドを呼び出すことにより、選択リストに含める各選択肢ごとに、Choice オブジェクトを作成します。
- 新規 Choice オブジェクトごとに、Choice オブジェクトの型を指定する ChoiceType プロパティーを設定します。以下のように、整数、文字列、整数グループ・ノード、または文字列グループ・ノードを指定できます。
- Integer: ChoiceType プロパティーを ChoiceType.INTEGER に設定します。Integer 値を設定するには ChoiceIntegerValue プロパティーを使用します。
- String: ChoiceType プロパティーを ChoiceType.STRING に設定します。String 値を設定するには ChoiceStringValue プロパティーを使用します。
- Integer グループ・ノード: ChoiceType プロパティーを ChoiceType.MIDNODE_INTEGER に設定します。Integer 型の ChoiceList オブジェクト値を設定するには ChoiceValues プロパティーを使用します。
- String グループ・ノード: ChoiceType プロパティーを ChoiceType.MIDNODE_STRING に設定します。String 型の ChoiceList オブジェクト値を設定するには ChoiceValues プロパティーを使用します。
- 新規 Choice オブジェクトごとに、DisplayNames プロパティーを設定します (この代わりに DisplayName プロパティーを設定する場合は、ステップ 4 に進みます)。
- Factory.LocalizedString.createInstance メソッドを呼び出して、LocalizedString オブジェクトを作成します。
- LocalizedString オブジェクトの LocaleName プロパティーを ObjectStore オブジェクトの LocaleName プロパティーの値に設定します。
- LocalizedString オブジェクトの LocalizedText プロパティーを、選択肢の名前を指定する文字列に設定します。
- Factory.LocalizedString.createList メソッドを呼び出して、LocalizedStringList コレクション・オブジェクトを作成し、それを Choice オブジェクトの DisplayNames プロパティーに設定します。
- DisplayNames プロパティーの add メソッドを呼び出して、LocalizedString オブジェクトを LocalizedStringList コレクションに追加します。
- ステップ 5 に進みます。
- 新規 Choice オブジェクトごとに、DisplayNames プロパティーを設定しない場合は、DisplayName プロパティーに、選択肢の名前を指定する文字列を設定してください。
- Factory.Choice.createList メソッドを呼び出して com.filenet.api.collection.ChoiceList リスト・コレクションを作成し、選択リストに所属させる Choice オブジェクトを追加します。
- Factory.ChoiceList.createInstance メソッドを呼び出して、com.filenet.api.admin.ChoiceList オブジェクトを作成します。
- ステップ 6 で作成した com.filenet.api.admin.ChoiceList オブジェクトの ChoiceValues プロパティーに、ステップ 5 で作成した com.filenet.api.collection.ChoiceList オブジェクト (Choice オブジェクトのリスト・コレクションが格納されているオブジェクト) を設定します。
string 型および integer 型の選択リストを作成する方法を以下のコード例に示します。
Java™ の例
/***************************
* String-type choice list *
***************************/
// グループ用に string 型の Choice オブジェクトを作成
Choice objChoiceMidStr1 = Factory.Choice.createInstance();
objChoiceMidStr1.set_ChoiceType(ChoiceType.STRING);
objChoiceMidStr1.set_DisplayName("Seattle");
objChoiceMidStr1.set_ChoiceStringValue("SEA");
Choice objChoiceMidStr2 = Factory.Choice.createInstance();
objChoiceMidStr2.set_ChoiceType(ChoiceType.STRING);
objChoiceMidStr2.set_DisplayName("Kirkland");
objChoiceMidStr2.set_ChoiceStringValue("KIR");
Choice objChoiceMidStr3 = Factory.Choice.createInstance();
objChoiceMidStr3.set_ChoiceType(ChoiceType.STRING);
objChoiceMidStr3.set_DisplayName("Bellevue");
objChoiceMidStr3.set_ChoiceStringValue("BEL");
// string 型の Choice オブジェクトを作成し、グループ・ノードを生成
Choice objChoiceStr1 = Factory.Choice.createInstance();
objChoiceStr1.set_ChoiceType(ChoiceType.MIDNODE_STRING);
objChoiceStr1.set_DisplayName("Washington");
objChoiceStr1.set_ChoiceValues(Factory.Choice.createList());
objChoiceStr1.get_ChoiceValues().add(objChoiceMidStr1);
objChoiceStr1.get_ChoiceValues().add(objChoiceMidStr2);
objChoiceStr1.get_ChoiceValues().add(objChoiceMidStr3);
Choice objChoiceStr2 = Factory.Choice.createInstance();
objChoiceStr2.set_ChoiceType(ChoiceType.STRING);
objChoiceStr2.set_ChoiceStringValue("OR");
// この Choice オブジェクトに対して LocalizedString オブジェクトを設定
LocalizedString objLocStr2 = Factory.LocalizedString.createInstance();
objLocStr2.set_LocaleName(objObjectStore.get_LocaleName());
objLocStr2.set_LocalizedText("Oregon");
// LocalizedStringList コレクションを作成し、LocalizedString オブジェクトを追加
objChoiceStr2.set_DisplayNames(Factory.LocalizedString.createList());
objChoiceStr2.get_DisplayNames().add(objLocStr2);
Choice objChoiceStr3 = Factory.Choice.createInstance();
objChoiceStr3.set_ChoiceType(ChoiceType.STRING);
objChoiceStr3.set_ChoiceStringValue("CA");
// この Choice オブジェクトに対して LocalizedString オブジェクトを設定
LocalizedString objLocStr3 = Factory.LocalizedString.createInstance();
objLocStr3.set_LocaleName(objObjectStore.get_LocaleName());
objLocStr3.set_LocalizedText("Oregon");
// LocalizedStringList コレクションを作成し、LocalizedString オブジェクトを追加
objChoiceStr3.set_DisplayNames(Factory.LocalizedString.createList());
objChoiceStr3.get_DisplayNames().add(objLocStr3);
// string 型の ChoiceList オブジェクトを作成
com.filenet.api.admin.ChoiceList objChoiceListStr = Factory.ChoiceList.createInstance(objObjectStore);
objChoiceListStr.set_DataType(TypeID.STRING);
// 選択リストに選択肢を追加して保存
objChoiceListStr.set_ChoiceValues(Factory.Choice.createList());
objChoiceListStr.get_ChoiceValues().add(objChoiceStr1);
objChoiceListStr.get_ChoiceValues().add(objChoiceStr2);
objChoiceListStr.get_ChoiceValues().add(objChoiceStr3);
objChoiceListStr.set_DisplayName("String State List");
objChoiceListStr.save(RefreshMode.REFRESH);
System.out.println("Choice list created: " + objChoiceListStr.get_Name());
System.out.println(objChoiceListStr);
/****************************
* Integer-type choice list *
****************************/
// グループ用に integer 型の Choice オブジェクトを作成
Choice objChoiceMidInt1 = Factory.Choice.createInstance();
objChoiceMidInt1.set_ChoiceType(ChoiceType.INTEGER);
objChoiceMidInt1.set_DisplayName("Seattle");
objChoiceMidInt1.set_ChoiceIntegerValue(11);
Choice objChoiceMidInt2 = Factory.Choice.createInstance();
objChoiceMidInt2.set_ChoiceType(ChoiceType.INTEGER);
objChoiceMidInt2.set_DisplayName("Kirkland");
objChoiceMidInt2.set_ChoiceIntegerValue(12);
Choice objChoiceMidInt3 = Factory.Choice.createInstance();
objChoiceMidInt3.set_ChoiceType(ChoiceType.INTEGER);
objChoiceMidInt3.set_DisplayName("Bellevue");
objChoiceMidInt3.set_ChoiceIntegerValue(13);
// integer 型の Choice オブジェクトを作成し、グループ・ノードを生成
Choice objChoiceInt1 = Factory.Choice.createInstance();
objChoiceInt1.set_ChoiceType(ChoiceType.MIDNODE_INTEGER);
objChoiceInt1.set_DisplayName("Washington");
objChoiceInt1.set_ChoiceValues(Factory.Choice.createList());
objChoiceInt1.get_ChoiceValues().add(objChoiceMidInt1);
objChoiceInt1.get_ChoiceValues().add(objChoiceMidInt2);
objChoiceInt1.get_ChoiceValues().add(objChoiceMidInt3);
objChoiceInt1.set_ChoiceIntegerValue(1);
Choice objChoiceInt2 = Factory.Choice.createInstance();
objChoiceInt2.set_ChoiceType(ChoiceType.INTEGER);
objChoiceInt2.set_DisplayName("Oregon");
objChoiceInt2.set_ChoiceIntegerValue(2);
Choice objChoiceInt3 = Factory.Choice.createInstance();
objChoiceInt3.set_ChoiceType(ChoiceType.INTEGER);
objChoiceInt3.set_DisplayName("California");
objChoiceInt3.set_ChoiceIntegerValue(3);
// integer 型の ChoiceList オブジェクトを作成
com.filenet.api.admin.ChoiceList objChoiceListInt = Factory.ChoiceList.createInstance(objObjectStore);
objChoiceListInt.set_DataType(TypeID.LONG);
// 選択リストに選択肢を追加して保存
objChoiceListInt.set_ChoiceValues(Factory.Choice.createList());
objChoiceListInt.get_ChoiceValues().add(objChoiceInt1);
objChoiceListInt.get_ChoiceValues().add(objChoiceInt2);
objChoiceListInt.get_ChoiceValues().add(objChoiceInt3);
objChoiceListInt.set_DisplayName("Integer State List");
objChoiceListInt.save(RefreshMode.REFRESH);
System.out.println("Choice list created: " + objChoiceListInt.get_Name());
System.out.println(objChoiceListInt);
C# の例
/***************************
* String-type choice list *
***************************/
// グループ用に string 型の Choice オブジェクトを作成
IChoice objChoiceMidStr1 = Factory.Choice.CreateInstance();
objChoiceMidStr1.ChoiceType = ChoiceType.STRING;
objChoiceMidStr1.DisplayName = "Seattle";
objChoiceMidStr1.ChoiceStringValue = "SEA";
IChoice objChoiceMidStr2 = Factory.Choice.CreateInstance();
objChoiceMidStr2.ChoiceType = ChoiceType.STRING;
objChoiceMidStr2.DisplayName = "Kirkland";
objChoiceMidStr2.ChoiceStringValue = "KIR";
IChoice objChoiceMidStr3 = Factory.Choice.CreateInstance();
objChoiceMidStr3.ChoiceType = ChoiceType.STRING;
objChoiceMidStr3.DisplayName = "Bellevue";
objChoiceMidStr3.ChoiceStringValue = "BEL";
// string 型の Choice オブジェクトを作成し、グループ・ノードを生成
IChoice objChoiceStr1 = Factory.Choice.CreateInstance();
objChoiceStr1.ChoiceType = ChoiceType.MIDNODE_STRING;
objChoiceStr1.DisplayName = "Washington";
objChoiceStr1.ChoiceValues = Factory.Choice.CreateList();
objChoiceStr1.ChoiceValues.Add(objChoiceMidStr1);
objChoiceStr1.ChoiceValues.Add(objChoiceMidStr2);
objChoiceStr1.ChoiceValues.Add(objChoiceMidStr3);
IChoice objChoiceStr2 = Factory.Choice.CreateInstance();
objChoiceStr2.ChoiceType = ChoiceType.STRING;
objChoiceStr2.ChoiceStringValue = "OR";
// この Choice オブジェクトに対して LocalizedString オブジェクトを設定
ILocalizedString objLocStr2 = Factory.LocalizedString.CreateInstance();
objLocStr2.LocaleName = objObjectStore.LocaleName;
objLocStr2.LocalizedText = "Oregon";
// LocalizedStringList コレクションを作成し、LocalizedString オブジェクトを追加
objChoiceStr2.DisplayNames = Factory.LocalizedString.CreateList();
objChoiceStr2.DisplayNames.Add(objLocStr2);
IChoice objChoiceStr3 = Factory.Choice.CreateInstance();
objChoiceStr3.ChoiceType = ChoiceType.STRING;
objChoiceStr3.ChoiceStringValue = "CA";
// この Choice オブジェクトに対して LocalizedString オブジェクトを設定
ILocalizedString objLocStr3 = Factory.LocalizedString.CreateInstance();
objLocStr3.LocaleName = objObjectStore.LocaleName;
objLocStr3.LocalizedText = "California";
// LocalizedStringList コレクションを作成し、LocalizedString オブジェクトを追加
objChoiceStr3.DisplayNames = Factory.LocalizedString.CreateList();
objChoiceStr3.DisplayNames.Add(objLocStr3);
// string 型の ChoiceList オブジェクトを作成
FileNet.Api.Admin.IChoiceList objChoiceListStr = Factory.ChoiceList.CreateInstance(objObjectStore);
objChoiceListStr.DataType = TypeID.STRING;
// 選択リストに選択肢を追加して保存
objChoiceListStr.ChoiceValues = Factory.Choice.CreateList();
objChoiceListStr.ChoiceValues.Add(objChoiceStr1);
objChoiceListStr.ChoiceValues.Add(objChoiceStr2);
objChoiceListStr.ChoiceValues.Add(objChoiceStr3);
objChoiceListStr.DisplayName = "String State List";
objChoiceListStr.Save(RefreshMode.REFRESH);
Console.WriteLine("Choice list created: " + objChoiceListStr.Name);
Console.WriteLine(objChoiceListStr);
/****************************
* Integer-type choice list *
****************************/
// グループ用に integer 型の Choice オブジェクトを作成
IChoice objChoiceMidInt1 = Factory.Choice.CreateInstance();
objChoiceMidInt1.ChoiceType = ChoiceType.INTEGER;
objChoiceMidInt1.DisplayName = "Seattle";
objChoiceMidInt1.ChoiceIntegerValue = 11;
IChoice objChoiceMidInt2 = Factory.Choice.CreateInstance();
objChoiceMidInt2.ChoiceType = ChoiceType.INTEGER;
objChoiceMidInt2.DisplayName = "Kirkland";
objChoiceMidInt2.ChoiceIntegerValue = 12;
IChoice objChoiceMidInt3 = Factory.Choice.CreateInstance();
objChoiceMidInt3.ChoiceType = ChoiceType.INTEGER;
objChoiceMidInt3.DisplayName = "Bellevue";
objChoiceMidInt3.ChoiceIntegerValue = 13;
// integer 型の Choice オブジェクトを作成し、グループ・ノードを生成
IChoice objChoiceInt1 = Factory.Choice.CreateInstance();
objChoiceInt1.ChoiceType = ChoiceType.MIDNODE_INTEGER;
objChoiceInt1.DisplayName = "Washington";
objChoiceInt1.ChoiceValues = Factory.Choice.CreateList();
objChoiceInt1.ChoiceValues.Add(objChoiceMidInt1);
objChoiceInt1.ChoiceValues.Add(objChoiceMidInt2);
objChoiceInt1.ChoiceValues.Add(objChoiceMidInt3);
objChoiceInt1.ChoiceIntegerValue = 1;
IChoice objChoiceInt2 = Factory.Choice.CreateInstance();
objChoiceInt2.ChoiceType = ChoiceType.INTEGER;
objChoiceInt2.DisplayName = "Oregon";
objChoiceInt2.ChoiceIntegerValue = 2;
IChoice objChoiceInt3 = Factory.Choice.CreateInstance();
objChoiceInt3.ChoiceType = ChoiceType.INTEGER;
objChoiceInt3.DisplayName = "California";
objChoiceInt3.ChoiceIntegerValue = 3;
// integer 型の ChoiceList オブジェクトを作成
FileNet.Api.Admin.IChoiceList objChoiceListInt = Factory.ChoiceList.CreateInstance(objObjectStore);
objChoiceListInt.DataType = TypeID.LONG;
// 選択リストに選択肢を追加して保存
objChoiceListInt.ChoiceValues = Factory.Choice.CreateList();
objChoiceListInt.ChoiceValues.Add(objChoiceInt1);
objChoiceListInt.ChoiceValues.Add(objChoiceInt2);
objChoiceListInt.ChoiceValues.Add(objChoiceInt3);
objChoiceListInt.DisplayName = "Integer State List";
objChoiceListInt.Save(RefreshMode.REFRESH);
Console.WriteLine("Choice list created: " + objChoiceListInt.Name);
Console.WriteLine(objChoiceListInt);
選択リストとプロパティー・テンプレートとの関連付け
選択リストをプロパティー・テンプレートに関連付けるには、以下の手順に従います。
- 関連付ける ChoiceList オブジェクトの型 (整数または文字列) と一致するプロパティー・テンプレートを検索または作成します。(integer 型の ChoiceList オブジェクトは PropertyTemplateInteger オブジェクトに関連付ける必要があり、string 型の ChoiceList オブジェクトは PropertyTemplateString オブジェクトに関連付ける必要があります。)
- プロパティー・テンプレートの ChoiceList プロパティーを ChoiceList オブジェクトに設定します。
- プロパティー・テンプレートの save メソッドを呼び出します。
選択リストをプロパティー・テンプレートに関連付ける方法を以下のコード例に示します。
Java の例
System.out.println("Type the symbolic name of the property template with which the choice list will be associated:");
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
String strSearchPT = null;
String clSearchName = null;
String prpSymbolicName;
String prpName;
try {
String strSearchPT = in.readLine();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
Iterator iter = objObjectStore.get_PropertyTemplates().iterator();
PropertyTemplate objPropertyTemplate = null;
// オブジェクト・ストアでプロパティー・テンプレートが検出されるまでループ
while (iter.hasNext())
{
objPropertyTemplate = (PropertyTemplate) iter.next();
prpSymbolicName = objPropertyTemplate.get_SymbolicName();
if (prpSymbolicName.equalsIgnoreCase(strSearchPT))
{
// PropertyTemplate オブジェクトが検出される
System.out.println("Property template selected: " + prpSymbolicName);
System.out.println("Type the name of the choice list to associate with the property template:");
try {
String clSearchName = in.readLine();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
Iterator iter2 = objObjectStore.get_ChoiceLists().iterator();
com.filenet.api.admin.ChoiceList objChoiceList = null;
// 選択リストが検出されるまでループ
while (iter2.hasNext())
{
objChoiceList = (com.filenet.api.admin.ChoiceList) iter2.next();
prpName = objChoiceList.get_Name();
if (prpName.equalsIgnoreCase(clSearchName))
{
// ChoiceList オブジェクトが見つかる
System.out.println("Choice list selected: " + prpName);
// プロパティー・テンプレートに選択リストを追加
objPropertyTemplate.set_ChoiceList(objChoiceList);
objPropertyTemplate.save(RefreshMode.REFRESH);
}
}
}
}
C# の例
String strSearchPT = null;
String strSearchCL = null;
String prpSymbolicName;
String prpName;
Console.WriteLine("Type the symbolic name of the property template with which the choice list will be associated:");
strSearchPT = Console.ReadLine();
// オブジェクト・ストアでプロパティー・テンプレートが検出されるまでループ
foreach (IPropertyTemplate objPropertyTemplate in objObjectStore.PropertyTemplates)
{
prpSymbolicName = objPropertyTemplate.SymbolicName;
if (prpSymbolicName.Equals(strSearchPT, StringComparison.OrdinalIgnoreCase))
{
// PropertyTemplate オブジェクトが検出される
Console.WriteLine("Property template selected: " + prpSymbolicName);
Console.WriteLine("Type the name of the choice list to associate with the property template:");
strSearchCL = Console.ReadLine();
// 選択リストが検出されるまでループ
foreach (FileNet.Api.Admin.IChoiceList objChoiceList in objObjectStore.ChoiceLists)
{
prpName = objChoiceList.Name;
if (prpName.Equals(strSearchCL, StringComparison.OrdinalIgnoreCase))
{
// ChoiceList オブジェクトが見つかる
Console.WriteLine("Choice list selected: " + prpName);
// プロパティー・テンプレートに選択リストを追加
objPropertyTemplate.ChoiceList = objChoiceList;
objPropertyTemplate.Save(RefreshMode.REFRESH);
}
}
}
}
選択リストとプロパティー定義との関連付け
選択リストをプロパティー定義に関連付けるには、以下の手順に従います。
- 関連付ける ChoiceList オブジェクトの型 (整数または文字列) と一致するプロパティー定義を検索または作成します。integer 型の ChoiceList オブジェクトは PropertyDefinitionInteger オブジェクトに関連付ける必要があり、string 型の ChoiceList オブジェクトは PropertyDefinitionString オブジェクトに関連付ける必要があります。
- プロパティー定義の ChoiceList プロパティーを ChoiceList オブジェクトに設定します。
- プロパティー定義が属するクラス定義の save メソッドを呼び出します。
選択リストをプロパティー定義に関連付ける方法を以下のコード例に示します。
Java の例
static PropertyFilter objPropertyFilter = new PropertyFilter();
...
System.out.println("Type the symbolic name of the class definition in which the property definition is located:");
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
String strSearchCD = null;
String strSearchPD = null;
String clSearchName = null;
String prpSymbolicName;
String prpName;
try {
String strSearchCD = in.readLine();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
objPropertyFilter.addIncludeProperty(new FilterElement(null, null, null, PropertyNames.PROPERTY_DEFINITIONS, null));
// 選択したクラス定義をサーバーから取得する
ClassDefinition objClassDefinition = Factory.ClassDefinition.fetchInstance(objObjectStore, strSearchCD, objPropertyFilter);
System.out.println("Type the symbolic name of the property definition with which the choice list will be associated:");
try {
String strSearchPD = in.readLine();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
Iterator iter = objClassDefinition.get_PropertyDefinitions().iterator();
PropertyDefinition objPropertyDefinition = null;
// オブジェクト・ストアでプロパティー定義が検出されるまでループ
while (iter.hasNext())
{
objPropertyDefinition = (PropertyDefinition) iter.next();
prpSymbolicName = objPropertyDefinition.get_SymbolicName();
if (prpSymbolicName.equalsIgnoreCase(strSearchPD))
{
// PropertyDefinition オブジェクトが見つかる
System.out.println("Property definition selected: " + prpSymbolicName);
System.out.println("Type the name of the choice list to associate with the property template:");
try {
String clSearchName = in.readLine();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
Iterator iter2 = objObjectStore.get_ChoiceLists().iterator();
com.filenet.api.admin.ChoiceList objChoiceList = null;
// 選択リストが検出されるまでループ
while (iter2.hasNext())
{
objChoiceList = (com.filenet.api.admin.ChoiceList) iter2.next();
prpName = objChoiceList.get_Name();
if (prpName.equalsIgnoreCase(clSearchName))
{
// ChoiceList オブジェクトが見つかる
System.out.println("Choice list selected: " + prpName);
// プロパティー定義に選択リストを追加
objPropertyDefinition.set_ChoiceList(objChoiceList);
objClassDefinition.save(RefreshMode.REFRESH);
}
}
}
}
C# の例
static PropertyFilter objPropertyFilter = new PropertyFilter();
...
String strSearchCD = null;
String strSearchPD = null;
String strSearchCL = null;
String prpSymbolicName;
String prpName;
Console.WriteLine("Type the symbolic name of the class definition in which the property definition is located:");
strSearchCD = Console.ReadLine();
objPropertyFilter.AddIncludeProperty(new FilterElement(null, null, null, PropertyNames.PROPERTY_DEFINITIONS, null));
// 選択したクラス定義をサーバーから取得する
IClassDefinition objClassDefinition = Factory.ClassDefinition.FetchInstance(objObjectStore, strSearchCD, objPropertyFilter);
Console.WriteLine("Type the symbolic name of the property definition with which the choice list will be associated:");
strSearchPD = Console.ReadLine();
// PropertyDefinitions プロパティーをプロパティー・キャッシュから取得する
IPropertyDefinitionList objPropertyDefinitions = objClassDefinition.PropertyDefinitions;
// プロパティー定義が見つかるまでループする
foreach (IPropertyDefinition objPropertyDefinition in objPropertyDefinitions)
{
prpSymbolicName = objPropertyDefinition.SymbolicName;
if (prpSymbolicName.Equals(strSearchPD, StringComparison.OrdinalIgnoreCase))
{
// PropertyDefinition オブジェクトが見つかる
Console.WriteLine("Property definition selected: " + prpSymbolicName);
Console.WriteLine("Type the name of the choice list to associate with the property definition:");
strSearchCL = Console.ReadLine();
// 選択リストが検出されるまでループ
foreach (FileNet.Api.Admin.IChoiceList objChoiceList in objObjectStore.ChoiceLists)
{
prpName = objChoiceList.Name;
if (prpName.Equals(strSearchCL, StringComparison.OrdinalIgnoreCase))
{
// ChoiceList オブジェクトが見つかる
Console.WriteLine("Choice list selected: " + prpName);
// プロパティー定義に選択リストを追加
objPropertyDefinition.ChoiceList = objChoiceList;
objClassDefinition.Save(RefreshMode.REFRESH);
}
}
}
}
選択リストの関連付けの解除
プロパティー・テンプレートまたはプロパティー定義から選択リストの関連付けを解除するためのコードは、選択リストを関連付けるコードとほとんど同じです (前述の例を参照)。唯一の違いは、プロパティー・テンプレートまたはプロパティー定義で ChoiceList プロパティーを null に設定するという点です。 次に例を示します。
Java の例
// Remove Choice List from property definition
objPropertyDefinition.set_ChoiceList(null);
objClassDefinition.save(RefreshMode.REFRESH);
C# の例
// Remove Choice List to property definition
objPropertyDefinition.ChoiceList = null;
objClassDefinition.Save(RefreshMode.REFRESH);