All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.java.ApplicationException.vsl Maven / Gradle / Ivy

Go to download

Produces generic Java code, such as: value objects, enumerations, exceptions, interfaces, etc.

The newest version!
#if ($umlUtils.shouldOutput($class))
## IMPORTANT!!! We can remove this when we upgrade to AndroMDA 3.4
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!!
// Generated by: ApplicationException.vsl in andromda-java-cartridge.
//
#if ($stringUtils.isNotBlank($class.packageName))
package $class.packageName;
#end
#set ($webFault=$class.hasStereotype("WebFault"))
#if ($webFault)
## Assume the only Exception AssociationEnd class is the faultBean
## FaultBean class is created by wsdl2java in CXF project and copied to common project
#set ($faultDetails=$class.packageName + "." + $class.name.replace("Exception", "Fault"))
#set ($faultClass=$class.name.replace("Exception", "Fault"))
#end

#parse("templates/java/ExceptionUtilsImports.vm")

/**
$class.getDocumentation(" * ")
 */
#if ($XMLBindingAnnotations)
    @XmlRootElement(name="#if ($webFault)$faultClass#else$class.name#end")
    // Annotate get/set fields with @XmlTransient, not the private fields.
    @XmlAccessorType(XmlAccessType.FIELD)
#if ($webFault)
    @XmlType(name="$stringUtils.uncapitalize($faultClass)")
    @javax.xml.ws.WebFault( name="$faultClass", targetNamespace="http://$javaUtils.reversePackage($class.packageName)#if($addNamespaceBackslash)/#end")
#else
    @XmlType(name="$stringUtils.uncapitalize($class.name)")
#end
#end
public#if($class.abstract) abstract#end class $class.name
#if($class.generalization)
    extends ${class.generalization.fullyQualifiedName}
#else
    extends Exception
#end
#if (!$class.interfaceAbstractions.empty)
    implements $class.implementedInterfaceList
#end
{
#if ($serializable)
    /** The serial version UID of this class. Throwable implements Serializable so declaration not needed. */
    private static final long serialVersionUID = ${class.serialVersionUID}L;

#if ($webFault)
    /** The Class with attributes populated with Exception Details, modeled as ValueObject, to fully describe the fault.
        Exception throwable and message are stored in the Exception class, identifying details such as name and id are in FaultDetails */
    private $faultDetails details;

#end
#end
    /**
     * The default constructor.
     */
    public ${class.name}()
    {
        super();
        // Avoid compiler warning from uncommented empty method
    }

    /**
     * Constructs a new instance of $class.name
     *
     * @param throwable the parent Throwable
     */
    public ${class.name}(Throwable throwable)
    {
        super(findRootCause(throwable));
    }

    /**
     * Constructs a new instance of $class.name
     *
     * @param messageIn the throwable message.
     */
    public ${class.name}(String messageIn)
    {
        super(messageIn);
    }

    /**
     * Constructs a new instance of $class.name
     *
     * @param messageIn the throwable message.
     * @param throwable the parent of this Throwable.
     */
    public ${class.name}(String messageIn, Throwable throwable)
    {
        super(messageIn, findRootCause(throwable));
    }

    private Object[] messageArguments;

    /**
     * Gets the message arguments that can be used by message resources (in
     * something like the presentation tier)
     *
     * @return messageArguments
     */
    public Object[] getMessageArguments()
    {
        return this.messageArguments;
    }

    /**
     * Sets the message arguments that can be used by message resources (in
     * something like the presentation tier)
     *
     * @param messageArgumentsIn
     */
    public void setMessageArguments(Object[] messageArgumentsIn)
    {
        this.messageArguments = messageArgumentsIn;
    }

#if ($webFault)
    /**
     * Constructs a new instance of $class.name with WebFault details
     *
     * @param throwable the parent Throwable
     * @param detailsIn $faultDetails WebFault details
     */
    public ${class.name}(Throwable throwable, $faultDetails detailsIn)
    {
        super(findRootCause(throwable));
        this.details = detailsIn;
    }

    /**
     * Constructs a new instance of $class.name with WebFault details
     *
     * @param messageIn the throwable message.
     * @param detailsIn $faultDetails WebFault details
     */
    public ${class.name}(String messageIn, $faultDetails detailsIn)
    {
        super(messageIn);
        this.details = detailsIn;
    }

    /**
     * Constructs a new instance of $class.name with WebFault details
     *
     * @param messageIn the throwable message.
     * @param throwable the parent of this Throwable.
     * @param detailsIn $faultDetails WebFault details
     */
    public ${class.name}(String messageIn, Throwable throwable, $faultDetails detailsIn)
    {
        super(messageIn, findRootCause(throwable));
        this.details = detailsIn;
    }

    /**
     * Returns the WebFault details
     *
     * @return details $faultDetails WebFault details
     */
    public $faultDetails getFaultInfo() {
        return this.details;
    }

#end
#parse("templates/java/ExceptionUtils.vm")
}
#end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy