WebObjects
■ このスレッドは過去ログ倉庫に格納されています
0583461=名無しにします
02/01/07 21:10ID:y2J8K6f8下手糞なソースだが大目に見てくれれば嬉しいっす。。
// Mainコンポーネントの初期化
public Main(WOContext context) {
super(context);
// データをフェッチする(返ってくるのはNSDictionaryのNSArray)
EOEditingContext ec = this.session().defaultEditingContext();
NSArray tmpRecords = EOUtilities.objectsWithFetchSpecificationAndBindings(ec,"Customer","CustomerFetch",null);
// NSArrayをEnumerationに変換する
Enumeration e = tmpRecords.objectEnumerator();
// レコード件数、エンタープライズオブジェクトの配列を定義
int intCnt = 0;
int intRecordKensuu = tmpRecords.count();
EOEnterpriseObject customerArrays[] = new EOEnterpriseObject[intRecordKensuu];
// Enumerationの中身を見て、一つ一つをEOに変換し配列に叩き込む
while(e.hasMoreElements()){
NSDictionary tmpDict = (NSDictionary)e.nextElement();
EOEnterpriseObject customer = EOUtilities.objectFromRawRow(ec,"Customer",tmpDict);
customerArrays[intCnt] = customer;
intCnt++;
}
// customerRecords(CustomerオブジェクトのNSMutableArray)を得る
customerRecords = new NSMutableArray(new NSArray(customerArrays));
}
■ このスレッドは過去ログ倉庫に格納されています