def generate(self):
        """
        Parse Json included in constructor to generate diagrams

        Raises:
            exception.ElementNotFoundException: when a type element is unknown
        """
        # self.writeHeader()
        for obj in self.json:
            if not obj['type'] in self.elements:
                # Element is missing in lib/.../json folder
                raise exception.ElementNotFoundException(obj['type'])
            else:
                base = json.load(open(self.defaultTemplatePath+'/json/'+obj['type']+'.json'))
                base.update(obj)

                # Links have a different behaviour than other elements
                if obj['type'] == "link":
                    base['from'] = base['from']
                    base['to'] = base['to']
                    self.links.append(base)
                    continue

                base['name'] = base['name']
                if not base['link'] is None:
                    self.transformEmbeddedLink(base)

                # Get position of element into grid
                base = self.getGridPosition(base)

                # Store hash of name in namedElements
                hashName = hashlib.md5(base['name'])
                self.namedElements[hashName.hexdigest()] = base

                # Transform JSON element to SVG
                self.svg.addElement(base)

        # links treatments
        for link in self.links:
            link = self.linkPosition(link)
            # Transform element in SVG
            self.svgLinks.addElement(link)

        self.svg.prependFragment(self.svgLinks.svgString)
        self.stats[Interpretor.STATS_NB_ELEMENTS] = len(self.namedElements)
        self.stats[Interpretor.STATS_NB_LINKS] = len(self.links)

        r = {}
        r['stats'] = self.stats
        size = GridManagement.getDimension(self.maxsize)
        self.svg.writeHeader(size)
        r['diy'] = self.svg.__str__()
        return r
    def getGridPosition(self, element):
        """
        Transform grid position into pixel position using GridManagement

        Args:
            element: a dictionnary of one element
        Returns:
            dictonnary element passed in parameter with pixel value for x and y
        """
        # transform position by using GridManagement
        # elements must have x and y parameters
        coord = self.splitPosition(element['position'])

        if coord[0] > self.maxsize['x']:
            self.maxsize['x'] = coord[0]
        if coord[1] > self.maxsize['y']:
            self.maxsize['y'] = coord[1]

        element['x'] = coord[0]
        element['y'] = coord[1]
        element = GridManagement.getPosition(element)
        return element
	def runTest(self):
		e = self.element.copy()
		GridManagement.getPosition(e)
		self.position_test(e)