ExternalCallout API 예
1.
다음 컨텐츠로 GetCreditScore.java라는 파일을 작성하십시오. 파일은 모델링 애플리케이션에서 점수를 페치하는 ScoreQueryUtility라는 클래스가 있다고 가정합니다.
import java.util.Map;
import com.unicacorp.interact.session.AudienceId;
import com.unicacorp.interact.flowchart.macrolang.storedobjs.IAffiniumExternalCallout;
import com.unicacorp.interact.flowchart.macrolang.storedobjs.CalloutException;
import java.util.Random;

public class GetCreditScore implements IAffiniumExternalCallout
{
// the class that has the logic to query an external system for a customer’s credit score
private static ScoreQueryUtility scoreQueryUtility;
public void initialize(Map<String, String> configurationData) throws CalloutException
{
// configurationData has the key- value pairs specific to the environment the server is running in
// initialize scoreQueryUtility here
}

public void shutdown(Map<String, String> configurationData) throws CalloutException
{
// shutdown scoreQueryUtility here
}

public int getNumberOfArguments()
{
// do not expect any additional arguments other than the customer’s id
return 0;
}

public List<String> getValue(AudienceId audienceId, Map<String, String> configurationData,
Object... arguments) throws CalloutException
{
Long customerId = (Long) audienceId.getComponentValue("Customer");
// now query scoreQueryUtility for the credit score of customerId
Double score = scoreQueryUtility.query(customerId);
String str = Double.toString(score);
List<String> list = new LinkedList<String>();
list.add(str);
return list;
}
}
2.
GetCreditScore.javaGetCreditScore.class로 컴파일하십시오.
3.
GetCreditScore.class 및 사용하는 다른 클래스 파일을 포함한 creditscore.jar라는 jar 파일을 작성하십시오.
4.
런타임 서버의 일부 위치(예를 들어, /data/interact/creditscore.jar)로 jar 파일을 복사하십시오.
5.
GetCreditScore 이름 및 /data/interact/creditscore.jar 클래스 경로의 외부 콜아웃을 구성 관리 페이지의 externalCallouts 카테고리에 작성하십시오.
6.
대화식 플로우차트에서 콜아웃을 EXTERNALCALLOUT(‘GetCreditScore’)로 사용할 수 있습니다.