Beanを作成 - 7.3

ConvertBody (メディエーション)

Version
7.3
Language
日本語
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
ジョブデザインと開発 > サードパーティーシステム > 処理コンポーネント(メディエーション) > ConvertBodyコンポーネント(メディエーション)
データガバナンス > サードパーティーシステム > 処理コンポーネント(メディエーション) > ConvertBodyコンポーネント(メディエーション)
データクオリティとプレパレーション > サードパーティーシステム > 処理コンポーネント(メディエーション) > ConvertBodyコンポーネント(メディエーション)
Last publication date
2023-08-09

手順

  1. リポジトリーツリービューで[Code] (コード)ノードを展開し、Beansノードを展開します。コンテキストメニューで[Create Bean] (Beanを作成)を選択します。
  2. [New Bean] (新規Bean)ウィザードが開きます。[Name] (名前)フィールドにBeanの名前(たとえばPrintConvertToBean)を入力します。[Finish] (終了)をクリックし、ウィザードを閉じます。
  3. デザインワークスペースに次のコードを入力します。
    package beans;
    
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    public class PrintConvertToBean {
    
    	/**
    	 * print input message
    	 * @param message
    	 */
    	public static void helloExample(Document message) {
    		if (message == null) {
    			System.out.println("There's no message here!");
    			return;
    		}
    		Element rootElement = message.getDocumentElement();
    		if (rootElement == null) {
    			System.out.println("There's no root element here!");
    			return;
    		}
    		System.out.println("The root element name is:"
    				+ rootElement.getNodeName());
    		System.out.println("The book categories are:");
    		NodeList types = rootElement.getElementsByTagName("category");
    		for(int i = 0;i<types.getLength();i++){
    			Element child = (Element) types.item(i);
    			System.out.println(child.getFirstChild().getNodeValue());
    		}
    	}
    }
  4. [Ctrl]+[S]を押し、Beanを保存します。

タスクの結果

JavaBeansの作成と使用については、 Talend Studioユーザーガイドを参照してください。