새 인터페이스를 생성하고 사용자 정의 Java™ 코드를 추가하여 사용자 정의 중개 기본요소를 구현합니다.
// Get the symbol from the body of the message String symbol = input1.getString("body/getQuote/symbol"); // If symbol is on the user's preferred list, set the isPreferred flag in the correlation context to 'true' if (symbol.equals("ibm")) { // Create the preferenceInformation business object and set the isPreferred flag to true com.ibm.websphere.bo.BOFactory factory = (com.ibm.websphere.bo.BOFactory) new com.ibm.websphere.sca.ServiceManager().locateService("com/ibm/websphere/bo/BOFactory"); DataObject preferenceInformation = factory.create("http://CustomMediation", "PreferenceInformation"); preferenceInformation.setBoolean("isPreferred", true); // Set the business object in the correlation context input1.setDataObject("context/correlation", preferenceInformation); } // Return the DataObject return input1;