Please read the following table in HTML format from a webpage and then answer the question in detail according to the table. Each table cell is defined by a <td> and a </td> tag. Each table row starts with a <tr> and ends with a </tr> tag. 'rowspan=m' and 'colspan=n' represents a cell spaning over 'm' rows and 'n' columns.

Webpage title:
List of Polish monarchs
Table title:
Piast dukes and kings
Table:
<table id='hittask' contenteditable='False'>
<tr> <th colspan=1 rowspan=1 > Name </th><th colspan=1 rowspan=1 > Lifespan </th><th colspan=1 rowspan=1 > Reign start </th><th colspan=1 rowspan=1 > Reign end </th><th colspan=1 rowspan=1 > Notes </th><th colspan=1 rowspan=1 > Family </th><th colspan=1 rowspan=1 > Image </th></tr>
<tr> <td colspan=1 rowspan=1 > Mieszko I of Poland Duke </td><td colspan=1 rowspan=1 > ca. 940 – 25 May 992 </td><td colspan=1 rowspan=1 > ca. 960 </td><td colspan=1 rowspan=1 > 992 </td><td colspan=1 rowspan=1 > Son of Siemomysł First Christian Polish monarch Misico, dux Wandalorum </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td class="highlighted"  colspan=1 rowspan=1 > Bolesław I the Brave Bolesław I the Great Polish: Bolesław I Chrobry (Wielki) King of Poland King </td><td colspan=1 rowspan=1 > 967 – 17 June 1025 </td><td colspan=1 rowspan=1 > Duke: 992 King: 18 April 1025 </td><td colspan=1 rowspan=1 > Duke: 18 April 1025 King: 17 June 1025 </td><td colspan=1 rowspan=1 > Son of Mieszko I and Dobrawa of Bohemia First to be crowned king Regnum Sclavorum, Gothorum sive Polonorum </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td class="highlighted"  colspan=1 rowspan=1 > Mieszko II Lambert King of Poland King </td><td colspan=1 rowspan=1 > ca. 990 – 10/11 May 1034 </td><td colspan=1 rowspan=1 > 1025 </td><td colspan=1 rowspan=1 > 1031 </td><td colspan=1 rowspan=1 > Son of Bolesław I and Emnilda of Lusatia </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Bezprym Duke </td><td colspan=1 rowspan=1 > ca. 986–1032 </td><td colspan=1 rowspan=1 > 1031 </td><td colspan=1 rowspan=1 > 1032 </td><td colspan=1 rowspan=1 > Son of Bolesław I and Judith of Hungary </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Otto Bolesławowic Duke </td><td colspan=1 rowspan=1 > 1000–1033 </td><td colspan=1 rowspan=1 > 1032 </td><td colspan=1 rowspan=1 > 1032 </td><td colspan=1 rowspan=1 > Son of Bolesław I and Emnilda </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Dytryk Theoderick Duke </td><td colspan=1 rowspan=1 > after 992 – after 1032 </td><td colspan=1 rowspan=1 > 1032 </td><td colspan=1 rowspan=1 > 1032 /1033 </td><td colspan=1 rowspan=1 > Grandson of Mieszko I and Oda of Haldensleben </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Mieszko II Lambert Duke </td><td colspan=1 rowspan=1 > ca. 990 – 10/11 May 1034 </td><td colspan=1 rowspan=1 > 1032 </td><td colspan=1 rowspan=1 > 1034 </td><td colspan=1 rowspan=1 > Restored </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Bolesław the Forgotten Polish: Bolesław Zapomniany Duke </td><td colspan=1 rowspan=1 > before 1016 – 1038 or 1039 </td><td colspan=1 rowspan=1 > 1034 </td><td colspan=1 rowspan=1 > 1038 /1039 </td><td colspan=1 rowspan=1 > Semi-legendary, existence disputed </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Casimir I the Restorer Polish: Kazimierz I Odnowiciel Duke </td><td colspan=1 rowspan=1 > 25 June 1016 – 28 November 1058 (aged 42) </td><td colspan=1 rowspan=1 > 1039 </td><td colspan=1 rowspan=1 > 1058 </td><td colspan=1 rowspan=1 > Son of Mieszko II and Richeza of Lotharingia </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td class="highlighted"  colspan=1 rowspan=1 > Bolesław II the Generous Polish: Bolesław II Szczodry King of Poland King </td><td class="highlighted"  colspan=1 rowspan=1 > ca. 1041 or 1042 – 2 or 3 April 1081 or 1082 </td><td class="highlighted"  colspan=1 rowspan=1 > Duke: 1058 King: 1076 </td><td class="highlighted"  colspan=1 rowspan=1 > Duke: 1076 King: 1079 </td><td colspan=1 rowspan=1 > Son of Kazimierz I and Maria Dobroniega of Kiev </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Władysław I Herman Duke </td><td colspan=1 rowspan=1 > ca. 1044 – 4 June 1102 </td><td colspan=1 rowspan=1 > 1079 </td><td colspan=1 rowspan=1 > 1102 </td><td colspan=1 rowspan=1 > Son of Kazimierz I and Maria Dobroniega </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Zbigniew Zbygniew Duke </td><td colspan=1 rowspan=1 > ca. 1073 – 8 July 1113 </td><td colspan=1 rowspan=1 > 1102 </td><td colspan=1 rowspan=1 > 1107 </td><td colspan=1 rowspan=1 > Son of Władysław I and Przecława of Prawdzic coat of arms (disputed) First jointly with Władysław I 1098-1102 </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
<tr> <td colspan=1 rowspan=1 > Bolesław III Wrymouth Polish: Bolesław III Krzywousty Duke </td><td colspan=1 rowspan=1 > 20 August 1086 – 28 October 1138 (aged 52) </td><td colspan=1 rowspan=1 > 1107 </td><td colspan=1 rowspan=1 > 1138 </td><td colspan=1 rowspan=1 > Son of Władysław I and Judith of Bohemia First jointly with Władysław 1098-1102 Introduced senioral principle </td><td colspan=1 rowspan=1 > Piast </td><td colspan=1 rowspan=1 >  </td></tr>
</table>
Question:
What roles did Boleslaw II have in Polish Royalty?
Answer:
Bolesław II the Generous (Polish: Bolesław II Szczodry; c. 1042 – 2 or 3 April 1081 or 1082) was Duke of Poland from 1058 to 1076 and third King of Poland until 1079.