Class XMLExportTools

  • Direct Known Subclasses:
    ProcessModelXMLExportTools

    public class XMLExportTools
    extends Object
    These methods will be used by both, the activity model and the process model.
    Author:
    Marco Waimer
    • Constructor Detail

      • XMLExportTools

        public XMLExportTools()
    • Method Detail

      • createConfigurationElement

        public static Element createConfigurationElement​(Document doc,
                                                         String ns,
                                                         Configuration conf,
                                                         String type,
                                                         String ecd,
                                                         String operation)
        Create an XML element for the given configuration.
        Parameters:
        doc -
        ns - The namespace the configuration should be used in.
        conf - The changeable configuration.
        type - The type of the configuration, i.e. test.
        ecd - The name of the executable component description. This optional attribute will be used for the configuration set XML.
        operation - The name of the operation. This optional attribute will be used for the configuration set XML.
        Returns:
        The XML representation of the Configuration.
      • createConfigurationDescriptionElement

        public static Element createConfigurationDescriptionElement​(Document doc,
                                                                    String ns,
                                                                    ConfigurationDescription confDesc,
                                                                    String ecd,
                                                                    String operation)
        Parameters:
        doc -
        ns - The namespace the element should be created in.
        confDesc - The configuration description.
        ecd - The name of the executable component description. This optional attribute will be used for the configuration set XML.
        operation - The name of the operation. This optional attribute will be used for the configuration set XML.
        Returns:
        The XML representation of the ConfigurationDescription.
      • createConfigurationEntryElement

        public static Element createConfigurationEntryElement​(Document doc,
                                                              String ns,
                                                              String name,
                                                              ConfigurationDescription.ConfigurationEntry confEntry)
        Despite the name implies, this creates an entry for a configuration description! Unfortunately, a configuration description entry has the same element name as a configuration entry.
        Parameters:
        doc -
        ns - The namespace the element should be created in.
        name - The name of the configuration entry.
        confEntry - The configuration entry, could be null.
        Returns:
        The XML representation of the configuration entry.
      • createClassPathElement

        public static Element createClassPathElement​(Document doc,
                                                     String ns,
                                                     String parent,
                                                     List<String> classPaths)
        Parameters:
        doc -
        ns - The namespace the element should be created in.
        parent - The name of the parent element.
        classPaths - The list of class path entries.
        Returns:
        The XML representation of the class path list.
      • createSeparatedClassPathElement

        public static Element createSeparatedClassPathElement​(Document doc,
                                                              String ns,
                                                              String parent,
                                                              Map<ActivityConstants.ActivityModelEntityType,​List<String>> map)
        Parameters:
        doc -
        ns - The namespace the element should be created in.
        parent - The name of the parent element.
        map - The separated class path entries.
        Returns:
        The XML representation of the class path list.
      • createExecutionControlPropertiesElement

        public static Element createExecutionControlPropertiesElement​(Document document,
                                                                      String ns,
                                                                      ExecutionControlProperties executionControlProperties)
        Create an XML element for the given execution control properties.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        executionControlProperties -
        Returns:
        a execution control properties element
      • createECPElement

        public static Element createECPElement​(Document document,
                                               String ns,
                                               ExecutionControlProperties executionControlProperties,
                                               ActivityConstants.ActivityModelEntityType entityType)
        Create an XML element for the given execution control properties.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        executionControlProperties -
        entityType - The origin entity type of the attribute.
        Returns:
        a execution control properties element
      • createUserAttributesElement

        public static Element createUserAttributesElement​(Document document,
                                                          String ns,
                                                          Map<String,​String> userAttributes)
        Creates a new container element for user attributes and fills it with the given user attributes.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        userAttributes - The user attributes.
        Returns:
        A new element containing all user attributes.
      • fillUserAttributesElement

        public static void fillUserAttributesElement​(Document document,
                                                     String ns,
                                                     Map<String,​String> userAttributes,
                                                     Element uasElement,
                                                     boolean namespaceAware)
        Fill the given XML element with values of the given user attributes.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        userAttributes - The user attributes.
        uasElement -
        namespaceAware - Whether the elements should be created name space aware.
      • createPluginDataContainerElement

        public static Element createPluginDataContainerElement​(Document doc,
                                                               String ns,
                                                               PluginDataContainer pdc)
        Creates a new container element for plugin data and fills it with the given plugin data.
        Parameters:
        doc -
        ns - The namespace the element should be created in.
        pdc -
        Returns:
        A new element containing all user attributes.
      • fillQualifiedAgentElement

        protected static void fillQualifiedAgentElement​(Document document,
                                                        String ns,
                                                        Element qaElement,
                                                        QualifiedAgent qa,
                                                        boolean ignoreUserSessionId)
        Creates an element representing a qualified agent, based on the given agent
        Parameters:
        document -
        ns - The namespace the element should be created in.
        qaElement -
        qa -
        ignoreUserSessionId - Whether to ignore the user session ID of the designated agent even if it is set.
      • createEBPInstanceReferenceElement

        public static Element createEBPInstanceReferenceElement​(Document document,
                                                                String ns,
                                                                EBPInstanceReference ebpIR,
                                                                boolean namespaceAware)
        Creates an ebp instance reference element, based on the given ebp instance reference object.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        ebpIR -
        namespaceAware - Whether the element should be created name space aware
        Returns:
        A new ebp instance reference element.
      • createURIArrayElement

        protected static Element createURIArrayElement​(Document document,
                                                       String ns,
                                                       URI[] arrayOfURIs,
                                                       String parentElementName,
                                                       boolean namespaceAware)
        Creates an element representing an array of URIs, based on the given array.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        arrayOfURIs -
        parentElementName -
        namespaceAware - Whether the element should be created name space aware
        Returns:
        A new element that represents an array of URIs.
      • sortedKeySet

        public static Set<String> sortedKeySet​(Set<String> keySet)
        Sort a given set of map keys.
        Parameters:
        keySet - a set of map keys
        Returns:
        a sorted set of map keys
      • addElement

        protected static Element addElement​(Document document,
                                            String ns,
                                            Element parent,
                                            String type)
        Create new child Element without data.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        parent - Element to which the created Element is appended to as a child
        type - type of the created Element
        Returns:
        The created child element.
      • addElement

        protected static Element addElement​(Document document,
                                            String ns,
                                            Element parent,
                                            String type,
                                            String textContent)
        Create new child Element with text data. Do not add any children to this element! Otherwise the string content may be affected by indentation.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        parent - Element to which the created Element is appended to as a child
        type - type of the created Element
        textContent - content of the element
        Returns:
        The created child element.
      • addElement

        protected static Element addElement​(Document document,
                                            String ns,
                                            Element parent,
                                            String type,
                                            String textContent,
                                            ActivityConstants.ActivityModelEntityType entityType)
        Create new child Element with text data. Do not add any children to this element! Otherwise the string content may be affected by indentation.
        Parameters:
        document -
        ns - The namespace the element should be created in.
        parent - Element to which the created Element is appended to as a child
        type - type of the created Element
        textContent - content of the element
        entityType - The origin entity type of the attribute.
        Returns:
        The created child element.
      • addElementNS

        protected static Element addElementNS​(Document document,
                                              Element parent,
                                              String type,
                                              String textContent)
        Create new child Element with text data. Do not add any children to this element! Otherwise the string content may be affected by indentation.
        Parameters:
        document -
        parent - Element to which the created Element is appended to as a child
        type - type of the created Element
        textContent - content of the element
        Returns:
        The created child element.