The Nativity Story

The plot begins with the portrayal of the Massacre of the Innocents in the Nativity. The remainder of the movie portrays the annunciation (conception) and birth of Jesus Christ to explain why King Herod the Great (CiarÃ¡n Hinds) ordered the murder.
The film then goes back one year before the massacre, to Jerusalem where Zachariah is a rabbi and making an offering, when he gets told by the Archangel Gabriel that his wife will bear a son by a vision. He states that he is too old, and is told by Gabriel that he will be unable to speak until the boy is born. It then goes to the town of Nazareth, where a teenaged girl named Mary (Keisha Castle-Hughes) is farming, and soldiers come to collect taxes, one man, who is unable to pay, has a third of his land seized and his daughter pressed into debt slavery to pay his debt. Mary is then, betrothed to marry Joseph of Judaea (Oscar Isaac), is visited by the Angel Gabriel and told that she will become pregnant with God's son, whom she is to name "Jesus". He then tells that her God has blessed her cousin Elizabeth (Shohreh Aghdashloo) with a child despite her old age. Mary asks her parents and Joseph could she visit with Elizabeth before the harvest, where she witnesses the birth of John the Baptist to Elizabeth and her husband the priest Zachariah (Stanley Townsend), who regains his speech after he refused to believe the Angel Gabriel's news that he would have a son. Mary returns from the visit pregnant, to the shock of Joseph and her parents, who fear that Joseph will accuse her of fornication, a sin punishable with death by stoning according to the Mosaic Law. At first Joseph does not believe Mary's explanation that she was visited by the angel Gabriel, but decides not to accuse her. Although he is still shocked and angry, Joseph is later visited in a dream by the Angel Gabriel, who tells him of God's plan for Mary's son. Joseph then believes Mary, and is ashamed for his earlier doubts.
Meanwhile, Caesar Augustus, the Roman emperor, has demanded that every man and his family across the Roman Empire must return to his place of birth for the census. As a direct descendant of King David, Joseph is forced to travel 110 kilometers (68Â mi) across Palestine's rocky terrain from Nazareth to Bethlehem, the place of his birth. With Mary on a donkey laden with supplies, the couple took nearly four weeks to reach Bethlehem. Upon arriving in town, Mary goes into labour, and Joseph frantically seeks a place for her to deliver. There is, however, no room in any inn or home partly because of the census, but at the last minute an innkeeper offers his stable for shelter.
Meanwhile, three Magi named Gaspar, Melchior and Balthasar, travel towards Judaea after having previously discovered that three planets will align to form a great star. This Star of Bethlehem appears before the Magi, after a visit by the Angel Gabriel. The Magi visit King Herod the Great and reveal to him that the Messiah is still a child and he will be a Messiah 'for the lowest of men to the highest of kings'. Shocked by this, Herod asks that they visit the newborn Messiah and report the child's location back to him, under the pretence that he, too, would like to worship him (what the Magi did not know was that Herod wanted to kill the baby for fear of a new king taking his throne). Later, the Magi arrive at the stable in which Mary is giving birth to Jesus, and they present the Infant with gifts of gold, frankincense, and myrrh.
After having been warned by the Angel in a dream, the Magi avoid Herod, but return to their home via a different route. King Herod realises that the Magi have tricked him, and carries out his plan of killing every boy in Bethlehem under the age of two. Joseph is warned in a dream of the danger and flees to Egypt with Mary and Jesus until Herod the Great dies and his two remaining sons (Herod was so paranoid that he killed his own wives, sons, and daughters) named Archelaus and Antipas take over his kingdom and Rome divides the kingdom- Archelaus gets the kingdom of Jerusalem, Bethlahem and Antipas gets the kingdom of Nazareth, Gailee. At the end of the movie, Joseph, Mary, and Jesus return; but do not go to Bethlehem for fear of Herod's oldest son and instead go to Nazareth.

Question: Who is Joseph a direct descendant of?
Answer: King David