Search in sources :

Example 1 with ImplicitChildElement

use of com.webcohesion.enunciate.modules.jaxb.model.ImplicitChildElement in project enunciate by stoicflame.

the class JaxwsModule method addReferencedTypeDefinitions.

protected void addReferencedTypeDefinitions(WebFault webFault, LinkedList<Element> contextStack) {
    contextStack.push(webFault);
    try {
        if (webFault.isImplicitSchemaElement()) {
            for (ImplicitChildElement childElement : webFault.getChildElements()) {
                WebFault.FaultBeanChildElement fbce = (WebFault.FaultBeanChildElement) childElement;
                this.jaxbModule.getJaxbContext().addReferencedTypeDefinitions(fbce.isAdapted() ? fbce.getAdapterType() : fbce.getType(), contextStack);
            }
        } else {
            DeclaredType faultBeanType = webFault.getExplicitFaultBeanType();
            if (faultBeanType != null) {
                this.jaxbModule.getJaxbContext().addReferencedTypeDefinitions(faultBeanType, contextStack);
            }
        }
    } catch (RuntimeException e) {
        if (e.getClass().getName().endsWith("CompletionFailure")) {
            throw new CompletionFailureException(contextStack, e);
        }
        throw e;
    } finally {
        contextStack.pop();
    }
}
Also used : CompletionFailureException(com.webcohesion.enunciate.CompletionFailureException) ImplicitChildElement(com.webcohesion.enunciate.modules.jaxb.model.ImplicitChildElement) DeclaredType(javax.lang.model.type.DeclaredType)

Example 2 with ImplicitChildElement

use of com.webcohesion.enunciate.modules.jaxb.model.ImplicitChildElement in project enunciate by stoicflame.

the class WebFault method getChildElements.

/**
 * If this is an implicit fault bean, return the child elements.
 *
 * @return The child elements of the bean, or null if none.
 */
public Collection<ImplicitChildElement> getChildElements() {
    if (!isImplicitSchemaElement()) {
        return Collections.emptyList();
    }
    Set<ImplicitChildElement> childElements = new TreeSet<ImplicitChildElement>(new Comparator<ImplicitChildElement>() {

        public int compare(ImplicitChildElement o1, ImplicitChildElement o2) {
            return o1.getElementName().compareTo(o2.getElementName());
        }
    });
    for (PropertyElement property : getAllFaultProperties(this)) {
        String propertyName = property.getPropertyName();
        if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName)) || "suppressed".equals(propertyName)) {
            continue;
        }
        childElements.add(new FaultBeanChildElement(property, this, context.getJaxbContext()));
    }
    return childElements;
}
Also used : ImplicitChildElement(com.webcohesion.enunciate.modules.jaxb.model.ImplicitChildElement) PropertyElement(com.webcohesion.enunciate.javac.decorations.element.PropertyElement)

Aggregations

ImplicitChildElement (com.webcohesion.enunciate.modules.jaxb.model.ImplicitChildElement)2 CompletionFailureException (com.webcohesion.enunciate.CompletionFailureException)1 PropertyElement (com.webcohesion.enunciate.javac.decorations.element.PropertyElement)1 DeclaredType (javax.lang.model.type.DeclaredType)1