SlideShare a Scribd company logo
1 of 9
Download to read offline
Consider the classes below:
Here is the code for the ParentChildRelation class:
import java.util.Date;
import java.util.Map;
public class ParentChildRelation {
private int rec_id;
private String name;
private Date startDate;
private Date endDate;
private Map<String, Integer> childData;
public int getRec_id() {
return rec_id;
}
public void setRec_id(int rec_id) {
this.rec_id = rec_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Map<String, Integer> getChildData() {
return childData;
}
public void setChildData(Map<String, Integer> childData) {
this.childData = childData;
}
}
Here is the code for the Service class:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ParentChildRelationService {
private List<ParentChildRelation> parentChildRelationList;
public void init() {
parentChildRelationList = new ArrayList<>();
// Adding records for Unit01
ParentChildRelation unit01Record1 = new ParentChildRelation();
unit01Record1.setRec_id(1001);
unit01Record1.setName("Unit01");
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
try {
Date startDate = dateFormat.parse("01-01-2023");
Date endDate = dateFormat.parse("31-01-2023");
unit01Record1.setStartDate(startDate);
unit01Record1.setEndDate(endDate);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Integer> unit01Record1ChildData = new HashMap<>();
unit01Record1ChildData.put("key1", 83);
unit01Record1ChildData.put("key2", 65);
unit01Record1ChildData.put("key3", 96);
unit01Record1ChildData.put("key4", 45);
unit01Record1ChildData.put("key5", 25);
unit01Record1ChildData.put("key6", 98);
unit01Record1ChildData.put("key7", 45);
unit01Record1.setChildData(unit01Record1ChildData);
parentChildRelationList.add(unit01Record1);
ParentChildRelation unit01Record2 = new ParentChildRelation();
unit01Record2.setRec_id(1002);
unit01Record2.setName("Unit01");
try {
Date startDate = dateFormat.parse("01-02-2023");
Date endDate = dateFormat.parse("28-02-2023");
unit01Record2.setStartDate(startDate);
unit01Record2.setEndDate(endDate);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Integer> unit01Record2ChildData = new HashMap<>();
unit01Record2ChildData.put("key1", 45);
unit01Record2ChildData.put("key2", 98);
unit01Record2ChildData.put("key3", 25);
unit01Record2ChildData.put("key4", 36);
unit01Record2ChildData.put("key5", 95);
unit01Record2ChildData.put("key6", 83);
unit01Record2ChildData.put("key7", 65);
unit01Record2.setChildData(unit01Record2ChildData);
parentChildRelationList.add(unit01Record2);
// Adding records for Unit02
ParentChildRelation unit02Record1 = new ParentChildRelation();
unit02Record1.setRec_id(1003);
unit02Record1.setName("Unit02");
try {
Date startDate = dateFormat.parse("01-01-2023");
Date endDate = dateFormat.parse("31-01-2023");
unit02Record1.setStartDate(startDate);
unit02Record1.setEndDate(endDate);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Integer> unit02Record1ChildData = new HashMap<>();
unit02Record1ChildData.put("key1", 100);
unit02Record1ChildData.put("key2", 200);
unit02Record1ChildData.put("key3", 300);
unit02Record1ChildData.put("key4", 400);
unit02Record1ChildData.put("key5", 500);
unit02Record1ChildData.put("key6", 600);
unit02Record1ChildData.put("key7", 700);
unit02Record1.setChildData(unit02Record1ChildData);
parentChildRelationList.add(unit02Record1);
// Adding records for Unit03
ParentChildRelation unit03Record1 = new ParentChildRelation();
unit03Record1.setRec_id(1004);
unit03Record1.setName("Unit03");
try {
Date startDate = dateFormat.parse("01-02-2023");
Date endDate = dateFormat.parse("28-02-2023");
unit03Record1.setStartDate(startDate);
unit03Record1.setEndDate(endDate);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Integer> unit03Record1ChildData = new HashMap<>();
unit03Record1ChildData.put("key1", 10);
unit03Record1ChildData.put("key2", 20);
unit03Record1ChildData.put("key3", 30);
unit03Record1ChildData.put("key4", 40);
unit03Record1ChildData.put("key5", 50);
unit03Record1ChildData.put("key6", 60);
unit03Record1ChildData.put("key7", 70);
unit03Record1.setChildData(unit03Record1ChildData);
parentChildRelationList.add(unit03Record1);
}
public List<ParentChildRelation> getParentChildRelationList() {
return parentChildRelationList;
}
}
And here is the code for the xhtml page to display the data in a datatable:
<h:body>
<h:dataTable value="#{parentChildRelationService.parentChildRelationList}"
var="parentChildRelation">
<h:column>
<f:facet name="header">Record ID</f:facet>
#{parentChildRelation.rec_id}
</h:column>
<h:column>
<f:facet name="header">Name</f:facet>
#{parentChildRelation.name}
</h:column>
<h:column>
<f:facet name="header">Start Date</
</h:column>
<h:column>
<f:facet name="header">End Date</f:facet>
#{parentChildRelation.endDate}
</h:column>
<ui:repeat value="#{parentChildRelation.childData.entrySet().toArray()}" var="entry">
<h:column>
<f:facet name="header">#{entry.key}</f:facet>
#{entry.value}
</h:column>
</ui:repeat>
</h:dataTable>
</h:body>
Give the java main code to call the following classes and display the below data in
datatable list using xhtml, the catch is the child data will be in Map with key pair values and we
need to display in same order as first record for that unit appears,
One point of time one table contains listing of only one unit, and columns for one unit remains
same.
Display the output as below by navigating through two pages from parent object to child object
using xhtml
Parent table begin{tabular}{|l|l|r|} hline 1002 & key1 & 45  hline 1002 & key2 & 98  hline
1002 & key3 & 25  hline 1002 & key4 & 36  hline 1002 & key5 & 95  hline 1002 & key6
& 83  hline 1002 & key7 & 65  hline end{tabular}
Consider the classes below- Here is the code for the ParentChildRelati.pdf

More Related Content

Similar to Consider the classes below- Here is the code for the ParentChildRelati.pdf

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfarjuncp10
 
Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docxQ2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docxamrit47
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxssuser562afc1
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfarishmarketing21
 
Bài tập và bài tập nâng cao của cây AVL.docx
Bài tập và bài tập nâng cao của cây  AVL.docxBài tập và bài tập nâng cao của cây  AVL.docx
Bài tập và bài tập nâng cao của cây AVL.docxLNhi89
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf
 MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf
MonsterAttack.javapublic class MonsterAttack {    int id;  .pdfanugrahafancy
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationUsing Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationAlex Hardman
 
Data20161007
Data20161007Data20161007
Data20161007capegmail
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfarihantgiftgallery
 
Full Stack Web Development.pptx
Full Stack Web Development.pptxFull Stack Web Development.pptx
Full Stack Web Development.pptxDineshGokuladas
 
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfListing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfAnkitchhabra28
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdfCreate a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdflakshmijewellery
 

Similar to Consider the classes below- Here is the code for the ParentChildRelati.pdf (20)

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docxQ2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
 
Functions
FunctionsFunctions
Functions
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdf
 
Bài tập và bài tập nâng cao của cây AVL.docx
Bài tập và bài tập nâng cao của cây  AVL.docxBài tập và bài tập nâng cao của cây  AVL.docx
Bài tập và bài tập nâng cao của cây AVL.docx
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf
 MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf
MonsterAttack.javapublic class MonsterAttack {    int id;  .pdf
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationUsing Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data Visualisation
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
 
Data20161007
Data20161007Data20161007
Data20161007
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdf
 
Full Stack Web Development.pptx
Full Stack Web Development.pptxFull Stack Web Development.pptx
Full Stack Web Development.pptx
 
Employ leave dtb
Employ leave dtbEmploy leave dtb
Employ leave dtb
 
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfListing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdfCreate a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
 

More from 21stcenturyjammu21

Consider the following intertemporal social welfare function- W-min(U0.pdf
Consider the following intertemporal social welfare function- W-min(U0.pdfConsider the following intertemporal social welfare function- W-min(U0.pdf
Consider the following intertemporal social welfare function- W-min(U0.pdf21stcenturyjammu21
 
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdf
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdfConsider poiters who led the Professionat Goifers' Associabon of Amenc.pdf
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdf21stcenturyjammu21
 
Consider an economy with the following values- Autonomous Consumptio.pdf
Consider an economy with the following values-   Autonomous Consumptio.pdfConsider an economy with the following values-   Autonomous Consumptio.pdf
Consider an economy with the following values- Autonomous Consumptio.pdf21stcenturyjammu21
 
Conduct research on IEEE- ACM or other relevant publications about the.pdf
Conduct research on IEEE- ACM or other relevant publications about the.pdfConduct research on IEEE- ACM or other relevant publications about the.pdf
Conduct research on IEEE- ACM or other relevant publications about the.pdf21stcenturyjammu21
 
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdfConfig Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf21stcenturyjammu21
 
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdfConnecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf21stcenturyjammu21
 
consequences of immobility- System Affected Physiological Effect and P.pdf
consequences of immobility- System Affected Physiological Effect and P.pdfconsequences of immobility- System Affected Physiological Effect and P.pdf
consequences of immobility- System Affected Physiological Effect and P.pdf21stcenturyjammu21
 
Consequences of misrepresentation in contracts- where a party who reli (1).pdf
Consequences of misrepresentation in contracts- where a party who reli (1).pdfConsequences of misrepresentation in contracts- where a party who reli (1).pdf
Consequences of misrepresentation in contracts- where a party who reli (1).pdf21stcenturyjammu21
 
consequences are endured by only specific individuals or groups- True.pdf
consequences are endured by only specific individuals or groups- True.pdfconsequences are endured by only specific individuals or groups- True.pdf
consequences are endured by only specific individuals or groups- True.pdf21stcenturyjammu21
 
Conduct research using the internet for one article concerning the Hum.pdf
Conduct research using the internet for one article concerning the Hum.pdfConduct research using the internet for one article concerning the Hum.pdf
Conduct research using the internet for one article concerning the Hum.pdf21stcenturyjammu21
 
Constructors-Destructors Extend the Stack-h class given in order for i.pdf
Constructors-Destructors Extend the Stack-h class given in order for i.pdfConstructors-Destructors Extend the Stack-h class given in order for i.pdf
Constructors-Destructors Extend the Stack-h class given in order for i.pdf21stcenturyjammu21
 
Constructive receipt of an asset does NOT exst in which of the followi.pdf
Constructive receipt of an asset does NOT exst in which of the followi.pdfConstructive receipt of an asset does NOT exst in which of the followi.pdf
Constructive receipt of an asset does NOT exst in which of the followi.pdf21stcenturyjammu21
 
Construct a support vector machine that computes the kernel function- (1).pdf
Construct a support vector machine that computes the kernel function- (1).pdfConstruct a support vector machine that computes the kernel function- (1).pdf
Construct a support vector machine that computes the kernel function- (1).pdf21stcenturyjammu21
 
Construct a support vector machine that computes the kernel function-.pdf
Construct a support vector machine that computes the kernel function-.pdfConstruct a support vector machine that computes the kernel function-.pdf
Construct a support vector machine that computes the kernel function-.pdf21stcenturyjammu21
 
Construct conceptual models for the following types of graphs- using E.pdf
Construct conceptual models for the following types of graphs- using E.pdfConstruct conceptual models for the following types of graphs- using E.pdf
Construct conceptual models for the following types of graphs- using E.pdf21stcenturyjammu21
 
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdfConsider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf21stcenturyjammu21
 
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdf
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdfConsider tossing a coin 6 times- This is a binomial experiment with P(.pdf
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdf21stcenturyjammu21
 
Consider the Solow growth model with a production function per person (1).pdf
Consider the Solow growth model with a production function per person (1).pdfConsider the Solow growth model with a production function per person (1).pdf
Consider the Solow growth model with a production function per person (1).pdf21stcenturyjammu21
 
Consider the Solow growth model with a production function per person.pdf
Consider the Solow growth model with a production function per person.pdfConsider the Solow growth model with a production function per person.pdf
Consider the Solow growth model with a production function per person.pdf21stcenturyjammu21
 
Consider the standard model of impacts of immigration- Labor demand in.pdf
Consider the standard model of impacts of immigration- Labor demand in.pdfConsider the standard model of impacts of immigration- Labor demand in.pdf
Consider the standard model of impacts of immigration- Labor demand in.pdf21stcenturyjammu21
 

More from 21stcenturyjammu21 (20)

Consider the following intertemporal social welfare function- W-min(U0.pdf
Consider the following intertemporal social welfare function- W-min(U0.pdfConsider the following intertemporal social welfare function- W-min(U0.pdf
Consider the following intertemporal social welfare function- W-min(U0.pdf
 
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdf
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdfConsider poiters who led the Professionat Goifers' Associabon of Amenc.pdf
Consider poiters who led the Professionat Goifers' Associabon of Amenc.pdf
 
Consider an economy with the following values- Autonomous Consumptio.pdf
Consider an economy with the following values-   Autonomous Consumptio.pdfConsider an economy with the following values-   Autonomous Consumptio.pdf
Consider an economy with the following values- Autonomous Consumptio.pdf
 
Conduct research on IEEE- ACM or other relevant publications about the.pdf
Conduct research on IEEE- ACM or other relevant publications about the.pdfConduct research on IEEE- ACM or other relevant publications about the.pdf
Conduct research on IEEE- ACM or other relevant publications about the.pdf
 
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdfConfig Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf
Config Lab L2 EtherChannel 2 Both layer 2 EtherChannel and layer 3 Eth.pdf
 
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdfConnecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf
Connecting youths io caing adels and octiaks Ae in ine Ahop Qtistiniti.pdf
 
consequences of immobility- System Affected Physiological Effect and P.pdf
consequences of immobility- System Affected Physiological Effect and P.pdfconsequences of immobility- System Affected Physiological Effect and P.pdf
consequences of immobility- System Affected Physiological Effect and P.pdf
 
Consequences of misrepresentation in contracts- where a party who reli (1).pdf
Consequences of misrepresentation in contracts- where a party who reli (1).pdfConsequences of misrepresentation in contracts- where a party who reli (1).pdf
Consequences of misrepresentation in contracts- where a party who reli (1).pdf
 
consequences are endured by only specific individuals or groups- True.pdf
consequences are endured by only specific individuals or groups- True.pdfconsequences are endured by only specific individuals or groups- True.pdf
consequences are endured by only specific individuals or groups- True.pdf
 
Conduct research using the internet for one article concerning the Hum.pdf
Conduct research using the internet for one article concerning the Hum.pdfConduct research using the internet for one article concerning the Hum.pdf
Conduct research using the internet for one article concerning the Hum.pdf
 
Constructors-Destructors Extend the Stack-h class given in order for i.pdf
Constructors-Destructors Extend the Stack-h class given in order for i.pdfConstructors-Destructors Extend the Stack-h class given in order for i.pdf
Constructors-Destructors Extend the Stack-h class given in order for i.pdf
 
Constructive receipt of an asset does NOT exst in which of the followi.pdf
Constructive receipt of an asset does NOT exst in which of the followi.pdfConstructive receipt of an asset does NOT exst in which of the followi.pdf
Constructive receipt of an asset does NOT exst in which of the followi.pdf
 
Construct a support vector machine that computes the kernel function- (1).pdf
Construct a support vector machine that computes the kernel function- (1).pdfConstruct a support vector machine that computes the kernel function- (1).pdf
Construct a support vector machine that computes the kernel function- (1).pdf
 
Construct a support vector machine that computes the kernel function-.pdf
Construct a support vector machine that computes the kernel function-.pdfConstruct a support vector machine that computes the kernel function-.pdf
Construct a support vector machine that computes the kernel function-.pdf
 
Construct conceptual models for the following types of graphs- using E.pdf
Construct conceptual models for the following types of graphs- using E.pdfConstruct conceptual models for the following types of graphs- using E.pdf
Construct conceptual models for the following types of graphs- using E.pdf
 
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdfConsider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf
Consider tossing a coin 6 times- This is a binomial experiment with P( (2).pdf
 
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdf
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdfConsider tossing a coin 6 times- This is a binomial experiment with P(.pdf
Consider tossing a coin 6 times- This is a binomial experiment with P(.pdf
 
Consider the Solow growth model with a production function per person (1).pdf
Consider the Solow growth model with a production function per person (1).pdfConsider the Solow growth model with a production function per person (1).pdf
Consider the Solow growth model with a production function per person (1).pdf
 
Consider the Solow growth model with a production function per person.pdf
Consider the Solow growth model with a production function per person.pdfConsider the Solow growth model with a production function per person.pdf
Consider the Solow growth model with a production function per person.pdf
 
Consider the standard model of impacts of immigration- Labor demand in.pdf
Consider the standard model of impacts of immigration- Labor demand in.pdfConsider the standard model of impacts of immigration- Labor demand in.pdf
Consider the standard model of impacts of immigration- Labor demand in.pdf
 

Recently uploaded

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Recently uploaded (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Consider the classes below- Here is the code for the ParentChildRelati.pdf

  • 1. Consider the classes below: Here is the code for the ParentChildRelation class: import java.util.Date; import java.util.Map; public class ParentChildRelation { private int rec_id; private String name; private Date startDate; private Date endDate; private Map<String, Integer> childData; public int getRec_id() { return rec_id; } public void setRec_id(int rec_id) { this.rec_id = rec_id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getStartDate() {
  • 2. return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } public Map<String, Integer> getChildData() { return childData; } public void setChildData(Map<String, Integer> childData) { this.childData = childData; } } Here is the code for the Service class: import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date;
  • 3. import java.util.HashMap; import java.util.List; import java.util.Map; public class ParentChildRelationService { private List<ParentChildRelation> parentChildRelationList; public void init() { parentChildRelationList = new ArrayList<>(); // Adding records for Unit01 ParentChildRelation unit01Record1 = new ParentChildRelation(); unit01Record1.setRec_id(1001); unit01Record1.setName("Unit01"); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); try { Date startDate = dateFormat.parse("01-01-2023"); Date endDate = dateFormat.parse("31-01-2023"); unit01Record1.setStartDate(startDate); unit01Record1.setEndDate(endDate); } catch (Exception e) { e.printStackTrace(); } Map<String, Integer> unit01Record1ChildData = new HashMap<>(); unit01Record1ChildData.put("key1", 83); unit01Record1ChildData.put("key2", 65);
  • 4. unit01Record1ChildData.put("key3", 96); unit01Record1ChildData.put("key4", 45); unit01Record1ChildData.put("key5", 25); unit01Record1ChildData.put("key6", 98); unit01Record1ChildData.put("key7", 45); unit01Record1.setChildData(unit01Record1ChildData); parentChildRelationList.add(unit01Record1); ParentChildRelation unit01Record2 = new ParentChildRelation(); unit01Record2.setRec_id(1002); unit01Record2.setName("Unit01"); try { Date startDate = dateFormat.parse("01-02-2023"); Date endDate = dateFormat.parse("28-02-2023"); unit01Record2.setStartDate(startDate); unit01Record2.setEndDate(endDate); } catch (Exception e) { e.printStackTrace(); } Map<String, Integer> unit01Record2ChildData = new HashMap<>(); unit01Record2ChildData.put("key1", 45); unit01Record2ChildData.put("key2", 98); unit01Record2ChildData.put("key3", 25); unit01Record2ChildData.put("key4", 36);
  • 5. unit01Record2ChildData.put("key5", 95); unit01Record2ChildData.put("key6", 83); unit01Record2ChildData.put("key7", 65); unit01Record2.setChildData(unit01Record2ChildData); parentChildRelationList.add(unit01Record2); // Adding records for Unit02 ParentChildRelation unit02Record1 = new ParentChildRelation(); unit02Record1.setRec_id(1003); unit02Record1.setName("Unit02"); try { Date startDate = dateFormat.parse("01-01-2023"); Date endDate = dateFormat.parse("31-01-2023"); unit02Record1.setStartDate(startDate); unit02Record1.setEndDate(endDate); } catch (Exception e) { e.printStackTrace(); } Map<String, Integer> unit02Record1ChildData = new HashMap<>(); unit02Record1ChildData.put("key1", 100); unit02Record1ChildData.put("key2", 200); unit02Record1ChildData.put("key3", 300); unit02Record1ChildData.put("key4", 400); unit02Record1ChildData.put("key5", 500);
  • 6. unit02Record1ChildData.put("key6", 600); unit02Record1ChildData.put("key7", 700); unit02Record1.setChildData(unit02Record1ChildData); parentChildRelationList.add(unit02Record1); // Adding records for Unit03 ParentChildRelation unit03Record1 = new ParentChildRelation(); unit03Record1.setRec_id(1004); unit03Record1.setName("Unit03"); try { Date startDate = dateFormat.parse("01-02-2023"); Date endDate = dateFormat.parse("28-02-2023"); unit03Record1.setStartDate(startDate); unit03Record1.setEndDate(endDate); } catch (Exception e) { e.printStackTrace(); } Map<String, Integer> unit03Record1ChildData = new HashMap<>(); unit03Record1ChildData.put("key1", 10); unit03Record1ChildData.put("key2", 20); unit03Record1ChildData.put("key3", 30); unit03Record1ChildData.put("key4", 40); unit03Record1ChildData.put("key5", 50); unit03Record1ChildData.put("key6", 60);
  • 7. unit03Record1ChildData.put("key7", 70); unit03Record1.setChildData(unit03Record1ChildData); parentChildRelationList.add(unit03Record1); } public List<ParentChildRelation> getParentChildRelationList() { return parentChildRelationList; } } And here is the code for the xhtml page to display the data in a datatable: <h:body> <h:dataTable value="#{parentChildRelationService.parentChildRelationList}" var="parentChildRelation"> <h:column> <f:facet name="header">Record ID</f:facet> #{parentChildRelation.rec_id} </h:column> <h:column> <f:facet name="header">Name</f:facet> #{parentChildRelation.name} </h:column> <h:column> <f:facet name="header">Start Date</ </h:column> <h:column>
  • 8. <f:facet name="header">End Date</f:facet> #{parentChildRelation.endDate} </h:column> <ui:repeat value="#{parentChildRelation.childData.entrySet().toArray()}" var="entry"> <h:column> <f:facet name="header">#{entry.key}</f:facet> #{entry.value} </h:column> </ui:repeat> </h:dataTable> </h:body> Give the java main code to call the following classes and display the below data in datatable list using xhtml, the catch is the child data will be in Map with key pair values and we need to display in same order as first record for that unit appears, One point of time one table contains listing of only one unit, and columns for one unit remains same. Display the output as below by navigating through two pages from parent object to child object using xhtml Parent table begin{tabular}{|l|l|r|} hline 1002 & key1 & 45 hline 1002 & key2 & 98 hline 1002 & key3 & 25 hline 1002 & key4 & 36 hline 1002 & key5 & 95 hline 1002 & key6 & 83 hline 1002 & key7 & 65 hline end{tabular}