1.
|
Créez un fichier appelé GetCreditScore.java ayant le contenu suivant. Ce fichier suppose qu'il existe une classe appelée ScoreQueryUtility qui extrait un score à partir d'une application de modélisation.
|
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.
|
3.
|
Créez un fichier jar appelé creditscore.jar contenant GetCreditScore.class et les autres fichiers de classe qu'il utilise.
|
4.
|
Copiez le fichier jar à un emplacement sur le serveur d'exécution, par exemple /data/interact/creditscore.jar.
|
5.
|
Créez un appel externe nommé GetCreditScore et le classpath /data/interact/creditscore.jar dans la catégorie externalCallouts sur la page Gestion des configurations.
|
6.
|
Dans un diagramme temps réél, l'appel externe peut être utilisé en tant que EXTERNALCALLOUT(‘GetCreditScore’).
|
Copyright IBM Corporation 2014. All Rights Reserved.
|