Exemple d'exposition manuelle d'interactionSpec : exemple Taderc99 CICS

Vous pouvez exposer les propriétés InteractionSpec et ConnectionSpec en tant que sortie de données pour que votre application Java™ puisse obtenir les valeurs des propriétés une fois que la transaction a été exécutée.

Avant de commencer

Pour exposer ces propriétés InteractionSpec pour la sortie, vous devez créer une classe de sortie et modifier l'interface et les fichiers d'implémentation de votre bean J2C avant de l'utiliser dans une application.

Procédure

L'exemple de code expose la propriété InteractionSpec functionName de l'exemple taderc99. Voici un exemple de classe d'encapsulation :
package sample.cics.data;

public class WrapperBean {
	protected CustomerInfo customerInfo;
	protected String funcName;

	/**
	 * @return Returns the functionName.
	 */
	public String getFuncName() {
		return funcName;
	}
	/**
	 * @param functionName The functionName to set.
	 */
	public void setFuncName(String functionName) {
		this.funcName = functionName;
	}
	/**
	 * @return Returns the customerInfo.
	 */
	public CustomerInfo getCustomerInfo() {
		return customerInfo;
	}
	/**
	 * @param customerInfo The customerInfo to set.
	 */
	public void setCustomerInfo(CustomerInfo customerInfo) {
		this.customerInfo = customerInfo;
	}
}

Exemple

Voici la méthode mise à jour. Les modifications à effectuer sont indiquées en gras.

/**
	 * @j2c.interactionSpec class="com.ibm.connector2.cics.ECIInteractionSpec"
	 * @j2c.interactionSpec-property name="functionName" value="TADERC99"
	 * @j2c.interactionSpec-returnProperty name="functionName" outputBinding="funcName"
	 * @generated
	 */
	public WrapperBean getCustomer(sample.cics.data.CustomerInfo arg) throws javax.resource.ResourceException {
		ConnectionSpec cs = getConnectionSpec();
		InteractionSpec is = interactionSpec;
		if (is == null) {
			is = new com.ibm.connector2.cics.ECIInteractionSpec();
			((com.ibm.connector2.cics.ECIInteractionSpec) is).setFunctionName("TADERC99");
		}
		sample.cics.data.CustomerInfo output = new sample.cics.data.CustomerInfo();
		invoke(cs, is, arg, output);
		WrapperBean bean = new WrapperBean();
		bean.setCustomerInfo(output);
		bean.setFuncName(((com.ibm.connector2.cics.ECIInteractionSpec) is).getFunctionName());
		return bean;	}

Commentaires