1

一連のレコードをループして、各レコードの開始日を現在の日付と比較し、ルールのアクション部分にメッセージを出力する必要があります。ILOG/ODM ルール XOM で arraylist を使用し、それをルールで使用して一連のレコードをループできるかどうかを調べようとしています。この要件を実装するための最良の方法を教えてください。

4

2 に答える 2

1

はい、ルール XOM で arraylist を使用し、ルールでそれを反復処理できます。ルール プロジェクトが XOM クラスのインスタンスを、言語化「test」を使用して入力パラメーターとして受け取ると仮定します。以下のようなものがあります。

XOM:

import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class Test
{
    private List<Record> recordList;

    public Test()
    {
    }

    public void setRecordList(List<Record> recordList)
    {
        this.recordList = recordList;
    }

    public List<Record> getRecordList()
    {
        return recordList;
    }

    public static int compareWithCurrentDate( Date date)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTime( date);
        return cal.compareTo( Calendar.getInstance());
    }
}


import java.util.Date;

public class Record
{
    private Date startDate;

    public Record()
    {
    }

    public void setStartDate(Date startDate)
    {
        this.startDate = startDate;
    }

    public Date getStartDate()
    {
        return startDate;
    }
}

BOM 言語化:

# Record
Record#concept.label = record
Record.startDate#phrase.action = set the start date of {this} to {start date}
Record.startDate#phrase.navigation = {start date} of {this}

# Test
Test#concept.label = test
Test.compareWithCurrentDate(java.util.Date)#phrase.navigation = compare {0} with current date
Test.recordList#phrase.action = set the record list of {this} to {record list}
Test.recordList#phrase.navigation = {record list} of {this}

ルール:

definitions 
    set 'current record' to a record in the record lists of test ; 
if
    compare the start date of 'current record' with current date is not 0 
then
    print "" ;
于 2015-08-11T09:19:20.350 に答える