Passed
Push — master ( bd4b5e...fa3bf6 )
by P.R.
01:57
created

CompoundJobNode.create_start()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
crap 1
1
"""
2
Enarksh
3
4
Copyright 2015-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8 1
import abc
9 1
from xml.etree.ElementTree import SubElement
10
11 1
from enarksh_lib.xml_generator.node.Node import Node
12
13
14 1
class CompoundJobNode(Node):
15
    """
16
    Class for generating XML messages for elements of type 'CompoundJobType'.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20 1
    def create_node(self):
21
        """
22
        Execute all the necessary steps the create a compound node.
23
        """
24 1
        self.create_start()
25 1
        self.create_resources()
26 1
        self.create_child_nodes()
27 1
        self.create_input_ports()
28 1
        self.create_output_ports()
29 1
        self.create_dependencies()
30 1
        self.create_finish()
31
32
    # ------------------------------------------------------------------------------------------------------------------
33 1
    @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 1
    @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 1
    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 1
        pass
62
63
    # ------------------------------------------------------------------------------------------------------------------
64 1
    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 1
        pass
72
73
    # ------------------------------------------------------------------------------------------------------------------
74 1
    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 1
        pass
82
83
    # ------------------------------------------------------------------------------------------------------------------
84 1
    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 1
        pass
93
94
    # ------------------------------------------------------------------------------------------------------------------
95 1
    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 1
        pass
103
104
    # ------------------------------------------------------------------------------------------------------------------
105 1
    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 1
        compound_job = SubElement(parent, 'CompoundJob')
112
113 1
        self._generate_xml_common(compound_job)
114
115
# ----------------------------------------------------------------------------------------------------------------------
116