Test Failed
Push — master ( 8ecc8b...fbff38 )
by P.R.
01:31
created

CompoundJobNode.create_node()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
1
"""
2
Enarksh
3
4
Copyright 2015-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
import abc
9
from xml.etree.ElementTree import SubElement
10
11
from enarksh_lib.xml_generator.node.Node import Node
12
13
14
class CompoundJobNode(Node):
15
    """
16
    Class for generating XML messages for elements of type 'CompoundJobType'.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20
    def create_node(self):
21
        """
22
        Execute all the necessary steps the create a compound node.
23
        """
24
        self.create_start()
25
        self.create_resources()
26
        self.create_child_nodes()
27
        self.create_input_ports()
28
        self.create_output_ports()
29
        self.create_dependencies()
30
        self.create_finish()
31
32
    # ------------------------------------------------------------------------------------------------------------------
33
    @abc.abstractmethod
34
    def create_child_nodes(self):
35
        """
36
        You MUST override this method in your concrete class to create the child nodes of your compound node.
37
38
        :rtype: None
39
        """
40
        raise NotImplementedError()
41
42
    # ------------------------------------------------------------------------------------------------------------------
43
    @abc.abstractmethod
44
    def create_dependencies(self):
45
        """
46
        You MUST override this method in your concrete class to create the dependencies between the child nodes of your
47
        compound node.
48
49
        :rtype: None
50
        """
51
        raise NotImplementedError()
52
53
    # ------------------------------------------------------------------------------------------------------------------
54
    def create_finish(self):
55
        """
56
        You MAY override this method in your concrete class to add additional logic for creating your compound node.
57
58
        :rtype: None
59
        """
60
        # Noting to do.
61
        pass
62
63
    # ------------------------------------------------------------------------------------------------------------------
64
    def create_input_ports(self):
65
        """
66
        You MAY override this method in your concrete class to create additional input ports for your compound node.
67
68
        :rtype: None
69
        """
70
        # Noting to do.
71
        pass
72
73
    # ------------------------------------------------------------------------------------------------------------------
74
    def create_output_ports(self):
75
        """
76
        You MAY override this method in your concrete class to create additional output ports for your compound node.
77
78
        :rtype: None
79
        """
80
        # Noting to do.
81
        pass
82
83
    # ------------------------------------------------------------------------------------------------------------------
84
    def create_resources(self):
85
        """
86
        You MAY override this method in your concrete class to create the resources at the level of you compound node.
87
        node.
88
89
        :rtype: None
90
        """
91
        # Noting to do.
92
        pass
93
94
    # ------------------------------------------------------------------------------------------------------------------
95
    def create_start(self):
96
        """
97
        You MAY override this method in your concrete class to add additional logic for creating your compound node.
98
99
        :rtype: None
100
        """
101
        # Noting to do.
102
        pass
103
104
    # ------------------------------------------------------------------------------------------------------------------
105
    def generate_xml(self, parent):
106
        """
107
        Generates the XML element for this node.
108
109
        :param xml.etree.ElementTree.Element parent: The parent XML element.
110
        """
111
        compound_job = SubElement(parent, 'CompoundJob')
112
113
        self._generate_xml_common(compound_job)
114
115
# ----------------------------------------------------------------------------------------------------------------------
116