/*********************************************************************************************************************** | |
* Copyright (c) 2010 Attensity Europe GmbH. | |
* All rights reserved. | |
* This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html | |
**********************************************************************************************************************/ | |
package org.eclipse.smila.processing.designer.model.processor.util; | |
import java.io.PrintWriter; | |
import javax.wsdl.Definition; | |
import javax.wsdl.WSDLException; | |
import javax.wsdl.extensions.ExtensibilityElement; | |
import javax.wsdl.extensions.ExtensionRegistry; | |
import javax.xml.namespace.QName; | |
import org.eclipse.bpel.model.Process; | |
import org.eclipse.bpel.model.extensions.BPELExtensionSerializer; | |
import org.eclipse.bpel.model.resource.BPELWriter; | |
import org.eclipse.smila.processing.designer.model.record.AnnotationValue; | |
import org.eclipse.smila.processing.designer.model.record.util.RecordConstants; | |
import org.eclipse.smila.processing.designer.model.record.util.RecordUtils; | |
import org.w3c.dom.Element; | |
import org.w3c.dom.Node; | |
/** | |
* Serialiaser for ExtensibilityElement {@link AnnotationValue}. | |
* | |
* Copyright (c) 2010 Attensity Europe GmbH | |
* | |
* @author Lars Kunze | |
*/ | |
public class AnnotationValueExtensionSerializer implements BPELExtensionSerializer | |
{ | |
@Override | |
public void marshall(Class arg0, QName arg1, ExtensibilityElement arg2, PrintWriter arg3, Definition arg4, | |
ExtensionRegistry arg5) throws WSDLException | |
{ | |
System.out.println("NOT yet implemented!"); | |
} | |
@Override | |
public void marshall(Class parentType, QName elementType, ExtensibilityElement extension, Node parentNode, Process process, | |
ExtensionRegistry extReg, BPELWriter bpelWriter) throws WSDLException | |
{ | |
AnnotationValue annotationValue = (AnnotationValue) extension; | |
Element elementAnnotationValue = | |
parentNode.getOwnerDocument().createElementNS(elementType.getNamespaceURI(), RecordConstants.NODE_V); | |
elementAnnotationValue.setPrefix(RecordUtils.addNamespace(process)); | |
elementAnnotationValue.setAttribute(RecordConstants.ATT_N, annotationValue.getName()); | |
elementAnnotationValue.appendChild(parentNode.getOwnerDocument().createTextNode(annotationValue.getValue())); | |
parentNode.appendChild(elementAnnotationValue); | |
} | |
} |